/* PWNSCAPE website. Colours are tokens only: the brand palette (CLAUDE.md, Brand), greens derived
   from it, and red for risk. Never use raw hex below :root. */
:root {
    /* Brand palette (owner, 2026-11). */
    --bg: #041A14;               /* page background */
    --surface: #062A20;          /* panels, raised surfaces */
    --primary: #8CF3B4;          /* buttons, headings, highlights, amounts */
    --primary-hover: #C2FFDA;    /* hover states */
    --accent: #41AF7B;           /* secondary accents, positive status */
    --text: #F4FFF5;             /* headings and bright text */
    --text-muted: #B4C6B4;       /* labels, fine print */
    --silver: #BFC2C5;           /* metallic details */

    /* The palette's channels, for translucent glows: rgba(var(--primary-rgb), .1) */
    --primary-rgb: 140, 243, 180;
    --text-rgb: 244, 255, 245;
    --bg-rgb: 4, 26, 20;

    /* Derived from the palette: body text, deep greens for lines, wells and gradients. */
    --text-soft: #D6E4D7;
    --ink: #02110C;              /* text on primary buttons */
    --line: #1C4D3C;
    --line-strong: #2B6A53;
    --line-dark: #0B3226;
    --inset: #05241B;
    --well: #031611;
    --panel-top: #083226;
    --panel-bottom: #041E17;
    --head-top: #0D4232;
    --head-bottom: #062A20;
    --bar-top: #072C21;
    --bar-bottom: #041A14;
    --stone-top: #1F5544;
    --stone-bottom: #0C3328;
    --hearth: #0B3D2C;
    --soot: #031410;
    --ember: #062A20;
    --black: #010A07;

    /* Risk */
    --red: #F6465D;
    --red-soft: #FF7A8A;
    --red-pale: #FFB3BD;

    --noise: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22140%22 height=%22140%22%3E%3Cfilter id=%22n%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.8%22 numOctaves=%222%22/%3E%3CfeColorMatrix values=%220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0%22/%3E%3C/filter%3E%3Crect width=%22140%22 height=%22140%22 filter=%22url(%23n)%22/%3E%3C/svg%3E');
    /* Chinese text falls back to the system's CJK fonts */
    --cjk: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', 'WenQuanYi Micro Hei', 'WenQuanYi Zen Hei';
    --display: 'MedievalSharp', var(--cjk), serif;
    --sans: 'IBM Plex Sans', var(--cjk), system-ui, sans-serif;
    --mono: 'IBM Plex Mono', var(--cjk), ui-monospace, monospace;

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--primary-hover); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes emberglow { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }
@keyframes drawerin { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- page shell: fills the viewport on desktop ---- */
.shell {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    background: var(--noise), radial-gradient(90% 70% at 50% 118%, var(--ember) 0%, var(--bg) 65%);
}

/* ---- top bar ---- */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 18px;
    border-bottom: 2px solid var(--line-strong);
    background: var(--noise), linear-gradient(180deg, var(--bar-top), var(--bar-bottom));
    box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
/* ---- entry burn progress strip, under the top bar ---- */
.burnbar { padding: 8px 18px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.burnbar[hidden] { display: none; }
.burnbar-text { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.burnbar-now b { color: var(--primary); font-weight: 600; }
.burnbar-next b { color: var(--text); font-weight: 600; }
.burnbar-total b { color: var(--primary); font-weight: 600; }
.burnbar-total[hidden] { display: none; }
.burnbar-now { margin-right: auto; }
.burnbar-track { position: relative; height: 10px; border-radius: 5px; background: var(--inset); border: 1px solid var(--line-dark); overflow: hidden; }
.burnbar-fill { height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--primary)); box-shadow: 0 0 10px var(--accent); transition: width .8s ease; }
.burnbar-fill.waiting { background: var(--line); box-shadow: none; }
@media (max-width: 700px) { .burnbar { padding: 8px 16px 10px; } }
.wordmark {
    font-family: var(--display);
    font-size: 24px;
    color: var(--primary);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 400;
}
.wordmark-logo { display: block; height: 60px; width: auto; margin: -6px 0; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
/* The $PWNSCAPE coin, inline with text (the wordmark and the burn step's balance). */
.coin {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.2em;
    image-rendering: pixelated;
}
.pill {
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 5px 13px;
    font-size: 12.5px;
    color: var(--text-soft);
}
.pill b { color: var(--primary); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); display: inline-block; }
.dot.live { background: var(--accent); }
.stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap; }
.stats b { color: var(--text); }
.stats .gold { color: var(--primary); }
.stats .red { color: var(--red); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn-ghost {
    background: var(--inset);
    border: 1px solid var(--line);
    color: var(--text-soft);
    border-radius: 5px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-hover); }
