/* ==========================================================================
   BINANCE TH Perks Q4 2026 — island page.
   Brand CI: Binance Yellow #F0B90B, Black #0B0E11, Dark Grey #53565A;
   Noto Sans Thai for Thai, Gotham for Latin. Press Start 2P is the game lettering.
   ========================================================================== */

/* Gotham's regular file also serves weight 500, so body text can ask for 500
   (Noto Sans Thai one step heavier reads better on black) while Latin stays regular. */
@font-face { font-family: 'Gotham'; src: url('../assets/fonts/gotham-400.woff2') format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Gotham'; src: url('../assets/fonts/gotham-600-700.woff2') format('woff2'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'Gotham'; src: url('../assets/fonts/gotham-800-900.woff2') format('woff2'); font-weight: 800 900; font-display: swap; }
:root {
  --bg: #0b0e11;
  --bg-veil: rgba(11, 14, 17, 0.92);
  --surface: #1e2329;
  --line: #2b3139;
  --line-strong: #474d57;
  --yellow: #f0b90b;
  --yellow-hover: #fcd535;
  --yellow-deep: #a37800;
  --yellow-tint: rgba(240, 185, 11, 0.1);
  --on-yellow: #181a20;
  --text: #eaecef;
  --muted: #b7bdc6;
  --placeholder: #8b929c;
  --surface-2: #2b3139;
  --label: #bcc0c5;
  --red: #f6465d;
  --green: #0ecb81;

  --font-pixel: 'Press Start 2P', monospace;
  --font-body: 'Gotham', 'Noto Sans Thai', system-ui, sans-serif;
  --ci-grey: #53565a;

  --gutter: clamp(12px, 3vw, 28px);
  --hud-h: 64px;
  --tap: 44px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-block: 6px 6px 0 3px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--yellow); text-underline-offset: 3px; }
a:hover { color: var(--yellow-hover); }
strong, b { font-weight: 700; }
::selection { background: var(--yellow); color: var(--on-yellow); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
input { caret-color: var(--yellow); }

.pixel { font-family: var(--font-pixel); font-weight: 400; letter-spacing: 0.04em; line-height: 1.4; }
.y { color: var(--yellow); }
.white { color: var(--text); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 0.9em; height: 0.9em; flex: none; fill: currentColor; shape-rendering: crispEdges; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 8px 18px;
  font: 600 1rem var(--font-body);
  color: var(--on-yellow);
  background: var(--yellow);
  border: 0;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--bg), 3px 3px 0 3px rgba(0, 0, 0, 0.5);
}
.btn-primary:hover { color: var(--on-yellow); background: var(--yellow-hover); }

/* --- stage ---------------------------------------------------------------- */
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 1.2s ease;
}
body.world-ready #world { opacity: 1; }

.fallback {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
}
.fallback img { width: min(92vw, 70vh); height: auto; opacity: 0.55; image-rendering: pixelated; }
body.no-webgl .fallback { display: grid; }
body.no-webgl #world,
body.no-webgl .tags { display: none; }

/* small, non-blocking progress while the island loads */
.world-status {
  position: fixed;
  left: 50%;
  top: calc(var(--hud-h) + 8px);
  z-index: 25;
  width: 120px;
  height: 8px;
  margin-left: -60px;
  border: 2px solid var(--line-strong);
  transition: opacity 0.4s ease;
}
.world-status span { display: block; height: 100%; background: var(--yellow); transform: scaleX(0); transform-origin: left; transition: transform 0.3s steps(6); }
body.world-ready .world-status, body.no-webgl .world-status, .no-js .world-status { opacity: 0; visibility: hidden; }

.noscript { position: fixed; left: 50%; bottom: 32px; z-index: 95; transform: translateX(-50%); }

/* --- screens ----------------------------------------------------------------
   Showing is instant for visibility (so focus can move in right away);
   hiding keeps visibility until the fade-out has finished. */
.screen {
  transition: opacity 0.35s ease, transform 0.5s var(--ease), visibility 0s linear 0s;
}
.screen:not(.is-active) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s var(--ease), visibility 0s linear 0.4s;
}

/* --- RPG window ------------------------------------------------------------ */
.window {
  background: var(--bg-veil);
  border: 3px solid var(--text);
  box-shadow: 0 0 0 3px var(--bg), var(--shadow-block);
}
.window-title { margin: 0 0 6px; padding-left: 10px; font-size: 0.7rem; color: var(--muted); }

/* --- HUD ------------------------------------------------------------------- */
.hud {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--hud-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) var(--gutter) 0;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0s linear 0s;
}
.hud > * { pointer-events: auto; }
body[data-state='title'] .hud, .no-js .hud { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }

/* BINANCE TH logo, a hairline, then PERKS Q4 2026: one link back to the menu */
.hud-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--tap);
  min-width: 0;
  color: var(--yellow);
  text-decoration: none;
  text-shadow: 2px 2px 0 var(--bg);
}
.hud-brand-text { display: grid; gap: 2px; padding-left: 14px; border-left: 2px solid var(--line-strong); }
.hud-brand .pixel { font-size: 0.75rem; }
.hud-brand small { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; }
.hud-right { display: flex; align-items: center; gap: 12px; }
.hud-logo { flex: none; width: 72px; height: auto; filter: drop-shadow(2px 2px 0 var(--bg)); } /* no box behind it: the shadow keeps it readable over the island, like the HUD text */
.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  font-size: 0.7rem;
  color: var(--on-yellow);
  background: var(--yellow);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0 0 3px var(--bg), 3px 3px 0 3px rgba(0, 0, 0, 0.5);
}
.hud-btn:hover { color: var(--on-yellow); background: var(--yellow-hover); }
.hud-sound { width: var(--tap); justify-content: center; padding: 0; color: var(--text); background: var(--bg-veil); border: 3px solid var(--line-strong); cursor: pointer; }
.hud-sound .icon { width: 18px; height: 18px; }
.hud-sound[aria-pressed='true'] { color: var(--yellow); border-color: var(--yellow); }
.hud-sound:hover { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }
/* the signed-in UID: a label, not a button (no fill, no hover), so it reads as information */
.hud-uid {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  margin: 0;
  padding: 0 12px;
  font-size: 0.7rem;
  color: var(--text);
  white-space: nowrap;
  background: var(--bg-veil);
  border: 3px solid var(--line-strong);
}
.hud-uid[hidden] { display: none; }
.hud-uid-key { color: var(--muted); }
/* LOG OUT: the quietest button, so it never competes with MY STARS or MENU */
.hud-logout { color: var(--text); background: var(--bg-veil); box-shadow: none; border: 3px solid var(--line-strong); padding: 0 11px; cursor: pointer; }
.hud-logout .icon { width: 14px; height: 14px; }
.hud-logout[hidden] { display: none; }
.hud-logout:hover { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }
.hud-player { color: var(--yellow); background: var(--bg-veil); border: 3px solid var(--yellow); padding: 0 11px; }
.hud-player:hover { color: var(--on-yellow); }
body[data-state='menu'] #hud-menu { display: none; }
body[data-state='stars'] .hud-player { color: var(--on-yellow); background: var(--yellow); }

/* --- title ----------------------------------------------------------------- */
.title-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px var(--gutter);
  text-align: center;
  background: radial-gradient(ellipse 60% 50% at center, rgba(11, 14, 17, 0.78) 0%, rgba(11, 14, 17, 0.35) 60%, rgba(11, 14, 17, 0) 100%);
}
.no-js .title-screen { opacity: 1; visibility: visible; pointer-events: auto; }
.no-js .btn-start { display: none; }

