/* Platform home (/). The studio's warm dark soil-and-gold look, mobile first,
   no web fonts (system CJK + monospace), no external assets. Motion is small,
   stepped like the pixel art, and stops under prefers-reduced-motion. */
:root {
  --bg: #140d09; --bg2: #1c120c; --bg3: #24170e; --line: #6b5030; --shadow: #0a0604;
  --ink: #f4ead5; --soft: #c7b8a1; --mute: #9f8a70; --gold: #e9bc67; --gold-hi: #f4d396; --deep: #211408;
  --sky: #7fdcf5; --ok: #8fd6a4;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: ui-monospace, SFMono-Regular, Menlo, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--bg); font-synthesis: none; -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100svh;
  background:
    linear-gradient(rgba(20, 13, 9, 0) 70%, #21140c),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 4px),
    var(--bg);
}
body.sheet-open { overflow: hidden; }
main { max-width: 620px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom)); }
.en { display: none; }
html[data-lang="en"] .zh { display: none; }
html[data-lang="en"] .en { display: inline; }
.dev-note { background: #5a1d1d; color: #ffd9d9; padding: 8px 10px; font-size: 12px; border: 2px dashed #ff8080; }

/* Top bar: studio mark left; coins, language and the game menu right. */
header .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; font-weight: 800; letter-spacing: .14em; color: var(--gold); text-decoration: none; white-space: nowrap; }
.mark { width: 16px; height: 16px; flex: none; image-rendering: pixelated; }
.top-right { display: flex; align-items: center; gap: 6px; flex: none; }
.lang { font: inherit; font-size: 12px; font-weight: 700; color: var(--gold); background: rgba(17, 11, 8, .94); border: 2px solid var(--line); padding: 0 8px; height: 34px; min-width: 44px; cursor: pointer; }
.lang:hover { border-color: var(--gold); }
.hub-nav { --pnav-line: var(--line); --pnav-gold: var(--gold); --pnav-ok: var(--ok); --pnav-size: 36px; }

.coins { display: none; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 8px; font: inherit; color: var(--ink); cursor: pointer;
  background: rgba(17, 11, 8, .94); border: 2px solid #9c6a17;
  clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px); }