a.btn-ghost { display: inline-flex; align-items: center; text-decoration: none; }
.btn-gold {
    background: var(--primary);
    color: var(--ink);
    border: none;
    border-radius: 5px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 13px;
}
.btn-gold:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 0 16px rgba(var(--primary-rgb), .45); }
.btn-gold:disabled { opacity: .55; }
.btn-stone {
    background: var(--noise), linear-gradient(180deg, var(--stone-top), var(--stone-bottom));
    border: 1px solid var(--line-strong);
    box-shadow: inset 0 1px 0 rgba(var(--text-rgb), .12), 0 1px 2px rgba(0, 0, 0, .6);
    color: var(--primary-hover);
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 12px;
    text-shadow: 0 1px 0 var(--black);
}
.btn-stone:hover { border-color: var(--primary); color: var(--primary-hover); }

/* ---- main three-column layout ---- */
.main {
    display: grid;
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(250px, 300px);
    gap: 14px;
    padding: 14px 18px;
    min-height: 0;
}
.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--noise), linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
    border: 1px solid var(--line);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--black), inset 0 1px 0 rgba(var(--primary-rgb), .12), inset 0 0 36px rgba(0, 0, 0, .5), 0 4px 18px rgba(0, 0, 0, .45);
}
.panel-head {
    padding: 11px 16px;
    border-bottom: 1px solid var(--black);
    box-shadow: 0 1px 0 rgba(var(--primary-rgb), .1);
    background: var(--noise), linear-gradient(180deg, var(--head-top), var(--head-bottom));
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-head h2 {
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: 16px;
    color: var(--primary-hover);
    letter-spacing: .5px;
    text-shadow: 0 1px 0 var(--black);
}
.panel-head small { font-size: 11px; color: var(--text-muted); }
.panel-head .right { margin-left: auto; }
.panel-body { flex: 1; overflow-y: auto; min-height: 0; }
.empty {
    padding: 22px 18px;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-muted);
}
.empty b { display: block; color: var(--text-soft); font-size: 13px; margin-bottom: 4px; }
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.side .grow { flex: 1; }

