/* =====================================================================================================
   Kingdom theme: a hand-made mobile-game look on top of style.css.
   Chunky outlines, candy buttons with a lip, parchment dialogs, rounded game fonts, painted icons.
   Loaded after style.css; only overrides.
   ===================================================================================================== */
:root {
    --display: "Lilita One", "Baloo 2", system-ui, sans-serif;
    --body: "Baloo 2", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Baloo 2", system-ui, sans-serif;
    --k: #2b130c;                 /* outline ink */
    --k-soft: #4a2617;
    --cream: #fff3d6;
    --cream-2: #f1d9a6;
    --parch: #f7e6c0;
    --parch-2: #ecd29c;
    --red: #e8452c;
    --red-hi: #ff7656;
    --red-lo: #b52a17;
    --gold-bg-hi: #ffd36a;
    --gold-bg: #e0a93c;
    --jade: #3fa66b;
    --wood-hi: #6b3a20;
    --plate: linear-gradient(180deg, #43251a 0%, #2c1711 100%);
    --plate-edge: 0 0 0 2px var(--k), inset 0 0 0 2px #a8742c, inset 0 4px 0 1px rgba(255, 214, 140, .18), 0 4px 0 1px var(--k);
    --outline: 0 2px 0 var(--k), 2px 0 0 var(--k), -2px 0 0 var(--k), 0 -2px 0 var(--k), 1.5px 1.5px 0 var(--k), -1.5px 1.5px 0 var(--k), 1.5px -1.5px 0 var(--k), -1.5px -1.5px 0 var(--k), 0 4px 0 var(--k);
    --outline-s: 0 1.5px 0 var(--k), 1.5px 0 0 var(--k), -1.5px 0 0 var(--k), 0 -1.5px 0 var(--k), 1px 1px 0 var(--k), -1px 1px 0 var(--k), 1px -1px 0 var(--k), -1px -1px 0 var(--k), 0 2.5px 0 var(--k);
    --paper-tex: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .3  0 0 0 0 .15  0 0 0 .09 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
    --lacquer-tex: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'><path d='M0 20h40M20 0v40' stroke='%23ffffff' stroke-opacity='.025' stroke-width='1'/><circle cx='20' cy='20' r='6' fill='none' stroke='%23ffd36a' stroke-opacity='.035'/></svg>");
}
html, body { font: 500 15px/1.45 var(--body) }
b, strong { font-weight: 700 }

/* painted icons that replace emoji */
.gi { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -.24em; flex: none; line-height: 0 }
.gi svg { width: 100%; height: 100%; display: block; overflow: visible }

/* ---------- panels: thick ink edge and a gold bevel, not a thin glowing hairline ---------- */
.sheet, .hud { background: var(--lacquer-tex), var(--plate); box-shadow: var(--plate-edge), 0 12px 26px rgba(0, 0, 0, .4) }

/* ---------- top bar ---------- */
header.top { background: linear-gradient(180deg, rgba(20, 8, 6, .55), rgba(20, 8, 6, 0)) }
.brand .en { font: 400 21px/1.05 var(--display); letter-spacing: .01em; color: var(--cream); text-shadow: var(--outline-s) }
.brand .pop { font-weight: 600; color: #f3dcc0; text-shadow: 0 1px 0 var(--k), 0 0 6px rgba(0, 0, 0, .8) }
.brand .pop b { font-weight: 800 }
.seal { border-radius: 9px; box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2px rgba(255, 220, 180, .45), 0 3px 0 2px var(--k) }
.seg { background: #1c0d09; box-shadow: 0 0 0 2px var(--k), inset 0 2px 4px rgba(0, 0, 0, .6), 0 3px 0 2px var(--k); padding: 3px }
.seg button { font: 400 14px var(--display); letter-spacing: .02em; color: #c9a988 }
.seg button[aria-pressed="true"] { background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); color: var(--k); box-shadow: 0 0 0 1.5px var(--k), inset 0 -3px 0 rgba(150, 90, 20, .35), inset 0 2px 0 rgba(255, 255, 255, .6) }
.icon { background: linear-gradient(180deg, #fff4d8, var(--cream-2)); color: var(--k); box-shadow: 0 0 0 2px var(--k), inset 0 -3px 0 rgba(150, 100, 40, .3), inset 0 2px 0 #fff, 0 3px 0 2px var(--k) }
.icon:active { transform: translateY(2px); box-shadow: 0 0 0 2px var(--k), inset 0 -2px 0 rgba(150, 100, 40, .3), 0 1px 0 2px var(--k) }

/* ---------- buttons: candy with an ink outline and a lip ---------- */
.btn { font: 700 15px/1.15 var(--body); color: var(--k); border-radius: 14px; background: linear-gradient(180deg, #fff6dc 0%, #f6e0ae 55%, #ecc985 100%);
    box-shadow: 0 0 0 2px var(--k), inset 0 -4px 0 rgba(160, 100, 30, .28), inset 0 2px 0 rgba(255, 255, 255, .85), 0 4px 0 2px var(--k); margin: 2px 2px 6px }
.btn:active:not(:disabled), .btn.juicy:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 2px var(--k), inset 0 -2px 0 rgba(160, 100, 30, .28), inset 0 2px 0 rgba(255, 255, 255, .85), 0 0 0 2px var(--k) }
.btn.small { font-size: 14px; font-weight: 700; border-radius: 12px; min-height: 38px }
.btn.primary, .btn.juicy.primary { font: 400 17px/1.1 var(--display); letter-spacing: .02em; color: #fff; text-shadow: var(--outline-s);
    background: linear-gradient(180deg, var(--red-hi) 0%, var(--red) 52%, #d23620 100%);
    box-shadow: 0 0 0 2px var(--k), inset 0 -5px 0 var(--red-lo), inset 0 2px 0 rgba(255, 220, 200, .75), 0 4px 0 2px var(--k); margin-bottom: 6px }
.btn.primary:active:not(:disabled), .btn.juicy.primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 2px var(--k), inset 0 -3px 0 var(--red-lo), inset 0 2px 0 rgba(255, 220, 200, .75), 0 0 0 2px var(--k) }
.btn.primary.small { font-size: 15px }
.btn.big { font-size: 22px; padding: 14px 30px 16px; border-radius: 18px }
.btn.primary:disabled, .btn.juicy.primary:disabled { background: linear-gradient(180deg, #b9a58c, #8f7a62); color: #f3e7d4; text-shadow: var(--outline-s);
    box-shadow: 0 0 0 2px var(--k), inset 0 -4px 0 rgba(0, 0, 0, .2), 0 4px 0 2px var(--k) }
.btn.juicy { box-shadow: 0 0 0 2px var(--k), inset 0 -4px 0 rgba(160, 100, 30, .28), inset 0 2px 0 rgba(255, 255, 255, .85), 0 4px 0 2px var(--k); margin-bottom: 6px }
.btn.juicy:disabled { opacity: .6; box-shadow: 0 0 0 2px var(--k), 0 4px 0 2px var(--k) }
.btn.juicy::after { background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent) }
.btn.primary.ready { animation: none }
.btn.primary.ready::after { animation: shine 1.8s ease-in-out infinite }
.btn.ghost { box-shadow: none; background: none; color: inherit; margin: 0 }
.btn .gi { margin-right: 6px; width: 1.3em; height: 1.3em; vertical-align: -.3em }
.btn.primary .gi svg { filter: drop-shadow(0 1.5px 0 var(--k)) }
.link { color: inherit; font-weight: 800 }
.close { width: 38px; height: 38px; top: 8px; right: 8px; border-radius: 50%; color: #fff; font: 400 26px/1 var(--display); text-shadow: 0 2px 0 var(--k);
    background: linear-gradient(180deg, var(--red-hi), var(--red)); box-shadow: 0 0 0 2px var(--k), inset 0 -3px 0 var(--red-lo), inset 0 2px 0 rgba(255, 220, 200, .7), 0 3px 0 2px var(--k) }
.close:active { transform: translateY(2px) }

/* ---------- HUD ---------- */
.hud { border-radius: 18px; padding: 6px 10px 6px 6px; gap: 6px }
.hud-who { font: 700 15px/1.1 var(--body); color: var(--cream) }
.hud-rank { font: 400 13px var(--display); letter-spacing: .02em; color: var(--gold-bg-hi) }
.hud-honour { font: 600 11px var(--body) }
.hud-track { height: 9px; border-radius: 6px; background: #140806; box-shadow: 0 0 0 1.5px var(--k), inset 0 2px 0 rgba(0, 0, 0, .5); margin-top: 4px }
.hud-bar { border-radius: 6px; background: linear-gradient(180deg, #ffe9a6, var(--gold-bg) 60%, #c27d1c); box-shadow: inset 0 -2px 0 rgba(120, 60, 0, .35) }
.hud-title { font: 400 11px var(--display); letter-spacing: .02em; color: var(--k); background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); box-shadow: 0 0 0 1.5px var(--k) }
.hud-stat { background: #160907; box-shadow: 0 0 0 1.5px var(--k), inset 0 2px 0 rgba(0, 0, 0, .55), inset 0 -1px 0 rgba(255, 210, 150, .12); padding: 3px 10px 3px 5px; gap: 4px }
.hud-stat b { font: 400 16px/1 var(--display); color: var(--cream); letter-spacing: .02em }
.hud-stat .ico { width: 22px; height: 22px; filter: drop-shadow(0 1.5px 0 var(--k)) }
.lvl-ring { width: 50px; height: 50px; box-shadow: 0 0 0 2px var(--k), 0 3px 0 2px var(--k);
    background: conic-gradient(var(--gold-bg-hi) calc(var(--p) * 1%), #1a0b08 0) }
.lvl-ring::before { inset: 5px; background: radial-gradient(circle at 38% 30%, var(--red-hi), var(--red) 55%, var(--red-lo)); box-shadow: 0 0 0 2px var(--k), inset 0 2px 0 rgba(255, 220, 200, .5) }
.lvl-n { font: 400 21px/1 var(--display); color: #fff; text-shadow: var(--outline-s) }
.hud.guest .lvl-n { color: var(--gold-bg-hi); text-shadow: var(--outline-s) }
.rank-badge { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px var(--gold-bg); background: #3a1a10 }

/* ---------- Xiaoyu and her bubble ---------- */
.xiaoyu { background: var(--cream); box-shadow: 0 0 0 3px var(--k), 0 0 0 6px var(--gold-bg), 0 0 0 8px var(--k), 0 6px 0 7px var(--k), 0 14px 22px rgba(0, 0, 0, .4) }
.xiaoyu-name { font: 400 12px var(--display); letter-spacing: .03em; text-transform: none; background: var(--red); color: #fff; text-shadow: 0 1px 0 var(--k); padding: 1px 9px 2px; box-shadow: 0 0 0 2px var(--k); bottom: -12px }
.bubble { background: var(--paper-tex), var(--parch); color: var(--k); border-radius: 18px 18px 6px 18px; box-shadow: 0 0 0 2.5px var(--k), 0 4px 0 2.5px var(--k), 0 12px 22px rgba(0, 0, 0, .35); font: 600 15px/1.35 var(--body) }
.bubble .who { font: 400 13px var(--display); letter-spacing: .02em; text-transform: none; color: var(--red-lo) }

/* ---------- labels over houses: wooden plaques with a dark edge ---------- */
.label { font: 700 13px var(--body); color: #ffe2a0; background: linear-gradient(180deg, #7a4426, #4a2414); border: 0; outline: 0; border-radius: 6px;
    box-shadow: 0 0 0 2px var(--k), inset 0 1px 0 rgba(255, 220, 160, .3), 0 3px 0 2px var(--k); text-shadow: 0 1px 0 var(--k) }
.label::after { bottom: -8px; border-width: 7px; border-top-color: var(--k) }
.label.mine { background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); color: var(--k); text-shadow: none }
.label.mine::after { border-top-color: var(--k) }

/* ---------- the sheet ---------- */
.sheet { border-radius: 24px 24px 0 0; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--lacquer-tex), linear-gradient(180deg, #3a1f16 0%, #26130e 120px, #22110c 100%);
    box-shadow: 0 0 0 2px var(--k), inset 0 3px 0 #c8913a, inset 0 5px 0 var(--k), 0 -8px 24px rgba(0, 0, 0, .35) }
.grip span { width: 46px; height: 6px; border-radius: 3px; background: #c8913a; box-shadow: 0 0 0 1.5px var(--k) }
.tabs { gap: 3px; padding: 4px; border-radius: 16px; background: #150907; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .65), 0 0 0 1.5px #4a2a18 }
.tabs button { font: 400 11.5px var(--display); letter-spacing: .02em; color: #b8977a; border-radius: 12px; min-height: 54px; padding: 5px 2px 6px; gap: 1px }
.tabs button[aria-selected="true"] { color: var(--k); background: linear-gradient(180deg, #fff6dc, #f3d79c); box-shadow: 0 0 0 2px var(--k), inset 0 -3px 0 rgba(160, 100, 30, .3), inset 0 2px 0 #fff; transform: translateY(-2px) }
.tab-ic { font-size: 22px; filter: saturate(.55) brightness(.8); opacity: .9 }
.tabs button[aria-selected="true"] .tab-ic { filter: none; opacity: 1; transform: scale(1.12) }
.tab-ic .gi { width: 26px; height: 26px; vertical-align: 0 }
.dot-badge { width: 12px; height: 12px; background: var(--red); box-shadow: 0 0 0 2px var(--k); top: 3px }
.dot-badge.gift { background: var(--gold-bg-hi) }
.pane h2 { font: 400 21px/1.15 var(--display); letter-spacing: .01em; color: var(--cream); text-shadow: 0 2px 0 var(--k); margin-top: 12px }
.pane h3 { font: 400 15px var(--display); letter-spacing: .02em; text-transform: none; color: #e9b75a; text-shadow: 0 1.5px 0 var(--k) }
.h-seal { width: 30px; height: 30px; font-size: 20px; border-radius: 7px; box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px rgba(255, 220, 180, .45), 0 2px 0 2px var(--k) }
.note { font-size: 13.5px; font-weight: 500; color: #d6bea2 }
.small-note { font: 600 13px var(--body) }
.gain-txt { font-weight: 800 }

/* list rows are solid tiles with an edge, not see-through boxes */
.results button, .deeds button, .quest, .builds li, .shop li, .ach-list li, .skills li, .story-done li, .ladder li, .stats-list li, .place, .district, .skin, .chip, .vote, .goal, .tier-card, .home-hero, .days li, .chest-stash button, .pass-track button, .bag-grid li, .back-list li, .game-card {
    background-color: #3a2018 }
.results button, .deeds button, .builds li, .shop li, .ach-list li, .skills li, .place, .goal, .tier-card, .home-hero {
    background-image: linear-gradient(180deg, #432519, #33190f); box-shadow: 0 0 0 1.5px var(--k), inset 0 1px 0 rgba(255, 214, 150, .14), 0 3px 0 1.5px var(--k); border-radius: 14px }
.results button { margin-bottom: 3px }
.results button:hover, .deeds button:hover { background-image: linear-gradient(180deg, #4e2c1c, #3b1d12) }
.r-name { font: 700 15px var(--body); color: var(--cream) }
.r-name mark { color: var(--gold-bg-hi) }
.quest { background-image: linear-gradient(180deg, #452619, #33190f); box-shadow: 0 0 0 1.5px var(--k), inset 0 1px 0 rgba(255, 214, 150, .14), 0 3px 0 1.5px var(--k); border-radius: 16px }
.quest.story { background-image: linear-gradient(180deg, #7a2416, #4a160c); box-shadow: 0 0 0 1.5px var(--k), inset 0 0 0 1.5px #c84a2a, 0 3px 0 1.5px var(--k) }
.quest.trial { background-image: linear-gradient(180deg, #6a4a16, #3e2a0c); box-shadow: 0 0 0 1.5px var(--k), inset 0 0 0 1.5px #d9a43a, 0 3px 0 1.5px var(--k) }
.q-head b { font: 400 17px var(--display); letter-spacing: .01em; text-shadow: 0 1.5px 0 var(--k) }
.q-text { color: #e2cbb0 }
.steps .tick { box-shadow: 0 0 0 1.5px var(--k), inset 0 2px 0 rgba(0, 0, 0, .4); background: #1a0b08 }
.steps li.done .tick { background: var(--jade); color: #fff; box-shadow: 0 0 0 1.5px var(--k) }
.deeds .state { color: var(--k); background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); box-shadow: 0 0 0 1.5px var(--k); font: 400 13px var(--display); letter-spacing: .02em }
.deed-ic, .shop .sw, .b-ic, .pl-ic, .trade-list .it, .shop .pet-img { background: #1c0d09; box-shadow: 0 0 0 1.5px var(--k), inset 0 2px 3px rgba(0, 0, 0, .5) }
.district { box-shadow: 0 0 0 1.5px var(--k), 0 3px 0 1.5px var(--k); background-image: linear-gradient(180deg, #432519, #33190f); border-radius: 14px; font-weight: 700 }
.chip { font: 700 13.5px var(--body); background-image: linear-gradient(180deg, #4a2a1c, #36190f); box-shadow: 0 0 0 1.5px var(--k), inset 0 1px 0 rgba(255, 214, 150, .16), 0 2px 0 1.5px var(--k); color: var(--cream) }
.chip.on, .chip.ready { background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); color: var(--k) }
.chip b { color: var(--gold-bg-hi) }
.chip.on b, .chip.ready b { color: var(--red-lo) }
.vote { background-image: linear-gradient(180deg, #4a2a1c, #36190f); box-shadow: 0 0 0 1.5px var(--k), 0 2px 0 1.5px var(--k) }
.vote.on { background: linear-gradient(180deg, var(--red-hi), var(--red)); color: #fff; text-shadow: 0 1px 0 var(--k) }
.days li { box-shadow: 0 0 0 1.5px var(--k), 0 3px 0 1.5px var(--k); background-image: linear-gradient(180deg, #432519, #33190f); border-radius: 12px }
.days b { font: 400 16px var(--display) }
.days li.got { background: linear-gradient(180deg, #5a6a2a, #3a4a1a) }
.days li.got::after { content: ""; top: -5px; right: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--jade) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 8.5l2.6 2.4L12 5.5' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/100%; box-shadow: 0 0 0 1.5px var(--k) }
.days li.now { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2px var(--gold-bg-hi), 0 3px 0 2px var(--k) }
.days li.big { background: linear-gradient(180deg, #8a2a18, #5a160c) }
.track { height: 14px; border-radius: 8px; background: #140806; box-shadow: 0 0 0 1.5px var(--k), inset 0 2px 0 rgba(0, 0, 0, .55) }
.track .bar { border-radius: 8px; background: linear-gradient(180deg, #ffe9a6, var(--gold-bg) 55%, #c27d1c); box-shadow: inset 0 -2px 0 rgba(120, 60, 0, .35); animation: none }
.goal-line b { font: 400 28px var(--display); text-shadow: 0 2px 0 var(--k) }
.ladder li { box-shadow: 0 0 0 1.5px var(--k) }
.ladder li.now { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2px var(--gold-bg-hi); background: #4a2a14 }
.ladder .zh, .skills .zh, .tier-zh { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px rgba(255, 220, 180, .4) }
.skin { box-shadow: 0 0 0 1.5px var(--k), 0 3px 0 1.5px var(--k); background-image: linear-gradient(180deg, #432519, #33190f) }
.skin.on { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2.5px var(--gold-bg-hi), 0 3px 0 2px var(--k); background: #5a3a14 }
.skin img, .npc-head img, .trade-head img, .merchants img, .results img[src^="img/folk/"] { box-shadow: 0 0 0 1.5px var(--k) }
.bag-grid li { box-shadow: 0 0 0 1.5px var(--k), inset 0 3px 6px rgba(0, 0, 0, .6); background: #1c0d09 }
.bag-grid li.full { background: radial-gradient(circle at 50% 40%, #6a4a1c, #2a140c) }
.bag-grid li b { font: 400 13px var(--display); text-shadow: var(--outline-s); color: #fff }
.chest-stash button { box-shadow: 0 0 0 1.5px var(--k), 0 3px 0 1.5px var(--k); background-image: linear-gradient(180deg, #3a2018, #2a140c) }
.chest-stash .cs-box .gi, .gc-ic .gi, .pl-ic .gi, .a-ic .gi, .b-ic .gi, .loot .l-ic .gi, .back-list li > span:first-child .gi, .jar-ic .gi { width: 1.25em; height: 1.25em }
.chest-stash li.has button { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2.5px var(--rc), 0 3px 0 2px var(--k), 0 0 18px color-mix(in srgb, var(--rc) 50%, transparent) }
.chest-stash b { font: 400 22px/1 var(--display); text-shadow: 0 2px 0 var(--k) }
.pass-track button { box-shadow: 0 0 0 1.5px var(--k), 0 3px 0 1.5px var(--k); background-image: linear-gradient(180deg, #3a2018, #2a140c) }
.pass-track li.big button { box-shadow: 0 0 0 1.5px var(--k), inset 0 0 0 2px var(--gold-bg), 0 3px 0 1.5px var(--k) }
.pass-track li.open button { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2.5px var(--gold-bg-hi), 0 3px 0 2px var(--k), 0 0 16px rgba(255, 211, 106, .5) }
.pass-track small { font: 400 12px var(--display) }
.pass-tier { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2px var(--gold-bg-hi), 0 4px 0 2px var(--k) }
.pass-tier small { font: 400 11px var(--display); letter-spacing: .04em; text-transform: none }
.pass-tier b { font: 400 30px var(--display); text-shadow: var(--outline-s) }
.ach-list li.m3 { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2px var(--gold-bg-hi), 0 3px 0 2px var(--k) }
.a-track, .b-track { height: 8px; background: #140806; box-shadow: 0 0 0 1px var(--k) }
.a-track i, .b-track span { background: linear-gradient(180deg, #ffe9a6, var(--gold-bg)) }
.rw { font: 700 13px var(--body); background: #1c0d09; box-shadow: 0 0 0 1.5px var(--k), inset 0 1px 0 rgba(255, 214, 150, .12) }
.rw.xp { background: linear-gradient(180deg, #5fbf6a, #2f8a3e); box-shadow: 0 0 0 1.5px var(--k), inset 0 1px 0 rgba(255, 255, 255, .35); text-shadow: 0 1px 0 rgba(0, 0, 0, .4) }
.xp-chip { background: linear-gradient(180deg, #5fbf6a, #2f8a3e); box-shadow: 0 0 0 1.5px var(--k) }
input[type=search], input[type=text], .code-form input { font: 700 16px var(--body); border-radius: 14px; background: #fff3d6; color: var(--k); box-shadow: 0 0 0 2px var(--k), inset 0 3px 0 rgba(120, 70, 20, .18) }
input::placeholder { color: rgba(90, 50, 30, .45) }
.search-wrap [data-icon] { color: var(--red-lo) }
.code-form input { letter-spacing: .14em }
.place { color: var(--cream) }
.place b { font: 400 16px var(--display); letter-spacing: .01em }
.place:nth-child(1) { background-image: linear-gradient(90deg, #5a2a6a, #33190f) }
.place:nth-child(2) { background-image: linear-gradient(90deg, #4a4a52, #33190f) }
.place:nth-child(3) { background-image: linear-gradient(90deg, #8a2a18, #33190f) }
.game-card { color: var(--cream); box-shadow: 0 0 0 2px var(--k), inset 0 1px 0 rgba(255, 214, 150, .2), 0 4px 0 2px var(--k); background: linear-gradient(90deg, #a83420, #5a1a0e) }
.game-card.wall { background: linear-gradient(90deg, #5a3a7a, #2e1a40) }
.gc-t b { font: 400 19px var(--display); letter-spacing: .01em; text-shadow: 0 2px 0 var(--k) }
.gc-t small { color: #f0d6bc }
.gc-go { font: 400 16px var(--display); color: var(--k); background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); box-shadow: 0 0 0 2px var(--k), 0 3px 0 2px var(--k), inset 0 2px 0 rgba(255, 255, 255, .6) }

/* ---------- house card and dialogs: warm parchment with a thick ink frame ---------- */
.card, .dialog {
    --ink: #3b1d14; --ink-soft: #7a5638; --gold-hi: #b8321f; --gold: #a0641c; --line: rgba(59, 29, 20, .3); --line-soft: rgba(59, 29, 20, .14);
    color: var(--ink); background: var(--paper-tex), radial-gradient(120% 90% at 50% 0%, #fff4d8 0%, var(--parch) 45%, var(--parch-2) 100%);
    box-shadow: 0 0 0 3px var(--k), inset 0 0 0 3px #fff3d6, inset 0 0 0 5px #d9a64a, inset 0 0 0 6px rgba(59, 29, 20, .35), 0 6px 0 3px var(--k), 0 22px 40px rgba(0, 0, 0, .45) }
.dialog { border-radius: 22px; padding: 24px 22px 20px }
.card { border-radius: 20px }
.dialog h2 { font: 400 28px/1.1 var(--display); letter-spacing: .01em; color: #fff3d6; text-shadow: var(--outline) }
.dialog h3 { font: 400 15px var(--display); letter-spacing: .02em; text-transform: none; color: var(--red-lo) }
.dialog .note, .card .note { color: var(--ink-soft); font-weight: 600 }
.dialog .r-name, .card .r-name, .card .say, .dialog .say { color: var(--ink) }
.say { font: 600 14px/1.4 var(--body); font-style: normal; background: rgba(255, 255, 255, .45); box-shadow: 0 0 0 1.5px rgba(59, 29, 20, .25), inset 4px 0 0 var(--red) }
.card .results button, .dialog .results button, .card .chip, .dialog .shop li, .card .shop li, .dialog .back-list li { color: var(--ink); background: linear-gradient(180deg, #fffaf0, #f3e2bb); box-shadow: 0 0 0 1.5px var(--k), inset 0 -2px 0 rgba(160, 100, 30, .2), 0 2px 0 1.5px var(--k) }
.card .chip b { color: var(--red-lo) }
.dialog .rw { background: #fffaf0; color: var(--ink); box-shadow: 0 0 0 1.5px var(--k), 0 2px 0 1.5px var(--k) }
.dialog .rw b { color: var(--red-lo) }
.dialog .rw.xp { background: linear-gradient(180deg, #5fbf6a, #2f8a3e); color: #fff }
.dialog .rw.xp b { color: #fff }
.card-photo::after { background: linear-gradient(180deg, rgba(247, 230, 192, 0) 45%, var(--parch)) }
.card-photo { box-shadow: inset 0 -2px 0 rgba(59, 29, 20, .2) }
.card-photo .district-tag { font: 400 12px var(--display); letter-spacing: .03em; text-transform: none; color: #fff; background: var(--red); box-shadow: 0 0 0 2px var(--k); text-shadow: 0 1px 0 var(--k) }
.plaque { font: 700 18px/1.15 var(--body); color: #ffe2a0; border-radius: 8px; text-shadow: 0 1.5px 0 var(--k); background: linear-gradient(180deg, #7a4426, #4a2414);
    box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px rgba(255, 210, 140, .35), 0 3px 0 2px var(--k) }
.plaque.gilded { background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); color: var(--k); text-shadow: none; box-shadow: 0 0 0 2px var(--k), inset 0 2px 0 rgba(255, 255, 255, .6), 0 3px 0 2px var(--k), 0 0 18px rgba(255, 211, 106, .45) }
.plaque.big { font-size: 22px }
.tag { color: var(--ink); box-shadow: 0 0 0 1.5px var(--line); font-weight: 800 }
.tag.gold { background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); color: var(--k); box-shadow: 0 0 0 1.5px var(--k) }
.work { background: #e6cc96; box-shadow: 0 0 0 2px var(--k), inset 0 2px 0 rgba(0, 0, 0, .15) }
.work-bar { background: linear-gradient(180deg, #ffe9a6, var(--gold-bg)) }
.emote { background: #fffaf0; box-shadow: 0 0 0 1.5px var(--k), 0 2px 0 1.5px var(--k) }
.done-note { color: #2f7a3e; font-weight: 700 }
.dialog .seg, .card .seg { background: #e6cc96; box-shadow: 0 0 0 2px var(--k), inset 0 2px 3px rgba(0, 0, 0, .15) }
.dialog .seg button { color: #6a4a30 }
.dialog .lbl { color: var(--ink); font-weight: 700 }
.code { font: 400 32px var(--display); color: var(--red-lo); letter-spacing: .1em; background: #fffaf0; border: 2px dashed var(--red); box-shadow: 0 2px 0 rgba(59, 29, 20, .2) }
.demo-flag { color: #8a4a1a; border-color: rgba(138, 74, 26, .45) }
.note.demo { color: #e9b98a }
.dialog .note.demo, .card .note.demo { color: #8a4a1a }
.err { color: #c8321f; font-weight: 700 }
.dialog .link { color: var(--red-lo) }
.wh-result { font: 400 24px var(--display); color: #fff3d6; text-shadow: var(--outline-s) }

/* kickers: a red ribbon, not spaced-out capitals */
.kicker { justify-self: center; width: max-content; max-width: 100%; margin: 0; padding: 4px 18px 5px; font: 400 14px/1.1 var(--display); letter-spacing: .03em; text-transform: none; color: #fff;
    text-shadow: 0 1.5px 0 var(--k); background: linear-gradient(180deg, var(--red-hi), var(--red-lo)); clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%, 9px 50%);
    filter: drop-shadow(0 2px 0 var(--k)) }
.dialog:not(.center) > .kicker, .trade-head .kicker, .back-dlg .kicker { justify-self: start }
.q-head .kicker { font-size: 11.5px; padding: 2px 12px 3px; justify-self: start }

/* the boards inside game dialogs stay night-dark */
.def-hud { background: linear-gradient(180deg, #43251a, #2c1711); color: var(--cream); box-shadow: 0 0 0 2px var(--k), inset 0 1px 0 rgba(255, 214, 150, .18); border-radius: 14px; font: 400 17px var(--display); letter-spacing: .02em }
.def-hud b { color: var(--gold-bg-hi) }
.def-hud .gi { width: 1.25em; height: 1.25em }
.def-board { --ink: #f6ecdc; --ink-soft: #e2cbb0; --gold-hi: #ffd36a; color: var(--ink); box-shadow: 0 0 0 2.5px var(--k), inset 0 3px 8px rgba(0, 0, 0, .5); border-radius: 16px }
.def-start, .def-over { background: rgba(26, 12, 8, .82) }
.def-start p { font-weight: 600 }
.def-over h3 { font: 400 30px var(--display); color: #ffd36a; text-shadow: var(--outline) }
.cat-fever { height: 20px; border-radius: 10px; background: #2a140c; box-shadow: 0 0 0 2px var(--k), inset 0 2px 0 rgba(0, 0, 0, .5) }
.cat-fever span { font: 400 13px/20px var(--display); letter-spacing: .14em; text-shadow: var(--outline-s) }
.def-pot { font: 400 16px var(--display); box-shadow: 0 0 0 1.5px var(--k) }

/* ---------- floating round buttons: cream tokens ---------- */
.fab { width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(180deg, #fff6dc 0%, #f6e0ae 60%, #e9c27a 100%);
    box-shadow: 0 0 0 2px var(--k), inset 0 -4px 0 rgba(160, 100, 30, .3), inset 0 2px 0 #fff, 0 4px 0 2px var(--k), 0 10px 18px rgba(0, 0, 0, .35) }
.fab:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--k), inset 0 -2px 0 rgba(160, 100, 30, .3), 0 1px 0 2px var(--k) }
.fab span { font-size: 26px; line-height: 1 }
.fab span .gi { width: 30px; height: 30px; vertical-align: 0 }
.fab small { font: 400 11px/1 var(--display); letter-spacing: .02em; color: var(--k); margin-top: 1px }
.fab-n { font: 400 13px/22px var(--display); background: var(--red); box-shadow: 0 0 0 2px var(--k); text-shadow: 0 1px 0 var(--k) }
.fab-n.coin { background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); color: var(--k); text-shadow: none }
.fab-chest.ready { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 3px var(--rc, var(--gold-bg)), 0 4px 0 2px var(--k), 0 0 22px var(--rc, var(--gold-bg)) }
.fab-wheel.ready { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 3px var(--gold-bg-hi), 0 4px 0 2px var(--k), 0 0 22px rgba(255, 211, 106, .8) }
.fab-home.ready { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 3px var(--gold-bg), 0 4px 0 2px var(--k), 0 0 16px rgba(255, 211, 106, .5) }
.fab-home.jar-full { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 3px var(--gold-bg-hi), 0 4px 0 2px var(--k), 0 0 24px rgba(255, 211, 106, .9) }
.fab-play.ready { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 3px var(--red), 0 4px 0 2px var(--k), 0 0 20px rgba(232, 69, 44, .75) }
@media (max-width: 760px) and (max-height: 700px) {
    .fab { width: 48px; height: 48px; border-radius: 15px }
    .fab span .gi { width: 25px; height: 25px }
    .fab small { font-size: 10px }
}

/* ---------- quest tracker, walking chip, rush pill, toasts ---------- */
.tracker { background: var(--paper-tex), linear-gradient(180deg, #fff4d8, var(--parch-2)); color: var(--k); border-radius: 16px; box-shadow: 0 0 0 2px var(--k), inset 0 -3px 0 rgba(160, 100, 30, .22), 0 4px 0 2px var(--k), 0 10px 20px rgba(0, 0, 0, .3) }
.tr-text b { font: 400 15px var(--display); letter-spacing: .01em; color: var(--red-lo) }
.tr-text span { color: #4a2a1a; font-weight: 600 }
.q-seal { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px rgba(255, 220, 180, .45) }
.walk-chip { background: var(--paper-tex), var(--parch); color: var(--k); box-shadow: 0 0 0 2px var(--k), 0 3px 0 2px var(--k); font: 700 14px var(--body) }
.walk-stop { font: 400 13px var(--display); background: var(--red); color: #fff; box-shadow: 0 0 0 1.5px var(--k); text-shadow: 0 1px 0 var(--k) }
.rush-pill { font: 600 13.5px var(--body); background: var(--plate); box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px #a8742c, 0 3px 0 2px var(--k) }
.rush-pill.on { background: linear-gradient(180deg, var(--red-hi), var(--red-lo)); color: #fff; text-shadow: 0 1px 0 var(--k); box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px var(--gold-bg-hi), 0 3px 0 2px var(--k), 0 0 22px rgba(255, 122, 74, .6) }
@keyframes rushpulse { 50% { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px var(--gold-bg-hi), 0 3px 0 2px var(--k), 0 0 34px rgba(255, 170, 74, .9) } }
.toast { background: var(--paper-tex), var(--parch); color: var(--k); border-radius: 16px; font: 700 14px var(--body); box-shadow: 0 0 0 2px var(--k), 0 3px 0 2px var(--k), 0 10px 18px rgba(0, 0, 0, .3) }
.toast.gain { color: var(--red-lo) }
.toast.quest { color: #fff; text-shadow: 0 1px 0 var(--k); background: linear-gradient(180deg, #5fbf6a, #2f8a3e) }
.toast b { color: inherit }
.coach { background: var(--paper-tex), var(--parch); color: var(--k); box-shadow: 0 0 0 2px var(--k), 0 3px 0 2px var(--k), var(--lift) }
.coach .btn { background: linear-gradient(180deg, var(--red-hi), var(--red)); color: #fff; box-shadow: 0 0 0 1.5px var(--k), 0 2px 0 1.5px var(--k); margin: 0 }
.float-txt { font: 400 22px var(--display); color: #ffd36a; text-shadow: var(--outline) }
.combo { background: var(--plate); box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px #a8742c, 0 4px 0 2px var(--k) }
.combo-x { font: 400 26px/1 var(--display); text-shadow: var(--outline-s) }
.combo-l { font: 400 11px var(--display); letter-spacing: .1em }
.combo-l b { font: 400 20px var(--display); text-shadow: var(--outline-s) }

/* ---------- big moments ---------- */
.stamp-pop b { font: 400 clamp(40px, 12vw, 70px)/1 var(--display); text-shadow: 0 3px 0 var(--k), 3px 0 0 var(--k), -3px 0 0 var(--k), 0 -3px 0 var(--k), 2px 2px 0 var(--k), -2px 2px 0 var(--k), 2px -2px 0 var(--k), -2px -2px 0 var(--k), 0 7px 0 var(--k), 0 0 30px var(--sc, var(--gold-hi)) }
.stamp-pop small { font: 400 15px var(--display); letter-spacing: .06em; text-transform: none; text-shadow: var(--outline-s) }
.ach-pop { background: var(--paper-tex), var(--parch); box-shadow: 0 0 0 2.5px var(--k), inset 0 0 0 2px #d9a64a, 0 4px 0 2.5px var(--k), 0 14px 28px rgba(0, 0, 0, .45) }
.ach-pop small { font: 400 12px var(--display); letter-spacing: .04em; text-transform: none; color: var(--red-lo) }
.ach-pop b { font: 400 19px var(--display); color: var(--k) }
.ach-pop em { color: #6a4a30; font-weight: 600 }
.ach-medal .gi, .ach-medal { width: 40px; height: 40px }
.levelup { background: radial-gradient(circle at 50% 30%, #c8381f, #6a160c 75%); box-shadow: 0 0 0 3px var(--k), inset 0 0 0 3px var(--gold-bg-hi), 0 6px 0 3px var(--k), 0 24px 50px rgba(0, 0, 0, .55) }
.levelup .kicker { background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); color: var(--k); text-shadow: none }
.lu-n { font: 400 84px/1 var(--display); color: #ffd36a; text-shadow: 0 4px 0 var(--k), 4px 0 0 var(--k), -4px 0 0 var(--k), 0 -4px 0 var(--k), 3px 3px 0 var(--k), -3px 3px 0 var(--k), 3px -3px 0 var(--k), -3px -3px 0 var(--k), 0 9px 0 var(--k) }
.lu-got { font-weight: 700; color: #fff3d6; text-shadow: 0 1px 0 var(--k) }
.stamp { box-shadow: 0 0 0 3px var(--k), inset 0 0 0 4px rgba(255, 220, 180, .5), 0 6px 0 3px var(--k) }
.chest-rar { font: 400 34px var(--display); text-shadow: var(--outline), 0 0 26px currentColor }
.chest-hint { font: 400 16px var(--display); letter-spacing: .08em; text-shadow: var(--outline-s) }
.loot { background: var(--paper-tex), linear-gradient(180deg, #fff4d8, var(--parch-2)); box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2.5px var(--rc), 0 4px 0 2px var(--k), 0 0 18px color-mix(in srgb, var(--rc) 50%, transparent) }
.loot b { font: 400 17px/1.1 var(--display); color: var(--k) }
.loot small { color: #6a4a30; font-weight: 700 }
.loot.new { background: var(--paper-tex), radial-gradient(circle at 50% 30%, #fffbe8, var(--parch)) }
.loot.new small { color: var(--red-lo) }
.wheel-hub { font: 400 19px var(--display); letter-spacing: .04em; text-shadow: var(--outline-s); box-shadow: 0 0 0 3px var(--k), inset 0 0 0 3px var(--gold-bg-hi), 0 5px 0 3px var(--k) }
.wheel-disc { box-shadow: 0 0 0 4px var(--k), 0 0 0 9px var(--gold-bg), 0 0 0 12px var(--k), 0 6px 0 12px var(--k), inset 0 0 26px rgba(0, 0, 0, .35) }
.wh-slice small { font: 400 10px/1.05 var(--display); letter-spacing: .02em; text-shadow: 0 1px 0 rgba(0, 0, 0, .6) }
.wh-slice.jp small { text-shadow: none }
.wheel-pin { filter: drop-shadow(0 0 0 var(--k)) drop-shadow(0 2px 0 var(--k)) }

/* ---------- title screen ---------- */
.splash { background: #2a120c }
.splash-bg { filter: saturate(1.15) brightness(.95) }
.splash-bg::after { background: radial-gradient(70% 50% at 50% 38%, rgba(255, 170, 90, .18), rgba(40, 14, 8, 0) 70%), linear-gradient(180deg, rgba(30, 10, 6, .35) 0%, rgba(30, 10, 6, .15) 35%, rgba(30, 10, 6, .82) 78%, #1e0b07 100%) }
.splash-inner { gap: 6px; width: min(420px, 100%) }
.splash-rays { position: absolute; left: 50%; top: 92px; width: 560px; height: 560px; margin: -280px 0 0 -280px; pointer-events: none; opacity: .55;
    background: repeating-conic-gradient(from 0deg, rgba(255, 214, 140, .22) 0 8deg, transparent 8deg 20deg); -webkit-mask: radial-gradient(circle, #000 12%, transparent 62%); mask: radial-gradient(circle, #000 12%, transparent 62%); animation: spin 40s linear infinite }
.splash-chibi { position: relative; width: 190px; height: 190px; margin: 0 0 -26px; object-fit: contain; filter: drop-shadow(0 4px 0 var(--k)) drop-shadow(0 14px 18px rgba(0, 0, 0, .45)); animation: hop .7s .1s cubic-bezier(.3, 1.6, .5, 1) both, bob 2.6s 1s ease-in-out infinite }
.logo { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; animation: drop .6s cubic-bezier(.3, 1.6, .5, 1) both }
.logo-seal { display: grid; place-items: center; width: 70px; height: 70px; flex: none; padding-top: 2px; border-radius: 12px; font: 30px/.95 var(--brush); color: #fff3d6; text-align: center;
    background: linear-gradient(180deg, #e2452c, #a8261a); box-shadow: 0 0 0 3px var(--k), inset 0 0 0 3px rgba(255, 220, 180, .5), 0 5px 0 3px var(--k); transform: rotate(-6deg) }
.logo-word { display: grid; text-align: left; line-height: .9; font-family: var(--display); color: #fff3d6; text-shadow: var(--outline) }
.logo-word small { font-size: 26px; letter-spacing: .01em }
.logo-word b { font-weight: 400; font-size: clamp(44px, 13vw, 58px); color: #ffd36a; letter-spacing: .01em;
    text-shadow: 0 3px 0 var(--k), 3px 0 0 var(--k), -3px 0 0 var(--k), 0 -3px 0 var(--k), 2px 2px 0 var(--k), -2px 2px 0 var(--k), 2px -2px 0 var(--k), -2px -2px 0 var(--k), 0 7px 0 var(--k), 0 12px 18px rgba(0, 0, 0, .4) }
.splash .lede { margin: 16px 0 10px; max-width: 32ch; padding: 10px 16px 11px; border-radius: 16px; font: 600 15.5px/1.4 var(--body); color: var(--k); opacity: 1;
    background: var(--paper-tex), var(--parch); box-shadow: 0 0 0 2.5px var(--k), 0 4px 0 2.5px var(--k), 0 12px 24px rgba(0, 0, 0, .35) }
.splash .lede b { color: var(--red-lo); font-weight: 800; white-space: nowrap }
.splash #enter { min-width: min(300px, 100%); font-size: 24px }
.btn.ghost.splash-new { min-width: min(300px, 100%); min-height: 50px; margin: 4px 2px 8px; border-radius: 16px; font: 400 18px var(--display); letter-spacing: .02em; color: var(--k); text-decoration: none;
    background: linear-gradient(180deg, #fff6dc 0%, #f6e0ae 55%, #ecc985 100%); box-shadow: 0 0 0 2px var(--k), inset 0 -4px 0 rgba(160, 100, 30, .28), inset 0 2px 0 rgba(255, 255, 255, .85), 0 4px 0 2px var(--k) }
.btn.ghost.splash-new:active { transform: translateY(4px); box-shadow: 0 0 0 2px var(--k), 0 0 0 2px var(--k) }
.splash .note { color: #f3dcc0; font-weight: 600; text-shadow: 0 1px 0 var(--k), 0 0 8px rgba(0, 0, 0, .9) }
@media (max-height: 640px) {
    .splash-chibi { width: 130px; height: 130px; margin-bottom: -18px }
    .splash-rays { top: 64px }
    .logo-seal { width: 58px; height: 58px; font-size: 25px }
    .logo-word small { font-size: 21px }
    .logo-word b { font-size: 44px }
    .splash .lede { margin: 10px 0 6px; font-size: 14.5px }
}
@media (max-width: 360px) {
    .logo-word b { font-size: 42px }
    .logo-word small { font-size: 20px }
    .logo-seal { width: 56px; height: 56px; font-size: 24px }
}

/* welcome gifts as little tiles */
.welcome-gifts span { font: 700 13px var(--body); color: var(--k); background: #fffaf0; box-shadow: 0 0 0 1.5px var(--k), 0 2px 0 1.5px var(--k); padding: 4px 10px }

/* ---------- wide screens ---------- */
@media (min-width: 761px) {
    .sheet { border-radius: 22px; box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2px #a8742c, inset 0 4px 0 1px rgba(255, 214, 140, .18), 0 5px 0 2px var(--k), 0 18px 30px rgba(0, 0, 0, .4) }
}

/* phones: the name stays on one line */
.brand .en { white-space: nowrap }
@media (max-width: 760px) { .brand .en { font-size: 18px } }
@media (max-width: 360px) { .brand .en { font-size: 15px } }

/* music switch: the note gets a slash when off */
#music .slash { opacity: 0 }
#music[aria-pressed="false"] .slash { opacity: 1 }
#music[aria-pressed="false"], #sound[aria-pressed="false"] { background: linear-gradient(180deg, #d8c6a8, #b8a07c); color: #5a3a24 }
@media (max-width: 400px) {
    header.top { padding-left: 12px; padding-right: 12px; gap: 6px }
    .top-actions { gap: 6px }
    .icon { width: 36px; height: 36px }
    .seg button { padding: 6px 9px; min-height: 32px }
}
/* iPhone SE and smaller: header pieces shrink so both sound switches stay on screen */
@media (max-width: 360px) {
    header.top { padding-left: 10px; padding-right: 10px }
    .brand { gap: 6px }
    .seal { width: 30px; height: 30px; font-size: 21px }
    .brand .en { font-size: 14.5px }
    .seg button { padding: 5px 7px; font-size: 13px; min-height: 30px }
    .top-actions { gap: 6px }
    .icon { width: 34px; height: 34px }
    .icon svg { width: 18px; height: 18px }
}
/* very short phones: five round buttons must clear the quest bar */
@media (max-width: 760px) and (max-height: 600px) {
    .fab { width: 44px; height: 44px; border-radius: 14px }
    .fab span .gi { width: 23px; height: 23px }
    .fab small { font-size: 9.5px }
}

/* ================= pass 3: fixes from the full playthrough (2026-11-14) ================= */
/* grid rows never shrink below their content (the Royal Pass track was squashed to 14px) */
.pane { grid-auto-rows: max-content; padding-right: 6px }

/* buttons you cannot use yet look it: flat, faded, no lip */
.btn:disabled:not(.primary) { background: linear-gradient(180deg, #d8c7a6, #bca783); color: #6e553b; opacity: .72; filter: saturate(.6);
    box-shadow: 0 0 0 2px var(--k), 0 2px 0 2px var(--k); cursor: not-allowed }
.btn:disabled:not(.primary)::after { display: none }

/* long names stay on one line in the Me tab */
.home-hero .plaque { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; font-size: clamp(14px, 4.6vw, 19px) }

/* quest done: Xiaoyu stamps the chapter seal herself */
.qd-hero { display: flex; align-items: flex-end; justify-content: center; margin: 0 0 2px; min-height: 120px }
.qd-chibi { width: 124px; height: 124px; object-fit: contain; margin-right: -22px; position: relative; z-index: 1;
    filter: drop-shadow(0 3px 0 var(--k)) drop-shadow(0 8px 10px rgba(60, 20, 8, .3)); animation: hop .6s cubic-bezier(.3, 1.6, .5, 1) both }
.quest-done .stamp { width: 96px; height: 96px; font-size: 54px; margin-bottom: 8px; animation-delay: .25s; animation-fill-mode: both }
.stamp.two { writing-mode: vertical-rl; font-size: 40px; line-height: 1.02; letter-spacing: 0 }

/* chests you own: say "Open" and bounce */
.chest-stash li.has button { animation: chestwait 1.8s ease-in-out infinite }
.chest-stash li.has:nth-child(2) button { animation-delay: .3s }
.chest-stash li.has:nth-child(3) button { animation-delay: .6s }
.chest-stash li.has:nth-child(4) button { animation-delay: .9s }
.cs-open { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 9px 2px; border-radius: 999px; font: 400 12px/1.2 var(--display); font-style: normal; letter-spacing: .03em;
    color: #fff; text-shadow: var(--outline-s); background: linear-gradient(180deg, var(--red-hi), var(--red)); box-shadow: 0 0 0 1.5px var(--k), 0 2px 0 1.5px var(--k); white-space: nowrap }
.chest-stash button { position: relative; overflow: visible }
.chest-stash { padding-bottom: 8px }
@keyframes chestwait { 0%, 70%, 100% { transform: none } 78% { transform: translateY(-4px) rotate(-3deg) } 86% { transform: translateY(0) rotate(3deg) } 93% { transform: rotate(-1deg) } }

/* achievements: closest ones first, the rest behind a button */
.ach-more { list-style: none; background: none !important; box-shadow: none !important; padding: 2px 0 0 !important; display: block !important }
.ach-more .btn { width: 100% }

/* ranking: the top three shine */
#ranking li.top button { background: linear-gradient(90deg, var(--tc), rgba(0, 0, 0, 0) 75%), linear-gradient(180deg, #3a2018, #2a140c) }
#ranking li.top1 { --tc: rgba(255, 196, 64, .38) }
#ranking li.top2 { --tc: rgba(210, 220, 235, .3) }
#ranking li.top3 { --tc: rgba(214, 132, 72, .32) }
#ranking li.top .rk { font-size: 22px }
#ranking li.top .rk .gi { width: 26px; height: 26px }

/* mini-game rules: four short lines with icons instead of a paragraph */
.rules { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 7px; text-align: left; font: 600 15px/1.25 var(--body); max-width: 290px }
.rules li { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px }
.rules li > span:first-child { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-size: 17px;
    background: linear-gradient(180deg, #5a3020, #3a1c12); box-shadow: 0 0 0 1.5px var(--k), inset 0 1px 0 rgba(255, 214, 150, .2) }
.rules .gi { width: 19px; height: 19px }
.def-start { gap: 12px }

/* the night wall: moon, stars, brick wall and little masked rebels on the ladders */
.def-board:not(.cat-board) { background:
    radial-gradient(circle at 84% 34%, #fff6d8 0 13px, rgba(255, 240, 200, .25) 14px 24px, transparent 25px),
    radial-gradient(1.5px 1.5px at 12% 40%, #fff 98%, transparent), radial-gradient(1.5px 1.5px at 30% 55%, #ffe9b0 98%, transparent),
    radial-gradient(1.5px 1.5px at 52% 36%, #fff 98%, transparent), radial-gradient(1.5px 1.5px at 66% 62%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 20% 78%, #ffe9b0 98%, transparent), radial-gradient(1.5px 1.5px at 92% 70%, #fff 98%, transparent),
    linear-gradient(180deg, #121233 0%, #2a1e46 55%, #4a2a2a 100%) }
.def-wall { background:
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(43, 19, 12, .45) 11px 13px),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(43, 19, 12, .35) 26px 28px),
    linear-gradient(180deg, #a59a90, #7d726a); box-shadow: 0 3px 0 var(--k), 0 8px 0 rgba(0, 0, 0, .3) }
.def-wall::after { background: repeating-linear-gradient(90deg, transparent 0 22px, #121233 22px 34px); height: 14px }
.slot .climber { width: 30px; height: 30px; margin-left: -15px; border-radius: 0; box-shadow: none; background: none }
.slot .climber::before { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='20' r='9' fill='%23e8b48a' stroke='%232b130c' stroke-width='2'/%3E%3Crect x='7.5' y='17.5' width='17' height='4.5' rx='1' fill='%232b130c'/%3E%3Ccircle cx='12.5' cy='19.7' r='1.5' fill='%23fff'/%3E%3Ccircle cx='19.5' cy='19.7' r='1.5' fill='%23fff'/%3E%3Cpath d='M2 15.5 16 3l14 12.5z' fill='%23c99a4a' stroke='%232b130c' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    animation: wobble .35s ease-in-out infinite alternate }
@keyframes wobble { from { transform: rotate(-7deg) } to { transform: rotate(7deg) } }
.slot.up::after { font: 400 12px var(--display); letter-spacing: .06em; color: #ffd36a; text-shadow: var(--outline-s) }

/* nudges: the first quest after moving in, and the search box on a first visit */
.tracker.nudge { animation: nudge 1.1s cubic-bezier(.3, 1.5, .5, 1) 2 }
@keyframes nudge { 0%, 100% { transform: none } 20% { transform: scale(1.06) } 40% { transform: scale(.98) } 60% { transform: scale(1.03) } }
.search-wrap.hint input { box-shadow: 0 0 0 2px var(--k), 0 0 0 5px #ffd36a, 0 0 22px rgba(255, 211, 106, .7); animation: hintglow 1.4s ease-in-out infinite }
@keyframes hintglow { 50% { box-shadow: 0 0 0 2px var(--k), 0 0 0 3px #ffd36a, 0 0 8px rgba(255, 211, 106, .35) } }

/* title screen on phones: the buttons sit low, where thumbs are, and the sunset shows above */
@media (max-width: 760px) and (min-height: 700px) {
    .splash { place-items: end center; padding-bottom: calc(26px + var(--safe-b, 0px)) }
    .splash-chibi { width: 220px; height: 220px; margin-bottom: -30px }
    .splash-rays { top: 110px }
}
@media (prefers-reduced-motion: reduce) {
    .chest-stash li.has button, .slot .climber::before, .tracker.nudge, .search-wrap.hint input, .qd-chibi { animation: none }
}

/* ================= pass 4: alignment and readable text (2026-11-14) ================= */
/* toasts: one line of text with an inline icon (flex split "Welcome rush:" into its own column) */
.toast { display: block; border-radius: 18px; line-height: 1.35; padding: 9px 16px; max-width: 100%; text-wrap: balance }
.toast .ico, .toast .gi { vertical-align: -.25em; margin-right: 6px; display: inline-block }

/* Go buttons: the word sits in the middle */
.tracker .go, .steps .go { display: inline-grid; place-items: center; line-height: 1; padding-top: 0; padding-bottom: 2px; min-height: 38px }
.tracker .go { margin-bottom: 4px }

/* tab badges: small, on the icon's top-right corner, never on top of each other */
.dot-badge { width: 11px; height: 11px; top: 4px; right: calc(50% - 20px); box-shadow: 0 0 0 2px var(--k); background: #e2402a }
.dot-badge.gift { width: 11px; height: 11px; top: 4px; right: calc(50% - 20px); background: #ffd36a }
.tabs button:has(#badge-quests:not([hidden])) #badge-daily { right: calc(50% - 32px) }

/* readable text: nothing important below ~4.5:1 */
.ladder li { opacity: 1 }
.ladder li:not(.got):not(.now) { background: linear-gradient(180deg, #2c1610, #200f0a) }
.ladder li:not(.got):not(.now) b, .ladder li:not(.got):not(.now) .r-name { color: #dcc6aa }
.ladder li:not(.got):not(.now) :is(.r-addr, .at) { color: #b9a184 }
.ladder li.got { opacity: 1 }
.btn:disabled:not(.primary) { color: #4a3324; opacity: .9 }
.rw.xp { background: linear-gradient(180deg, #3f9a4c, #23692f); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .55) }
.rw.xp s { opacity: .8 }
.pass-track li:not(.open):not(.got) button { opacity: .85 }
.chip:disabled { opacity: .78 }
.deeds li.done button { opacity: .8 }
.steps li.done { color: #ecdcc4; text-decoration-color: rgba(255, 211, 106, .8) }
.steps li.done b { color: #9fe0a8 }
.quest .steps li { color: #fff3e0 }
.goal b, #goal-build { color: #ffb36a }
.kicker { text-shadow: 0 1px 0 rgba(0, 0, 0, .45) }
.tabs button { color: #d2b496 }
.note, .r-addr, .small-note { color: #d8c0a2 }
.dialog .note, .card .note, .dialog .r-addr, .card .r-addr, #tracker-step { color: #6b4a30 }

/* wide screens: the HUD and the menu panel share one left column; the quest sits top-centre */
@media (min-width: 761px) {
    .hud { width: 360px; max-width: 360px; box-sizing: border-box }
    .hud .hud-stat:first-of-type { margin-left: auto }
    .tracker { left: 0; right: 0; margin: 0 auto; width: max-content; max-width: min(440px, calc(100% - 820px)); min-width: 300px; top: calc(var(--safe-t) + 10px) }
    .toasts { top: calc(var(--safe-t) + 92px) }
}
@media (min-width: 761px) and (max-width: 1180px) {
    .tracker { top: calc(var(--safe-t) + 64px); max-width: calc(100% - 420px); margin-left: 392px; margin-right: auto }
}

/* the Spin button: only the wheel disc turns (the whole icon spun off-centre, pointer and all) */
.fab-wheel.ready span { animation: none }
.gi .wd { transform-box: view-box; transform-origin: 12px 12.5px }
.fab-wheel.ready .gi .wd { animation: wheelturn 2.4s cubic-bezier(.45, 0, .2, 1) infinite }
@keyframes wheelturn { 0% { transform: rotate(0) } 70% { transform: rotate(540deg) } 100% { transform: rotate(540deg) } }
@media (prefers-reduced-motion: reduce) { .fab-wheel.ready .gi .wd { animation: none } }

/* ================= grand chest opening ================= */
.chest-modal:not([hidden]) { animation: chestbg .35s ease-out both }
@keyframes chestbg { from { opacity: 0 } }
.chest-modal { background: radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--rc, #e8dcc6) 22%, #3c140e) 0%, rgba(20, 6, 4, .92) 55%, rgba(6, 2, 2, .97) 100%) }
.chest-rays { width: 760px; height: 760px; margin: -380px 0 0 -380px; top: 190px; opacity: .3; animation-duration: 22s }
.chest-modal[data-state="open"] .chest-rays { opacity: .75; animation-duration: 7s }
.chest-rar { transition: color .3s, transform .3s }
.chest-modal[data-state="open"] .chest-rar { animation: rarpunch .6s cubic-bezier(.2, 1.6, .4, 1) }
@keyframes rarpunch { 0% { transform: scale(.6) } 60% { transform: scale(1.18) } }

/* the chest itself: planks, iron bands tinted by rarity, studs, a gold lock */
.chest-box { width: 210px; height: 178px; margin-top: 34px; --band: color-mix(in srgb, var(--rc, #e8dcc6) 55%, #6b4a2a) }
.chest-box.drop { animation: cdrop .75s cubic-bezier(.25, 1.5, .45, 1) both, cidle 2.6s 1s ease-in-out infinite }
@keyframes cdrop { 0% { transform: translateY(-260px) scale(.7) rotate(-8deg); opacity: 0 } 55% { transform: translateY(0) scale(1.12, .86); opacity: 1 } 75% { transform: scale(.96, 1.06) } }
@keyframes cidle { 50% { transform: translateY(-5px) scale(1.02) } }
.cb-shadow { position: absolute; left: 18px; right: 18px; bottom: -14px; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent) }
.cb-body { left: 12px; right: 12px; height: 96px; border-radius: 10px 10px 16px 16px;
    background:
        radial-gradient(circle at 12% 22%, #ffe6a0 0 3px, transparent 3.5px), radial-gradient(circle at 88% 22%, #ffe6a0 0 3px, transparent 3.5px),
        radial-gradient(circle at 12% 78%, #ffe6a0 0 3px, transparent 3.5px), radial-gradient(circle at 88% 78%, #ffe6a0 0 3px, transparent 3.5px),
        linear-gradient(90deg, transparent 6%, var(--band) 6% 17%, transparent 17% 83%, var(--band) 83% 94%, transparent 94%),
        repeating-linear-gradient(180deg, transparent 0 22px, rgba(43, 19, 12, .55) 22px 24px),
        linear-gradient(180deg, #9a5e2c, #6a3818 70%, #4e260e);
    box-shadow: 0 0 0 3px var(--k), inset 0 3px 0 rgba(255, 220, 160, .25), inset 0 -10px 0 rgba(0, 0, 0, .28) }
.cb-lid { left: 6px; right: 6px; bottom: 90px; height: 72px; border-radius: 70px 70px 10px 10px; transition: transform .6s cubic-bezier(.25, 1.55, .45, 1);
    background:
        linear-gradient(90deg, transparent 6%, var(--band) 6% 17%, transparent 17% 83%, var(--band) 83% 94%, transparent 94%),
        repeating-linear-gradient(90deg, transparent 0 30px, rgba(43, 19, 12, .4) 30px 32px),
        linear-gradient(180deg, #b87436, #8a4c20 60%, #6a3818);
    box-shadow: 0 0 0 3px var(--k), inset 0 8px 0 rgba(255, 230, 180, .3), inset 0 -6px 0 color-mix(in srgb, var(--rc, #e8dcc6) 70%, #3a1c0a) }
.cb-lock { bottom: 70px; width: 36px; height: 40px; margin-left: -18px; border-radius: 8px 8px 12px 12px; background: linear-gradient(180deg, #fff0b0, #e0a93c 55%, #a8701c); box-shadow: 0 0 0 2.5px var(--k), inset 0 2px 0 rgba(255, 255, 255, .7); z-index: 2 }
.cb-lock::after { top: 12px; width: 8px; height: 14px; margin-left: -4px; border-radius: 4px 4px 2px 2px; background: var(--k) }
.cb-glow { inset: -60px; opacity: .5; animation: glowbreath 2s ease-in-out infinite }
@keyframes glowbreath { 50% { opacity: .8; transform: scale(1.08) } }
/* light leaking out of the lid seam: stronger with every tap */
.cb-seam { position: absolute; left: 14px; right: 14px; bottom: 88px; height: 6px; border-radius: 4px; background: #fffbe6; box-shadow: 0 0 10px 3px var(--rc, #fff), 0 0 26px 8px color-mix(in srgb, var(--rc, #fff) 60%, transparent); opacity: 0; transition: opacity .3s; z-index: 1 }
.chest-modal[data-taps="1"] .cb-seam { opacity: .35 }
.chest-modal[data-taps="2"] .cb-seam { opacity: .7 }
.chest-modal[data-taps="3"] .cb-seam { opacity: 1 }
.chest-modal[data-taps="3"] .cb-lid { transform: translateY(-5px) rotate(-3deg) }
.cb-sparks { position: absolute; inset: -30px; pointer-events: none;
    background: radial-gradient(circle at 10% 30%, #fff 0 2px, transparent 3px), radial-gradient(circle at 92% 20%, #fff 0 2.5px, transparent 3.5px), radial-gradient(circle at 80% 85%, #fff 0 2px, transparent 3px), radial-gradient(circle at 18% 88%, #fff 0 2px, transparent 3px);
    filter: drop-shadow(0 0 4px var(--rc, #fff)); animation: spin 9s linear infinite; opacity: .8 }
.chest-box.shake1 { animation: cshake .4s }
.chest-box.shake2 { animation: cshake .45s; filter: brightness(1.15) drop-shadow(0 0 12px var(--rc)) }
.chest-box.shake3 { animation: cshake2 .55s; filter: brightness(1.3) drop-shadow(0 0 22px var(--rc)) }

/* the reveal: white flash, lid flies off, a beam of light, cards fly out */
.chest-flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 42%, #fff 0%, color-mix(in srgb, var(--rc, #fff) 60%, #fff) 25%, transparent 70%); z-index: 3 }
.chest-modal[data-state="open"] .chest-flash { animation: cflash .7s ease-out }
@keyframes cflash { 0% { opacity: 0 } 15% { opacity: 1 } 100% { opacity: 0 } }
.chest-modal[data-state="open"] .cb-lid { transform: translate(-78px, 6px) rotate(-74deg) }
.chest-modal[data-state="open"] .cb-seam { opacity: 0 }
.chest-modal[data-state="open"] .cb-lock { opacity: 0; transform: translateY(20px) rotate(30deg); transition: opacity .3s, transform .4s }
.cb-beam { position: absolute; left: 50%; bottom: 80px; width: 120px; height: 520px; margin-left: -60px; transform-origin: 50% 100%; transform: scaleY(0); opacity: 0; pointer-events: none;
    background: linear-gradient(0deg, #fffbe6 0%, color-mix(in srgb, var(--rc, #fff) 80%, #fff) 30%, transparent 100%); -webkit-mask: linear-gradient(90deg, transparent, #000 30% 70%, transparent); mask: linear-gradient(90deg, transparent, #000 30% 70%, transparent) }
.chest-modal[data-state="open"] .cb-beam { animation: cbeam 1.4s cubic-bezier(.2, .9, .3, 1) forwards, beampulse 2s 1.4s ease-in-out infinite }
@keyframes cbeam { 0% { transform: scaleY(0); opacity: 0 } 25% { transform: scaleY(1.05); opacity: 1 } 100% { transform: scaleY(1); opacity: .55 } }
@keyframes beampulse { 0%, 100% { transform: scaleY(1); opacity: .55 } 50% { opacity: .35 } }
.chest-modal[data-state="open"] .chest-box { animation: copen .55s cubic-bezier(.3, 1.6, .5, 1) }
.chest-modal[data-rar="legendary"][data-state="open"] .chest-stage, .chest-modal[data-rar="epic"][data-state="open"] .chest-stage { animation: bigshake .5s .05s }
@keyframes bigshake { 15% { transform: translate(-6px, 3px) } 30% { transform: translate(6px, -3px) } 45% { transform: translate(-4px, 2px) } 60% { transform: translate(3px, -1px) } }
.loot { animation: lootfly .75s cubic-bezier(.2, 1.25, .4, 1) both }
@keyframes lootfly {
    0% { transform: translate(var(--fx, 0), var(--fy, 40px)) scale(.15) rotate(var(--fr, -12deg)); opacity: 0 }
    15% { opacity: 1 }
    55% { transform: translate(calc(var(--fx, 0px) * .35), calc(var(--fy, 0px) * .35 - 70px)) scale(.9) rotate(calc(var(--fr, 0deg) * -.4)) }
    100% { transform: none; opacity: 1 }
}
.loot.new { animation: lootfly .75s cubic-bezier(.2, 1.25, .4, 1) both, newglow 1.6s 1.2s ease-in-out infinite }
@keyframes newglow { 50% { box-shadow: 0 0 0 2px var(--k), inset 0 0 0 2.5px var(--rc), 0 4px 0 2px var(--k), 0 0 34px var(--rc) } }
@media (prefers-reduced-motion: reduce) {
    .chest-box.drop, .cb-sparks, .cb-glow, .chest-modal[data-state="open"] .cb-beam, .chest-modal[data-state="open"] .chest-stage { animation: none }
    .loot { animation-duration: .01s }
}

/* ================= wish box ================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.wish-box { display: grid; gap: 10px; margin: 6px 0 16px; padding: 14px; border-radius: 18px; background: linear-gradient(180deg, #fff6e4, #f6e2c0); box-shadow: 0 0 0 2.5px var(--k), 0 4px 0 2px var(--k); color: #4a2a18 }
.wb-title { display: flex; gap: 10px; align-items: center; margin: 0 }
.wb-title img { flex: none; width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 2px 0 rgba(43, 19, 12, .35)) }
.wb-title b { display: block; font-family: 'Lilita One', system-ui, sans-serif; font-weight: 400; font-size: 19px; color: #8b1e1e; letter-spacing: .3px }
.wb-title small { display: block; font-size: 13px; line-height: 1.3; color: #6b4a30 }
.wb-topics { display: flex; flex-wrap: wrap; gap: 6px }
.wb-topics label { cursor: pointer }
.wb-topics input { position: absolute; opacity: 0; pointer-events: none }
.wb-topics span { display: inline-block; padding: 6px 11px; border-radius: 99px; font-weight: 700; font-size: 13.5px; background: #fff; color: #5a3a22; box-shadow: 0 0 0 2px #d9b98e; transition: transform .12s, background .15s }
.wb-topics input:checked + span { background: #c8302a; color: #fff; box-shadow: 0 0 0 2px var(--k), 0 2px 0 1px var(--k); transform: translateY(-1px) }
.wb-topics input:focus-visible + span { outline: 3px solid #ffd36a; outline-offset: 2px }
.wb-text { position: relative; display: block }
.wb-text textarea { box-sizing: border-box; width: 100%; resize: vertical; min-height: 76px; padding: 10px 12px 22px; border: 0; border-radius: 12px; font: 600 15px/1.35 'Baloo 2', system-ui, sans-serif; color: #3a2010; background: #fffdf8; box-shadow: inset 0 0 0 2px #d9b98e, inset 0 2px 4px rgba(0, 0, 0, .08) }
.wb-text textarea::placeholder { color: #a48466 }
.wb-text textarea:focus { outline: none; box-shadow: inset 0 0 0 2.5px #c8302a, 0 0 0 3px rgba(255, 211, 106, .6) }
.wb-text i { position: absolute; right: 10px; bottom: 6px; font-style: normal; font-size: 12px; font-weight: 700; color: #8a6a4c }
.wb-text i.low { color: #c8302a }
.wb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden }
.wish-box .btn { justify-self: stretch }
.wish-status { margin: 0; font-size: 13px; line-height: 1.35; color: #6b4a30; text-align: center }
.wish-status.ok { color: #2f7a3a; font-weight: 700 }
.wish-status.bad { color: #b0261f; font-weight: 700 }

/* ================= tap any item: locked things stay tappable and open their card ================= */
.chip[aria-disabled="true"] { opacity: .62; cursor: help }
.skin[aria-disabled="true"] { cursor: help }
.skin[aria-disabled="true"] img { filter: grayscale(1) brightness(.5) }
.skin[aria-disabled="true"]:hover { transform: none }
.bag-grid li.full, .loot[data-info] { cursor: pointer }
.bag-grid li.full:focus-visible, [data-info]:focus-visible { outline: 3px solid #ffd36a; outline-offset: 2px }
.item-info { z-index: 30 }
.ii-dialog { position: relative; width: min(340px, 100%); padding: 22px 20px 18px; text-align: center; background: linear-gradient(180deg, #fff6e4, #f3dcb6); color: #4a2a18; border-radius: 22px; box-shadow: 0 0 0 3px var(--k), 0 6px 0 3px var(--k), 0 20px 40px rgba(0, 0, 0, .45); animation: iipop .32s cubic-bezier(.2, 1.5, .4, 1) }
@keyframes iipop { from { transform: scale(.7) translateY(20px); opacity: 0 } }
.ii-x { position: absolute; top: 8px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; font-size: 26px; line-height: 1; color: #8a6a4c; cursor: pointer }
.ii-icon { width: 104px; height: 104px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 26px; background: radial-gradient(circle at 50% 40%, #fff, color-mix(in srgb, var(--rc) 45%, #fff3dc)); box-shadow: 0 0 0 3px var(--k), inset 0 0 0 4px var(--rc), 0 4px 0 2px var(--k), 0 0 26px color-mix(in srgb, var(--rc) 70%, transparent) }
.ii-emoji { font-size: 58px; line-height: 1; filter: drop-shadow(0 3px 0 rgba(43, 19, 12, .25)) }
.ii-img { width: 92px; height: 92px; object-fit: contain }
.ii-dye { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 3px var(--k), inset 0 -6px 0 rgba(0, 0, 0, .15), inset 0 5px 0 rgba(255, 255, 255, .6) }
.ii-tag { margin: 0; font-size: 12.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #8a6a4c }
.ii-rar { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--rc); color: #2b130c; box-shadow: 0 0 0 1.5px var(--k) }
.ii-dialog h2 { margin: 4px 0 6px; font-family: 'Lilita One', system-ui, sans-serif; font-weight: 400; font-size: 26px; color: #8b1e1e }
.ii-text { margin: 0 0 12px; font-size: 15px; line-height: 1.4; color: #4a2a18 }
.ii-facts { display: grid; gap: 6px; margin: 0 0 12px; text-align: left }
.ii-facts div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1.5px #e0c49a }
.ii-facts dt { font-weight: 700; color: #8a6a4c; font-size: 13px }
.ii-facts dd { margin: 0; font-weight: 800; color: #3a2010; font-size: 13.5px; text-align: right }
.ii-tip { margin: 0 0 14px; font-size: 13px; color: #6b4a30 }

/* ================= the whole game sits on an unrolled scroll ================= */
.scroll-frame { position: fixed; inset: 0; z-index: 60; pointer-events: none;
    box-shadow: inset 0 0 0 2px #2b130c, inset 0 0 0 5px #e7c98f, inset 0 0 0 6.5px #9a6a34, inset 0 0 0 8px #2b130c, inset 0 0 36px 4px rgba(70, 35, 10, .5) }
.scroll-frame::before, .scroll-frame::after { content: ''; position: absolute; top: 0; bottom: 0; width: 8px;
    background: repeating-linear-gradient(180deg, transparent 0 22px, rgba(43, 19, 12, .25) 22px 24px) }
.scroll-frame::before { left: 8px; box-shadow: 4px 0 8px -4px rgba(0, 0, 0, .4) }
.scroll-frame::after { right: 8px; box-shadow: -4px 0 8px -4px rgba(0, 0, 0, .4) }
.sf-roll { position: absolute; left: -6px; right: -6px; height: 12px; border-radius: 6px;
    background: linear-gradient(180deg, #c98a4a 0%, #f0c27a 30%, #9a5a26 70%, #5a2e10 100%);
    box-shadow: 0 0 0 2px #2b130c, 0 3px 6px rgba(0, 0, 0, .45) }
.sf-roll.sf-top { top: -3px }
.sf-roll.sf-bot { bottom: -3px; box-shadow: 0 0 0 2px #2b130c, 0 -3px 6px rgba(0, 0, 0, .45) }
.sf-roll::before, .sf-roll::after { content: ''; position: absolute; top: -4px; width: 22px; height: 20px; border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fff2b0, #e0a93c 45%, #8a5a14 100%); box-shadow: 0 0 0 2px #2b130c }
.sf-roll::before { left: 0 }
.sf-roll::after { right: 0 }
/* the corner knobs mark the scroll's ends; on bigger screens the frame gets a little more presence */
@media (min-width: 761px) {
    .scroll-frame { box-shadow: inset 0 0 0 2px #2b130c, inset 0 0 0 7px #e7c98f, inset 0 0 0 9px #9a6a34, inset 0 0 0 11px #2b130c, inset 0 0 60px 8px rgba(70, 35, 10, .5) }
    .scroll-frame::before { left: 11px } .scroll-frame::after { right: 11px }
    .sf-roll { height: 16px } .sf-roll::before, .sf-roll::after { width: 28px; height: 26px; top: -5px }
}

/* ================= title screen v2: a painted dusk while loading, then the live town orbits behind the logo ================= */
/* since 11-25: sharp Blender renders of the town at sunset (kingdom_town_renders.py splash), tall on phones, wide on desktop;
   the title screen keeps them (no live-town takeover), with a slow drift */
.splash-bg { inset: -3%; filter: saturate(1.08); animation: drift 28s ease-in-out infinite alternate;
    background: #2a120c url("img/splash-tall.webp") center 40% / cover no-repeat }
@media (orientation: landscape) { .splash-bg { background-image: url("img/splash-wide.webp"); background-position: center 60% } }
/* phones: buttons sit low, so shade the bottom and leave the sunset bright */
.splash-bg::after { background: linear-gradient(180deg, rgba(30, 10, 6, .2) 0%, rgba(30, 10, 6, 0) 22%, rgba(30, 10, 6, .15) 45%, rgba(30, 10, 6, .78) 75%, #1e0b07 100%) }
.splash-lanterns { position: absolute; inset: 0; pointer-events: none; overflow: hidden }
.splash-lanterns i { position: absolute; bottom: -40px; width: 16px; height: 20px; border-radius: 45% 45% 40% 40%;
    background: radial-gradient(circle at 50% 40%, #fff2b0, #ff9a3a 45%, #c8302a 80%); box-shadow: 0 0 14px 4px rgba(255, 150, 60, .55);
    animation: lanternrise 16s linear infinite; opacity: 0 }
.splash-lanterns i::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 2px; height: 6px; margin-left: -1px; background: #ffd36a }
.splash-lanterns i:nth-child(1) { left: 8%; animation-delay: 0s; transform: scale(.8) }
.splash-lanterns i:nth-child(2) { left: 22%; animation-delay: -5s; animation-duration: 19s }
.splash-lanterns i:nth-child(3) { left: 36%; animation-delay: -11s; transform: scale(.6) }
.splash-lanterns i:nth-child(4) { left: 51%; animation-delay: -2s; animation-duration: 21s; transform: scale(.7) }
.splash-lanterns i:nth-child(5) { left: 63%; animation-delay: -8s }
.splash-lanterns i:nth-child(6) { left: 77%; animation-delay: -14s; animation-duration: 18s; transform: scale(.9) }
.splash-lanterns i:nth-child(7) { left: 90%; animation-delay: -4s; transform: scale(.65) }
.splash-lanterns i:nth-child(8) { left: 44%; animation-delay: -17s; animation-duration: 23s; transform: scale(.5) }
.splash-lanterns i:nth-child(9) { left: 14%; animation-delay: -12s; animation-duration: 20s; transform: scale(.55) }
@keyframes lanternrise { 0% { translate: 0 0; opacity: 0 } 8% { opacity: .95 } 50% { translate: 18px -55vh } 85% { opacity: .8 } 100% { translate: -10px -112vh; opacity: 0 } }

/* the live town shows through once it is built */
.splash::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.6s;
    background: radial-gradient(ellipse 70% 60% at 50% 42%, transparent 35%, rgba(20, 6, 4, .5) 80%, rgba(20, 6, 4, .8)), linear-gradient(180deg, rgba(20, 6, 4, .45), transparent 24%, transparent 50%, rgba(20, 6, 4, .9) 92%) }
.splash.live { background: transparent }
.splash.live::before { opacity: 1 }
.splash-bg { transition: opacity 1.6s ease }
.splash.live .splash-bg { opacity: 0 }
.splash-inner { z-index: 1 }

.splash-stats { display: flex; gap: 8px; justify-content: center; margin: 14px 0 0; padding: 0; list-style: none; animation: drop .6s .15s cubic-bezier(.3, 1.6, .5, 1) both }
.splash-stats li { display: grid; min-width: 82px; padding: 6px 10px 5px; border-radius: 14px; background: rgba(255, 246, 228, .94); box-shadow: 0 0 0 2px var(--k), 0 3px 0 1px var(--k) }
.splash-stats b { font: 400 22px/1 var(--display); color: #8b1e1e }
.splash-stats span { font-size: 11.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #6b4a30 }
.splash .lede { margin-top: 10px }

/* desktop: logo and buttons on the left, Xiaoyu big on the right, the town all around */
@media (min-width: 900px) {
    .splash-inner { width: min(1080px, 92vw); max-width: none; grid-template-columns: 1.05fr .95fr; align-items: center; justify-items: start; column-gap: 36px; text-align: left;
        grid-template-areas: "logo chibi" "stats chibi" "lede chibi" "enter chibi" "new chibi" "note chibi" }
    .splash-inner > .logo { grid-area: logo; justify-content: flex-start }
    .splash-inner > .splash-stats { grid-area: stats; justify-content: flex-start }
    .splash-inner > .lede { grid-area: lede; text-align: left; max-width: 38ch }
    .splash-inner > #enter { grid-area: enter; min-width: 340px }
    .splash-inner > #enter-new { grid-area: new; min-width: 340px }
    .splash-inner > .note { grid-area: note }
    .splash-inner > .splash-how { justify-self: start }
    .btn.ghost.splash-new { justify-self: start; min-width: 340px; margin-left: 0 }
    /* shade only behind the text column, so the sunlit town stays bright on the right */
    .splash-bg::after { background: radial-gradient(ellipse 48% 58% at 24% 62%, rgba(30, 10, 6, .62), rgba(30, 10, 6, .25) 60%, rgba(30, 10, 6, 0) 100%),
        linear-gradient(180deg, rgba(30, 10, 6, 0) 70%, rgba(30, 10, 6, .5) 100%) }
    .splash-chibi { grid-area: chibi; width: min(420px, 38vw); height: auto; aspect-ratio: 1; margin: 0; justify-self: center }
    .splash-rays { left: 76%; top: 50%; width: 900px; height: 900px; margin: -450px 0 0 -450px }
    .logo-seal { width: 104px; height: 104px; font-size: 44px; border-radius: 16px }
    .logo-word small { font-size: 40px }
    .logo-word b { font-size: 104px }
    .splash-stats li { min-width: 108px; padding: 8px 14px 7px }
    .splash-stats b { font-size: 30px }
    .splash .lede { font-size: 17px }
}
@media (prefers-reduced-motion: reduce) {
    .splash-lanterns { display: none }
}

/* while the title screen is up, only the town itself shows behind it: no HUD, buttons or labels */
#app:has(#splash:not([hidden])) > :not(#stage):not(#splash):not(.scroll-frame):not(.modal) { visibility: hidden }

/* party row in Me: dance and fireworks */
.party-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 4px }
.party-row .btn { min-height: 46px; font-size: 16px }
.party-row small { margin-left: 4px; font-size: 12px; opacity: .8 }

/* very small phones: the HUD stats squeeze in instead of poking out of the panel */
@media (max-width: 359px) {
    .hud { gap: 4px }
    .hud .hud-stat { padding: 3px 6px 3px 3px; gap: 2px; font-size: 13.5px }
    .hud .hud-stat .ico { width: 18px; height: 18px }
}

/* ================= chest loot: four to a row on every phone, a NEW card takes two slots, the last row stays centred ================= */
.chest-loot { --lg: 7px; width: min(400px, 100%); gap: var(--lg); margin-top: 8px }
.chest-loot .loot { flex: 0 0 calc((100% - 3 * var(--lg)) / 4); width: auto; min-width: 0; box-sizing: border-box; padding: 9px 4px 7px }
.chest-loot .loot.new { flex-basis: calc((100% - var(--lg)) / 2) }
.chest-loot .loot b { font-size: 16px; overflow-wrap: anywhere }
.chest-loot .loot small { font-size: 10.5px; text-align: center; overflow-wrap: anywhere }
.chest-loot .loot .l-ic { font-size: 28px }
/* the lid flies up and away when the chest bursts open, so the open chest stays centred under its title */
.chest-modal[data-state="open"] .cb-lid { transform: none; animation: lidfly .7s cubic-bezier(.2, .8, .3, 1) forwards }
@keyframes lidfly { 0% { transform: none; opacity: 1 } 35% { transform: translate(-8px, -70px) rotate(-14deg); opacity: 1 } 100% { transform: translate(-30px, -150px) rotate(-40deg) scale(.7); opacity: 0 } }

/* ================= phone alignment pass: one 16px gutter for header, HUD, quest card and tabs ================= */
@media (max-width: 760px) {
    header.top { padding-left: 16px; padding-right: 16px }
    /* the collapsed menu keeps its tabs clear of the bottom scroll roller */
    .sheet.collapsed .grip { height: 20px }
}
@media (max-width: 480px) {
    .hud, .tracker { right: 16px; max-width: none }
    .hud .hud-stat:first-of-type { margin-left: auto }
    .tracker .tr-text { flex: 1; min-width: 0 }
}
@media (max-width: 330px) {
    header.top { padding-left: 16px; padding-right: 16px; gap: 4px }
    .top-actions { gap: 4px }
    .icon { width: 32px; height: 32px }
    .seg button { padding: 4px 6px; font-size: 12px; min-height: 30px }
    .brand .en { font-size: 13.5px }
}
/* game score bars: the stats spread evenly, the fire pot sits in line instead of shoving them left */
.def-hud { gap: 6px; align-items: center }
.def-hud > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap }
.def-hud .def-pot { margin-left: 0; min-height: 32px; padding: 3px 10px }
@media (max-width: 400px) {
    .def-hud { font-size: 15px; padding: 5px 8px; gap: 4px }
    .def-hud > span { gap: 2px }
    .def-hud .def-pot { padding: 3px 8px; font-size: 14px }
}
/* party buttons: the firecracker count is a corner badge, so both labels stay on one line */
.party-row .btn { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; gap: 4px; padding-left: 8px; padding-right: 8px; font-size: 15px }
.party-row .btn { position: relative }
.party-row #act-fw-n { position: absolute; top: 3px; right: 4px; margin: 0; padding: 0 5px; font-size: 11px !important; border-radius: 999px; font: 400 12px/1.2 var(--display); opacity: 1;
    color: var(--k); background: linear-gradient(180deg, #ffe39a, var(--gold-bg)); box-shadow: 0 0 0 1.5px var(--k) }
/* menu tabs: seven equal slots that always fit, the longest label shrinks instead of pushing "Me" off screen */
.tabs button { flex: 1 1 0; min-width: 0 }
@media (max-width: 360px) {
    .tabs { gap: 1px; padding: 3px }
    .tabs button { font-size: 10px; letter-spacing: 0; padding-left: 0; padding-right: 0 }
    .tab-ic .gi { width: 22px; height: 22px }
}
/* wide screens: the header buttons line up with the right-hand column (rush pill, buttons, Xiaoyu) */
@media (min-width: 761px) {
    header.top { padding-right: 22px }
}
/* phones held sideways: an open menu would slide over the HUD, so the HUD steps aside until the menu closes */
@media (max-width: 760px) and (max-height: 420px) {
    #app:has(.sheet:not(.collapsed)) .hud { visibility: hidden }
}
@media (max-width: 760px) and (max-height: 420px) {
    /* the round buttons run in a row above the menu instead of a column up through the HUD */
    .fabs { grid-auto-flow: column; top: auto }
}

/* ================= hide and seek: her portrait peeks, the name tag becomes a warm / cold meter ================= */
.xiaoyu.hiding { animation: peekwob 2.4s ease-in-out infinite }
.xiaoyu.hiding img { object-fit: contain; background: radial-gradient(circle at 50% 40%, #fff6dc, #f3d79c) }
.xiaoyu-name.seeking { white-space: nowrap; transition: background .3s }
.xiaoyu-name.seeking[data-heat="cold"] { background: #3a6ea8 }
.xiaoyu-name.seeking[data-heat="cool"] { background: #6a8a9a }
.xiaoyu-name.seeking[data-heat="warm"] { background: #d0791e }
.xiaoyu-name.seeking[data-heat="hot"] { background: #e2301c; animation: heatpulse .6s ease-in-out infinite alternate }
@keyframes peekwob { 0%, 100% { transform: rotate(0) } 45% { transform: rotate(-6deg) } 55% { transform: rotate(5deg) } }
@keyframes heatpulse { to { transform: translateX(-50%) scale(1.12) } }
@media (prefers-reduced-motion: reduce) { .xiaoyu.hiding, .xiaoyu-name.seeking[data-heat="hot"] { animation: none } }

/* ---------------- Day 8: battles in the streets ---------------- */
body.in-battle :is(.tracker, .fabs, .rush-pill, .walk-chip, .xiaoyu, .combo) { display: none !important }
.battle-hud { position: absolute; z-index: 6; top: calc(var(--safe-t) + 118px + var(--hud-extra, 0px)); left: 16px; right: 16px; display: grid; gap: 6px; padding: 8px 10px 9px; border-radius: 16px; color: var(--cream);
    background: linear-gradient(180deg, #4a1d14, #2a110c); box-shadow: 0 0 0 2px var(--k), inset 0 0 0 1.5px #a8742c, 0 4px 0 2px var(--k), 0 10px 22px rgba(0, 0, 0, .4); animation: pop .3s cubic-bezier(.3, 1.4, .5, 1) }
.battle-hud[hidden], .battle-pad[hidden] { display: none }
.bh-top { display: flex; align-items: center; gap: 8px; min-width: 0 }
.bh-name { display: grid; min-width: 0; flex: 1; line-height: 1.15 }
.bh-name small { font: 700 10.5px var(--body); letter-spacing: .08em; text-transform: uppercase; color: #ffb08a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.bh-name b { font: 400 17px var(--display); color: var(--gold-bg-hi, #ffd36a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.bh-wave { flex: none; font: 400 14px var(--display); padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 1px rgba(255, 211, 106, .35); white-space: nowrap; font-variant-numeric: tabular-nums }
.bh-wave:empty { display: none }
.bh-flee { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--body); color: var(--cream); background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 1.5px rgba(255, 243, 214, .3); cursor: pointer }
.bh-row { display: flex; align-items: center; gap: 8px; min-width: 0 }
.bh-hearts { flex: none; font-size: 15px; letter-spacing: -1px; line-height: 1; white-space: nowrap }
.bh-bar { position: relative; flex: 1; min-width: 0; height: 22px; border-radius: 999px; overflow: hidden; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .5) }
.bh-bar[hidden] { display: none }
.bh-bar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--bhp, 1)); background: linear-gradient(180deg, #8fdc6a, #3f9a33); transition: transform .25s ease-out }
.bh-bar span { position: relative; display: block; padding: 0 10px; font: 700 12px/22px var(--body); color: #fff; text-shadow: 0 1px 0 var(--k), 0 0 4px var(--k); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.bh-bar.boss i { background: linear-gradient(180deg, #ff7656, #b5321f) }
.bh-bar.shake { animation: bhshake .35s }
@keyframes bhshake { 25% { transform: translateX(-4px) } 50% { transform: translateX(4px) } 75% { transform: translateX(-2px) } }

.battle-pad { position: absolute; z-index: 6; right: 14px; bottom: calc(112px + var(--safe-b)); display: grid; grid-template-columns: auto auto; grid-template-areas: ". throw" "dodge swing"; gap: 10px; align-items: end; justify-items: center; touch-action: manipulation; user-select: none; -webkit-user-select: none }
.bp { position: relative; border: 0; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 0; padding: 0; cursor: pointer; color: var(--cream); line-height: 1; -webkit-tap-highlight-color: transparent;
    background: radial-gradient(circle at 50% 35%, #6a2a1c, #34140d); box-shadow: 0 0 0 2.5px var(--k), inset 0 0 0 2px #c48a32, 0 4px 0 2.5px var(--k), 0 10px 18px rgba(0, 0, 0, .45) }
.bp small { font: 700 10px var(--body); letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; color: #ffe2a8 }
.bp-swing { grid-area: swing; width: 86px; height: 86px; font-size: 34px; background: radial-gradient(circle at 50% 35%, #d8452c, #7a1d10) }
.bp-dodge { grid-area: dodge; width: 64px; height: 64px; font-size: 24px }
.bp-throw { grid-area: throw; width: 54px; height: 54px; font-size: 22px }
.bp-throw b { position: absolute; right: -4px; top: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; font: 700 12px var(--body); color: var(--k); background: var(--gold-bg, #e0a93c); box-shadow: 0 0 0 2px var(--k) }
.bp:disabled { filter: grayscale(.85) brightness(.75); cursor: default }
.bp.hit { animation: bphit .18s ease-out }
@keyframes bphit { 40% { transform: scale(.88) translateY(2px) } }
.bp-dodge.cool::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(rgba(0, 0, 0, .55) var(--a, 0deg), transparent 0); animation: cooldown 1s linear forwards; pointer-events: none }
@property --a { syntax: "<angle>"; inherits: false; initial-value: 360deg }
@keyframes cooldown { from { --a: 360deg } to { --a: 0deg } }

.hit-layer { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden }
.hit-n { position: absolute; transform: translate(-50%, 0); font: 400 24px var(--display); color: #fff; text-shadow: 0 2px 0 var(--k), 0 0 3px var(--k), 0 0 6px var(--k); animation: hitn .8s ease-out forwards; white-space: nowrap }
.hit-n.crit { font-size: 32px; color: #ffd36a }
.hit-n.ouch { color: #ff7656 }
.hit-n.ally { font-size: 18px; color: #ffcfb8 }
.hit-n.miss { font-size: 18px; color: #bfe8ff }
@keyframes hitn { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.6) } 20% { opacity: 1; transform: translate(-50%, -6px) scale(1.15) } 100% { opacity: 0; transform: translate(-50%, -42px) scale(1) } }
body.hurt .hit-layer { animation: hurtflash .45s ease-out }
@keyframes hurtflash { 0% { box-shadow: inset 0 0 0 0 rgba(216, 50, 31, 0) } 25% { box-shadow: inset 0 0 90px 18px rgba(216, 50, 31, .55) } 100% { box-shadow: inset 0 0 0 0 rgba(216, 50, 31, 0) } }

.dialog.battle-over { text-align: center; justify-items: center }
.dialog.battle-over h2 { margin: 0; font: 400 28px var(--display); color: var(--gold-bg-hi, #ffd36a) }
.dialog.battle-over .note { margin: 0 }
.dialog.battle-over .rewards { justify-content: center }
.dialog.battle-over .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap }
#battle-over.lost h2 { color: #ffb08a }

.dialog.day8 { text-align: center; justify-items: center; gap: 12px }
.dialog.day8 h2 { margin: 0; font: 400 30px/1.05 var(--display); color: #ff7656; text-shadow: 0 2px 0 var(--k) }
.dialog.day8 p { margin: 0; font-size: 14.5px; line-height: 1.45 }
.d8-art { position: relative; width: 100%; height: 74px; border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #1b0f22, #4a1d14 70%, #6a2a1c); box-shadow: inset 0 0 0 2px rgba(255, 211, 106, .25) }
.d8-wall { position: absolute; left: 0; right: 0; bottom: 4px; font-size: 30px; letter-spacing: 6px; filter: saturate(.6) }
.d8-hen { position: absolute; left: 50%; bottom: 26px; font-size: 40px; transform: translateX(-50%) scaleX(-1); animation: d8hop .7s ease-in-out infinite alternate }
.d8-fire { position: absolute; right: 18%; bottom: 30px; font-size: 26px; animation: bob 1s ease-in-out infinite }
@keyframes d8hop { to { transform: translateX(-50%) scaleX(-1) translateY(-8px) rotate(-6deg) } }
.d8-tired { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, .25) }
.d8-tired img { flex: none; width: 44px; height: auto }
.dialog.day8 #d8-later { justify-self: center }
.d8-cta { padding: 9px 12px; border-radius: 12px; font-weight: 700; color: var(--k); background: linear-gradient(180deg, #ffe7a8, #f4c35e); box-shadow: 0 0 0 2px var(--k) }

.card .smashed { display: grid; gap: 8px; padding: 10px; border-radius: 12px; background: rgba(120, 40, 20, .14); box-shadow: inset 0 0 0 1.5px rgba(181, 50, 31, .45) }
.card .smashed p { margin: 0; font-size: 13.5px }
.card .smashed .btn small { display: block; font-size: 11px; opacity: .85; font-weight: 600 }

@media (min-width: 761px) {
    .battle-hud { left: 0; right: 0; margin: 0 auto; width: min(440px, calc(100% - 820px)); min-width: 320px; top: calc(var(--safe-t) + 10px) }
    .battle-pad { right: 26px; bottom: 26px }
}
@media (min-width: 761px) and (max-width: 1180px) {
    .battle-hud { top: calc(var(--safe-t) + 64px); width: auto; max-width: calc(100% - 430px); margin-left: 392px; margin-right: 22px }
}
@media (max-width: 360px) {
    .bp-swing { width: 76px; height: 76px; font-size: 30px }
    .bp-dodge { width: 58px; height: 58px }
    .bh-name b { font-size: 15px }
    .bh-hearts { font-size: 13px }
}
/* toasts drop below the battle bar */
body.in-battle .toasts { top: calc(var(--safe-t) + 252px + var(--hud-extra, 0px)) }
@media (min-width: 761px) {
    body.in-battle .toasts { top: calc(var(--safe-t) + 136px) }
}
@media (min-width: 761px) and (max-width: 1180px) {
    body.in-battle .toasts { top: calc(var(--safe-t) + 190px) }
}
/* in a battle Xiaoyu's speech bubble sits above the fight buttons */
@media (max-width: 760px) {
    body.in-battle .bubble { right: 16px; left: 16px; bottom: calc(274px + var(--safe-b)); max-width: none }
}
@media (min-width: 761px) {
    body.in-battle .bubble { right: 220px }
}
@media (prefers-reduced-motion: reduce) { .bh-bar.shake, .bp.hit, .d8-hen, .d8-fire, body.hurt .hit-layer { animation: none } }

/* ---------------- the royal forge, your gear and the arena ---------------- */
.hit-n.loot { font-size: 20px; color: #bff0c8 }
.gear-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.gear-row li, .forge-slot .fs-head { display: flex; align-items: center; gap: 10px; min-width: 0 }
.gear-row li { padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gc, #c9a45a) 60%, transparent) }
.gear-row li > span:last-child, .forge-slot .fs-head > span:last-child { display: grid; min-width: 0 }
.gear-row small, .forge-slot small { font-size: 11px; opacity: .75; text-transform: uppercase; letter-spacing: .04em }
.gear-row b, .forge-slot .fs-head b { font: 400 15px/1.15 var(--display); color: var(--gc, var(--gold-bg-hi)); overflow-wrap: anywhere }
.fs-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; border-radius: 12px; background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 2px var(--gc, #c9a45a) }
.fs-by { font-size: 11.5px; opacity: .8; overflow-wrap: anywhere }
.gear-go { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px }
.gear-go .btn { min-height: 44px; position: relative }
.gear-go .dot-badge { position: absolute; right: 6px }
#arena-note { margin-top: 6px }
.dialog.forge h2, .dialog.arena h2 { margin: 0; font: 400 26px/1.1 var(--display); color: var(--gold-bg-hi) }
.forge-smith, .ar-who { margin: 0; padding: 9px 12px; border-radius: 12px; background: rgba(0, 0, 0, .25); font-size: 14px; line-height: 1.4 }
.forge-smith b { color: var(--gold-bg-hi); overflow-wrap: anywhere }
.forge-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px }
.forge-slot { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, .2); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gc, #c9a45a) 55%, transparent) }
.forge-slot .r-addr { font-size: 12.5px; opacity: .85 }
.fs-next { margin: 0; font-size: 13px }
.fs-next b { color: var(--gold-bg-hi) }
.forge-cost { display: flex; flex-wrap: wrap; gap: 6px }
.fc { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 13px; background: rgba(0, 0, 0, .3) }
.fc .gi, .fc svg { width: 16px; height: 16px }
.fc.ok { box-shadow: inset 0 0 0 1.5px rgba(95, 208, 168, .7) }
.fc.short { box-shadow: inset 0 0 0 1.5px rgba(255, 118, 86, .8); color: #ffb08a }
.fc.time { opacity: .85 }
.forge-slot .btn { min-height: 44px }
.forge-slot .note { margin: 0 }
.forge-job { display: grid; gap: 6px; font-size: 13px }
.fj-bar { height: 10px; border-radius: 6px; overflow: hidden; background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 1.5px var(--k) }
.fj-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff7a3a, #ffd36a); transition: width .9s linear }
.card .forge-duty { background: rgba(255, 122, 58, .12); box-shadow: inset 0 0 0 1.5px rgba(255, 160, 80, .5) }
.dialog.arena { justify-items: center; text-align: center }
.dialog.arena .rules { max-width: 330px }
.ar-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px }
.ar-stats span { padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .3); font-size: 13px }
.ar-stats b { color: var(--gold-bg-hi) }
.dialog.arena .note { margin: 0 }
@media (max-width: 360px) {
    .gear-row, .gear-go { grid-template-columns: 1fr }
}
/* Kingdom completion in the Me tab */
.done-meter { display: grid; gap: 8px; margin: 14px 0 4px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1.5px rgba(255, 211, 106, .35) }
.dm-head { display: flex; align-items: baseline; gap: 8px }
.dm-head b { font: 400 26px var(--display); color: var(--gold-bg-hi) }
.dm-head span { font-weight: 700 }
.dm-bar { height: 12px; border-radius: 7px; overflow: hidden; background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 1.5px var(--k) }
.dm-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c9a45a, #ffd36a); transition: width .6s ease }
.dm-parts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px }
.dm-parts li { display: flex; justify-content: space-between; gap: 6px; padding: 5px 9px; border-radius: 9px; background: rgba(0, 0, 0, .25); font-size: 13px }
.dm-parts li.full { box-shadow: inset 0 0 0 1.5px rgba(95, 208, 168, .7) }
.dm-parts b { color: var(--gold-bg-hi); white-space: nowrap }
.dm-btns { display: flex; flex-wrap: wrap; gap: 8px }
.dm-btns .btn { flex: 1 1 140px; min-height: 40px }
/* the ending */
.dialog.ending { text-align: center; justify-items: center; gap: 8px }
.dialog.ending h2 { margin: 0; font: 400 28px/1.05 var(--display); color: var(--gold-bg-hi); text-shadow: 0 2px 0 var(--k) }
.dialog.ending > p { margin: 0; font-size: 14px; line-height: 1.4; max-width: 36ch }
.end-art { position: relative; width: 84px; height: 84px; margin-top: 12px }
.end-art img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 4px 0 var(--k)) }
.end-crown { position: absolute; left: 50%; top: -22px; font-size: 32px; transform: translateX(-50%); animation: hop .7s .2s cubic-bezier(.3, 1.6, .5, 1) both, bob 2.4s 1s ease-in-out infinite }
.end-rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 5px; width: 100%; text-align: left }
.end-rows li { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 11px; background: rgba(0, 0, 0, .25) }
.end-rows li > span:first-child { font-size: 17px; text-align: center }
.end-rows li:first-child, .end-rows li:nth-child(2) { grid-column: 1 / -1 }
.end-rows b { font-size: 13.5px }
.end-rows small { display: block; font-size: 11.5px; opacity: .8; text-transform: uppercase; letter-spacing: .04em }
.end-rows b { overflow-wrap: anywhere }
.dialog.ending .note { margin: 0 }
.end-next { margin: 0; padding: 7px 10px; border-radius: 12px; font-size: 13px; background: rgba(255, 211, 106, .12); font-weight: 600 }
.dialog.ending #end-ok { min-width: min(260px, 100%) }
/* how to play: above the splash too */
.modal.howto-modal { z-index: 40 }
.dialog.howto { gap: 10px }
.dialog.howto h2 { margin: 0; font: 400 28px var(--display); color: var(--gold-bg-hi) }
.dialog.howto .rules li { font-size: 14px; line-height: 1.4 }
.dialog.howto #howto-ok { justify-self: center; min-width: 180px }
.splash .splash-how { margin-top: 4px; color: #f3dcc0 }

/* hover feedback on every control, mouse and trackpad only (a phone never gets a stuck hover):
   a little lift in light for buttons and cards, a soft gold wash on the tabs and the 3D/2D switch */
@media (hover: hover) and (pointer: fine) {
    .btn:not(:disabled), .fab, .top-actions .icon, .hud-me, .tracker, .xiaoyu, .seg button, #tabs [role=tab] { transition: filter .12s, background-color .12s, color .12s, box-shadow .12s }
    .btn:not(:disabled):hover, .fab:hover, .top-actions .icon:hover, .hud-me:hover, .tracker:hover, .xiaoyu:hover { filter: brightness(1.1) saturate(1.06) }
    .fab:hover, .top-actions .icon:hover { filter: brightness(1.12) drop-shadow(0 0 7px rgba(255, 211, 106, .75)) }
    .seg button[aria-pressed="false"]:hover { background-color: rgba(255, 211, 106, .16) }
    #tabs [role=tab][aria-selected="false"]:hover { background-color: rgba(255, 211, 106, .12); color: #fff3d6 }
    button.link:hover { color: #ffd36a }
}

/* big stamps ("LANTERN RUSH!", "COMBO 10!") always fit a phone: they shrink with the screen and may break onto two lines */
.stamp-pop { width: max-content; max-width: 94vw }
.stamp-pop b { font-size: clamp(34px, 10.5vw, 70px); white-space: normal; text-wrap: balance; overflow-wrap: anywhere }