.title-logo {
  margin: 0;
  font-size: clamp(1.9rem, 7vw, 4.2rem);
  line-height: 1.25;
  color: var(--yellow);
  text-shadow: 0 4px 0 var(--yellow-deep), 0 8px 0 var(--bg), 6px 10px 0 rgba(0, 0, 0, 0.55);
}
/* a 2px pixel outline keeps small title text readable over the moving island */
.title-season, .title-sub {
  margin: 0;
  color: var(--text);
  text-shadow: 2px 0 0 var(--bg), -2px 0 0 var(--bg), 0 2px 0 var(--bg), 0 -2px 0 var(--bg), 2px 2px 0 var(--bg), -2px -2px 0 var(--bg), 2px -2px 0 var(--bg), -2px 2px 0 var(--bg);
}
.title-season { font-size: clamp(0.8rem, 2.4vw, 1.1rem); }
.title-sub { margin: 4px 0 10px; font-weight: 400; }

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 26px;
  font-size: clamp(0.85rem, 2.6vw, 1.05rem);
  color: var(--on-yellow);
  background: var(--yellow);
  text-decoration: none;
  box-shadow: 0 0 0 4px var(--bg), 6px 6px 0 4px rgba(0, 0, 0, 0.55);
  animation: pulse 1.2s steps(2) infinite;
}
.btn-start:hover, .btn-start:focus-visible { color: var(--on-yellow); background: var(--yellow-hover); animation: none; }
@keyframes pulse { 50% { transform: translateY(2px); box-shadow: 0 0 0 4px var(--bg), 3px 3px 0 4px rgba(0, 0, 0, 0.55); } }

.title-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  font-size: 0.92rem;
  background: var(--bg-veil);
}
.title-link .icon { width: 0.7em; height: 0.7em; }

