﻿:root {
  --bg: #c7d59f;
  --fg: #303c32;
  --muted: #7a8070;
  --line: #dfe2d3;
  --panel: #faf9f0;
  --accent: #ef7c1b;
  --accent-press: #d66b13;
  --cat: #2a9d8f;
  --danger: #c34535;
  --shadow: 0 8px 28px #33462b20;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); font-family: 'Outfit', system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; transition: background .15s, transform .15s; }
button:active { transform: translateY(2px); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--cat); outline-offset: 4px; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; align-items: safe center; justify-items: center; padding: 28px; overflow-y: auto; background: #43513752; backdrop-filter: blur(3px); }
.card { width: min(930px, 100%); min-height: min(640px, calc(100dvh - 56px)); display: grid; grid-template-columns: 1fr 1fr; border: 6px solid #faf9f0; border-radius: 30px; background: var(--panel); box-shadow: 0 24px 90px #25342045; overflow: hidden; }
.welcome { position: relative; display: flex; flex-direction: column; padding: 38px 32px 24px; background: #e6eed1 url(img/splash.webp) center calc(100% + 60px) / 100% auto no-repeat; overflow: hidden; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; line-height: 1.6; }
h1 { margin: 26px 0 0; font-size: clamp(42px, 5.3vw, 64px); font-weight: 900; line-height: .98; letter-spacing: -.055em; }
h1 > span { color: #5d7c4a; }
.title-dot { color: var(--accent); }
.sub { color: #68785c; font-size: 15px; line-height: 1.7; margin: 20px 0; }
.welcome-note { position: relative; margin-top: auto; align-self: flex-start; display: flex; gap: 9px; align-items: center; padding: 6px 12px; border-radius: 999px; background: #faf8eedd; font-size: 10px; font-weight: 600; color: #657253; white-space: nowrap; }
.welcome-note > span:first-child { font-size: 23px; color: #be902b; }
.setup { padding: 34px 32px 22px; }
.setup-heading .eyebrow { color: var(--muted); font-size: 9px; }
h2 { margin: 6px 0 23px; font-size: 23px; letter-spacing: -.035em; }
.field { display: grid; gap: 7px; font-weight: 700; font-size: 12px; }
input { min-width: 0; width: 100%; padding: 12px 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fffef9; }
input::placeholder { color: #a2a594; }
.species { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 17px 0 13px; }
.sp { position: relative; display: grid; justify-items: center; gap: 4px; padding: 15px 6px 12px; border: 2px solid var(--line); border-radius: 16px; background: #f1f1e6; }
.sp b { font-size: 14px; }
.sp small { font-size: 10px; color: var(--muted); }
.sp.on[data-kind='dog'] { border-color: var(--accent); background: #fff0dc; }
.sp.on[data-kind='cat'] { border-color: var(--cat); background: #e3f1e9; }
.sp.on::after { content: '✓'; position: absolute; top: 7px; right: 9px; color: var(--fg); font-size: 12px; font-weight: 800; }
.pet-preview { --coat: #b9773e; position: relative; display: block; width: 48px; height: 39px; margin: 8px 0 10px; border-radius: 45%; background: var(--coat); box-shadow: 0 4px 0 #303c3212; }
.pet-preview::before, .pet-preview::after { content: ''; position: absolute; top: -7px; width: 16px; height: 30px; background: var(--coat); filter: brightness(.75); border-radius: 50%; }
.pet-preview::before { left: -6px; transform: rotate(20deg); }
.pet-preview::after { right: -6px; transform: rotate(-20deg); }
.pet-preview i { position: absolute; width: 8px; height: 7px; background: #303235; border-radius: 50%; left: 20px; top: 25px; }
.pet-preview i::before, .pet-preview i::after { content: ''; position: absolute; width: 4px; height: 5px; background: #303235; border-radius: 50%; top: -11px; }
.pet-preview i::before { left: -9px; }.pet-preview i::after { right: -9px; }
.cat-preview { --coat: #e39b4a; width: 43px; height: 36px; }
.cat-preview::before, .cat-preview::after { width: 17px; height: 22px; border-radius: 3px; top: -8px; transform: rotate(12deg); }
.cat-preview::after { transform: rotate(-12deg); }
.cat-preview i { left: 18px; top: 25px; background: #cb887a; }
.coat { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.colors { display: flex; gap: 10px; }
.colors button { width: 28px; height: 28px; padding: 0; border: 3px solid var(--panel); border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.colors button.on { box-shadow: 0 0 0 2px var(--fg); }
.primary, .secondary, .row button { width: 100%; border-radius: 12px; padding: 13px 16px; font-weight: 800; }
.primary { display: flex; justify-content: space-between; border: 1px solid #cd6713; background: var(--accent); color: white; box-shadow: 0 4px 0 #c3661c; font-size: 16px; }
.primary:hover { background: var(--accent-press); }
.online-divider { display: flex; align-items: center; gap: 12px; margin: 23px 0 14px; color: var(--muted); font-size: 10px; }
.online-divider::before, .online-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.secondary { display: flex; justify-content: space-between; border: 1px solid var(--line); background: #e8edda; font-size: 13px; }
.secondary span { color: #788366; font-size: 10px; font-weight: 400; align-self: center; }
.row { display: grid; grid-template-columns: 89px 1fr; gap: 8px; margin-top: 8px; }
.row input { text-transform: uppercase; text-align: center; letter-spacing: .13em; padding: 11px 6px; }
.row button { display: flex; justify-content: space-between; background: transparent; border: 1px solid var(--line); font-size: 12px; }
.secondary:hover, .row button:hover { background: #e1e8cf; }
.error { color: var(--danger); margin: 10px 0; font-size: 12px; font-weight: 600; line-height: 1.5; }
.error:empty { margin: 10px 0 0; }
.controls { border-top: 1px solid var(--line); padding-top: 13px; color: var(--muted); font-size: 11px; }
summary { cursor: pointer; }
.controls summary { list-style: none; display: flex; justify-content: space-between; }
.controls p { line-height: 1.8; margin-bottom: 0; }
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.panel { position: absolute; pointer-events: auto; background: #faf9f0f2; border: 1px solid #fffef9; border-radius: 18px; box-shadow: var(--shadow); padding: 14px; }
.needs { top: max(16px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); width: 182px; display: grid; gap: 9px; }
.need { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 8px; }
.need > span { font-size: 20px; }
.need-label { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 700; color: var(--muted); }
.bar { height: 7px; border-radius: 6px; background: #e4e7d8; overflow: hidden; }
.bar i { display: block; width: 50%; height: 100%; background: #e6a247; border-radius: 6px; transition: width .3s; }
#n-energy { background: #94af68; }#n-fun { background: #69b6a6; }
.bar i.low { background: var(--danger) !important; }
.my-score { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; font-size: 11px; color: var(--muted); }
.my-score b { color: var(--fg); }
.level-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.level-row b { font-weight: 900; color: #b5651d; }
#n-xp { background: #f4c542; width: 0; }
.event-banner { left: 50%; transform: translateX(-50%); bottom: max(72px, calc(env(safe-area-inset-bottom) + 56px)); width: min(520px, calc(100vw - 520px)); min-width: 300px; padding: 12px 16px; border: 2px solid #f6c48b; }
.ev-head { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.ev-head > span:first-child { font-size: 24px; }
#ev-timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 800; color: #c9650f; }
#ev-text { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
#ev-text b { color: var(--fg); }
.ev-orders { margin-top: 8px; display: grid; gap: 4px; }
.ev-hold { font-weight: 700; color: var(--fg); }
.ev-order { display: flex; align-items: center; gap: 8px; padding: 3px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.04); color: var(--fg); font-size: 13px; }
.ev-order .ico { font-size: 20px; line-height: 1; }
.ev-order .who { font-weight: 700; }
.ev-order b { color: #c9650f; }
.ev-order .time { margin-left: auto; font-variant-numeric: tabular-nums; }
.ev-order.urgent b, .ev-order.urgent .time { color: #d0453a; }
.ev-order.mine { background: #ffe9cf; outline: 2px solid #ef7c1b; }
.event-results { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100vw - 32px)); pointer-events: none; padding: 18px 20px; text-align: center; z-index: 25; }
.event-results h3 { margin: 0 0 12px; font-size: 18px; }
#res-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; text-align: left; font-size: 13px; }
#res-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 10px; background: #f1f2e6; }
#res-list li.me { outline: 2px solid var(--accent); }
#res-list small { color: var(--muted); }
.score { top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 22px; padding: 11px 24px; }
.team { display: grid; gap: 3px; min-width: 73px; text-align: center; }
.team small { font-size: 11px; font-weight: 700; white-space: nowrap; }
.team b { font-size: 28px; line-height: 1; font-weight: 900; }
.dog b { color: var(--accent); }.cat b { color: var(--cat); }
.score-middle { display: grid; gap: 2px; text-align: center; color: #a1a88d; font-size: 17px; }
.clock { font-size: 17px; }
.leave { position: absolute; pointer-events: auto; right: max(16px, env(safe-area-inset-right)); top: max(16px, env(safe-area-inset-top)); border: 1px solid #fffef9; border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; min-height: 44px; padding: 10px 16px; }
.leave span { margin-left: 13px; color: var(--muted); }
.side { top: calc(max(16px, env(safe-area-inset-top)) + 58px); right: max(16px, env(safe-area-inset-right)); width: 204px; font-size: 12px; }
.room-line { display: flex; gap: 7px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; font-size: 10px; }
.room-line b { letter-spacing: .1em; }
.mini { border: 1px solid var(--line); border-radius: 7px; background: white; min-height: 36px; padding: 5px 8px; font-size: 10px; }
#players-box > summary { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; list-style: none; }
#players-box > summary span { color: var(--muted); font-weight: 400; }
#players { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
#players li { display: flex; justify-content: space-between; gap: 8px; }
#players li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#players li.me { color: var(--cat); font-weight: 800; }
#players .bot { color: var(--muted); }
.map-panel { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 222px; padding: 9px; }
.map-caption { display: flex; justify-content: space-between; font-size: 10px; font-weight: 700; padding: 1px 3px 7px; }
.map-caption span { color: var(--muted); font-weight: 400; }
#minimap { display: block; width: 100%; height: auto; border-radius: 9px; }
.hint { position: absolute; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100% - 280px); padding: 10px 14px; border-radius: 11px; background: #303c32d9; color: #faf9f0; font-size: 11px; line-height: 1.5; }
#toasts { position: fixed; top: calc(max(16px, env(safe-area-inset-top)) + 100px); left: 50%; transform: translateX(-50%); width: min(430px, calc(100vw - 440px)); z-index: 20; display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.toast { padding: 9px 14px; border-radius: 12px; background: var(--panel); border: 1px solid #fff; box-shadow: var(--shadow); text-align: center; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; animation: toast-in .2s ease-out, toast-out .3s ease-in 2.7s forwards; }
.toast.bad { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }
#touch { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#stick { position: absolute; left: max(20px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom)); width: 122px; height: 122px; border: 2px solid #faf9f080; background: #faf9f04d; border-radius: 50%; pointer-events: auto; touch-action: none; }
.stick-arrows { position: absolute; inset: 10px; color: #faf9f0a0; font-size: 85px; line-height: 90px; text-align: center; }
#knob { position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border: 2px solid #fff; border-radius: 50%; background: #faf9f0eb; box-shadow: 0 4px 0 #35482b33; }
.tbtns { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(2, 62px); gap: 10px; pointer-events: auto; }
.tbtns button { height: 57px; border: 2px solid #fff9; border-radius: 20px; background: #faf9f0eb; box-shadow: 0 4px 0 #35482b33; font-size: 12px; font-weight: 800; touch-action: none; }
.tbtns button:first-child { background: #ffe0b4; border-color: #fff0d7; }.tbtns button:active { background: var(--accent); color: #fff; }
@media (max-width: 720px) {
  .overlay { padding: 14px; align-items: start; }
  .card { max-width: 430px; min-height: 0; grid-template-columns: 1fr; border-width: 4px; border-radius: 24px; }
  .welcome { padding: 22px 23px 18px; min-height: 190px; background: linear-gradient(90deg, #e6eed1 34%, #e6eed100 54%), #e6eed1 url(img/splash.webp) left 70px top 58% / cover no-repeat; }
  .welcome .eyebrow { font-size: 8px; }
  h1 { font-size: 41px; margin-top: 12px; position: relative; z-index: 1; }
  h1 br { display: none; }h1 > span { display: block; }
  .sub { margin: 12px 0 0; font-size: 11px; line-height: 1.6; max-width: 200px; z-index: 1; }
  .sub br { display: none; }.welcome-note { display: none; }
  .setup { padding: 20px 22px; }.setup-heading .eyebrow { display: none; }h2 { font-size: 20px; margin: 0 0 17px; }
  .species { margin-top: 13px; }.sp { padding-top: 10px; }.coat { margin-bottom: 17px; }
  .colors button { width: 30px; height: 30px; }.online-divider { margin: 20px 0 12px; }
  .needs { top: calc(max(10px, env(safe-area-inset-top)) + 77px); left: max(10px, env(safe-area-inset-left)); width: 130px; padding: 10px; gap: 6px; border-radius: 14px; }
  .need { grid-template-columns: 18px 1fr; gap: 5px; }.need > span { font-size: 15px; }.need-label { font-size: 8px; margin-bottom: 2px; }.bar { height: 5px; }.my-score { font-size: 9px; padding-top: 6px; }
  .score { left: max(10px, env(safe-area-inset-left)); transform: none; top: max(10px, env(safe-area-inset-top)); padding: 10px 15px; gap: 13px; border-radius: 14px; }.team { min-width: 62px; }.team small { font-size: 9px; }.team b { font-size: 23px; }.clock { font-size: 13px; }.score-middle { font-size: 13px; gap: 0; }
  .leave { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); min-height: 44px; font-size: 11px; padding: 10px; }.leave span { margin-left: 5px; }
  .side { top: calc(max(10px, env(safe-area-inset-top)) + 77px); right: max(10px, env(safe-area-inset-right)); width: 151px; max-height: 142px; overflow-y: auto; overscroll-behavior: contain; padding: 10px; border-radius: 14px; font-size: 10px; }
  .room-line { flex-wrap: wrap; margin-bottom: 8px; padding-bottom: 8px; gap: 5px; }.mini { margin-left: auto; font-size: 9px; min-height: 32px; padding: 4px; }
  #players-box > summary { font-size: 10px; }#players { max-height: 170px; overflow-y: auto; }
  .map-panel { top: calc(max(10px, env(safe-area-inset-top)) + 229px); bottom: auto; right: max(10px, env(safe-area-inset-right)); width: 132px; padding: 6px; border-radius: 12px; }.map-caption { font-size: 8px; padding-bottom: 5px; }
  .hint { display: none; }
  #toasts { top: calc(max(10px, env(safe-area-inset-top)) + 245px); left: max(10px, env(safe-area-inset-left)); transform: none; width: calc(100vw - 164px); max-height: 100px; overflow: hidden; justify-items: start; }.toast { font-size: 10px; padding: 7px 9px; }
  .level-row { font-size: 9px; }
  .event-banner { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); transform: none; width: auto; min-width: 0; bottom: calc(max(24px, env(safe-area-inset-bottom)) + 160px); padding: 9px 12px; border-radius: 14px; }
  .ev-head { font-size: 13px; }.ev-head > span:first-child { font-size: 19px; }#ev-text { font-size: 10px; margin-top: 4px; }
}
@media (pointer: coarse) {
  .hint { display: none; }
  .map-panel { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 150px); }
}
@media (max-width: 720px) and (pointer: coarse) { .map-panel { bottom: auto; } }
@media (max-height: 550px) and (pointer: coarse) and (orientation: landscape) {
  .needs { width: 122px; top: max(10px, env(safe-area-inset-top)); padding: 8px; gap: 4px; }.need-label { display: none; }.my-score { padding-top: 4px; }
  .score { top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
  .side { top: 65px; right: 10px; max-height: calc(100dvh - 210px); overflow-y: auto; }#players { max-height: 65px; }.map-panel { top: 110px; left: 10px; right: auto; bottom: auto; width: 115px; }
  #toasts { top: 95px; left: 145px; transform: none; width: calc(100vw - 320px); max-height: 65px; }
  #stick { width: 105px; height: 105px; bottom: max(14px, env(safe-area-inset-bottom)); }.tbtns { bottom: max(14px, env(safe-area-inset-bottom)); gap: 8px; }.tbtns button { height: 48px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.account { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #f1f1e6; font-size: 12px; font-weight: 600; }
.account > span { flex: 1 1 140px; overflow-wrap: anywhere; }
.auth { width: min(400px, calc(100% - 32px)); border: 6px solid #faf9f0; border-radius: 24px; padding: 24px; background: var(--panel); color: var(--fg); box-shadow: 0 24px 90px #25342045; }
.auth::backdrop { background: #43513780; }
.auth form { display: grid; gap: 12px; }
.auth h2 { margin: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tabs button { border: 1px solid var(--line); border-radius: 10px; padding: 9px; background: #f1f1e6; font-weight: 700; }
.tabs button.on { background: var(--accent); border-color: #cd6713; color: white; }
.auth-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-note:empty { display: none; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 11px; line-height: 1.5; color: var(--muted); }
.agree input { width: auto; margin-top: 2px; }
.auth .error { margin: 0; }
