/* the public pages beside the game (shop.html, refund.html, terms.html): the front page's palette, fonts and frames
   (js/ui.js makes the --fr-* frames), but a page that scrolls and is read, not a screen */
:root {
  --ink: #3a2416; --wood: #6a4a32; --red: #9a4636; --red2: #b25a46; --gold: #ecd08e; --gold2: #a8834a;
  --text: #f6ecd8; --muted: #cdb895; --jade: #8ccaa8; --line: rgba(230, 196, 126, .28); --zh: 'Ma Shan Zheng', serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--text); font-family: 'Mitr', system-ui, sans-serif; font-weight: 400; line-height: 1.7;
  background: #120a12 linear-gradient(180deg, #0d0a1c 0, #1c0f1c 420px, #120a12 900px) no-repeat; }
html[lang=en] [data-l=th], html[lang=th] [data-l=en] { display: none !important; }
a { color: var(--gold); }
a:hover { color: #fff4d8; }
.zh { font-family: var(--zh); font-weight: 400; }

.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 6px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  background: linear-gradient(#8a6444 0 2px, #6e4c34 2px calc(100% - 4px), #4e3424 calc(100% - 4px)); box-shadow: 0 2px 0 var(--ink), 0 4px 0 var(--gold2), 0 6px 12px rgba(0,0,0,.4); }
.brand { display: flex; align-items: center; gap: 8px; color: #fbe9c6; text-decoration: none; text-shadow: 2px 2px 0 #3a0806; white-space: nowrap; }
.brand img { width: 32px; height: 32px; image-rendering: pixelated; }
.brand .zh { font-size: 26px; line-height: 32px; color: #f6d27a; }
.brand b { font-weight: 500; font-size: 15px; }
.top nav { display: flex; gap: 4px 14px; flex-wrap: wrap; margin-left: auto; font-size: 14px; }
.top nav a { color: #f4e6c8; text-decoration: none; text-shadow: 1px 1px 0 #000; white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current] { color: var(--gold); }
.top nav a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }
.lang { display: flex; font-size: 13px; }
.lang button { font: inherit; background: none; border: 0; padding: 0 5px; color: #b8a888; text-shadow: 1px 1px 0 #000; cursor: pointer; }
.lang button[aria-pressed=true] { color: var(--gold); }

main { max-width: 880px; margin: 0 auto; padding: 22px 16px 40px; }
h1 { margin: 6px 0 4px; font-size: clamp(26px, 5vw, 36px); font-weight: 600; line-height: 1.25; color: #fbe9c6; text-shadow: 3px 3px 0 #3a0806; }
h1 .zh { margin-right: 10px; font-size: 1.15em; color: #f6d27a; }
.lead { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.updated { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.panel { margin: 0 0 16px; padding: 6px 14px 10px; border: 12px solid transparent; border-image: var(--fr-panel) 12 fill stretch; image-rendering: pixelated;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.45)); }
.panel h2 { margin: 0 0 6px; font-size: 18px; font-weight: 500; color: var(--gold); text-shadow: 1px 1px 0 #3a0806; }
.panel h2 .n { color: var(--gold2); margin-right: 6px; }
.panel p, .panel li { font-size: 14.5px; }
.panel p { margin: 6px 0; }
.panel ul, .panel ol { margin: 6px 0; padding-left: 22px; }
.panel li { margin: 3px 0; }
.panel li::marker { color: var(--gold2); }
b, strong { font-weight: 500; color: #fff2d8; }
.note { font-size: 13px !important; color: var(--muted); }

/* the pack cards (shop.html), filled from GET /api/gems/packs */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 10px 0 6px; }
.pack { padding: 10px 12px; background: rgba(20, 10, 6, .5); box-shadow: inset 0 0 0 1px rgba(168, 131, 74, .55), 0 0 0 2px var(--ink); }
.pack .nm { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pack .nm b { font-size: 16px; }
.pack .nm small { color: var(--muted); font-size: 12px; }
.pack .price { margin: 2px 0 6px; font-size: 24px; font-weight: 600; color: var(--gold); text-shadow: 2px 2px 0 #3a0806; font-variant-numeric: tabular-nums; }
.pack .price small { font-size: 13px; font-weight: 400; color: var(--muted); text-shadow: none; }
.pack dl { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.pack dt { color: var(--muted); }
.pack dd { margin: 0; text-align: right; }
.pack dd.first { color: var(--jade); font-weight: 500; }
.packMsg { color: var(--muted); font-size: 14px; }
.packMsg.err { color: #ff9a8a; }

/* the premium card plans (shop.html) */
.plans { width: 100%; max-width: 520px; margin: 8px 0; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.plans th, .plans td { padding: 4px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.plans th { font-weight: 500; color: var(--muted); }
.plans td:first-child { white-space: nowrap; }
.plans td:nth-child(2) { text-align: right; }
.plans th:nth-child(2) { text-align: right; }
.plans small { color: var(--jade); font-size: 12px; }

.steps { counter-reset: s; list-style: none; padding-left: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 24px; line-height: 22px; text-align: center; font-size: 13px; color: var(--gold);
  background: rgba(154, 70, 54, .5); box-shadow: inset 0 0 0 1px var(--red2); }

.cta { display: inline-block; margin-top: 6px; font-size: 15px; line-height: 26px; padding: 0 16px; color: var(--gold); text-decoration: none; text-shadow: 1px 1px 0 #3a0806;
  border: 6px solid transparent; border-image: var(--fr-red) 6 fill stretch; image-rendering: pixelated; }
.cta:hover { border-image-source: var(--fr-redhi); color: #fff4d8; }

footer { max-width: 880px; margin: 0 auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); font-size: 12.5px; color: var(--muted); }
footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 6px; }
footer p { margin: 2px 0; }