/* leaderboard rows (rendered by bscape.js once the ledger exists) */
.lb-row { display: flex; align-items: center; gap: 9px; padding: 8px 14px; border-bottom: 1px solid var(--line-dark); }
.lb-rank { width: 22px; text-align: center; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.lb-rank.top { height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 700; font-size: 11px; background: var(--primary); }
.lb-rank.top.r2 { background: var(--text-soft); }
.lb-rank.top.r3 { background: var(--accent); }
.lb-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { display: block; font-weight: 400; font-size: 10.5px; color: var(--text-muted); }
.lb-bnb { font-size: 12px; color: var(--primary); font-weight: 600; }

/* ---- game frame ---- */
.game { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.game-area {
    flex: 1;
    min-height: 0;
    container-type: size;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.frame, .game-bar {
    /* The biggest 765x503 frame that fits the column with the button bar under it. */
    width: min(100cqw, (100cqh - 48px) * 765 / 503);
}
.frame {
    position: relative;
    aspect-ratio: 765 / 503;
    background: var(--black);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(var(--primary-rgb), .08);
}
.corner { position: absolute; width: 14px; height: 14px; z-index: 6; pointer-events: none; border: 0 solid var(--accent); }
.corner.tl { left: 0; top: 0; border-left-width: 3px; border-top-width: 3px; }
.corner.tr { right: 0; top: 0; border-right-width: 3px; border-top-width: 3px; }
.corner.bl { left: 0; bottom: 0; border-left-width: 3px; border-bottom-width: 3px; }
.corner.br { right: 0; bottom: 0; border-right-width: 3px; border-bottom-width: 3px; }
/* Big screen: the side columns fold away and the game takes the whole width. */
.bigscreen .main { grid-template-columns: minmax(0, 1fr); }
.bigscreen .main > aside { display: none; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: var(--black); }

.title-screen {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    overflow-x: hidden;
    background: var(--noise), radial-gradient(130% 100% at 50% 115%, var(--hearth) 0%, var(--soot) 55%, var(--black) 100%);
}
.title-screen[hidden] { display: none; }
.title-screen::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 40%;
    background: radial-gradient(60% 90% at 18% 0%, rgba(var(--primary-rgb), .14), transparent 70%), radial-gradient(60% 90% at 82% 0%, rgba(var(--primary-rgb), .14), transparent 70%);
    animation: emberglow 3s ease-in-out infinite;
    pointer-events: none;
}
.title-banner {
    /* Full bleed across the top of the frame; fades into the screen below it. */
    position: relative;
    display: block;
    flex-shrink: 0;
    width: calc(100% + 32px);
    height: auto;
    margin: -16px -16px -36px;
    aspect-ratio: 3 / 1;
    object-fit: cover;
    -webkit-mask-image: linear-gradient(to bottom, var(--black) 70%, transparent);
    mask-image: linear-gradient(to bottom, var(--black) 70%, transparent);
}
.title-logo { display: none; position: relative; flex-shrink: 0; height: 110px; width: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .6)); }
/* The sign-up steps need the room: the banner gives way to the smaller logo once one is open. */
.title-screen:has([data-view]:not([data-view="home"]):not([hidden])) .title-banner { display: none; }
.title-screen:has([data-view]:not([data-view="home"]):not([hidden])) .title-logo { display: block; }
.title-box {
    position: relative;
    background: rgba(var(--bg-rgb), .86);
    border: 2px solid var(--accent);
    outline: 2px solid var(--black);
    border-radius: 4px;
    padding: 18px 30px;
    text-align: center;
    max-width: 100%;
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), .15), 0 10px 40px rgba(0, 0, 0, .8);
}
.title-box h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--primary-hover); text-shadow: 0 1px 0 var(--black); }
.title-box p { margin: 0 0 14px; font-size: 12px; color: var(--text-soft); line-height: 1.5; }
.title-box .btn-stone { padding: 9px 22px; font-size: 13px; font-weight: 600; }
.mobile-note { display: none; margin-top: 10px !important; margin-bottom: 0 !important; color: var(--text-muted) !important; }

/* ---- sign-up flow inside the title box ---- */
.title-screen { overflow-y: auto; justify-content: safe center; }
.title-box { width: min(420px, 100%); }
.title-box section[hidden] { display: none; }
.title-box b { color: var(--primary-hover); }
.title-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.wallet-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.wallet-list button { display: flex; align-items: center; gap: 10px; justify-content: flex-start; width: 100%; }
.wallet-list img { width: 22px; height: 22px; border-radius: 4px; }
.link-btn { background: none; border: none; color: var(--text-muted); font-size: 12px; text-decoration: underline; padding: 4px; margin-top: 6px; }
.link-btn:hover { color: var(--primary-hover); }
.title-box .fine { font-size: 11px; color: var(--text-muted); margin: 8px 0 0; }
.burn-tiers { list-style: none; margin: 4px auto 0; padding: 0; max-width: 300px; font-size: 11px; color: var(--text-muted); }
.burn-recover { margin: 10px auto 0; max-width: 360px; font-size: 11px; color: var(--text-muted); text-align: left; }
.burn-recover summary { cursor: pointer; text-align: center; }
.burn-recover form { margin-top: 6px; }
.burn-tiers li { display: flex; justify-content: space-between; gap: 12px; padding: 1px 0; }
.burn-tiers li.current { color: var(--primary); font-weight: 600; }
.title-box .status:empty { display: none; }
.title-box .status.error { color: var(--red-soft); }
.title-box .status.ok { color: var(--accent); }
.gas-note {
    background: rgba(var(--primary-rgb), .08);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 7px 10px;
    color: var(--text-soft) !important;
}
.balances { display: flex; justify-content: center; gap: 22px; margin: 0 0 12px; font-size: 12px; }
.balances div { display: flex; gap: 6px; }
.balances dt { color: var(--text-muted); }
.balances dd { margin: 0; color: var(--text); font-weight: 600; }
.balances dd.short { color: var(--red-soft); }
.register { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.register label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-soft); }
.register input {
    background: var(--well);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    padding: 7px 9px;
    font: inherit;
    font-size: 13px;
}
.register input:focus { border-color: var(--primary); outline: none; }
.register .fine { margin: 0; }
.register .btn-gold { margin-top: 4px; }
.mono { font-family: var(--mono); }
.wallet-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12.5px;
    color: var(--text-soft);
}
.wallet-chip[hidden], .btn-ghost[hidden], .footer a[hidden] { display: none; }
.wallet-chip button { background: none; border: none; color: var(--text-muted); padding: 0; font-size: 12px; }
.wallet-chip button:hover { color: var(--red); }

