:root {
  --bg: #0b1230;
  --panel: rgba(14, 20, 48, 0.86);
  --ink: #f4ecd8;
  --muted: #a9b0d0;
  --accent: #ffb54a;
  --line: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui), "Sarabun", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  overflow: hidden;
  touch-action: manipulation;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- character creator ---------- */
.creator {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 24px max(24px, 6vw);
  pointer-events: none;           /* let the canvas receive drags */
}

.card {
  pointer-events: auto;
  width: min(380px, 100%);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.card h1 { margin: 0; font-size: 22px; }
.hint, .note { margin: 0; color: var(--muted); font-size: 13px; }
.note { color: #ffd48a; }

.group { display: grid; gap: 6px; }
.lab { font-size: 13px; color: var(--muted); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button {
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.seg button[aria-checked="true"] {
  background: rgba(255, 181, 74, 0.18);
  border-color: var(--accent);
}

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.swatches button[aria-checked="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 10px rgba(255, 230, 170, 0.55);
}

.namerow { display: flex; gap: 8px; }
.namerow input { flex: 1; min-width: 0; }
.namerow button {
  width: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 18px;
  cursor: pointer;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* avoids iOS zoom on focus */
}
input::placeholder { color: var(--muted); }

.primary {
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffc766, #f08f2a);
  color: #2a1604;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
}
.primary:disabled { opacity: 0.55; cursor: default; }

.link {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px;
}

/* ---------- riverbank HUD ---------- */
.top {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #e0524a;
  vertical-align: middle;
}
.dot.on { background: #54d37a; }

.panel {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  text-align: center;
}

.fab {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(260px, calc(100% - 48px));
  box-shadow: 0 0 24px rgba(255, 170, 60, 0.45);
  animation: fab-glow 2.6s ease-in-out infinite;
}
.fab.wait { opacity: 0.75; animation: none; box-shadow: none; }
@keyframes fab-glow { 50% { box-shadow: 0 0 34px rgba(255, 170, 60, 0.75); } }
.sheet-close {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 4px 8px;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.row .primary { padding: 10px 16px; font-size: 16px; white-space: nowrap; }

.pill-btn {
  pointer-events: auto;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

#peopleBtn { color: var(--ink); }

.people {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 42px);
  left: 12px;
  width: min(260px, calc(100% - 24px));
  max-height: min(50vh, 340px);
  z-index: 6;
  overflow-y: auto;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
.people-head { margin: 0 0 6px; padding: 0 4px; font-size: 13px; }
.people-head small { display: block; color: var(--muted); font-size: 11px; }
.people ul { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; gap: 4px; align-items: center; }
.people li .who {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.people li .go {
  flex: none;
  padding: 6px 10px;
  background: rgba(255, 181, 74, 0.16);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.people li button:hover, .people li button:focus-visible { background: rgba(255, 255, 255, 0.1); }
.people li .who span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people li small { color: var(--muted); white-space: nowrap; }

/* ---------- speech bubbles ---------- */
.say-btn {
  position: fixed;
  right: 12px;
  bottom: calc(var(--panel-h, 120px) + 24px + env(safe-area-inset-bottom));
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  font-size: 20px;
  cursor: pointer;
}
.say {
  position: fixed;
  left: 50%;
  bottom: calc(var(--panel-h, 120px) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 84px));
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.chips button:hover, .chips button:focus-visible { background: rgba(255, 181, 74, 0.2); }

.mine-row {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 42px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: none;           /* only the pills inside take taps */
}
.mine-pill { color: var(--ink); font-size: 12px; }
.share-pill { color: var(--accent); font-size: 12px; }
.menu {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 42px);
  right: 12px;
  width: min(220px, calc(100% - 24px));
  z-index: 6;                                    /* above the 'my krathongs' pill */
  display: grid;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
.menu button {
  padding: 10px 12px;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: rgba(255, 255, 255, 0.1); }
#menuBtn { color: var(--ink); }
.help {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 8, 24, 0.6);
  backdrop-filter: blur(3px);
}
.help-card {
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);       /* a long unbroken string (a prize link) must wrap, not widen the card */
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.help-card h2 { margin: 0; font-size: 18px; }
.help-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; }

.styles { display: flex; justify-content: center; gap: 12px; }
.styles button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.styles button[aria-checked="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 12px rgba(255, 220, 150, 0.6);
}

.tip {
  position: fixed;
  max-width: 240px;
  padding: 8px 12px;
  background: rgba(10, 14, 34, 0.92);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  pointer-events: none;
  transform: translate(-50%, -120%);
  word-break: break-word;
}
.tip small { display: block; color: var(--muted); margin-top: 2px; }

.status {
  position: fixed;
  left: 50%;
  top: calc(max(10px, env(safe-area-inset-top)) + 80px);
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10, 14, 34, 0.9);
  border: 1px solid var(--line);
  font-size: 13px;
  pointer-events: none;
}

/* on-screen joystick (touch devices) */
.stick {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(var(--panel-h, 120px) + 28px + env(safe-area-inset-bottom));
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(14, 20, 48, 0.5);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 210, 122, 0.85);
  box-shadow: 0 0 14px rgba(255, 210, 122, 0.45);
  pointer-events: none;
}

/* narrow screens: the creator card becomes a bottom sheet */
@media (max-width: 700px) {
  .creator { align-items: flex-end; justify-content: center; padding: 12px; }
  .card { gap: 10px; padding: 14px; }
  .card h1 { font-size: 18px; }
  .hint { display: none; }
  .top { left: 8px; right: 8px; gap: 6px; }
  .pill { padding: 6px 10px; font-size: 12px; }
  .pill-btn { font-size: 12px; }
}

/* ---- fireworks event ---- */
.event-pill {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
}
.event-pill.live { background: rgba(120, 40, 90, 0.85); border-color: #ffb3d1; }
.meter {
  position: fixed;
  top: calc(92px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(280px, 64vw);
  z-index: 5;
  display: grid;
  gap: 4px;
  text-align: center;
}
.meter-label { font-size: 12px; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.meter-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.meter.full .meter-label { color: #ffd25a; }
#meterFill { height: 100%; width: 0; background: linear-gradient(90deg, #ffcf4a, #ff6fa8); transition: width 0.25s; }
.spark-btn {
  position: fixed;
  right: 14px;
  bottom: calc(var(--bottom) + 190px);      /* above the shortcut buttons: joining the show is optional */
  padding: 11px 18px;
  font-size: 17px;
  z-index: 6;
  box-shadow: 0 0 22px rgba(255, 111, 168, 0.6);
  animation: spark-pulse 1s ease-in-out infinite;
}
.spark-btn:active { transform: scale(0.96); }
@keyframes spark-pulse { 50% { box-shadow: 0 0 34px rgba(255, 111, 168, 0.95); } }
#hud.wish-open .spark-btn { display: none; }
.event-pill.result { background: rgba(60, 40, 10, 0.88); border-color: #ffd25a; }
.prize-text, .prize-note { margin: 0; font-size: 14px; line-height: 1.5; }
.prize-note { opacity: 0.75; font-size: 12px; }
.prize-code {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  text-align: center;
  font: 700 20px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 1px;
  user-select: all;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.prize-code.is-link { font-size: 13px; line-height: 1.4; letter-spacing: 0; text-align: left; }
.ghost { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 10px 16px; font: inherit; cursor: pointer; }

.credit { margin: 0; font-size: 11px; line-height: 1.5; opacity: 0.7; }
.credit a { color: inherit; text-decoration: underline; }

/* ================= HUD v2: gold on violet, after the designer's mock-up ================= */
:root {
  --gold: #e0b254;
  --hud-bg: rgba(40, 22, 76, 0.84);
  --hud-line: rgba(224, 178, 84, 0.55);
  --top: max(10px, env(safe-area-inset-top));
  --bottom: max(14px, env(safe-area-inset-bottom));
}

.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; }
.top > #peopleBtn { justify-self: start; }
.top-center { display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.top-actions { justify-self: end; display: flex; gap: 10px; pointer-events: none; }

.hud-pill {
  background: var(--hud-bg);
  border: 1px solid var(--hud-line);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.total b { color: #ffe08a; }
.ppl { margin-left: 4px; }

.quest-banner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(520px, 62vw);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-line);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
#questText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-arrow { font-size: 18px; color: var(--gold); }
#hud.event-on .quest-banner { display: none; }          /* the event pill takes this slot while a show is on */

.icon-btn {
  pointer-events: auto;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.icon-btn .ico {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--hud-bg);
  border: 1.5px solid var(--hud-line);
  font-size: 22px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.icon-btn .lbl { font-size: 11px; font-weight: 700; color: #ffe08a; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.icon-btn:hover .ico, .icon-btn:focus-visible .ico { border-color: #ffe08a; }

/* things that used to sit just under the old top bar now sit under the taller one */
.people { top: calc(var(--top) + 46px); }
.menu { top: calc(var(--top) + 66px); background: var(--hud-bg); border-color: var(--hud-line); }
.mine-row { top: calc(var(--top) + 96px); }
.status { top: calc(var(--top) + 104px); }
.m-only { display: none; }

.hud-card {
  position: fixed;
  z-index: 4;
  padding: 10px 12px;
  background: var(--hud-bg);
  border: 1.5px solid var(--hud-line);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  color: var(--ink);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0 0 6px;
  background: none;
  border: 0;
  color: #ffe08a;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
}
button.card-head { cursor: pointer; }
.chev { color: var(--gold); font-size: 20px; }

.missions { left: 14px; bottom: calc(var(--bottom) + 62px); width: min(300px, 40vw); }
.m-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.m-list li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 700;
}
.m-prog { color: #ffe08a; font-variant-numeric: tabular-nums; }
.m-list li.done .m-prog { color: #54d37a; font-size: 16px; }
.m-bar { grid-column: 2 / 4; display: block; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.m-bar b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffcf4a, #ff6fa8); transition: width 0.3s; }
.m-btn { cursor: pointer; }
.m-btn:hover .m-name { text-decoration: underline; }

.round-btn {
  position: fixed;
  z-index: 4;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--hud-bg);
  border: 1.5px solid var(--hud-line);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.sound-btn { left: 14px; bottom: var(--bottom); }
.say-btn { right: 14px; bottom: var(--bottom); background: var(--hud-bg); border: 1.5px solid var(--hud-line); }

/* the big golden button, with a lotus on each side */
.fab {
  width: min(300px, calc(100% - 150px));
  padding: 15px 22px;
  font-size: 26px;
  letter-spacing: 0.5px;
  border: 2px solid #fff0b0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe58f 0%, #f7b02f 52%, #e28a1c 100%);
  color: #5a3205;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(112, 60, 10, 0.6), 0 0 30px rgba(255, 180, 70, 0.65), inset 0 2px 6px rgba(255, 255, 255, 0.6);
}
.fab::before, .fab::after {
  content: '🪷';
  position: absolute;
  top: 50%;
  font-size: 44px;
  line-height: 1;
  text-shadow: none;
  filter: drop-shadow(0 0 10px rgba(255, 120, 200, 0.75));
  pointer-events: none;
}
.fab::before { left: -42px; transform: translateY(-50%) rotate(-12deg); }
.fab::after { right: -42px; transform: translateY(-50%) rotate(12deg); }
.fab.wait { box-shadow: 0 0 0 4px rgba(112, 60, 10, 0.5); }
.fab.wait::before, .fab.wait::after { opacity: 0.45; filter: grayscale(0.7); }

.panel .styles { display: none; }                       /* the picker card chooses the style now */

@media (max-width: 700px) {
  .top { grid-template-columns: auto 1fr auto; gap: 6px; }
  .top-center { display: contents; }
  .total { grid-column: 2; grid-row: 1; justify-self: center; }
  .quest-banner { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin-top: 8px; max-width: 100%; font-size: 12px; }
  .hud-pill { font-size: 12px; padding: 6px 10px; }
  .ppl { display: none; }
  .wide-only { display: none; }
  .m-only { display: block; }
  .icon-btn .lbl { display: none; }
  .icon-btn .ico { width: 38px; height: 38px; font-size: 18px; }
  .menu { top: calc(var(--top) + 52px); }
  .people { top: calc(var(--top) + 40px); }
  .mine-row { top: calc(var(--top) + 90px); }
  .status { top: calc(var(--top) + 96px); }

  .missions { display: none; left: 12px; right: 12px; width: auto; bottom: calc(var(--panel-h, 70px) + 24px + env(safe-area-inset-bottom, 0px)); }
  .missions.open { display: block; }
  .fab { width: calc(100% - 190px); font-size: 22px; padding: 13px 14px; }
  .fab::before, .fab::after { font-size: 32px; }
  .fab::before { left: -30px; }
  .fab::after { right: -30px; }
}

/* the wish sheet shares the HUD look */
.panel { background: var(--hud-bg); border: 1.5px solid var(--hud-line); }
.chips button { border-color: var(--hud-line); }
.panel .primary {
  border: 2px solid #fff0b0;
  background: linear-gradient(180deg, #ffe58f 0%, #f7b02f 52%, #e28a1c 100%);
  color: #5a3205;
}


/* ---- krathong picker dialog ---- */
.pick {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(8, 6, 28, 0.62);
  backdrop-filter: blur(4px);
}
.pick-card {
  position: relative;
  width: min(1040px, 100%);
  max-height: 96vh;
  overflow-y: auto;
  padding: 22px 26px 24px;
  display: grid;
  gap: 14px;
  background: linear-gradient(180deg, rgba(62, 32, 112, 0.97), rgba(38, 20, 76, 0.97));
  border: 2px solid var(--gold);
  border-radius: 34px;
  box-shadow: 0 0 0 5px rgba(224, 178, 84, 0.2), 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}
.pick-title {
  margin: 0 auto;
  padding: 6px 34px;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 800;
  color: #ffe08a;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--hud-line);
}
.pick-sub { margin: 0; font-size: 14px; color: #e9dcf5; }
.pick-x {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(40, 22, 76, 0.9);
  border: 2px solid var(--gold);
  color: #ffe08a;
  font-size: 18px;
  cursor: pointer;
}
.pick-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.pick-item {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 6px;
  padding: 12px 8px 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.14);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.pick-item img { width: 100%; max-width: 170px; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }
.pick-item b { font-size: 16px; color: #ffe08a; }
.pick-item small { font-size: 12px; line-height: 1.45; color: #d9cde8; }
.pick-item[aria-checked="true"] { border-color: #ffe08a; background: rgba(255, 224, 138, 0.12); box-shadow: 0 0 22px rgba(255, 200, 90, 0.55); }
.pick-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: #ffd25a;
  color: #5a3205;
  font-weight: 900;
}
.pick-item[aria-checked="true"] .pick-check { display: grid; }
.pick-actions { display: flex; justify-content: center; gap: 16px; margin-top: 4px; }
.pick-cancel, .pick-ok {
  min-width: 150px;
  padding: 12px 26px;
  border-radius: 999px;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.pick-cancel { background: rgba(40, 22, 76, 0.9); border: 2px solid var(--gold); color: #ffe08a; }
.pick-ok {
  border: 2px solid #fff0b0;
  background: linear-gradient(180deg, #ffe58f 0%, #f7b02f 52%, #e28a1c 100%);
  color: #5a3205;
  box-shadow: 0 0 20px rgba(255, 180, 70, 0.55);
}
@media (max-width: 760px) {
  .pick-card { padding: 16px 14px 18px; border-radius: 26px; }
  .pick-cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding: 4px 2px 10px; }
  .pick-item { flex: 0 0 62%; scroll-snap-align: center; }
  .pick-item small { display: none; }
  .pick-cancel, .pick-ok { min-width: 0; flex: 1; padding: 11px 12px; font-size: 16px; }
}

/* ---- throwing a krathong ---- */
.aim-pill {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom) + 84px);
  transform: translateX(-50%);
  z-index: 5;
  max-width: calc(100% - 120px);
  white-space: normal;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  background: rgba(120, 40, 90, 0.88);
  border-color: #ffb3d1;
  pointer-events: none;
}

/* launch sheet: float from the bank or throw it */
.go-row { margin-top: 8px; }
.go-row .primary { flex: 1; }
.panel .primary.alt {
  background: linear-gradient(180deg, #ffd9ec 0%, #ff9ac4 52%, #e0588f 100%);
  border-color: #fff0b0;
  color: #4a0f2e;
}
.aim-pill { display: flex; align-items: center; gap: 10px; pointer-events: auto; background: rgba(40, 24, 90, 0.9); border-color: #ffe9a8; }
.aim-pill[hidden] { display: none; }
.aim-pill button { font: inherit; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1.5px solid #ffe9a8; background: transparent; color: #ffe9a8; cursor: pointer; }

/* ---- fortune-teller booth ---- */
.booth-btn {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom) + 76px);
  transform: translateX(-50%);
  z-index: 6;
  padding: 12px 26px;
  border-radius: 999px;
  border: 2px solid #fff0b0;
  background: linear-gradient(180deg, #c9a6ff 0%, #8a5ad8 55%, #5f33b0 100%);
  color: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(150, 110, 255, 0.75);
  animation: booth-pulse 1.2s ease-in-out infinite;
}
.booth-btn[hidden] { display: none; }
.booth-btn:active { transform: translateX(-50%) scale(0.96); }
@keyframes booth-pulse { 50% { box-shadow: 0 0 36px rgba(190, 150, 255, 1); } }
.fortune-card { position: relative; width: min(520px, 100%); overflow: hidden; }
.fortune-card .sheet-close { z-index: 2; }
.f-carousel { position: relative; margin: 8px -4px 0; }
.f-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 18px;
  cursor: grab;
  outline: none;
  touch-action: pan-x;
}
.f-track::-webkit-scrollbar { display: none; }
.f-track.dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.f-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  box-sizing: border-box;
  min-height: 250px;
  padding: 22px 26px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.f-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 240, 176, 0.8);
  background: rgba(30, 16, 64, 0.65);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.f-arrow:first-child { left: 6px; }
.f-arrow:last-child { right: 6px; }
.f-arrow:disabled { opacity: 0; pointer-events: none; }
.f-dots { display: flex; justify-content: center; gap: 7px; margin: 12px 0 4px; }
.f-dots i { width: 8px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.3); transition: width 0.2s, background 0.2s; }
.f-dots i.on { width: 22px; background: #ffd25a; }
@media (max-width: 640px) { .booth-btn { bottom: calc(var(--bottom) + 70px); } }
.fortune-card > *, .f-carousel { min-width: 0; }
.f-track { width: 100%; box-sizing: border-box; }

/* promo banner cards */
.f-banner { padding: 0; min-height: 0; aspect-ratio: 16 / 9; position: relative; display: block; text-decoration: none; background: #2a1a5a; -webkit-user-drag: none; }
.f-banner img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.f-cap { position: absolute; left: 12px; bottom: 12px; padding: 7px 14px; border-radius: 999px; background: rgba(30, 16, 64, 0.82); border: 1.5px solid #ffe9a8; color: #ffe9a8; font-size: 14px; font-weight: 700; text-shadow: none; }

/* dialogs sit above every HUD card and button; the wish sheet owns the bottom corners while it is open */
.help { z-index: 10; }
#hud.wish-open .sound-btn, #hud.wish-open .say-btn, #hud.wish-open .goto { display: none; }
#hud.wish-open .missions { display: none; }
@media (max-width: 380px) { .pick-cancel, .pick-ok { font-size: 15px; white-space: nowrap; } }
/* phone held sideways: the missions card would sit on top of the joystick, so it folds away like on a portrait phone */
@media (max-height: 480px) {
  .missions { display: none; }
  .missions.open { display: block; }
  .m-only { display: block; }
}
/* sideways phone: size the banner modal by the height so the whole card (and its close button) fits */
@media (max-height: 480px) {
  .fortune-card { width: min(520px, calc((100vh - 190px) * 1.78)); padding-top: 12px; padding-bottom: 12px; }
  .fortune-card h2 { margin: 0 0 4px; font-size: 18px; }
  .fortune-card .prize-note { display: none; }
}

/* ---- holding hands: the request to answer, and the pill while holding ---- */
.hand-pill {
  position: fixed;
  left: 50%;
  top: calc(var(--top) + 52px);               /* up in the HUD: the chat bar, the wish sheet and the launch button all open at the bottom */
  transform: translateX(-50%);
  z-index: 7;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: normal;
  pointer-events: auto;
  background: rgba(120, 40, 90, 0.9);
  border-color: #ffb3d1;
}
.hand-pill[hidden] { display: none; }
@media (max-width: 700px) { .hand-pill { top: calc(var(--top) + 84px); } }
.hand-pill button { font: inherit; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1.5px solid #ffe9a8; background: transparent; color: #ffe9a8; cursor: pointer; }
.hand-pill button:hover, .hand-pill button:focus-visible { background: rgba(255, 255, 255, 0.14); }

/* ---- tapping a character ---- */
.person-tip { display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: auto; }
.person-tip[hidden] { display: none; }
.person-tip small { margin: 0; font-size: 12px; }
.person-tip button { font: inherit; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; border: 1.5px solid #ffb3d1; background: rgba(120, 40, 90, 0.9); color: #fff3d6; cursor: pointer; }
.person-tip button[hidden] { display: none; }

/* ---- shortcuts: walk to a place ---- */
.goto {
  position: fixed;
  right: 14px;
  bottom: calc(var(--bottom) + 58px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.goto button {
  width: 60px;
  padding: 6px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--hud-bg);
  border: 1.5px solid var(--hud-line);
  border-radius: 16px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.goto button span { font-size: 20px; line-height: 1.1; }
.goto button small { font-size: 10px; line-height: 1.1; white-space: nowrap; }
#hud.wish-open .goto, #hud.say-open .goto, #hud.say-open .spark-btn { display: none; }
.goto button:hover, .goto button:focus-visible { background: rgba(255, 255, 255, 0.14); }

/* ---- prize wheel (game/spin.js) ---- */
.spin-card { text-align: center; overflow-x: hidden; scrollbar-width: thin; }
.spin-stage { position: relative; width: min(80vw, 300px); aspect-ratio: 1; margin: 14px auto 16px; }
.spin-pointer { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); z-index: 2; font-size: 28px; line-height: 1;
  color: var(--accent); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.spin-wheel { position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; border: 4px solid #e0b254; box-shadow: 0 0 26px rgba(255, 181, 74, 0.35); }
.spin-slice { position: absolute; left: 50%; top: 50%; display: flex; align-items: center; gap: 5px; white-space: nowrap; transition: filter .4s; }
.spin-emoji { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
img.spin-emoji { width: 26px; height: 26px; object-fit: contain; }
.rs-emoji img { width: 84px; height: 84px; object-fit: contain; display: block; margin: 0 auto; }
.spin-label { font-size: 13px; font-weight: 700; line-height: 1; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 0 6px rgba(0, 0, 0, 0.45); }
.spin-slice.win { animation: spin-win 0.9s ease-in-out infinite alternate; }
.spin-slice.win .spin-label { color: #fff3b0; }
.spin-slice.miss { filter: saturate(0.6); }
@keyframes spin-win { from { filter: drop-shadow(0 0 2px #fff3b0); } to { filter: drop-shadow(0 0 10px #ffd34a) brightness(1.25); } }
.result-card { text-align: center; justify-items: stretch; gap: 10px; padding-top: 22px; }
.rs-emoji { font-size: 54px; line-height: 1; filter: drop-shadow(0 4px 14px rgba(255, 200, 90, 0.45)); animation: rs-pop 0.5s cubic-bezier(.2, 1.4, .4, 1) both; }
.result-card h2 { font-size: 21px; line-height: 1.35; margin: 0; overflow-wrap: anywhere; }
.rs-prize { margin: 0; justify-self: center; padding: 4px 14px; border-radius: 999px; background: rgba(224, 178, 84, 0.18); border: 1px solid rgba(224, 178, 84, 0.5); color: #ffe3a8; font-size: 14px; font-weight: 700; }
.result-card .prize-text { white-space: pre-line; overflow-wrap: anywhere; }
.result-card .prize-code.is-loading { font: 500 14px/1.4 inherit; letter-spacing: 0; opacity: 0.75; user-select: none; }
.rs-cta { display: block; text-align: center; text-decoration: none; box-sizing: border-box; }
.rs-cta[hidden], .rs-prize[hidden] { display: none; }
@keyframes rs-pop { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rs-emoji { animation: none; } }
.cid-chip { position: fixed; left: 14px; top: calc(var(--top) + 48px); z-index: 3; margin: 0; padding: 1px 9px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(10, 16, 40, 0.38); color: rgba(255, 255, 255, 0.62); font: inherit; font-size: 10.5px; line-height: 1.7; min-height: 0; width: auto; box-shadow: none; }
.cid-chip[hidden] { display: none; }
.cid-chip code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.02em; }
.cid-chip:hover, .cid-chip:focus-visible { color: #fff; background: rgba(10, 16, 40, 0.6); }
#hud.wish-open .cid-chip, #hud.say-open .cid-chip { display: none; }
/* on a phone the top rows hold the mission banner: the code goes bottom-left, above the joystick (28px gap + 112px stick) */
@media (max-width: 700px) { .cid-chip { top: auto; left: max(14px, env(safe-area-inset-left)); bottom: calc(var(--panel-h, 70px) + 28px + 112px + 8px + env(safe-area-inset-bottom)); font-size: 9.5px; } }
.spin-cid { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; font-size: 12px; opacity: 0.75; }
.spin-cid[hidden] { display: none; }
.spin-cid code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.02em; word-break: break-all; }
.spin-cid button { padding: 4px 12px; font-size: 12px; min-height: 0; }
.spin-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; max-height: 40vh; overflow-y: auto; text-align: left; }
.spin-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.spin-list li span { grid-column: 1; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.spin-list li button { grid-column: 2; grid-row: 1 / span 2; padding: 6px 12px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .spin-wheel { transition-duration: 0.01s !important; } .spin-slice.win { animation: none; } }
.spin-card .prize-text { font-size: 18px; font-weight: 700; }

/* the "spin for a prize" button shown after a launch, above the launch button */
.spin-prompt { position: fixed; left: 50%; bottom: calc(var(--panel-h, 64px) + 22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5;
  padding: 13px 28px; border: 2px solid #fff0b0; border-radius: 999px; font: inherit; font-size: 20px; font-weight: 700; white-space: nowrap; cursor: pointer;
  background: linear-gradient(180deg, #ffe58f 0%, #f7b02f 52%, #e28a1c 100%); color: #5a3205;
  box-shadow: 0 0 0 4px rgba(112, 60, 10, 0.55), 0 0 30px rgba(255, 180, 70, 0.7); animation: spin-prompt-in .45s ease-out both, spin-prompt-pulse 1.6s ease-in-out .45s infinite; }
.spin-prompt:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@keyframes spin-prompt-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.9); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes spin-prompt-pulse { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .spin-prompt { animation: none; } }

/* ---- "how to play" as pages (game/help.js): a picture from the game, a title and a few short lines ---- */
.help-pager { gap: 10px; text-align: center; grid-template-columns: minmax(0, 1fr); }
.help-step { font-size: 12px; color: var(--muted); letter-spacing: 0.4px; }
.help-media { aspect-ratio: 390 / 330; border-radius: 14px; overflow: hidden; background: #0b1230; border: 1px solid var(--line); touch-action: pan-y; }
.help-media img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.25s ease; }
.help-media img.ready { opacity: 1; }
.help-pager h2 { margin: 2px 0 0; font-size: 20px; }
.help-lines { text-align: center; justify-items: center; gap: 4px !important; font-size: 14px; color: var(--ink); }
.help-lines li { max-width: 34em; }
.help-dots { display: flex; justify-content: center; gap: 8px; }
.help-dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.28); cursor: pointer; }
.help-dots button.on { width: 22px; border-radius: 6px; background: var(--accent); }
.help-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help-nav .ghost[disabled] { opacity: 0.35; cursor: default; }
.help-nav #helpClose { grid-column: 1 / -1; }
.help-nav #helpClose:not([hidden]) { grid-column: 2; }
.help-never { justify-self: center; padding: 4px 8px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.help-never:hover, .help-never:focus-visible { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .help-media img { transition: none; } }

/* MISSIONS_ENABLED=0 on the server: no quest banner, missions card or menu entry */
#hud.no-missions .quest-banner, #hud.no-missions .missions, #hud.no-missions #missionsBtn { display: none !important; }

/* the odds of each prize, under the wheel */
.spin-odds-box { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.spin-odds-title { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; text-align: center; }
.spin-odds { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.spin-odds li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.spin-odds li b { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.spin-odds li.off { opacity: 0.5; }
.spin-odds li.off b { color: var(--muted); font-weight: 400; }
.spin-odds-note { margin: 6px 0 0; font-size: 11px; line-height: 1.4; color: var(--muted); text-align: center; }

/* prize terms (collapsed by default) */
.terms { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); text-align: left; }
.terms summary { cursor: pointer; text-align: center; text-decoration: underline; list-style: none; }
.terms summary::-webkit-details-marker { display: none; }
.terms ul { margin: 6px 0 0; padding-left: 18px; }
.terms { max-height: 38vh; overflow-y: auto; }
.terms h4 { margin: 10px 0 2px; font-size: 12.5px; color: var(--text, #fff); }
.terms b { color: var(--text, #fff); font-weight: 600; }


/* result popup: the code and the CTA come first; the terms are a small link at the very end and scroll inside their own box */
.result-card .terms { max-height: 30vh; margin-top: 2px; font-size: 11.5px; opacity: 0.9; }
.result-card .terms:not([open]) { max-height: none; overflow: visible; }
.result-card #rsCta { font-size: 16px; padding-block: 13px; }

/* wallpaper-discount popup: player id, the "save picture" button and the steps */
.rs-cid { margin: 0; font-size: 12.5px; color: var(--muted); }
.rs-cid code { display: block; margin-top: 2px; font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.02em; word-break: break-all; color: var(--text, #fff); font-size: 13px; }
.rs-steps { margin: 0; padding: 10px 12px 10px 30px; display: block; text-align: left; font-size: 13px; line-height: 1.55; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.04); list-style: decimal; }
.rs-steps li + li { margin-top: 3px; }
.rs-cid[hidden], .rs-shot[hidden], .rs-steps[hidden] { display: none; }

/* the four fortune tellers: all four at once, tap one for the details */
.ft-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.ft-tile { font: inherit; color: inherit; text-align: center; display: grid; justify-items: center; align-content: start; gap: 5px; padding: 14px 10px 12px; cursor: pointer;
  border-radius: 16px; border: 1.5px solid rgba(255, 233, 168, 0.35); background: linear-gradient(160deg, rgba(90, 42, 134, 0.55), rgba(40, 18, 70, 0.75)); transition: transform 0.15s, border-color 0.15s; }
.ft-tile:hover, .ft-tile:focus-visible { border-color: #ffd25a; transform: translateY(-2px); outline: none; }
.ft-tile:active { transform: scale(0.98); }
.ft-photo { width: 92px; height: 92px; border-radius: 50%; overflow: hidden; position: relative; flex: none;
  background: radial-gradient(circle at 50% 35%, #ffe9a8 0%, #d9a53a 55%, #8a1f3a 100%); border: 3px solid #ffe9a8; box-shadow: 0 0 18px rgba(255, 210, 90, 0.3); }
.ft-photo .ft-img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.ft-name { margin: 2px 0 0; font-size: 16px; line-height: 1.25; color: #ffe9a8; }
.ft-code { color: var(--muted); font-size: 11.5px; }
.ft-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.ft-chips span { padding: 2px 8px; border-radius: 999px; font-size: 11px; background: rgba(255, 233, 168, 0.14); border: 1px solid rgba(255, 233, 168, 0.4); color: #ffe9a8; }
.ft-more { margin-top: 2px; font-size: 12px; color: #ffd25a; }
.ft-detail { display: grid; justify-items: center; gap: 8px; text-align: center; margin-top: 4px; }
.ft-detail .ft-photo { width: 128px; height: 128px; }
.ft-detail .ft-name { font-size: 21px; }
.ft-detail .ft-bio { margin: 2px 0 0; text-align: left; font-size: 13.5px; line-height: 1.6; color: rgba(255, 255, 255, 0.9); }
.ft-detail .ft-chips span { font-size: 12px; }
.ft-cta { display: block; width: 100%; text-align: center; text-decoration: none; box-sizing: border-box; margin-top: 4px; }
.ft-back { justify-self: start; }
.ft-grid[hidden], .ft-detail[hidden] { display: none; }
@media (max-width: 380px) { .ft-photo { width: 80px; height: 80px; } .ft-name { font-size: 15px; } }
@media (max-height: 480px) { .ft-photo { width: 56px; height: 56px; } .ft-tile { padding: 8px 6px; gap: 2px; } .ft-chips, .ft-more { display: none; } }
.f-dots[hidden], .f-carousel[hidden] { display: none; }

/* outfit style and head decoration: text options, two per row */
.seg.seg-wrap { grid-template-columns: repeat(2, 1fr); }
.seg.seg-wrap button { padding: 8px 6px; font-size: 13px; line-height: 1.25; }

/* phone: the creator sheet takes at most half the screen so the character stays in view above it; rows are compact
   (label beside the options, style and hat options scroll sideways) and the start button stays at the bottom of the sheet */
@media (max-width: 700px) {
  .card { max-height: 48dvh; gap: 8px; padding: 12px 14px 0; }
  .card .group { grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 8px; }
  .card .lab { font-size: 12px; line-height: 1.2; }
  .card .seg { gap: 6px; }
  .card .seg button { padding: 7px 4px; }
  .card .seg.seg-wrap { display: flex; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .card .seg.seg-wrap::-webkit-scrollbar { display: none; }
  .card .seg.seg-wrap button { flex: none; white-space: nowrap; padding: 7px 12px; }
  .card .swatches { gap: 8px; }
  .card .swatches button { width: 32px; height: 32px; }
  .card #enter { position: sticky; bottom: 0; margin: 2px -14px 0; border-radius: 0 0 20px 20px; padding-block: 13px; }
  .card #enterNote { position: sticky; bottom: 0; }
}
.seg.seg-wrap { position: relative; }

/* wheel window, top to bottom on every screen: wheel, text, buttons, then the terms as a small closed link at the end */
.spin-card #spinOddsBox { margin: 4px 0 0; }
.spin-card .terms { font-size: 10.5px; line-height: 1.4; max-height: 26vh; margin-top: 0; opacity: 0.85; }
.spin-card .terms:not([open]) { max-height: none; overflow: visible; }
.spin-card .terms summary { font-size: 11px; }
.spin-card .terms h4 { margin: 6px 0 2px; font-size: 11px; }
.spin-card .terms ul { margin-top: 3px; padding-left: 16px; }
.result-card .terms { font-size: 10.5px; line-height: 1.4; }
.result-card .terms h4 { font-size: 11px; margin: 6px 0 2px; }

/* wheel window: no box around it, the wheel floats over the dimmed page */
.spin-card { background: transparent; border-color: transparent; box-shadow: none; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.6); }
.spin-card .terms { background: rgba(10, 14, 36, 0.55); border-radius: 10px; padding: 6px 10px; }
.spin-card { scrollbar-width: none; -ms-overflow-style: none; }
.spin-card::-webkit-scrollbar { display: none; }
.spin-card .terms:not([open]) { background: none; padding: 0; }

/* result popup effect: the card pops in with a golden glow and confetti falls (game/spin.js) */
#spinResult:not([hidden]) .result-card { animation: rs-card-in 0.45s cubic-bezier(.2, 1.3, .4, 1) both, rs-glow 2.4s ease-in-out 0.45s 2; }
.rs-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.rs-confetti i { position: absolute; top: -14px; width: 9px; height: 14px; opacity: 0; animation: rs-fall linear forwards; }
@keyframes rs-card-in { from { opacity: 0; transform: scale(0.8) translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes rs-glow { 0%, 100% { box-shadow: 0 0 0 rgba(255, 190, 80, 0); } 50% { box-shadow: 0 0 34px rgba(255, 190, 80, 0.55); } }
@keyframes rs-fall {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0); }
  100% { opacity: 0; transform: translate3d(var(--dx), 105vh, 0) rotate(var(--rot)); }
}
@media (prefers-reduced-motion: reduce) { #spinResult:not([hidden]) .result-card { animation: none; } }