html.js .coins:not([hidden]) { display: inline-flex; }
.coins:hover { border-color: var(--gold); }
.coins:active { transform: translateY(1px); }
.coins b { font-size: 15px; font-weight: 900; color: #ffe08a; font-variant-numeric: tabular-nums; min-width: 1ch; }
.coins-txt { font-family: var(--sans); color: var(--soft); font-size: 12px; }
.coin { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff6c8 0 18%, #ffd54a 19% 58%, #c48322 59% 100%); box-shadow: 0 0 0 2px #3a2208; }
.coins.bump { animation: bump .32s steps(3); }
@keyframes bump { 50% { transform: scale(1.12); } }

h1 { font-size: clamp(30px, 9vw, 46px); line-height: 1.2; margin: 26px 0 10px; letter-spacing: .02em; }
.caret { display: inline-block; width: .42em; height: .9em; margin-left: .12em; vertical-align: -0.08em; background: var(--gold); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.intro { font-family: var(--sans); color: var(--soft); line-height: 1.7; margin: 0; font-size: 15px; }
.shared { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 6px 10px; font-family: var(--sans); font-size: 12px; color: #d7b67b; background: rgba(233, 188, 103, .07); border: 1px dashed var(--line); }
.notice { font-family: var(--sans); font-size: 13px; line-height: 1.6; color: #ffd9a8; background: #3a210f; border-left: 4px solid #e08a3a; padding: 10px 12px; margin: 14px 0 0; }

/* Game cards: an animated pixel scene on top, then name, one line, today and the button. */
.cards { display: grid; gap: 18px; margin: 24px 0 30px; }
.card { position: relative; display: flex; flex-direction: column; border: 2px solid var(--line); background: var(--bg2); box-shadow: 6px 6px 0 var(--shadow); transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translate(-1px, -1px); box-shadow: 7px 7px 0 var(--shadow); }
.card.is-closed { border-style: dashed; }
.stage { position: relative; height: 104px; overflow: hidden; border-bottom: 2px solid var(--line); background: #1b130d; }
.stage-size-it-up { background: #1f1610; }
.scene { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.card-top { display: flex; align-items: center; gap: 12px; }
.art { width: 40px; height: 40px; flex: none; image-rendering: pixelated; }
.card h2 { font-size: 22px; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.card h2 small { font-size: 13px; color: #d7b67b; font-weight: 600; }
.new { align-self: flex-start; font-size: 11px; font-weight: 800; color: var(--deep); background: var(--sky); padding: 3px 7px; box-shadow: 2px 2px 0 #2a6a80; }
.meta { margin-left: auto; align-self: flex-start; font-size: 11px; letter-spacing: .08em; color: var(--mute); border: 1px solid #3a2a1a; padding: 3px 6px; white-space: nowrap; }
.blurb { font-family: var(--sans); line-height: 1.7; color: #d0c0a8; margin: 12px 0 10px; font-size: 15px; }
.today { display: grid; gap: 3px; font-size: 13px; color: var(--mute); min-height: 1.4em; margin: auto 0 14px; padding-left: 12px; border-left: 3px solid #3a2a1a; }
.today:empty { border-left-color: transparent; }
.today[data-status="done"] { border-left-color: var(--ok); }
.today[data-status="done"] .state { color: var(--ok); }
.today[data-status="playing"] { border-left-color: var(--gold); color: var(--gold); }
.today[data-status="soon"] { border-left-color: var(--sky); color: var(--sky); }
.today[data-status="none"] { border-left-color: var(--gold); color: var(--soft); }
.today .next { color: var(--soft); }
.tick { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.play { display: flex; align-items: center; justify-content: center; min-height: 48px; color: var(--deep); background: var(--gold); border: 2px solid var(--gold-hi); padding: 10px 18px; text-decoration: none; font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 #6f4e23; }
.play:hover { background: #f3ce88; }
.play:active { transform: translateY(2px); box-shadow: 0 2px 0 #6f4e23; }
.play.is-done { color: var(--gold); background: transparent; border-color: var(--line); box-shadow: 0 4px 0 var(--shadow); }
.play.is-done:hover { border-color: var(--gold); }
.play.is-soon { color: var(--mute); background: transparent; border: 2px dashed var(--line); box-shadow: none; cursor: default; }
a:focus-visible, button:focus-visible { outline: 3px solid #d8f4ed; outline-offset: 4px; }

/* Scene motion (SVG groups; transforms in viewBox units). */
.scene g { transform-box: fill-box; }
.stage-rare-dig .drill { transform: translateY(6px); animation: drill 7s steps(1) infinite; }
@keyframes drill {
  0% { transform: translateY(6px); } 8% { transform: translateY(8px); } 16% { transform: translateY(10px); } 24% { transform: translateY(12px); }
  32% { transform: translateY(14px); } 40% { transform: translateY(16px); } 48% { transform: translateY(18px); } 56% { transform: translateY(20px); }
  78% { transform: translateY(20px); } 84% { transform: translateY(14px); } 90% { transform: translateY(9px); } 96%, 100% { transform: translateY(6px); }
}
.stage-rare-dig .dust { animation: dust .3s steps(2) infinite; }
@keyframes dust { 50% { transform: translateX(1px); opacity: .4; } }
.stage-rare-dig .spark { opacity: 0; animation: spark 7s steps(1) infinite; }
@keyframes spark { 0%, 55% { opacity: 0; } 58%, 62%, 66%, 70% { opacity: 1; } 60%, 64%, 68%, 74%, 100% { opacity: 0; } }
.stage-size-it-up .grow { transform-origin: 0 100%; animation: grow 5s steps(1) infinite; }
@keyframes grow {
  0%, 12% { transform: scale(.55); } 18% { transform: scale(.65); } 24% { transform: scale(.75); } 30% { transform: scale(.85); }
  36%, 58% { transform: scale(1); } 64% { transform: scale(.9); } 70% { transform: scale(.8); } 76% { transform: scale(.7); } 82%, 100% { transform: scale(.55); }
}
.stage-size-it-up .hand { animation: hand 5s steps(1) infinite; }
@keyframes hand {
  0%, 12% { transform: translate(-9px, 8px); } 18% { transform: translate(-7px, 6px); } 24% { transform: translate(-5px, 4px); } 30% { transform: translate(-2px, 2px); }
  36%, 58% { transform: translate(0, 0); } 64% { transform: translate(-2px, 2px); } 70% { transform: translate(-4px, 4px); } 76% { transform: translate(-6px, 6px); } 82%, 100% { transform: translate(-9px, 8px); }
}

footer { font-size: 12px; line-height: 1.8; color: #a99172; font-family: var(--sans); border-top: 1px dashed #3a2a1a; padding-top: 14px; }
footer p { margin: 0 0 4px; }
footer .founders { display: flex; align-items: center; gap: 8px; color: var(--soft); }
footer .wordmark { color: var(--gold); font-weight: 800; letter-spacing: .04em; }
footer a { color: #c8a674; }

/* Coin sheet: a centred pixel card (Esc, backdrop and focus handled by hub.js). */
.sheet-back { position: fixed; inset: 0; background: rgba(6, 3, 2, .72); z-index: 90; }
.sheet { position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 20px)); max-height: min(calc(100svh - 24px), 760px); overflow: auto; overscroll-behavior: contain;
  background: var(--bg2); border: 2px solid #9c6a17; box-shadow: 0 0 0 2px #000, 0 8px 0 2px rgba(0, 0, 0, .55);
  padding: 16px 16px 20px; animation: sheetIn .18s ease-out; }
@keyframes sheetIn { from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)); } }
.sheet[hidden], .sheet-back[hidden] { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { font-size: 20px; margin: 0; color: var(--gold); }
.sheet h3 { font-size: 14px; color: var(--gold); margin: 18px 0 6px; letter-spacing: .06em; }
.close { font: inherit; font-size: 24px; line-height: 1; width: 44px; height: 44px; color: var(--ink); background: transparent; border: 2px solid var(--line); cursor: pointer; }
.sheet-bal { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 12px 0 4px; }
.sheet-bal b { font-size: 26px; color: #ffe08a; }
.lead, .rules, .empty { font-family: var(--sans); color: var(--soft); line-height: 1.7; font-size: 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #3a2a1a; font-family: var(--sans); font-size: 14px; color: #e5d6bd; }
.rows b { color: var(--gold); white-space: nowrap; font-family: var(--mono); }
.rows b.neg { color: #e9a07a; }
.rules { padding-left: 18px; margin: 14px 0 0; }
.rules li { margin: 4px 0; }

@media (max-width: 380px) { .coins-txt { display: none; } .eyebrow span { letter-spacing: .1em; } }
@media (min-width: 760px) {
  main { max-width: 940px; padding-top: 28px; }
  h1 { margin-top: 56px; }
  .intro { font-size: 16px; max-width: 34em; }
  .cards { grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 34px; }
  .stage { height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .caret, .scene g, .sheet, .coins.bump, .card { animation: none !important; transition: none !important; }
  .stage-rare-dig .spark { opacity: 0; }
}