.game-bar { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; min-height: 38px; }
.game-bar .hint { margin-left: auto; font-size: 11.5px; color: var(--text-muted); }

/* ---- bridge ---- */
.tabs { display: flex; border-bottom: 1px solid var(--line-dark); }
.tab {
    flex: 1;
    padding: 11px 8px;
    font-size: 12.5px;
    font-weight: 700;
    border: none;
    border-bottom: 2px solid transparent;
    background: var(--well);
    color: var(--text-muted);
    text-shadow: 0 1px 0 var(--black);
}
.tab[aria-selected='true'] {
    background: var(--noise), linear-gradient(180deg, var(--head-top), var(--head-bottom));
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
}
.bridge-body { padding: 16px; text-align: center; font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.bridge-body p { margin: 0 0 10px; }
.bridge-body .note { font-size: 10.5px; margin: 10px 0 0; }
.network { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-soft); border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; margin-bottom: 10px; }
.bridge-form { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 8px; }
.bridge-form[hidden] { display: none; }
.bridge-form label { font-size: 11.5px; color: var(--text-soft); }
.bridge-row { display: flex; gap: 8px; }
.bridge-row input {
    flex: 1;
    min-width: 0;
    background: var(--well);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    padding: 7px 9px;
    font: inherit;
    font-size: 13px;
}
.bridge-row input:focus { border-color: var(--primary); outline: none; }
.bridge-form .fine { font-size: 10px; color: var(--text-muted); margin: 0; overflow-wrap: anywhere; }
.bridge-body .status:empty { display: none; }
.bridge-body .status.error { color: var(--red-soft); }
.bridge-body .status.ok { color: var(--accent); }
.claim-body { padding: 14px 16px 16px; text-align: center; font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.claim-body p { margin: 0 0 10px; }
.claim-body .note { font-size: 11px; }
.claim-body .note:empty, .claim-body .fine:empty, .claim-body .status:empty { display: none; }
.claim-body .btn-gold { width: 100%; margin-bottom: 10px; }
.claim-body .btn-gold[hidden] { display: none; }
.claim-body .status.error { color: var(--red-soft); }
.claim-body .status.ok { color: var(--accent); }
.claim-body .fine { font-size: 10px; margin: 0; }
#claim-total { color: var(--primary); font-weight: 600; }
.bridge-history { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; font-size: 11px; }
.bridge-history:empty { display: none; }
.bridge-history li { padding: 5px 0; border-top: 1px solid var(--line-dark); }

/* ---- challenges and leaderboard ---- */
.ch-card { border-bottom: 1px solid var(--line-dark); }
.ch-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: 0;
    color: inherit;
    text-align: left;
}
.ch-head:hover, .ch-head[aria-expanded='true'] { background: var(--inset); }
.ch-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; color: var(--text); }
.ch-sub { display: block; font-weight: 400; font-size: 10.5px; color: var(--text-muted); }
.ch-prize { font-size: 12px; color: var(--primary); font-weight: 600; text-align: right; }
.ch-prize .ch-sub { text-align: right; }
.ch-body { padding: 0 14px 10px; }
.ch-section { padding: 10px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); border-bottom: 1px solid var(--line-dark); }
.ch-desc { margin: 0 0 6px; font-size: 11.5px; color: var(--text-soft); }
.ch-top, .lb-list { list-style: none; margin: 0; padding: 0; }
.ch-top .lb-row { padding: 6px 0; }
.lb-pick {
    margin: 10px 14px;
    width: calc(100% - 28px);
    background: var(--well);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    padding: 6px 8px;
    font: inherit;
    font-size: 12.5px;
}
.lb-pick:focus { border-color: var(--primary); outline: none; }

