@font-face { font-family: "Toy"; src: url(assets/font/nunito-cyr.woff2) format("woff2"); font-weight: 400 1000; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Toy"; src: url(assets/font/nunito-lat.woff2) format("woff2"); font-weight: 400 1000; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root { --cream: #FFF6E3; --navy: #1E3557; --red: #E2412F; --orange: #FF7A1A; --lime: #B8E04A; --water: #3FA9F5; --grass: #7FB547; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #BFE3F2; font-family: "Toy", "Trebuchet MS", "Noto Sans Armenian", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-weight: 800; color: var(--navy); touch-action: none; user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font-family: inherit; font-weight: 900; color: inherit; cursor: pointer; }

/* enamel plates */
.plate { background: var(--cream); border: 3px solid var(--navy); border-radius: 16px; box-shadow: 0 3px 0 rgba(30,53,87,.35), 0 8px 20px rgba(0,0,0,.25), inset 0 0 0 2px rgba(255,255,255,.7); position: relative; }
.plate::after { content: ""; position: absolute; top: -3px; right: 14px; width: 10px; height: 6px; background: #d8cdb5; border-radius: 0 0 5px 5px; opacity: .8; }

.screen { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px); }
#loading { justify-content: center; background: #BFE3F2; z-index: 40; }
.load-plate { padding: 16px 22px; font-size: 20px; text-align: center; min-width: 220px; }
.bar { margin-top: 10px; height: 12px; border: 2px solid var(--navy); border-radius: 8px; overflow: hidden; background: #fff; }
#loadBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--water), #8fd3ff); transition: width .2s; }

.pill { border: 3px solid var(--navy); background: var(--cream); color: var(--navy); border-radius: 40px; font-size: 19px; padding: 11px 22px; box-shadow: 0 4px 0 var(--navy); }
.pill:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.pill.white { background: #fff; font-size: 26px; padding: 13px 42px; display: inline-flex; align-items: center; gap: 12px; }
.pill.go { background: #5aa64a; color: #fff; }
.pill.small { font-size: 16px; padding: 8px 16px; }
.tri { width: 0; height: 0; border-left: 18px solid var(--navy); border-top: 11px solid transparent; border-bottom: 11px solid transparent; border-radius: 3px; }
.wobble { animation: wob 2.6s ease-in-out infinite; }
@keyframes wob { 0%, 100% { transform: rotate(0) } 10% { transform: rotate(-3deg) scale(1.03) } 20% { transform: rotate(3deg) scale(1.03) } 30% { transform: rotate(0) } }
.link { background: none; border: 0; color: var(--navy); text-decoration: underline; font-size: 16px; padding: 6px; }
.link.light { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.chip { border: 3px solid var(--navy); background: var(--cream); border-radius: 12px; font-size: 15px; padding: 6px 10px; box-shadow: 0 3px 0 var(--navy); }
.note { margin-top: 8px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.7); font-size: 15px; text-align: center; }

/* start */
#start { justify-content: space-between; pointer-events: none; }
#start > * { pointer-events: auto; }
#playBtn { margin-top: max(6px, 2vh); }
.title-sign, .res-sign { position: relative; margin-bottom: 12vh; display: flex; align-items: center; }
.title-sign .plate.big, .res-sign .plate.big { padding: 12px 26px 14px; text-align: center; transform: rotate(-2deg); border-width: 4px; border-radius: 22px; }
.t1 { white-space: nowrap; font-size: clamp(34px, 11vw, 84px); font-weight: 1000; line-height: 1; letter-spacing: .5px; color: var(--navy); }
.t2 { white-space: nowrap; font-size: clamp(18px, 5.4vw, 40px); font-weight: 900; color: var(--red); margin-top: 4px; }
.splash { position: absolute; width: clamp(80px, 24vw, 160px); z-index: 2; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.2)); }
.splash.l { left: -14%; bottom: -18%; }
.splash.r { right: -14%; bottom: -14%; transform: scaleX(-1); }

#langWrap { position: fixed; z-index: 45; top: calc(env(safe-area-inset-top) + 10px); right: 10px; display: flex; flex-direction: column; align-items: flex-end; }
.lang-list { margin-top: 6px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.lang-list button { border: 0; background: none; font-size: 17px; text-align: left; padding: 7px 12px; border-radius: 10px; }
.lang-list button.on { background: #ffe3b8; }
body.ingame #langWrap { top: calc(env(safe-area-inset-top) + 58px); }

/* name entry */
#namebox { justify-content: flex-end; }
.kb { width: min(96vw, 560px); padding: 10px 8px 8px; }
.kb-title { text-align: center; font-size: 19px; margin-bottom: 6px; }
#nameInput { width: 100%; font: inherit; font-size: 24px; font-weight: 900; color: var(--navy); padding: 8px 12px; border: 3px solid var(--navy); border-radius: 12px; background: #fff; outline: none; margin-bottom: 8px; }
.keys { display: flex; flex-direction: column; gap: 5px; }
.kb-row { display: flex; gap: 4px; justify-content: center; }
.key { flex: 1 1 0; min-width: 0; max-width: 48px; height: 44px; border: 2px solid var(--navy); border-radius: 9px; background: #fff; font-size: 19px; box-shadow: 0 2px 0 var(--navy); padding: 0; }
.key:active { transform: translateY(2px); box-shadow: none; background: #ffe3b8; }
.kb-row.last { margin-top: 6px; }
.key.wide { max-width: none; flex: 1.6 1 0; font-size: 15px; }
.key.wider { max-width: none; flex: 2.4 1 0; font-size: 15px; }
.key.alt { background: #dfe7f1; }
.key.go { background: #5aa64a; color: #fff; }
.kb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* lobby, picker, help */
#lobby, #picker, #help { justify-content: center; background: rgba(30,53,87,.35); }
.card { width: min(92vw, 420px); padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 92vh; overflow-y: auto; }
.card h3 { margin: 0; text-align: center; font-size: 24px; }
.msg { text-align: center; font-size: 15px; }
.seats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seat { background: #fff; border: 2px solid var(--navy); border-radius: 12px; padding: 4px 2px; text-align: center; font-size: 12px; overflow: hidden; }
.seat img { width: 40px; height: 40px; object-fit: contain; display: block; margin: 0 auto 2px; }
.seat.empty img { opacity: .25; filter: grayscale(1); }
.seat.mine { background: #ffe3b8; }
.seat .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pick { border: 2px solid var(--navy); background: #fff; border-radius: 12px; padding: 6px 4px; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 2px 0 var(--navy); }
.pick img { width: 54px; height: 54px; object-fit: contain; }
.pick.near { background: #ffe3b8; border-color: var(--orange); }
.pick .tag { font-size: 10px; color: var(--orange); }
.help-card p { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 700; }

/* spin */
#spin { position: fixed; inset: 0; z-index: 15; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 18px); }
.banner-top { padding: 8px 20px; font-size: clamp(18px, 5.4vw, 26px); }
.spin-result { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.seeker-plate { padding: 8px 22px; font-size: clamp(26px, 8vw, 42px); color: var(--red); }
.role-plate { padding: 8px 18px; text-align: center; font-size: clamp(20px, 6vw, 30px); color: var(--red); }
.role-plate small { display: block; color: var(--navy); font-size: .65em; }

#blind { position: fixed; inset: 0; z-index: 12; background: rgba(15,30,50,.86); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; pointer-events: none; }
#blind .plate { padding: 16px 24px; text-align: center; font-size: 22px; max-width: 90vw; }
.blind-num { font-size: clamp(80px, 26vw, 140px); font-weight: 1000; color: var(--water); line-height: 1.05; }
#blind .sub { font-size: 15px; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.roster { position: absolute; top: calc(env(safe-area-inset-top) + 8px); left: 8px; display: flex; flex-direction: column; gap: 4px; }
.rtag { display: flex; align-items: center; gap: 5px; background: var(--cream); border: 2px solid var(--navy); border-radius: 10px; padding: 2px 8px 2px 2px; font-size: 13px; min-width: 96px; max-width: 34vw; box-shadow: 0 2px 0 rgba(30,53,87,.4); }
.rtag img { width: 22px; height: 22px; object-fit: contain; border-radius: 50%; background: #fff; }
.rtag .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtag .st { width: 12px; height: 12px; border-radius: 50%; background: #5aa64a; border: 1.5px solid var(--navy); flex: none; }
.rtag.seeker .st { background: var(--water); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.rtag.mine { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.rtag.house .st { background: #c98b4e; border-radius: 3px; }
.timer { position: absolute; top: calc(env(safe-area-inset-top) + 8px); left: 50%; translate: -50% 0; padding: 3px 16px; font-size: 26px; font-weight: 1000; }
.timer.low { color: var(--red); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.phase-msg { position: absolute; top: calc(env(safe-area-inset-top) + 58px); left: 50%; translate: -50% 0; background: rgba(30,53,87,.82); color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 14px; text-align: center; width: max-content; max-width: min(56vw, 420px); }
.phase-msg:empty { display: none; }
.banner { position: absolute; top: 24%; left: 50%; translate: -50% 0; padding: 10px 18px; font-size: clamp(20px, 6vw, 32px); text-align: center; max-width: 90vw; opacity: 0; transition: opacity .3s, transform .3s; transform: scale(.8); }
.banner.on { opacity: 1; transform: scale(1); }
.banner.red { color: var(--red); }
.corner { position: absolute; top: calc(env(safe-area-inset-top) + 8px); right: 8px; display: flex; gap: 6px; pointer-events: auto; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--navy); background: var(--cream); font-size: 18px; box-shadow: 0 2px 0 var(--navy); padding: 0; }
.round.off { opacity: .5; }
.reticle { position: absolute; left: 50%; top: 46%; width: 34px; height: 34px; margin: -17px; border: 3px solid rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 0 2px rgba(30,53,87,.5); }
.reticle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; background: #fff; border-radius: 50%; }
.ammo { position: absolute; right: 10px; top: calc(env(safe-area-inset-top) + 60px); width: 20px; height: 130px; border: 3px solid var(--navy); border-radius: 12px; background: var(--cream); overflow: hidden; }
#ammoFill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(#8fd3ff, var(--water)); }
.actions { position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: auto; }
.act { display: flex; align-items: center; gap: 6px; border: 3px solid var(--navy); background: var(--cream); border-radius: 30px; padding: 4px 12px 4px 4px; font-size: 14px; box-shadow: 0 3px 0 var(--navy); max-width: 52vw; }
.act img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 50%; }
.act:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.fire { position: relative; width: 104px; height: 104px; border-radius: 50%; border: 4px solid var(--navy); background: radial-gradient(circle at 40% 35%, #a9e2ff, var(--water)); box-shadow: 0 4px 0 var(--navy), 0 8px 16px rgba(0,0,0,.3); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; color: #fff; font-size: 13px; text-shadow: 0 1px 2px var(--navy); }
.fire img { width: 62px; margin-top: -6px; }
.fire .ring { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); transform: rotate(-90deg); pointer-events: none; }
.fire .ring circle { fill: none; stroke: var(--orange); stroke-width: 7; stroke-dasharray: 289; stroke-dashoffset: 0; stroke-linecap: round; }
.fire.cool { filter: saturate(.4) brightness(.9); }
.hints { position: absolute; left: 50%; translate: -50% 0; bottom: calc(env(safe-area-inset-bottom) + 10px); display: flex; gap: 12px; background: rgba(30,53,87,.75); color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 13px; white-space: nowrap; }
.hints:empty { display: none; }
.hints kbd { display: inline-block; background: var(--cream); color: var(--navy); border: 2px solid var(--navy); border-radius: 6px; padding: 0 5px; margin-right: 4px; font: inherit; font-size: 12px; }
.stick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,246,227,.25); border: 3px solid rgba(255,246,227,.7); }
.knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: var(--cream); border: 3px solid var(--navy); }

/* result */
#result { justify-content: center; gap: 10px; background: rgba(30,53,87,.25); }
.res-sign { margin-bottom: 4px; }
.res-t { font-size: clamp(32px, 10vw, 56px); text-align: center; }
.res-mine { padding: 6px 18px; font-size: 22px; }
.res-mine.win { color: #3b8f2e; }
.res-mine.lose { color: var(--red); }
.res-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 14px; width: min(92vw, 420px); }
.res-cols > div + div { border-left: 2px dashed rgba(30,53,87,.4); padding-left: 12px; }
.col-h { font-size: 15px; margin-bottom: 6px; }
.rrow { display: flex; align-items: center; gap: 6px; font-size: 15px; margin: 3px 0; }
.rrow img { width: 26px; height: 26px; object-fit: contain; }

@media (min-aspect-ratio: 5/4) {
  .kb { width: min(70vw, 620px); }
  .key { height: 46px; max-width: 54px; }
  .title-sign { margin-bottom: 8vh; }
}
@media (pointer: fine) { .act span { display: inline; } }
.stick { pointer-events: none; }
.stick.rest { opacity: .75; }
.stick.rest::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px dashed rgba(255,246,227,.6); }
.act.leftact { position: absolute; left: 12px; bottom: calc(env(safe-area-inset-bottom) + 14px); pointer-events: auto; z-index: 3; }
.act.leftact span { display: inline; }

.wasd { position: absolute; left: 14px; bottom: calc(env(safe-area-inset-bottom) + 74px); display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 54px); gap: 6px; pointer-events: auto; z-index: 3; user-select: none; touch-action: none; }
.wk { border: 3px solid var(--navy); background: var(--cream); color: var(--navy); border-radius: 12px; font-size: 22px; font-weight: bold; box-shadow: 0 3px 0 var(--navy); padding: 0; cursor: pointer; }
.wk.w { grid-column: 2; grid-row: 1; } .wk.a { grid-column: 1; grid-row: 2; } .wk.s { grid-column: 2; grid-row: 2; } .wk.d { grid-column: 3; grid-row: 2; }
.wk.on, .wk:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); background: #ffe7a8; }