/* --- menu + dialog --------------------------------------------------------- */
.dock {
  position: fixed;
  z-index: 30;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  max-height: calc(100dvh - var(--hud-h) - var(--gutter) - 12px);
  display: flex;
  align-items: flex-end;
  gap: 24px;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock:not(.is-active) { transform: translateY(24px); }

.menu { flex: none; width: min(300px, 100%); max-height: 100%; overflow-y: auto; padding: 12px 8px 8px; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu-item {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: var(--tap);
  padding: 10px 12px 10px 34px;
  color: var(--text);
  text-decoration: none;
}
.menu-item .pixel { font-size: 0.78rem; }
/* pixel cursor: shown on hover/focus, and on the first item until the menu is used */
.menu-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 13px;
  width: 10px;
  height: 12px;
  background: var(--yellow);
  clip-path: polygon(0 0, 20% 0, 20% 10%, 40% 10%, 40% 25%, 60% 25%, 60% 40%, 80% 40%, 80% 60%, 60% 60%, 60% 75%, 40% 75%, 40% 90%, 20% 90%, 20% 100%, 0 100%);
  visibility: hidden;
}
.menu-item:hover, .menu-item:focus-visible { color: var(--yellow); background: var(--yellow-tint); }
.menu-item:focus-visible { outline-offset: -3px; }
.menu-item:hover::before, .menu-item:focus-visible::before,
.menu:not(:hover):not(:focus-within) li:first-child .menu-item::before { visibility: visible; }
.menu-item:hover::before, .menu-item:focus-visible::before { animation: nudge 0.6s steps(2) infinite; }
.menu-item[aria-current='page'] .pixel { color: var(--yellow); }
@keyframes nudge { 50% { transform: translateX(3px); } }

.dialog {
  flex: 1;
  max-width: 640px;
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
}
.dialog p { margin: 0; min-height: 3.2em; }
.dialog-face { flex: none; width: 64px; height: 64px; image-rendering: pixelated; background: var(--surface); border: 2px solid var(--line-strong); }

/* --- landmark labels ------------------------------------------------------- */
.tags { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 8px 10px 7px;
  font-size: 0.62rem;
  color: var(--on-yellow);
  background: var(--yellow);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0 0 3px var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
/* invisible hit area brings the tap target up to 44px */
.tag::before { content: ''; position: absolute; inset: -9px -6px; }
.tag::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--yellow);
}
.tag.is-visible { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.25s ease, visibility 0s; }
.tag:hover { color: var(--on-yellow); background: var(--yellow-hover); }
.tag { box-shadow: 0 0 0 3px #fff; }
.tag::after { filter: drop-shadow(0 3px 0 #fff); }

/* phones: labels 20% smaller so they stop covering the buildings */
@media (max-width: 599px), (max-width: 899px) and (orientation: portrait) {
  .tag { padding: 6px 8px 6px; font-size: 0.5rem; box-shadow: 0 0 0 2px #fff; }
  .tag::before { inset: -12px -8px; }
  .tag::after { bottom: -7px; margin-left: -4px; border-width: 4px; filter: drop-shadow(0 2px 0 #fff); }
}

/* --- zone panel -------------------------------------------------------------- */
.panel {
  position: fixed;
  z-index: 30;
  top: calc(var(--hud-h) + 12px);
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  /* three quarters of the screen; the island keeps the left quarter, where the camera frames
     the landmark, its keeper and the player */
  width: calc(75vw - var(--gutter));
  display: flex;
  flex-direction: column;
}
.panel:not(.is-active) { transform: translateX(calc(100% + 40px)); }
.panel-grip { display: none; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 20px;
  border-bottom: 3px solid var(--line-strong);
}
.panel-head h2 { margin: 0; font-size: 0.95rem; color: var(--yellow); }
.panel-head h2:focus { outline: none; }
/* focus lands here on every screen change; mark it without boxing the title */
.panel-head h2:focus-visible { outline: none; text-decoration: underline 3px var(--yellow); text-underline-offset: 8px; }
.panel-close {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  color: var(--text);
  border: 3px solid var(--line-strong);
}
.panel-close .icon { width: 14px; height: 14px; }
.panel-close:hover { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px 24px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}
.panel-body section { display: grid; gap: 12px; }
.panel-body section[hidden] { display: none; }

/* no room for the UID next to the brand and four buttons: the Dashboard shows it */
@media (max-width: 999px) {
  .hud-uid:not([hidden]) { display: none; }
}

.panel-back {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  color: var(--text);
  border: 3px solid var(--line-strong);
}
.panel-back[hidden] { display: none; }
.panel-back .icon { width: 14px; height: 14px; }
.panel-back:hover { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }
.panel-head h2 { flex: 1; }

.panel-body { display: grid; align-content: start; gap: 16px; }
.panel-body > * { margin: 0; min-width: 0; }

.label, .b-badge, .b-tag { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label); }
.note { font-size: 0.85rem; color: var(--muted); }
.empty { padding: 20px; text-align: center; color: var(--muted); background: var(--surface); border: 2px dashed var(--line-strong); }
.gold, .y { color: var(--yellow); }
.inline-link { color: var(--yellow); }
.btn-inline {
  display: inline-block;
  margin: 2px 0;
  padding: 4px 10px;
  font-weight: 600;
  color: var(--on-yellow);
  background: var(--yellow);
  text-decoration: none;
}
.btn-inline:hover { color: var(--on-yellow); background: var(--yellow-hover); }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: 2px solid var(--line-strong);
  white-space: nowrap;
}
.btn-ghost:hover { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }
.flag { display: inline-block; margin-right: 6px; padding: 1px 6px; font: 400 0.6rem var(--font-pixel); color: var(--on-yellow); background: var(--yellow); vertical-align: 2px; }
.flag-hot { background: var(--red); color: #fff; }

.keeper { display: flex; align-items: center; gap: 14px; }
.keeper img { flex: none; width: 64px; height: 64px; object-fit: contain; object-position: bottom; image-rendering: pixelated; background: var(--surface); border: 2px solid var(--line-strong); }
.keeper p { position: relative; margin: 0; padding: 10px 14px; background: var(--surface); border: 2px solid var(--text); }
.keeper p::before { content: ''; position: absolute; left: -10px; top: 50%; margin-top: -6px; border: 6px solid transparent; border-right: 4px solid var(--text); border-left: 0; }

/* zone landing cards */
.zone-card {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 2px solid var(--line);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.zone-card .pixel { font-size: 0.78rem; line-height: 1.6; }
.zone-card small { font-size: 0.92rem; color: var(--muted); }
.zone-card:hover { color: var(--text); border-color: var(--yellow); transform: translateX(-3px); }

/* --- content blocks ------------------------------------------------------------ */
.b-hero {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 20px 22px;
  background: linear-gradient(150deg, rgba(240, 185, 11, 0.12), transparent 65%), var(--surface);
  border: 2px solid var(--line);
}
.b-hero h3 { margin: 0; font-size: clamp(1.35rem, 2.2vw, 1.9rem); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; text-wrap: balance; }
.b-hero p { margin: 0; max-width: 68ch; color: var(--muted); }
.b-hero .btn-primary { margin-top: 6px; }
.b-badge { padding: 3px 10px; color: var(--yellow); border: 1px solid rgba(240, 185, 11, 0.4); background: var(--yellow-tint); }
.b-tag { color: var(--on-yellow); background: var(--yellow); padding: 3px 10px; }

.b-heading { margin: 10px 0 -4px; padding-bottom: 8px; font-size: 1.15rem; font-weight: 700; border-bottom: 2px solid var(--line); }
.b-heading.gold ~ .b-list a { font-weight: 700; }
.b-text { max-width: 72ch; }
.b-text.small { font-size: 0.9rem; color: var(--muted); }
.b-list { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }
.b-list li::marker { color: var(--yellow); }
.b-list.number { padding-left: 1.8em; }
.b-list.number li::marker { font-weight: 700; }
.b-btn { margin: 0; }
hr.b { border: 0; border-top: 2px solid var(--line); }

.b-notice { padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.b-notice.info { text-align: center; font-size: 0.9rem; border-style: dashed; }
.b-notice.gold { color: var(--text); background: rgba(240, 185, 11, 0.07); border-color: rgba(240, 185, 11, 0.28); }
.b-notice.gold b { color: var(--yellow); }
.b-notice.warn { border-color: rgba(246, 70, 93, 0.4); background: rgba(246, 70, 93, 0.08); }
.b-notice.good { border-color: rgba(14, 203, 129, 0.4); background: rgba(14, 203, 129, 0.08); }
/* gold notices in a row read as one callout with hairlines between the rules */
.b-notice.gold:has(+ .b-notice.gold) { border-bottom-color: transparent; }
.b-notice.gold + .b-notice.gold { margin-top: -16px; border-top-color: rgba(240, 185, 11, 0.14); }

/* tables */
.table-wrap { overflow-x: auto; border: 2px solid var(--line); background: var(--surface); scrollbar-color: var(--line-strong) transparent; }
.table-wrap:focus-visible { outline-offset: 0; }
.b-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.b-table.fixed { table-layout: fixed; min-width: 640px; }
.b-table.nw td { white-space: nowrap; }
.b-table.nw.fixed { min-width: 920px; }
.b-table th, .b-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.b-table th { font-size: 0.86rem; font-weight: 700; text-align: left; background: var(--surface-2); }
.b-table.accent th { color: var(--on-yellow); background: var(--yellow); }
.b-table .th-title { display: block; }
.b-table .th-sub { display: block; margin-top: 4px; font-size: 0.78rem; font-weight: 500; opacity: 0.85; }
.b-table td:first-child { font-weight: 600; }
.b-table.center th, .b-table.center td { text-align: center; }
.b-table .ta-mark { text-align: center; }
/* centred tables merge cells down with "^": only the merged (rowspan) cells carry weight, as in the planner's file */
.b-table.center td:first-child { font-weight: 500; }
.b-table.center td[rowspan] { font-weight: 600; }
.b-table .ta-left { text-align: left !important; }
.b-table .ta-big { font-size: 1.05rem; white-space: nowrap; }
.b-table tr.row-em td { background: var(--surface-2); font-weight: 600; }
.b-table tr.row-head td { background: var(--yellow); color: var(--on-yellow); font-weight: 700; letter-spacing: 0.06em; text-align: center; }
.b-table tbody tr:last-child td { border-bottom: 0; }
.b-caption { margin: 8px 0 0; font-size: 0.88rem; color: var(--muted); }
.b-caption.right { text-align: right; }

.emblem { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-right: 10px; vertical-align: middle; background: var(--bg); border: 2px solid var(--line-strong); overflow: hidden; }
.badge-sprite { display: block; width: 36px; height: 36px; object-fit: contain; object-position: bottom; image-rendering: pixelated; }

/* accordion */
.b-acc { display: grid; gap: 8px; }
.b-acc details, .side-quest { background: var(--surface); border: 2px solid var(--line); }
.b-acc summary, .side-quest summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.b-acc summary::-webkit-details-marker, .side-quest summary::-webkit-details-marker { display: none; }
.b-acc summary::after, .side-quest summary::after { content: '+'; margin-left: auto; font-family: var(--font-pixel); font-size: 0.8rem; color: var(--yellow); }
.b-acc details[open] summary::after, .side-quest[open] summary::after { content: '-'; }
.b-acc details[open], .side-quest[open] { border-color: var(--line-strong); }
.b-acc summary:hover, .side-quest summary:hover { color: var(--yellow); }
.acc-body { padding: 4px 18px 16px; color: var(--muted); }
.acc-body a { word-break: break-all; }
.acc-flat { padding: 12px 16px; font-weight: 600; background: var(--surface); border: 2px solid var(--line); }

/* quest overview (from Home) */
.quest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.quest { padding: 16px 18px; background: var(--surface); border: 2px solid var(--line); }
.quest-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.quest-head h3 { flex: 1; margin: 0; font-size: 0.8rem; color: var(--yellow); line-height: 1.6; }
.quest-no { display: grid; place-items: center; width: 30px; height: 30px; font-size: 0.7rem; color: var(--on-yellow); background: var(--yellow); }
.quest-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; }
.quest-grid ul { margin: 6px 0 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: 0.95rem; }
.quest-grid li::marker { color: var(--yellow); }
.quest-prize { margin: 6px 0 0; font-weight: 700; color: var(--text); }

/* side quests + pills */
.side-quests { display: grid; gap: 8px; }
.sq-title { display: grid; min-width: 0; }
.sq-title small { font-weight: 500; color: var(--muted); }
.sq-reward { color: var(--yellow); white-space: nowrap; }
.pill { flex: none; padding: 3px 9px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--green); background: rgba(14, 203, 129, 0.12); }
.pill-off { color: var(--muted); background: rgba(83, 86, 90, 0.35); }
.pill-hot { color: var(--red); background: rgba(246, 70, 93, 0.12); }
.pill-pending { color: var(--yellow); background: var(--yellow-tint); }
.pill-rejected { color: var(--red); background: rgba(246, 70, 93, 0.12); }

/* --- sign in ------------------------------------------------------------------ */
.signin { display: grid; gap: 12px; max-width: 460px; padding: 18px 20px; background: var(--surface); border: 2px solid var(--yellow); }
.signin h3 { margin: 0; font-size: 0.8rem; }
.signin > p { margin: 0; }
.signin-form { display: grid; gap: 6px; }
.signin-form label { font-size: 0.9rem; color: var(--label); margin-top: 6px; }
.signin-form input {
  min-height: var(--tap);
  padding: 8px 12px;
  font: 500 1.05rem var(--font-body);
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--line-strong);
  border-radius: 0;
}
.signin-form input::placeholder { color: var(--placeholder); }
.signin-form input:focus-visible { outline-offset: 0; border-color: var(--yellow); }
.signin-form .btn-primary { margin-top: 8px; }

/* the planner's checkout questions, as a page of the Perks Shop */
.ship-form { display: grid; gap: 14px; max-width: 720px; padding: 20px; background: var(--surface); border: 2px solid var(--line-strong); }
.ship-form h3 { margin: 0; font-size: 1.1rem; }
.ship-form .eyebrow { margin: 0; font-size: 0.8rem; color: var(--label); }
/* the checkout's image pickers (js/world/player.js): the thumbnail, the file button and the hint */
.ship-pick { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.ship-prev:empty { display: none; }
.ship-prev img { display: block; width: 96px; height: 96px; object-fit: cover; border: 2px solid var(--line-strong); }
.ship-pick-side { display: grid; gap: 6px; align-content: start; }
.ship-file { font-size: 0.85rem; color: var(--muted); }
.ship-clear { justify-self: start; }
.ship-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ship-items li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ship-items .total { font-weight: 700; }
.ship-items .total b { color: var(--yellow); }
.ship-form .field { display: grid; gap: 6px; }
.ship-form label { font-size: 0.92rem; color: var(--text); line-height: 1.6; }
.ship-form .qn { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-right: 4px; font-size: 0.8rem; font-weight: 700; color: var(--on-yellow); background: var(--yellow); }
.ship-form .qhint, .ship-form .hint { color: var(--label); font-size: 0.85rem; }
.ship-form input, .ship-form textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: 500 1rem var(--font-body);
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--line-strong);
}
.ship-form input::placeholder, .ship-form textarea::placeholder { color: var(--placeholder); }
.ship-form input:focus-visible, .ship-form textarea:focus-visible { outline-offset: 0; border-color: var(--yellow); }
.ship-form .privacy-note { margin: 0; font-size: 0.85rem; line-height: 1.7; color: var(--label); overflow-wrap: anywhere; }
.ship-form .privacy-note b { display: block; color: var(--text); }
.ship-form .form-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.form-error { margin: 4px 0 0; min-height: 1.4em; font-size: 0.9rem; color: var(--red); }
.link-btn { min-height: var(--tap); padding: 0; font: inherit; font-size: 0.92rem; color: var(--yellow); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* --- dashboard ------------------------------------------------------------------ */
.test-note { padding: 8px 14px; font-size: 0.9rem; color: var(--on-yellow); background: var(--yellow); }
.plaque {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.14), transparent 60%), var(--surface);
  border: 2px solid rgba(240, 185, 11, 0.5);
}
.plaque-sprite { width: 144px; height: 144px; object-fit: contain; object-position: bottom; image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.45)); }
.plaque-main { display: grid; gap: 6px; }
.plaque-main p { margin: 0; }
.plaque-who { font-size: 0.95rem; color: var(--muted); }
.plaque-rank { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label); }
.plaque-tier { font-size: clamp(0.95rem, 1.6vw, 1.25rem); color: var(--yellow); line-height: 1.5; }
.notches { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; max-width: 420px; }
.notches span { height: 12px; background: var(--line); }
.notches span.on { background: var(--yellow); box-shadow: 0 0 8px rgba(240, 185, 11, 0.5); }
.plaque-next b { color: var(--yellow); }
.plaque-stars { display: grid; gap: 8px; margin: 0; min-width: 170px; }
.plaque-stars div { display: flex; justify-content: space-between; gap: 16px; font-size: 0.9rem; }
.plaque-stars dt { color: var(--label); }
.plaque-stars dd { margin: 0; font-variant-numeric: tabular-nums; }
.plaque-stars .total { display: grid; gap: 0; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.plaque-stars .total dt { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.plaque-stars .total dd { font: 400 1.5rem var(--font-pixel); color: var(--yellow); }

.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.card-actions .btn-ghost { background: none; font-family: var(--font-body); cursor: pointer; }
.card-actions small { color: var(--muted); }
/* the card's time of day: three toggles in the card dialog (openCard in js/world/card.js) */
.card-scene { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.card-scene > span { font-size: 0.85rem; color: var(--muted); margin-right: 2px; }
.card-scene .btn-ghost { gap: 8px; background: none; font-family: var(--font-body); font-weight: 600; color: var(--text); cursor: pointer; }
.card-scene .btn-ghost[aria-pressed="true"] { color: var(--yellow); border-color: var(--yellow); }
.card-scene .btn-ghost[aria-pressed="true"]:hover { color: var(--on-yellow); }
@media (max-width: 600px) {
  .card-scene > span { flex-basis: 100%; text-align: center; }
  .card-scene .btn-ghost { flex: 1 1 0; justify-content: center; padding: 0 6px; }
}
.swatch { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-strong); }
.swatch-day { background: linear-gradient(#f0b90b 50%, #c9a04e 50%); }
.swatch-dusk { background: linear-gradient(#8a3f7a 25%, #f7b36a 25% 50%, #d1a45a 50%); }
.swatch-night { background: linear-gradient(#0b0e11 50%, #3a3f47 50%); }
.class-pick { display: grid; gap: 12px; padding: 16px; background: var(--surface); border: 2px solid var(--yellow); }
.class-pick.is-set { border-color: var(--line); }
.class-pick h3 { margin: 0; font-family: var(--font-body); font-size: 0.98rem; font-weight: 700; letter-spacing: 0.02em; color: var(--yellow); }
.class-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 460px; }
.class-option {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 6px 10px;
  font: 600 0.95rem var(--font-body);
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--line-strong);
  cursor: pointer;
}
.class-option img { width: 64px; height: 64px; object-fit: contain; object-position: bottom; image-rendering: pixelated; }
.class-option:hover, .class-option[aria-pressed='true'] { border-color: var(--yellow); color: var(--yellow); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.dash-grid .b { display: grid; gap: 12px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ladder li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface); border: 2px solid var(--line); }
.ladder li:not(.current) .badge-sprite { opacity: 0.45; filter: grayscale(0.6); }
.ladder li:not(.current) b { color: var(--muted); }
.ladder li.current { border-color: var(--yellow); background: rgba(240, 185, 11, 0.07); }
.ladder .badge-sprite { width: 40px; height: 40px; background: var(--bg); }
.ladder b { display: block; }
.ladder small { color: var(--muted); }
.lb tr.me td { background: rgba(240, 185, 11, 0.1); color: var(--yellow); }
.tier-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tier-cell .badge-sprite { width: 32px; height: 32px; }

/* --- Perks Shop ------------------------------------------------------------------ */
.shop-stars b { color: var(--yellow); }
.shop-stars small { display: block; color: var(--muted); }
.subtabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); }
.subtabs a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.subtabs a[aria-current='page'] { color: var(--yellow); border-bottom-color: var(--yellow); }
.subtabs .count { padding: 0 6px; font-size: 0.75rem; color: var(--on-yellow); background: var(--yellow); }
.rewards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
/* a column: the picture, name and price on top; sizes, quantity and notes pinned to the bottom so
   every card's quantity box lines up across the row */
.reward { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--surface); border: 2px solid var(--line); }
.reward-sizes { display: grid; align-content: start; gap: 8px; margin-top: auto; }
.reward-buy { display: grid; align-content: start; }
.reward-sizes:empty, .reward-buy:empty { display: none; }
.reward-sizes:empty + .reward-buy { margin-top: auto; }
.reward-note { margin: 0; min-height: 2.7em; display: grid; align-content: start; gap: 2px; }
/* The boss did not like the cards' lines landing at different heights (2026-09-28). Each card is a
   subgrid of six rows — picture, name, price, sizes, counter, note — so the shelf sizes each row for
   the whole row of cards at once and every line starts level, however long a name is and whether or
   not an item has sizes. An empty part keeps its place, which is what holds the rest in line; the
   six rows are the six parts rewardGrid() always writes (js/world/player.js). Where subgrid is
   missing the cards stay as they were: bottom-aligned, nothing worse than before. */
@supports (grid-template-rows: subgrid) {
  .reward { display: grid; grid-template-rows: subgrid; grid-row: span 6; gap: 12px; }
  .reward-sizes, .reward-sizes:empty + .reward-buy { margin-top: 0; }
  .reward-sizes:empty, .reward-buy:empty { display: block; }
  /* the sizes sit at the foot of their row, so "เลือก Size ก่อน" stays level from card to card and a
     second row of buttons, if an item ever needs one, grows upwards instead of pushing it down */
  .reward-sizes { align-content: end; }
}
.reward-zoom { display: block; padding: 0; background: none; border: 0; cursor: zoom-in; }
.reward-zoom:hover img, .reward-zoom:focus-visible img { outline: 2px solid var(--yellow); outline-offset: -2px; }
.zoom-modal img { width: min(86vw, calc(100vh - 200px), 640px); width: min(86vw, calc(100dvh - 200px), 640px); aspect-ratio: 1; object-fit: contain; background: radial-gradient(circle at 50% 55%, #3a404a 0%, #22272e 62%); }
.zoom-modal img.pixel-art { padding: 10%; image-rendering: pixelated; }
.zoom-modal .zoom-name { font-weight: 700; color: var(--text); }
.reward img, .reward .no-art { width: 100%; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; background: radial-gradient(circle at 50% 55%, #3a404a 0%, #22272e 62%); }
.reward img { padding: 12%; }
.reward .no-art { display: grid; place-items: center; font-size: 0.85rem; color: var(--muted); }
.reward.is-short img { opacity: 0.55; filter: grayscale(0.5); }
.reward-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0; font-size: 0.88rem; color: var(--muted); }
.reward small { font-size: 0.85rem; color: var(--muted); text-align: center; }
/* two-line names must not make one card taller than the next */
.reward > b { display: flex; align-items: flex-start; min-height: 2.9em; }
/* an uploaded photo fills its square instead of floating inside a padded box */
.reward img { padding: 0; object-fit: cover; }
/* แตะแล้วตอบสนองทันที ไม่ซูมเผลอตอนดับเบิลแตะ */
button, a, summary, .tag, .zone-card, .menu-item { touch-action: manipulation; }
.hud, .dock, .panel-head, .tags { -webkit-user-select: none; user-select: none; }
.table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
/* รายละเอียดสินค้า อ่านเหมือนกระดาษบรีฟเดียวกับหัวข้อคอนเทนต์ */
.reward-detail { text-align: left; }
.reward-detail summary { display: flex; align-items: flex-start; gap: 6px; min-height: 2.9em; font-size: 1rem; font-weight: 700; color: var(--text); cursor: pointer; list-style: none; }
.reward-detail summary:hover { color: var(--yellow); }
.reward-detail summary::after { color: var(--yellow); }
.reward-detail[open]::before { content: ''; position: fixed; inset: 0; z-index: 80; background: rgba(6, 8, 11, 0.74); }
.reward-detail[open] > div {
  position: fixed; z-index: 81; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(700px, calc(100vw - 28px)); max-height: 74vh; overflow-y: auto;
  margin: 0; padding: 22px 24px; font-size: 0.95rem; line-height: 1.8;
  border: 3px solid var(--yellow); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}
.rd-title { display: block; margin-bottom: 12px; padding-right: 46px; font-size: 1.15rem; font-weight: 700; color: #0b0e11; }
.rd-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center;
  font: 700 17px var(--font-body); line-height: 1; color: #0b0e11; background: transparent; border: 2px solid #d5d0c3; cursor: pointer; }
.rd-close:hover { color: #0b0e11; background: var(--yellow); border-color: var(--yellow); }
.reward-detail:not([open]) .rd-close { display: none; }
.reward-detail summary::-webkit-details-marker { display: none; }
.reward-detail summary::after { content: '+'; margin-left: auto; padding-left: 8px; font-family: var(--font-pixel); font-size: 0.62rem; line-height: 1.6; }
.reward-detail[open] summary::after { content: ' -'; }
.reward-detail > div { margin-top: 8px; padding: 10px 12px; font-size: 0.86rem; line-height: 1.7; color: #0b0e11; background: #ffffff; border: 2px solid var(--line-strong); }
.reward-detail > div a { color: #8a6a0e; }
.reward-detail > div b, .reward-detail > div strong, .reward-detail > div .gold, .reward-detail > div .y { color: #0b0e11; }
/* the hero's call to action sits on the right, clear of the heading and blurb */
.b-hero { grid-template-columns: minmax(0, 1fr) auto; column-gap: 18px; }
.b-hero > * { grid-column: 1; }
.b-hero .btn-primary { grid-column: 2; grid-row: 1 / -1; justify-self: end; align-self: start; margin-top: 0; }
.b-hero h3.pixel { font-size: clamp(0.92rem, 1.7vw, 1.3rem); line-height: 1.65; letter-spacing: 0; }
/* ป้ายเหลืองได้กรอบเงาแบบเดียวกับปุ่ม จะได้ดูเป็นชิ้นเดียวกัน */
.b-hero .b-tag { display: inline-block; padding: 7px 12px; font-weight: 700; line-height: 1.4; box-shadow: none; margin-bottom: 0; }
.achievement-kicker { font-family: var(--font-body); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; }
@media (max-width: 560px) {
  .b-hero { grid-template-columns: minmax(0, 1fr); }
  .b-hero .btn-primary { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 8px; }
}
/* Four to a row, always: no item in the shop has more than four sizes (S, M, 2XL, 3XL on the white
   T-shirt), so every card's sizes fit on one line and land level with the next card's. A fifth size
   would start a second row, which the subgrid above still keeps level. The buttons are smaller than
   a full 44px tap target to fit four across a 200px card — the boss asked for that (2026-09-28);
   they are still 38px, and spaced, so they stay comfortable to hit. */
.reward .sizes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.reward .size {
  min-width: 0; height: 38px; padding: 0 4px;
  font: 700 0.82rem var(--font-body); color: var(--text); background: none; border: 2px solid var(--line-strong); cursor: pointer;
}
.reward .size:hover:not(:disabled) { border-color: var(--yellow); }
.reward .size[aria-pressed='true'] { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }
.reward .size:disabled { color: #8a9099; text-decoration: line-through; cursor: not-allowed; } /* sold out */
.reward .size-list { margin: 0; font-size: 0.85rem; color: var(--muted); }
.reward .need { color: #ff6f80; } /* Binance red lifted one step so small text clears 4.5:1 */
.stepper { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center; border: 2px solid var(--line-strong); }
.stepper button { height: var(--tap); font: 700 1.2rem var(--font-body); color: var(--text); background: none; border: 0; cursor: pointer; }
.stepper button:hover:not(:disabled) { color: var(--on-yellow); background: var(--yellow); }
.stepper button:disabled { color: #8a9099; cursor: not-allowed; } /* dimmer than enabled, still 4.5:1 on the card */
.stepper output { text-align: center; font-variant-numeric: tabular-nums; }
.cart-bar { position: sticky; bottom: -24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--bg); border: 2px solid var(--yellow); }
.cart-bar p { margin: 0; }
.requests { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.request { display: grid; gap: 6px; padding: 14px 16px; background: var(--surface); border: 2px solid var(--line); }
.request-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.request small { color: var(--muted); }
.request ul { list-style: none; margin: 4px 0; padding: 8px 0; display: grid; gap: 4px; border-block: 1px solid var(--line); }
.request li { display: flex; justify-content: space-between; gap: 12px; }

/* dialog text on the menu speaks the home headline */
.title-prize { margin: 0 0 6px; font-size: clamp(1.05rem, 2.4vw, 1.4rem); font-weight: 700; color: var(--yellow); text-shadow: 2px 2px 0 var(--bg); }
.title-prize:empty { display: none; }
.noscript { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); margin: 0; padding: 12px 18px; background: var(--surface); }

@media (max-width: 1100px) {
  .plaque { grid-template-columns: auto minmax(0, 1fr); }
  .plaque-stars { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .plaque-stars .total { border-bottom: 0; padding-bottom: 0; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .quest-grid { grid-template-columns: 1fr; }
  .plaque { gap: 12px 14px; padding: 16px; }
  .plaque-sprite { width: 80px; height: 80px; align-self: start; }
  .plaque-stars { grid-template-columns: 1fr; gap: 6px; }
  .plaque-stars .total { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
  .plaque-stars .total dd { font-size: 1.2rem; }
  .rewards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .reward { padding: 10px; }
  .reward-meta { display: grid; }
  .class-option img { width: 48px; height: 48px; }
}

/* --- welcome card after signing in --------------------------------------------- */
/* the island melts into a blur behind, so GM + tier, the name and the UID stand out */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  text-align: center;
  cursor: pointer;
  background: rgba(11, 14, 17, 0.62);
  -webkit-backdrop-filter: blur(10px) saturate(0.6);
  backdrop-filter: blur(10px) saturate(0.6);
  animation: welcome-in 0.7s ease both;
}
.welcome.is-leaving { animation: welcome-out 0.45s ease both; }
@keyframes welcome-in { from { opacity: 0; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }
@keyframes welcome-out { to { opacity: 0; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }
.welcome-in { display: grid; justify-items: center; gap: 14px; }
.welcome-in > * { margin: 0; }
/* the card hangs like a sign: drops in, swings once and settles */
.welcome-sign {
  aspect-ratio: 1;
  height: min(74dvh, calc(100vw - 2 * var(--gutter)));
  box-shadow: 0 0 0 4px var(--bg), 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 80px rgba(240, 185, 11, 0.18);
  transform-origin: 50% -40px;
  animation: sign-in 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.welcome-sign canvas { display: block; width: 100%; height: 100%; }
@keyframes sign-in {
  0% { opacity: 0; transform: translateY(-40px) rotate(-5deg); }
  60% { opacity: 1; transform: translateY(0) rotate(2deg); }
  100% { transform: none; }
}
.welcome-go { animation: fade-in 0.4s 0.8s ease both; min-height: var(--tap); padding: 0 16px; font-size: 0.7rem; color: var(--text); background: none; border: 0; cursor: pointer; }
.welcome-go > span { animation: blink 1.1s steps(2, jump-none) infinite; }
.welcome-go-tap { display: none; }
@media (hover: none) { .welcome-go-click { display: none; } .welcome-go-tap { display: inline; } }
@keyframes blink { 50% { opacity: 0.25; } }

/* --- achievement pop-up ------------------------------------------------------ */
.achievement { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--gutter); pointer-events: none; background: rgba(11, 14, 17, 0.5); animation: fade-in 0.3s ease both; }
.achievement.is-leaving { animation: fade-out 0.3s ease both; }
/* coins fly behind the words */
.achievement-card > :not(.coin) { position: relative; z-index: 1; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.achievement-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(360px, 100%);
  padding: 22px 24px 18px;
  text-align: center;
  background: var(--bg);
  border: 3px solid var(--yellow);
  box-shadow: 0 0 0 3px var(--bg), 0 0 40px rgba(240, 185, 11, 0.35), var(--shadow-block);
  pointer-events: auto;
  animation: pop-in 0.45s var(--ease) both;
}
.achievement.is-leaving .achievement-card { animation: pop-out 0.3s ease both; }
.achievement-kicker { margin: 0; font-size: 0.72rem; color: var(--yellow); }
.achievement-sprite { width: 128px; height: 128px; object-fit: contain; object-position: bottom; image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.5)); }
.achievement-title { margin: 0; font-size: 1.35rem; font-weight: 700; }
.achievement-sub { margin: 0; color: var(--muted); }
.achievement-close { margin-top: 6px; min-height: var(--tap); min-width: 88px; font: 600 0.95rem var(--font-body); color: var(--on-yellow); background: var(--yellow); border: 0; cursor: pointer; }
.achievement-close:hover { background: var(--yellow-hover); }
.achievement .coin {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 12px;
  height: 12px;
  margin: -6px;
  background: var(--yellow);
  box-shadow: inset -3px -3px 0 var(--yellow-deep), inset 2px 2px 0 #ffe58a;
  z-index: 0;
  animation: burst 0.9s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(16px) scale(0.92); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(8px) scale(0.96); } }
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) scale(0.4); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1); }
}

/* --- side-panel layout on narrow landscape screens and zoomed laptops ------ */
@media (max-width: 899px) and (orientation: landscape) and (min-width: 600px) {
  .dialog { display: none; }
  .hud-brand small { display: none; }
}

/* --- short screens: landscape phones, 200% zoom ------------------------------ */
@media (max-height: 560px) {
  :root { --hud-h: 56px; }
  .hud-logo { width: 60px; }
  .menu { padding: 6px 6px 4px; }
  .window-title { display: none; }
  .menu-item { padding: 8px 10px 8px 32px; }
  .menu-item::before { top: 12px; }
  .dialog { padding: 10px 12px; font-size: 0.88rem; }
  .dialog-face { width: 44px; height: 44px; }
  .title-screen { gap: 8px; }
  .title-logo { font-size: clamp(1.4rem, 5vw, 2.4rem); }
}

/* --- phones (portrait) ---------------------------------------------------------- */
@media (max-width: 599px), (max-width: 899px) and (orientation: portrait) {
  /* a step smaller than on desktop, so a phone screen holds more of each page (every size is in rem) */
  html { font-size: 15px; }
  /* except the boxes people type in: iOS Safari zooms the whole page in when a field's text is
     under 16px, and never zooms back out, so those keep a fixed 16px */
  .signin-form input, .create-card input, .ship-form input, .ship-form textarea { font-size: 16px; }
  :root { --hud-h: 60px; }
  .hud-brand small { display: none; }
  /* no room for PERKS Q4 2026 next to four buttons: the logo alone is the link to the menu */
  .hud-brand-text { display: none; }
  .hud-logo { width: 56px; }
  .hud-right { gap: 10px; }
  .hud-btn { padding: 0 11px; }
  /* LOG OUT keeps its icon; the words stay for screen readers */
  .hud-logout { width: var(--tap); justify-content: center; padding: 0; }
  .hud-logout-label { display: none; }

  .dock { flex-direction: column-reverse; align-items: stretch; gap: 14px; }
  .menu { width: 100%; padding: 8px 6px 6px; }
  .menu-item { padding: 8px 10px 8px 32px; }
  .menu-item::before { top: 12px; left: 11px; }
  .dialog { max-width: none; margin: 0; padding: 10px 12px; gap: 10px; font-size: 0.88rem; }
  .dialog-face { width: 44px; height: 44px; }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    /* three quarters of the screen: the strip above keeps the player in view (js/world/scene.js) */
    height: 75dvh;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  /* expanded, the sheet covers the whole screen, HUD included (its head keeps back and close) */
  .panel {
    transition: opacity 0.35s ease, transform 0.5s var(--ease), height 0.3s var(--ease), visibility 0s linear 0s;
  }
  .panel.is-expanded {
    z-index: 45;
    height: 100dvh;
    background: var(--bg); /* solid: the HUD and the island behind it would show through the veil */
    border-top: 0;
    padding-top: env(safe-area-inset-top);
  }
  /* while a finger drags it, the sheet follows without easing */
  .panel.is-dragging { transition: none; }
  .panel-grip, .panel-head { touch-action: none; }
  .panel:not(.is-active) { transform: translateY(calc(100% + 40px)); }
  .panel-grip {
    display: grid;
    place-items: center;
    height: var(--tap);
    margin-bottom: -14px;
    color: var(--muted);
    background: none;
    border: 0;
    cursor: pointer;
  }
  .panel-grip .icon { width: 28px; height: 14px; }
  .panel-head { padding-top: 4px; }

  /* every tap target at least 44px (--tap) */
  .btn-inline { display: inline-flex; align-items: center; min-height: var(--tap); }
  .rd-close { width: var(--tap); height: var(--tap); }
  .rd-title { padding-right: 54px; }
  /* links in accordion text: padding widens the hit area, the negative margin keeps the text where it was */
  .acc-body a { padding: 14px 13px; margin: 0 -13px; }
}

/* very narrow phones: keep the HUD on one line next to MY STARS + MENU */
@media (max-width: 420px) {
  .hud-brand .white { display: none; }
  .hud-btn { padding: 0 10px; font-size: 0.65rem; }
}
@media (max-width: 380px) {
  .hud, .hud-right { gap: 8px; }
  .hud-logo { width: 46px; }
}

/* Reduced motion: nothing bounces, slides or flies; screens and pop-ups still
   change state with a short fade so the change stays visible. */
@media (prefers-reduced-motion: reduce) {
  .welcome, .welcome.is-leaving, .welcome-sign, .welcome-go, .welcome-go > span { animation: none; }
  .btn-start, .menu-item::before { animation: none !important; }
  .dock:not(.is-active), .panel:not(.is-active) { transform: none; }
  .zone-card:hover { transform: none; }
  .achievement-card { animation-name: fade-in; }
  .achievement.is-leaving .achievement-card { animation-name: fade-out; }
  .world-status span { transition: none; }
}

/* ---------- overrides ---------- */
.b-table .ta-center { text-align: center !important; }
.b-table th, .b-table td { padding: 13px 18px; }
.b-table.fixed { min-width: 560px; }
.quest-grid > div:first-child { display: grid; grid-template-rows: auto 1fr; }
.quest-prize { margin-top: 8px; padding: 14px 16px; text-align: left; color: var(--yellow); background: var(--yellow-tint); border: 0; display: flex; align-items: center; }
/* the three lines of the plaque are one voice: same family, same size, no tracking or
   uppercasing (which pulled Thai glyphs apart and made the rank line look like another face) */
.plaque-who, .plaque-rank, .plaque-next {
  font-family: var(--font-body);
  font-size: 0.95rem;
  letter-spacing: normal;
  text-transform: none;
}
.plaque-who { color: var(--text); font-weight: 700; }
.plaque-rank { color: var(--text); font-weight: 700; }
.plaque-next { font-weight: 400; }
/* the tier meter breathes, one notch after the next, so it reads as charged rather than printed */
@keyframes notchPulse {
  0%, 100% { transform: translateY(0); background: var(--yellow); box-shadow: 0 0 5px rgba(240, 185, 11, 0.38); }
  45%      { transform: translateY(-1px); background: var(--yellow-hover); box-shadow: 0 0 10px rgba(240, 185, 11, 0.62); }
}
.notches span.on { animation: notchPulse 2.6s ease-in-out infinite; }
.notches span.on:nth-child(1) { animation-delay: 0.000s; }
.notches span.on:nth-child(2) { animation-delay: 0.085s; }
.notches span.on:nth-child(3) { animation-delay: 0.170s; }
.notches span.on:nth-child(4) { animation-delay: 0.255s; }
.notches span.on:nth-child(5) { animation-delay: 0.340s; }
.notches span.on:nth-child(6) { animation-delay: 0.425s; }
.notches span.on:nth-child(7) { animation-delay: 0.510s; }
.notches span.on:nth-child(8) { animation-delay: 0.595s; }
.notches span.on:nth-child(9) { animation-delay: 0.680s; }
.notches span.on:nth-child(10) { animation-delay: 0.765s; }
.notches span.on:nth-child(11) { animation-delay: 0.850s; }
.notches span.on:nth-child(12) { animation-delay: 0.935s; }
@media (prefers-reduced-motion: reduce) { .notches span.on { animation: none; } }
.plaque-stars > div { width: 100%; }
.plaque-stars .total { justify-content: center; justify-items: center; text-align: center; column-gap: 12px; } /* phones set label and number on one line */
.plaque-stars .total dt { text-indent: 0.06em; }
.plaque-stars div:not(.total) { justify-content: center; gap: 10px; }
.plaque-stars div:not(.total) dd { font-family: var(--font-body); font-weight: 700; color: var(--text); letter-spacing: 0; }
.card-actions small { word-break: keep-all; line-break: normal; overflow-wrap: normal; }

/* the 7-column Perks Tier table: compact enough to sit in the panel without sideways scrolling,
   while "Based on Stars" stays on one line */
.b-table.nw.fixed { min-width: 740px; }
.b-table.nw { font-size: 0.8rem; }
.b-table.nw th, .b-table.nw td { padding: 9px 8px; }
.b-table.nw .ta-big { font-size: 0.92rem; }
.b-table.nw .emblem { width: 34px; height: 34px; margin-right: 8px; }
.b-table.nw .badge-sprite { width: 30px; height: 30px; }

.plaque-stars dt { color: var(--text); }
.plaque-stars div:not(.total) dt { font-weight: 700; font-family: var(--font-body); }
.card-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(6, 8, 11, 0.88); }
.card-modal-in { display: grid; gap: 14px; justify-items: center; max-width: min(540px, 100%); }
.card-modal img { max-width: 100%; height: auto; border: 3px solid var(--line-strong); }
.card-modal p { margin: 0; max-width: 42ch; text-align: center; color: var(--muted); font-size: 0.92rem; }
.card-modal button { min-height: var(--tap); padding: 0 20px; font: inherit; font-weight: 700; color: var(--on-yellow); background: var(--yellow); border: 0; cursor: pointer; }
.card-modal .btn-ghost { color: var(--text); background: none; border: 2px solid var(--line-strong); }
.card-modal .btn-ghost:hover { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }
.card-modal .card-scene .btn-ghost[aria-pressed="true"] { color: var(--yellow); border-color: var(--yellow); }
.card-modal .card-scene .btn-ghost[aria-pressed="true"]:hover { color: var(--on-yellow); }
.card-studio { overflow-y: auto; }
.card-studio .card-modal-in { width: min(480px, 100%); margin-block: auto; padding: 18px 18px 20px; background: var(--bg); border: 3px solid var(--text); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.6); }
.card-studio h2 { justify-self: start; margin: 0; font: 400 0.95rem/1.4 var(--font-pixel); color: var(--yellow); }
/* square, as tall as the screen allows with the controls under it */
.card-preview { display: grid; place-items: center; width: min(100%, calc(100vh - 320px), calc(100dvh - 320px)); min-width: 220px; aspect-ratio: 1; background: var(--bg); border: 2px solid var(--line-strong); }
.card-preview img { width: 100%; height: 100%; border: 0; image-rendering: pixelated; }
.card-modal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.card-modal-actions [aria-busy="true"] { opacity: 0.6; }
/* the wardrobe's card button sits under the character, the width of the panel */
.dress-stage .card-actions { justify-self: stretch; }
.dress-stage .card-actions .btn-ghost { flex: 1; justify-content: center; }

@media (max-width: 560px) { .hud-right { gap: 8px; } }
/* in-page links keep their words together instead of splitting over two lines */
.inline-link { white-space: nowrap; }
/* an opened topic or side quest reads like a printed brief: black on white inside the dark row */
.acc-body {
  margin: 0 14px 14px;
  padding: 14px 16px;
  color: #0b0e11;
  background: #ffffff;
  border: 2px solid var(--line-strong);
}
.acc-body a { color: #8a6a0e; }
/* b and strong are not listed: they inherit, so a colour the back office put on a run of text
   still shows through bold. Uncoloured bold inherits .acc-body's black, as before. */
.acc-body .gold, .acc-body .y { color: #0b0e11; }
.acc-body li::marker { color: #8a6a0e; }
.acc-body .flag { color: #0b0e11; }
/* on QUEST every link is an action, so it carries the weight of one */
#panel-body[data-view="quests"] a:not(.zone-card):not(.btn-ghost):not(.btn-primary):not(.btn-inline) { font-weight: 700; }
/* side quest rows: the reward sits on the right, next to the open/close sign */
.side-quest summary .sq-title { flex: 1 1 auto; }
.side-quest summary .sq-reward { margin-left: auto; text-align: right; }
/* phones: one line can't hold it all, so the row stacks: name and the open/close sign, then days
   left and dates, then the reward */
@media (max-width: 599px), (max-width: 899px) and (orientation: portrait) {
  .side-quest summary {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 'title title sign' 'pill date date' 'reward reward reward';
    align-items: center;
    gap: 6px 10px;
  }
  .side-quest summary .sq-title { display: contents; }
  .side-quest summary .sq-title b { grid-area: title; font-size: 1.05rem; line-height: 1.4; color: var(--yellow); }
  .side-quest summary .sq-title small { grid-area: date; }
  .side-quest summary .pill { grid-area: pill; justify-self: start; }
  .side-quest summary .sq-reward { grid-area: reward; margin: 2px 0 0; text-align: left; white-space: normal; }
  .side-quest summary::after { grid-area: sign; align-self: start; margin: 4px 0 0; }
}
/* zone cards carry the name only — the blurb still shows on the page's own hero */
.zone-card small { display: none; }
/* แถบสำหรับทีมงานตอนเข้ามาดูหน้าเว็บในมุมมอง Affiliate */
.adminview {
  position: fixed; z-index: 60; left: 50%; top: 6px; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  max-width: calc(100% - 20px); padding: 7px 10px;
  color: var(--on-yellow); background: var(--yellow);
  box-shadow: 0 0 0 3px var(--bg); font-size: 0.82rem; font-weight: 700;
}
.adminview .av-tag { font-family: var(--font-pixel); font-size: 0.58rem; letter-spacing: 0.06em; }
.adminview .av-note { font-weight: 500; opacity: 0.78; }
.adminview select { max-width: 230px; padding: 5px 8px; font: inherit; font-weight: 600; color: var(--text); background: var(--bg); border: 2px solid rgba(0, 0, 0, 0.35); }
.adminview button { min-height: 32px; padding: 0 12px; font: inherit; font-weight: 700; color: var(--yellow); background: var(--bg); border: 0; cursor: pointer; }
.adminview button:hover { color: var(--on-yellow); background: var(--yellow-hover); }
body.is-adminview #hud-logout { display: none; }
/* the UID pill is the way back to HOME; the Stars pill is a read-out, not a button */
.hud-uid { color: var(--yellow); border-color: var(--yellow); text-decoration: none; }
.hud-uid:hover { color: var(--on-yellow); background: var(--yellow); }
.hud-uid .hud-uid-key { color: inherit; opacity: 0.72; }
.hud-player { margin: 0; color: var(--muted); background: var(--bg-veil); border: 3px solid var(--line-strong); box-shadow: none; cursor: default; pointer-events: none; }
.hud-player:hover { color: var(--muted); background: var(--bg-veil); }
@media (max-width: 900px) { .adminview { top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); } }

/* "create your character", the first time an affiliate signs in (js/world/create.js) */
.create {
  position: fixed; inset: 0; z-index: 72; display: grid; place-items: center; padding: var(--gutter);
  background: rgba(11, 14, 17, 0.62);
  -webkit-backdrop-filter: blur(10px) saturate(0.6);
  backdrop-filter: blur(10px) saturate(0.6);
  animation: welcome-in 0.7s ease both;
}
.create.is-leaving { animation: welcome-out 0.35s ease both; }
.create-card {
  display: grid; gap: 10px; width: min(420px, 100%); padding: 26px 24px; text-align: center;
  background: var(--bg-veil); border: 3px solid var(--yellow); box-shadow: var(--shadow-block);
}
.create-card > * { margin: 0; }
.create-kicker { font-size: 0.62rem; letter-spacing: 0.08em; color: var(--yellow); }
.create-card h2 { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.create-figure { display: grid; place-items: center; height: 168px; margin: 4px auto; }
.create-figure img { height: 160px; width: auto; image-rendering: pixelated; }
.create-note { font-size: 0.88rem; color: var(--muted); line-height: 1.6; }
.create-card label { margin-top: 6px; text-align: left; font-weight: 700; color: var(--label); }
.create-card input {
  min-height: var(--tap); padding: 0 12px; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg); border: 2px solid var(--line-strong);
}
.create-card input:focus { outline: none; border-color: var(--yellow); }
.create-card .form-error { text-align: left; color: var(--red); font-size: 0.88rem; }
.create-card .btn-primary { min-height: var(--tap); margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .create, .create.is-leaving { animation: none; } }
