/* GINZA KEEPER. Black night, white line art, one gold (the lens) and one red (danger). */
:root {
  --bg: #000; --card: #070707; --line: #1f1f1f; --line2: #2e2e2e;
  --fg: #f8f8f8; --muted: #8a8a8a; --dim: #5a5a5a;
  --gold: #e3c14f; --red: #eb0d17;
  --sans: Geist, system-ui, -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* motion: things arrive on --out, small things land with --back; nothing moves on a linear curve except a fill */
  --out: cubic-bezier(0.16, 1, 0.3, 1); --back: cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* each language gets its own fallback fonts, so shared Han characters use the right regional shapes */
:root:lang(ja) {
  --sans: Geist, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", monospace;
}
:root:lang(ko) {
  --sans: Geist, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", monospace;
}
:root:lang(zh) {
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow-x: hidden; }
/* in-app browsers (Telegram and the like) put their own bars over the page: size to the part that shows */
@supports (height: 100dvh) { html, body { height: 100dvh; } }
body {
  background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
body.playing { overflow: hidden; position: fixed; inset: 0; touch-action: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
.btn, .chip, .go-chips button, .langmenu button, .modesw button { transition: transform 0.12s var(--out), background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.2s; }
.btn:active, .chip:active, .go-chips button:active, .modesw button:active { transform: scale(0.96); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }
.lbl, .eyebrow, .rtag, h3 {
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.fine { font-size: 11px; line-height: 1.55; color: var(--muted); }
.link { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

#app {
  max-width: 1440px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 6px;
  /* safe areas: the phone's own, or inside Telegram the ones Telegram reports (its notch value plus its own floating buttons) */
  --safe-t: max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-b: max(env(safe-area-inset-bottom), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  padding: calc(8px + var(--safe-t)) calc(10px + max(env(safe-area-inset-right), var(--tg-safe-area-inset-right, 0px))) calc(6px + var(--safe-b)) calc(10px + max(env(safe-area-inset-left), var(--tg-safe-area-inset-left, 0px)));
}

/* ---- HUD ---- */
/* on a big screen the HUD, the fact line, the title and the panel grow with it: --k is set in resize() */
#hud, #foot, .panel, .t-in, .e-in { zoom: var(--k, 1); }
#hud { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; flex-direction: column; line-height: 1.1; flex: none; }
.brand b { font-size: 13px; letter-spacing: -0.01em; }
.brand span { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.hud-stats { display: flex; gap: 14px; margin-left: auto; align-items: flex-end; }
.stat { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
.stat .lbl { font-size: 8px; }
.stat b { font-family: var(--mono); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }
.lives { display: flex; gap: 4px; height: 18px; align-items: center; }
.stat b.gold { color: var(--gold); }
.lives i { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--fg); }
.lives i.in { animation: lifeIn 0.45s var(--back) both; }
.lives i.gone { background: none; border: 1px solid var(--dim); animation: lifeOut 0.5s var(--out) both; }
.lives i.last { background: var(--red); }
/* the last life pings; transform and opacity only, so it costs the game no paint */
.lives i.last::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--red); animation: ping 0.9s ease-out infinite; }
@keyframes lifeIn { from { transform: scale(0); } to { transform: none; } }
@keyframes lifeOut { 0% { transform: scale(1.9); background: var(--red); border-color: var(--red); } 55% { background: var(--red); border-color: var(--red); } 100% { transform: none; background: none; border-color: var(--dim); } }
@keyframes ping { from { transform: scale(1); opacity: 0.7; } 60%, to { transform: scale(2.2); opacity: 0; } }
.hud-btns { display: flex; gap: 6px; flex: none; }
.chip { min-width: 34px; height: 30px; padding: 0 8px; border: 1px solid var(--line2); border-radius: 8px; font-family: var(--mono); font-size: 11px; }
.chip:hover { background: #111; }
.chip.off { color: var(--dim); text-decoration: line-through; }
.langwrap { position: relative; display: inline-flex; }
.langmenu:not([hidden]) { animation: menuIn 0.18s var(--out); transform-origin: top right; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(0.96); } to { opacity: 1; transform: none; } }
.langmenu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; display: flex; flex-direction: column; min-width: 132px; padding: 4px; background: #0b0b0b; border: 1px solid var(--line2); border-radius: 8px; }
.langmenu button { text-align: left; padding: 11px 12px; border-radius: 6px; font-size: 14px; white-space: nowrap; }
.langmenu button:hover { background: #1a1a1a; }
.langmenu button.on { color: var(--gold); }

/* ---- stage ---- */
#stage { flex: 1; display: flex; justify-content: center; align-items: center; min-width: 0; }
#sceneWrap { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; line-height: 0; }
#scene { display: block; touch-action: none; cursor: none; }
/* game over: a panel under the goal, where the thumb already is */
/* with a mouse the panel is a card over the lower half of the goal */
.panel.card { border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.8); padding: 10px 14px 12px; }
.panel { position: absolute; display: flex; flex-direction: column; gap: 8px; padding: 6px 10px 8px; line-height: 1.3; background: #000; }
/* the rows arrive one after another, from where the goal is */
.panel > * { animation: rise 0.45s var(--out) backwards; }
.panel > :nth-child(2) { animation-delay: 0.06s; }
.panel > :nth-child(3) { animation-delay: 0.1s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
/* drawn again for a language change: no second entrance, but PLAY / RETRY keep breathing and the menu still opens */
.still, .still *:not(.play):not(.go-retry):not(.langmenu):not(.nudge):not(.g), .still *::before { animation: none !important; }
.go-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.go-info { font-family: var(--mono); font-size: 10px; letter-spacing: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.go-chips { display: flex; gap: 4px; flex: none; }
.go-chips button { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; padding: 7px 6px; border: 1px solid var(--line2); border-radius: 8px; color: #cfcfcf; white-space: nowrap; }
.go-chips button:hover { background: #111; }
.go-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.go-num { display: flex; flex-direction: column; }
.go-num b { font-family: var(--mono); font-size: clamp(36px, 11.5vw, 52px); font-weight: 700; line-height: 0.95; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.go-num span { white-space: nowrap; }
.go-num span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.go-num.gold b, .go-num.gold span { color: var(--gold); }
/* a medal run: light passes once across the number after it has counted up */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .go-num.gold b {
    background: linear-gradient(100deg, var(--gold) 42%, #fff6d0 50%, var(--gold) 58%) 100% 0 / 300% 100%;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: sheen 0.9s 0.65s var(--out) both;
  }
}
@keyframes sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
.go-side .hot { animation: hot 1.2s 0.5s ease-in-out 2; }
@keyframes hot { 50% { text-shadow: 0 0 14px rgba(227, 193, 79, 0.9); } }
.go-chips button:disabled, .modesw button:disabled { opacity: 0.4; }
/* a short panel (small phones): one line beside the score, tighter rows */
.panel.tight { gap: 5px; padding-top: 3px; padding-bottom: 5px; }
.panel.tight .go-side span + span { display: none; }
.panel.tight .go-num b { font-size: 34px; }
.panel.tight .go-retry { min-height: 44px; }

/* ---- GINZA ON / OFF: one switch, on the title and under the goal. Each side shows its own best, and a bar
   drawn to one scale, so the gap is seen before the numbers are read. ---- */
.modesw { display: flex; align-items: stretch; gap: 6px; min-width: 0; }
.modesw button {
  position: relative; overflow: hidden; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 6px 10px 9px; border: 1px solid var(--line2); border-radius: 8px; background: rgba(0, 0, 0, 0.6); color: var(--muted);
  font-family: var(--mono); white-space: nowrap; text-align: left;
}
.modesw b { display: flex; align-items: center; gap: 6px; max-width: 100%; font-size: 10px; letter-spacing: 0.08em; }
.modesw i { flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--dim); }
.modesw span { font-size: 15px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.modesw u { position: absolute; left: 0; bottom: 0; height: 3px; min-width: 2px; background: var(--dim); text-decoration: none; transition: width 0.5s var(--out); }
.modesw button.g u { background: var(--gold); }
.modesw button.on { color: var(--fg); border-color: var(--fg); }
.modesw button.g.on { border-color: var(--gold); }
.modesw button.g.on i { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px rgba(227, 193, 79, 0.8); }
.modesw button.g span { color: var(--gold); }
.modesw button:not(.g).on i { background: var(--fg); border-color: var(--fg); }
/* how many times more this player scores with Ginza */
.modesw em small { display: block; font-size: 8px; font-weight: 500; letter-spacing: 0.12em; text-align: center; text-shadow: none; color: var(--muted); }
.modesw em { flex: none; align-self: center; padding: 0 2px; line-height: 1.1; font-style: normal; font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--gold); text-shadow: 0 0 12px rgba(227, 193, 79, 0.5); }
/* after a run without Ginza, the ON side asks to be pressed */
.modesw.invite button.g { border-color: var(--gold); color: var(--gold); animation: invite 1.4s ease-in-out infinite; }
@keyframes invite { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 193, 79, 0.45); } 70% { box-shadow: 0 0 0 8px rgba(227, 193, 79, 0); } }
.go-side .dare { color: var(--gold); }
.mode { display: flex; flex-direction: column; gap: 6px; }
.go-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; color: #cfcfcf; text-align: right; }
.go-side .hot { color: var(--gold); font-weight: 700; }
/* RETRY: white pours in while the button is still locked, so the thumb sees when it goes live */
.go-retry {
  position: relative; overflow: hidden; isolation: isolate; flex: 1; min-height: 52px; border-radius: 10px; background: #1c1c1c;
  display: flex; align-items: center; justify-content: center;
  animation: rise 0.45s 0.12s var(--out) backwards, breathe 2.4s 1.4s ease-in-out infinite; transition: transform 0.12s var(--out);
}
.go-retry::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fg); transform-origin: left; transform: scaleX(var(--p, 1)); }
.still .go-retry { animation: breathe 2.4s ease-in-out infinite; }
.go-retry b { font-family: var(--mono); font-size: 15px; letter-spacing: 0.12em; color: #fff; mix-blend-mode: difference; }
.go-retry:not(:disabled):active { transform: scale(0.985); }
.go-retry:not(:disabled):active::before { background: #cfcfcf; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(248, 248, 248, 0.32); } 70% { box-shadow: 0 0 0 10px rgba(248, 248, 248, 0); } }

.realbox, .simbox { border: 1px solid var(--line2); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #050505; }
.simbox { border-style: dashed; }
.realbox .rtag { color: var(--fg); }
.realbox p, .simbox p { font-size: 12.5px; line-height: 1.55; }

#foot { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding-top: 4px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; color: var(--dim); }
#foot .link { font-size: 9px; color: var(--muted); white-space: nowrap; }
body.playing #foot .link { display: none; }
body:not(.playing) #hud, body:not(.playing) #foot { visibility: hidden; }
#footLine { height: 2.6em; overflow: hidden; display: block; line-height: 1.3; font-family: var(--sans); font-size: 11px; letter-spacing: 0; color: var(--muted); }
#footLine b { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--gold); border: 1px solid rgba(227,193,79,.5); border-radius: 4px; padding: 0 4px; margin-right: 4px; }

/* ---- score tables ---- */
.ladder { list-style: none; display: flex; flex-direction: column; }
.ladder li { display: grid; grid-template-columns: 18px 1fr auto 26px 58px; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.ladder li:first-child { border-top: 0; }
.ladder .pos { color: var(--dim); font-size: 10px; }
.ladder .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #bdbdbd; }
.ladder .rk { font-size: 9px; letter-spacing: 0.1em; color: var(--muted); }
.ladder b, .ladder .sv { font-variant-numeric: tabular-nums; text-align: right; }
.ladder .sv { font-size: 10px; color: var(--muted); }
.ladder li.me .nm { color: var(--fg); font-weight: 700; }
.ladder li.house .nm, .ladder li.house b { color: var(--dim); }

/* ---- real ticket figure ---- */
.ticket { display: flex; flex-direction: column; gap: 8px; }
.tk-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tk-head b { font-size: 13px; }
.tk-head span { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.tk-fig { position: relative; height: 26px; border-bottom: 1px solid var(--line2); }
.tk-fig i { position: absolute; display: block; }
.tk-zero { bottom: -4px; width: 1px; height: 12px; background: var(--muted); }
.tk-band { bottom: 6px; height: 8px; border: 1px solid var(--fg); border-top: 0; }
.tk-dot { bottom: 3px; width: 9px; height: 9px; margin-left: -4px; border-radius: 50%; background: var(--fg); }
.ticket p { font-size: 12px; line-height: 1.5; }

/* ---- overlays ---- */
#overlay { position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#overlay.title { background: rgba(0, 0, 0, 0.72); }
#overlay.title, #overlay.end { display: flex; }                 /* its content is centred when it fits and scrolls when it does not */
#overlay.title > *, #overlay.end > * { margin: auto; width: 100%; }
#overlay.end { background: #000; }
#overlay.leave { opacity: 0; pointer-events: none; transition: opacity 0.2s ease-out; }
#overlay.leave .t-in { transform: scale(1.03); transition: transform 0.2s ease-in; }
/* arriving: each block rises in turn; the name of the game comes up out of a mask */
.t-top, .t-main > *, .t-more, .e-in > * { animation: rise 0.6s var(--out) backwards; }
.e-in > :nth-child(2) { animation-delay: 0.05s; }
.t-main > :nth-child(2), .e-in > :nth-child(3) { animation-delay: 0.16s; }
.t-main > :nth-child(3), .e-in > :nth-child(4) { animation-delay: 0.22s; }
.t-main > :nth-child(4) { animation-delay: 0.28s; }
.t-more { animation-delay: 0.4s; }
.e-in > :nth-child(n+5) { animation-delay: 0.28s; }
.t-main > h1 { animation: none; }
/* the title is one column on a phone and two on a wide screen: the game on the left, the rest beside it */
.t-main, .t-more { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.title h1 span { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.title h1 i { display: block; font-style: normal; animation: lineUp 0.8s var(--out) both; }
.title h1 span + span i { animation-delay: 0.09s; }
@keyframes lineUp { from { transform: translateY(105%); } to { transform: none; } }
.t-in, .e-in {
  max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
  padding: calc(20px + max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)))) 18px calc(36px + max(env(safe-area-inset-bottom), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px))));
}
.e-in { max-width: 720px; }
.t-top { display: flex; justify-content: space-between; align-items: center; }
.t-btns { display: flex; gap: 6px; }
#overlay h1 { font-weight: 400; font-size: clamp(46px, 14vw, 76px); line-height: 0.94; letter-spacing: -0.055em; }
.t-tag { font-size: 16px; line-height: 1.45; max-width: 22em; }
.how { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--line); }
.how li { display: flex; gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.how b { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.name { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line2); border-radius: 8px; padding: 4px 12px; background: rgba(0, 0, 0, 0.6); }
.name span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.name input { flex: 1; min-width: 0; background: none; border: 0; color: var(--fg); font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: 0.16em; padding: 6px 0; text-transform: uppercase; outline: none; }
.name input::placeholder { color: var(--dim); letter-spacing: 0.08em; }
.name:focus-within { border-color: var(--fg); }
.name.set b { font-family: var(--mono); font-size: 16px; letter-spacing: 0.16em; padding: 7px 0; }
/* PLAY pressed with no name: the field shakes its head */
.name.nudge { animation: nudge 0.4s var(--out); border-color: var(--red); }
@keyframes nudge { 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-3px); } }
.btn.play.wait { opacity: 0.45; }
.t-main > .btn.play.wait { animation: rise 0.6s 0.34s var(--out) backwards; }
.btn.play { min-height: 72px; }
.t-main > .btn.play { animation: rise 0.6s 0.34s var(--out) backwards, breathe 2.4s 1.4s ease-in-out infinite; }
.still .t-main > .btn.play { animation: breathe 2.4s ease-in-out infinite; }
.still .t-main > .btn.play.wait { animation: none; }
.btn.play b { font-size: 20px; letter-spacing: 0.16em; }
.e-top { display: flex; }
.e-top .btn { min-height: 0; padding: 8px 14px; }
.e-in > .btn.primary { align-self: stretch; }
.btn { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 8px; text-decoration: none; color: var(--fg); min-height: 56px; justify-content: center; background: rgba(0, 0, 0, 0.6); }
.btn b { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; }
.btn span { font-size: 11px; color: var(--muted); }
.btn:hover { background: #111; }
.btn.primary { background: var(--fg); color: #000; border-color: var(--fg); }
.btn.primary span { color: #444; }
.btn.primary:hover { background: #dcdcdc; }
.btn.ghost { border-color: var(--line); }
.hall h3 { margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }

.end section { display: flex; flex-direction: column; gap: 10px; }
.bridge { font-size: 17px; line-height: 1.4; letter-spacing: -0.01em; }
.twobox { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.twobox > *, .e-in > * { min-width: 0; }
.realbox p, .simbox p, .fine { overflow-wrap: anywhere; }
@media (min-width: 680px) { .twobox { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: start; } }
.vs { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.vs th, .vs td { text-align: left; padding: 5px 6px 5px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.vs th { font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0.06em; color: var(--muted); }
.vs .n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0; padding-left: 6px; }
.vs td.g { font-weight: 700; }
.vs th.n { white-space: normal; }
.realbox ul { list-style: none; display: grid; gap: 3px; }

.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.8); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 0.2s ease-out; }
.modal .m-in { animation: pop 0.32s var(--out); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
.m-in { max-width: 520px; max-height: 90vh; overflow-y: auto; background: #050505; border: 1px solid var(--line2); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.m-in h2 { font-size: 24px; font-weight: 400; letter-spacing: -0.03em; }
.m-in p { font-size: 13px; line-height: 1.6; color: #cfcfcf; }
.m-in .btn { align-self: flex-start; min-height: 0; padding: 8px 14px; }

@media (min-width: 900px) {
  .t-in { max-width: 1000px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 56px; align-items: start; }
  .t-top { grid-column: 1 / -1; }
  .t-more { padding-top: 10px; }
}
@media (max-width: 480px) {
  #app { gap: 4px; padding-left: calc(5px + env(safe-area-inset-left)); padding-right: calc(5px + env(safe-area-inset-right)); }
  #hud, #foot { padding-left: 5px; padding-right: 5px; }
  #hud { gap: 8px; }
  .brand b { font-size: 11px; line-height: 1.05; max-width: 4.2em; }
  .hud-stats { gap: 10px; }
  .stat b { font-size: 14px; }
  .chip { min-width: 30px; height: 28px; padding: 0 6px; }
  #foot .link { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* phones held sideways: the game is built for one thumb in portrait */
#rotate { display: none; position: fixed; inset: 0; z-index: 60; background: #000; align-items: center; justify-content: center; text-align: center; padding: 24px; font-family: var(--mono); font-size: 14px; letter-spacing: 0.1em; }
/* min-width: a portrait phone whose keyboard has shrunk the page is not a phone held sideways */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) and (min-width: 560px) { #rotate { display: flex; } }
