@font-face { font-family: 'Barlow'; src: url('../../assets/fonts/barlow-condensed-latin-800-italic.woff2') format('woff2'); font-weight: 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('../../assets/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM'; src: url('../../assets/fonts/dm-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM'; src: url('../../assets/fonts/dm-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root { --ink: #1d2433; --ink2: #5d6680; --panel: #fffdf8f0; --card: #f3eee4; --card2: #e8e0d0; --pink: #ff5fa8; --blue: #2f7fff; --red: #ff3b4f; --sun: #ffcf33; --sun2: #d9a300; --green: #3fbf6a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd6f5; color: var(--ink); font-family: DM, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.coin { display: inline-block; width: .8em; height: .8em; margin-right: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0 0 18%, #ffd23f 22% 60%, #d99a00 64%); box-shadow: inset 0 0 0 2px #c98d00; vertical-align: -1px; flex: none; font-style: normal; }
.back { position: fixed; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); z-index: 6; padding: 10px 14px; border-radius: 999px; background: #fffdf8e6; color: var(--ink); font-weight: 700; font-size: 13px; text-decoration: none; box-shadow: 0 6px 16px #0003; }
body:not(.ui-menu) .back { display: none; }

.panel { position: fixed; z-index: 5; top: 70px; right: 18px; bottom: 18px; width: min(420px, 42vw); overflow-y: auto; overscroll-behavior: contain; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 26px; padding: 20px; box-shadow: 0 18px 50px #1d243355; border: 3px solid #fff; }
.panel.small { top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 24px); text-align: center; }
.logo { font: 800 italic 74px/.82 Barlow, sans-serif; display: flex; flex-direction: column; letter-spacing: -1px; }
.logo span { color: var(--pink); text-shadow: 3px 3px 0 #8a1f52; }
.logo b { color: var(--blue); font-weight: 800; text-shadow: 3px 3px 0 #173f8a; }
.tag { margin: 10px 0 12px; color: var(--ink2); font-size: 14px; line-height: 1.45; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border-radius: 999px; padding: 5px 12px; font: 800 italic 19px Barlow, sans-serif; }
.chip:empty { display: none; }
.big { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 18px; border-radius: 18px; background: var(--card); font: 800 italic 36px/1 Barlow, sans-serif; letter-spacing: 1px; box-shadow: 0 6px 0 #d8cfbd; transition: transform .08s; text-decoration: none; color: var(--ink); }
.big.go { background: var(--sun); box-shadow: 0 6px 0 var(--sun2), 0 10px 24px #b0800044; }
.big span { font-size: .6em; }
.big:active { transform: translateY(4px); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tile { background: var(--card); border-radius: 15px; padding: 10px 6px; font-weight: 700; font-size: 13px; }
.tile span { display: block; font-size: 24px; margin-bottom: 2px; }
.tile small { display: block; color: var(--ink2); font-size: 11px; font-weight: 700; margin-top: 2px; }
.wide-tile { width: 100%; margin-top: 8px; padding: 9px; }
.settings { display: grid; gap: 9px; margin-top: 8px; background: var(--card); border-radius: 15px; padding: 12px 14px; }
.switch { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span { width: 44px; height: 25px; border-radius: 999px; background: #d0c6b2; position: relative; flex: none; transition: background .2s; }
.switch > span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { left: 22px; }
.help { text-align: center; font-size: 11.5px; color: var(--ink2); margin: 12px 0 0; line-height: 1.5; }
.head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.head h2 { font: 800 italic 34px/1 Barlow, sans-serif; margin: 0; flex: 1; }
.panel.small h2 { font: 800 italic 54px/1 Barlow, sans-serif; margin: 0 0 8px; color: var(--red); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: #fff; font: 800 18px Barlow, sans-serif; display: grid; place-items: center; flex: none; box-shadow: 0 4px 12px #0002; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--card); padding: 4px; border-radius: 14px; margin-bottom: 10px; }
.tabs button { padding: 8px 2px; border-radius: 10px; font-weight: 700; font-size: 13px; }
.tabs button.on { background: #fff; box-shadow: 0 2px 6px #0001; }
.list { display: grid; gap: 8px; }
.town { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; text-align: left; background: var(--card); border: 3px solid transparent; border-radius: 18px; padding: 12px; }
.town > span { font-size: 40px; text-align: center; }
.town b { font: 800 italic 24px/1 Barlow, sans-serif; display: block; }
.town small { color: var(--ink2); font-size: 12px; font-weight: 700; }
.town.on { border-color: var(--green); background: #e2f5e6; }
.town .btn { pointer-events: none; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.item { background: var(--card); border: 3px solid transparent; border-radius: 16px; padding: 10px 6px 8px; display: grid; justify-items: center; gap: 3px; text-align: center; }
.item b { font: 800 italic 18px/1.05 Barlow, sans-serif; }
.item small { font-size: 12px; font-weight: 700; display: flex; align-items: center; color: var(--ink2); }
.item.on { border-color: var(--green); background: #e2f5e6; }
.item.locked small { color: var(--ink); }
.item.car { grid-column: 1 / -1; grid-template-columns: 1fr auto; justify-items: start; text-align: left; padding: 10px 12px; }
.item.car p { margin: 2px 0 4px; font-size: 12px; color: var(--ink2); grid-column: 1; }
.item.car .st { grid-column: 1; display: grid; grid-template-columns: 62px 1fr; gap: 2px 8px; font-size: 11px; font-weight: 700; color: var(--ink2); width: 100%; }
.item.car .st i { display: block; height: 7px; border-radius: 5px; background: #ddd2bd; margin-top: 4px; overflow: hidden; }
.item.car .st i u { display: block; height: 100%; background: var(--blue); }
.item.car > small { grid-column: 2; grid-row: 1; align-self: start; }
.sw { width: 44px; height: 44px; border-radius: 50%; box-shadow: inset -6px -6px 0 #0002, 0 0 0 3px #fff; }
.up { grid-column: 1 / -1; display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; background: var(--card); border-radius: 16px; padding: 10px 12px; text-align: left; }
.up > span { font-size: 28px; }
.up b { font: 800 italic 19px Barlow, sans-serif; display: block; }
.up small { font-size: 11.5px; color: var(--ink2); }
.pips { display: flex; gap: 3px; margin-top: 3px; }
.pips i { width: 18px; height: 6px; border-radius: 4px; background: #d8cfbd; }
.pips i.on { background: var(--sun2); }
.btn { border-radius: 12px; padding: 9px 12px; font-weight: 700; font-size: 13px; background: var(--sun); box-shadow: 0 3px 0 var(--sun2); display: inline-flex; align-items: center; white-space: nowrap; }

#hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; color: #fff; }
#hud .pause { position: absolute; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); pointer-events: auto; color: var(--ink); }
#mini { position: absolute; top: max(64px, calc(env(safe-area-inset-top) + 56px)); left: max(12px, env(safe-area-inset-left)); width: 140px; height: 140px; border-radius: 18px; border: 3px solid #ffffffcc; box-shadow: 0 6px 18px #0004; background: #1d2433aa; }
.wanted { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 6px #0008; }
.stars { font-size: 28px; letter-spacing: 3px; white-space: nowrap; }
.stars i { font-style: normal; color: #ffffff55; }
.stars i.on { color: var(--sun); text-shadow: 0 0 10px #ffcf33, 0 2px 4px #0008; }
.stars.flash i.on { animation: blink .35s 4; }
@keyframes blink { 50% { color: #ff3b4f; } }
.time { font: 800 italic 22px Barlow, sans-serif; }
.score { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); text-align: right; text-shadow: 0 2px 6px #0008; }
.score > b { display: block; font: 800 italic 34px/1 Barlow, sans-serif; }
.score span { font: 800 italic 24px Barlow, sans-serif; display: inline-flex; align-items: center; }
.combo { position: absolute; top: 27%; left: 50%; transform: translate(-50%, 0) scale(.9); font: 800 italic 36px/1 Barlow, sans-serif; text-shadow: 0 3px 0 #1d2433, 0 0 14px #0008; text-align: center; opacity: 0; transition: opacity .2s, transform .2s; white-space: nowrap; }
.combo.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.combo small { display: block; font-size: 20px; color: var(--sun); }
.busted { position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%); width: min(300px, 70vw); text-align: center; opacity: 0; transition: opacity .2s; }
.busted.on { opacity: 1; }
.busted span { font: 800 italic 22px Barlow, sans-serif; color: #ff5a6a; text-shadow: 0 2px 4px #000a; letter-spacing: 2px; }
.busted .track { position: relative; height: 16px; border-radius: 9px; background: #0007; border: 2px solid #fff; margin-top: 4px; overflow: hidden; }
.busted .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: linear-gradient(90deg, #ff3b4f, #2f7fff); width: 0; }
.bars { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; gap: 6px; width: min(340px, 44vw); }
.bar { position: relative; height: 18px; border-radius: 10px; background: #0007; border: 2px solid #fff; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ff5fa8, #ffb3d6); border-radius: 8px; transition: width .15s; }
.bar.nos i { background: linear-gradient(90deg, #2f7fff, #7fe0ff); }
.bar span { position: absolute; left: -2px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.hint { position: absolute; left: 50%; top: max(84px, calc(env(safe-area-inset-top) + 76px)); transform: translateX(-50%); font: 800 italic 28px/1.1 Barlow, sans-serif; text-shadow: 0 3px 0 #1d2433, 0 0 14px #000a; text-align: center; transition: opacity .4s; width: min(640px, 90vw); opacity: 0; }
#flash { position: fixed; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }

#touch { position: fixed; inset: auto 0 0 0; z-index: 4; pointer-events: none; padding: 0 max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); display: flex; justify-content: space-between; align-items: flex-end; }
#touch button { pointer-events: auto; touch-action: none; border-radius: 24px; background: #ffffff38; border: 2px solid #ffffffaa; color: #fff; font: 800 italic 28px Barlow, sans-serif; text-shadow: 0 2px 4px #0006; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#touch button.down { background: #ffffff88; transform: scale(.96); }
.pad-lr { display: flex; gap: 12px; }
#tL, #tR { width: 92px; height: 92px; font-size: 34px; }
.pad-act { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 10px; align-items: end; }
#tN { grid-column: 1; grid-row: 1; width: 86px; height: 56px; font-size: 20px; background: #2f7fff66; }
#tB { grid-column: 1; grid-row: 2; width: 86px; height: 64px; font-size: 20px; }
#tD { grid-column: 2; grid-row: 1 / 3; width: 112px; height: 130px; background: #ff5fa866; }
body.touch-play .bars { width: min(300px, 34vw); }
body.touch-play .busted { bottom: auto; top: 140px; }

.pause-info { color: var(--ink2); font-size: 14px; margin: -2px 0 14px; }
.res-big { font: 800 italic 70px/1 Barlow, sans-serif; }
.res-big small { font-size: .4em; }
.res-sub { color: var(--ink2); font-weight: 700; margin: 0 0 10px; }
.res-rows { display: grid; gap: 6px; margin: 4px 0 14px; text-align: left; }
.res-rows div { display: flex; justify-content: space-between; align-items: center; background: var(--card); border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: 14px; }
.res-rows div b { font: 800 italic 20px Barlow, sans-serif; display: flex; align-items: center; }
.res-rows .yes { color: #d99a00; }

#banner { position: fixed; left: 50%; top: 44%; transform: translate(-50%, -50%) scale(.9); z-index: 8; text-align: center; color: #fff; pointer-events: none; opacity: 0; transition: opacity .3s, transform .3s; text-shadow: 0 4px 0 #1d2433, 0 0 22px #0008; }
#banner.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner small { display: block; font: 700 16px Barlow, sans-serif; letter-spacing: 4px; }
#banner b { display: block; font: 800 italic clamp(46px, 9vw, 92px)/.95 Barlow, sans-serif; white-space: nowrap; }
#toasts { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 9; display: grid; gap: 8px; pointer-events: none; width: min(420px, calc(100vw - 24px)); }
body.in-run #toasts { left: auto; right: max(12px, env(safe-area-inset-right)); bottom: auto; top: max(92px, calc(env(safe-area-inset-top) + 84px)); transform: none; width: min(250px, 42vw); gap: 6px; }
body.in-run .toast { padding: 7px 10px; font-size: 12.5px; border-radius: 12px; }
body.in-run .toast > span { font-size: 18px; }
.toast { background: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: 0 10px 26px #0003; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; animation: tin .3s ease; }
.toast > span { font-size: 22px; }
.toast small { display: block; font-weight: 400; color: var(--ink2); font-size: 12px; }
.toast.out { animation: tout .35s ease forwards; }
@keyframes tin { from { transform: translateY(12px); opacity: 0; } }
@keyframes tout { to { transform: translateY(12px); opacity: 0; } }

@media (max-width: 760px) and (orientation: portrait) {
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 62vh; padding: 16px; }
  .panel.small { max-height: 86vh; }
  .logo { font-size: 56px; flex-direction: row; gap: 8px; }
  .tag { margin: 6px 0 10px; font-size: 13px; }
  .big { font-size: 30px; padding: 12px; }
  #mini { width: 100px; height: 100px; }
  .score > b { font-size: 28px; }
  .stars { font-size: 22px; }
  #tL, #tR { width: 72px; height: 84px; }
  #tN, #tB { width: 72px; }
  #tD { width: 92px; }
  body.touch-play .bars { top: auto; bottom: 200px; width: 60vw; }
  body.touch-play .busted { top: 30%; }
  .hint { font-size: 22px; top: 170px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .panel { top: 8px; bottom: 8px; right: 8px; width: min(380px, 48vw); padding: 14px; }
  .logo { font-size: 50px; flex-direction: row; gap: 8px; }
  .tag { display: none; }
  .big { font-size: 26px; padding: 10px; }
  #mini { width: 96px; height: 96px; top: 62px; }
  .score > b { font-size: 26px; }
  .stars { font-size: 20px; }
  #tL, #tR { width: 76px; height: 76px; }
  #tN, #tB { width: 76px; height: 50px; }
  #tD { width: 96px; height: 110px; }
  body.touch-play .bars { width: 32vw; }
  .hint { top: 64px; font-size: 22px; }
  .panel.small { padding: 12px 16px; width: min(560px, calc(100vw - 24px)); }
  .panel.small h2 { font-size: 34px; margin-bottom: 2px; }
  .res-big { font-size: 44px; }
  .res-rows { grid-template-columns: 1fr 1fr; gap: 5px; margin: 4px 0 8px; }
  .res-rows div { padding: 5px 10px; font-size: 12.5px; }
  .res-rows div b { font-size: 17px; }
  .panel.small .two { margin-top: 6px; }
  .panel.small .tile { padding: 6px; }
  .panel.small .tile span { font-size: 18px; }
}