/* ---- footer ---- */
.footer {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 7px 18px;
    border-top: 2px solid var(--line-strong);
    background: var(--noise), linear-gradient(180deg, var(--bar-bottom), var(--panel-top));
    font-size: 10.5px;
    color: var(--text-muted);
}
.footer .disclaimer { flex: 1; min-width: 0; }
.footer nav { display: flex; gap: 12px; flex-shrink: 0; flex-wrap: wrap; }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--primary-hover); }

/* ---- drawer ---- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 90; }
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 92vw);
    background: var(--well);
    border-left: 1px solid var(--line);
    z-index: 91;
    display: flex;
    flex-direction: column;
    animation: drawerin .22s ease;
    box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
}
.scrim[hidden], .drawer[hidden], .drawer section[hidden] { display: none; }
.drawer-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--black);
    background: var(--noise), linear-gradient(180deg, var(--head-top), var(--head-bottom));
}
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 400; font-family: var(--display); color: var(--primary); letter-spacing: .5px; }
.drawer-close {
    margin-left: auto;
    background: var(--inset);
    border: 1px solid var(--line);
    color: var(--text-soft);
    border-radius: 5px;
    width: 30px;
    height: 30px;
    font-size: 14px;
}
.drawer-close:hover { border-color: var(--red); color: var(--red-soft); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li {
    background: var(--inset);
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    padding: 16px;
    display: flex;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.5;
}
.steps li span { color: var(--primary-hover); font-weight: 700; }
.callout-red {
    margin-top: 12px;
    background: rgba(246, 70, 93, .08);
    border: 1px solid var(--red);
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--red-pale);
    line-height: 1.5;
}
.callout-red b { color: var(--red-soft); }
.drawer-text { font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.pill-btn { background: transparent; font: inherit; cursor: pointer; }
.pill-btn:hover { border-color: var(--primary); color: var(--text); }
.treasury { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 10px; }
.treasury-card { background: var(--inset); border: 1px solid var(--line-dark); border-radius: 6px; padding: 14px 16px; }
.treasury-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.treasury-head b { color: var(--text); font-size: 14px; }
.treasury-head span { color: var(--primary); font-weight: 700; font-size: 16px; }
.treasury-note { margin: 4px 0 8px !important; font-size: 12px; color: var(--text-muted); }
.treasury-rows { margin: 0 0 8px; display: grid; gap: 2px; }
.treasury-rows div { display: flex; justify-content: space-between; }
.treasury-rows dt { color: var(--text-muted); }
.treasury-rows dd { margin: 0; color: var(--text); }
.treasury-card a { font-size: 11.5px; color: var(--accent); }
.treasury-at { font-size: 11px; color: var(--text-muted); }
.drawer-text p { margin: 0 0 12px; }
.badge-18 { display: inline-block; border: 1px solid var(--red); color: var(--red-soft); border-radius: 4px; padding: 1px 7px; font-size: 11px; font-weight: 700; }

/* ---- smaller screens: stack, game first, page scrolls ---- */
@media (max-width: 1100px) {
    .shell { height: auto; min-height: 100vh; }
    .main { grid-template-columns: 1fr 1fr; }
    .game { grid-column: 1 / -1; order: -1; }
    .game-area { flex: none; container-type: inline-size; }
    .frame, .game-bar { width: 100%; }
    .panel { max-height: 420px; }
}
@media (max-width: 720px) {
    .topbar { padding: 10px 16px; gap: 10px; }
    .topbar-actions { margin-left: 0; width: 100%; }
    .main { grid-template-columns: 1fr; padding: 12px 16px; }
    .game-bar .hint { display: none; }
    .title-box { padding: 12px 14px; }
    .title-screen:has([data-view]:not([data-view="home"]):not([hidden])) .title-logo { display: none; }
    .frame { aspect-ratio: auto; min-height: calc((100vw - 32px) * 503 / 765); }
    .frame:has(.title-screen:not([hidden])) { min-height: 420px; }
    .mobile-note { display: block; }
    .footer { padding: 10px 16px; flex-direction: column; align-items: flex-start; gap: 8px; }
}
