/* Questland – visual system
   Look: hand-made adventure UI. Parchment panels, wooden planks, cloth ribbons,
   wax seals and hex badges on a dark wood table. Thick ink outlines, solid
   "stacked" shadows, chunky lettering. Everything is drawn in CSS/SVG. */

:root {
  --table: #2b211c;
  --table-2: #33271f;
  --wood: #7a5236;
  --wood-dark: #4f3423;
  --wood-light: #9b6c47;
  --parchment: #f3e6c9;
  --parchment-2: #e7d3aa;
  --parchment-edge: #c9a978;
  --ink: #3a2a1f;
  --ink-soft: #6b5541;
  --red: #d4574a;
  --red-dark: #9e3b31;
  --teal: #2e9e9b;
  --teal-dark: #1f6f6d;
  --olive: #9aae3c;
  --olive-dark: #6e7d27;
  --yellow: #f2b632;
  --yellow-dark: #b9851a;
  --purple: #7a4fb0;
  --purple-dark: #55347f;
  --cyan: #3bb9d6;
  --leaf: #8fd16a;
  --grass: #9ccc5f;
  --water: #5fb7cf;
  --radius-rough: 7px 12px 6px 14px / 12px 6px 13px 7px;
  --font-display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Theme tokens (Sagoland defaults). Themes below override these. */
  --line: #3a2a1f;                 /* outlines and hard shadows */
  --card: #fffaf0;                 /* light card inside panels */
  --on-table: #f3e6c9;             /* text directly on the background */
  --on-plank: #f3e6c9;             /* text on HUD / nav bars */
  --on-plank-soft: #f0dcb6;
  --title-shadow: 0 3px 0 #3a2a1f;
  --table-image: repeating-linear-gradient(90deg, rgba(0,0,0,.18) 0 2px, transparent 2px 64px);
  --font-weight-body: 800;
  --tile-1: #f2b632; --tile-2: #e98a9b; --tile-3: #b9a3e8; --tile-4: #5fb39a;
  --banner-sky: #d9eef2; --banner-ground: #9ccc5f;
  --highlight-panel: #fbe7b0; --locked: #d8c7a4;
  --rod: #8a5a36; --rod-dark: #5a3a22; --seal: #c0392b; --seal-dark: #8e2a20;
  /* map palette */
  --m-water: #5fb7cf; --m-wave: #e8f8ff; --m-sand: #ecd49a; --m-grass: #9ccc5f; --m-tuft: #6e9a3a;
  --m-line: #3a2a1f; --m-path: #f3e6c9;
  --m-mtn1: #9f88d8; --m-mtn2: #b9a3e8; --m-snow: #ffffff; --m-star: #f2b632; --m-cloud: #ffffff;
  --m-flag: #f2b632; --m-castle: #f1c5cc; --m-castle2: #e9aeb8; --m-roof: #d4574a; --m-window: #3a2a1f;
  --m-tree1: #4f9a4f; --m-tree2: #5fae55; --m-trunk: #8a5a36;
  --m-house: #f3e6c9; --m-house-roof: #d4574a; --m-door: #3a2a1f;
  --m-swamp: #5fa58e; --m-swamp2: #3f8270; --m-pad: #9ccc5f; --m-reed: #3e6d32; --m-cattail: #8a5a36;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--table);
  background-image: var(--table-image);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; letter-spacing: .01em; }
a { color: var(--teal-dark); }

.boot { color: var(--on-table); font-family: var(--font-display); font-size: 22px; text-align: center; padding-top: 40vh; }

/* ---------- shell ---------- */
.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; padding: calc(var(--safe-top) + 12px) 12px calc(var(--safe-bottom) + 108px); display: flex; flex-direction: column; gap: 14px; }

/* ---------- surfaces ---------- */
.parchment {
  background: var(--parchment);
  border: 3px solid var(--line);
  border-radius: var(--radius-rough);
  box-shadow: inset 0 0 0 4px var(--parchment-2), 0 5px 0 rgba(0,0,0,.45);
  padding: 16px;
  position: relative;
}
.parchment.tight { padding: 12px; }
.plank {
  background: var(--wood);
  background-image: repeating-linear-gradient(180deg, transparent 0 22px, rgba(0,0,0,.18) 22px 24px);
  border: 3px solid var(--line);
  border-radius: 10px;
  box-shadow: inset 0 3px 0 var(--wood-light), inset 0 -4px 0 var(--wood-dark), 0 5px 0 rgba(0,0,0,.45);
  color: var(--on-plank);
}
.nail { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #c7b08a; border: 2px solid var(--line); }

/* Ribbon title that sits on the top edge of a panel */
.ribbon {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red); color: #fff7ea;
  font-family: var(--font-display); font-size: 20px; line-height: 1;
  padding: 8px 22px 9px;
  border: 3px solid var(--line);
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%, 10px 50%);
  box-shadow: inset 0 -4px 0 var(--red-dark);
  text-shadow: 0 2px 0 var(--red-dark);
}
.ribbon.teal { background: var(--teal); box-shadow: inset 0 -4px 0 var(--teal-dark); text-shadow: 0 2px 0 var(--teal-dark); }
.ribbon.olive { background: var(--olive); box-shadow: inset 0 -4px 0 var(--olive-dark); text-shadow: 0 2px 0 var(--olive-dark); }
.ribbon.purple { background: var(--purple); box-shadow: inset 0 -4px 0 var(--purple-dark); text-shadow: 0 2px 0 var(--purple-dark); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -30px 0 10px -6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px;
  border: 3px solid var(--line); border-radius: 10px 12px 9px 13px;
  background: var(--yellow); color: var(--ink);
  font-family: var(--font-display); font-size: 18px; letter-spacing: .01em;
  box-shadow: inset 0 -5px 0 var(--yellow-dark), 0 4px 0 rgba(0,0,0,.45);
  transition: transform .08s;
  text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 var(--yellow-dark), 0 1px 0 rgba(0,0,0,.45); }
.btn.red { background: var(--red); color: #fff7ea; box-shadow: inset 0 -5px 0 var(--red-dark), 0 4px 0 rgba(0,0,0,.45); }
.btn.teal { background: var(--teal); color: #fff7ea; box-shadow: inset 0 -5px 0 var(--teal-dark), 0 4px 0 rgba(0,0,0,.45); }
.btn.olive { background: var(--olive); box-shadow: inset 0 -5px 0 var(--olive-dark), 0 4px 0 rgba(0,0,0,.45); }
.btn.parch { background: var(--parchment); box-shadow: inset 0 -5px 0 var(--parchment-edge), 0 4px 0 rgba(0,0,0,.45); }
.btn.small { min-height: 38px; font-size: 15px; padding: 0 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; padding: 0; }
.link-btn { background: none; border: 0; padding: 6px 4px; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); min-height: 44px; }

/* ---------- chips, badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--card); padding: 1px 9px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); }
.xp-tag { background: var(--yellow); border: 2.5px solid var(--line); border-radius: 6px 9px 6px 8px; padding: 1px 7px; font-weight: 900; font-size: 12px; white-space: nowrap; box-shadow: inset 0 -3px 0 var(--yellow-dark); }
.boss-tag { background: var(--red); color: #fff7ea; border: 2px solid var(--line); border-radius: 5px; padding: 0 5px; font-weight: 900; font-size: 10px; letter-spacing: .08em; }
.hex {
  display: inline-flex; align-items: center; justify-content: center;
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  background: var(--line); padding: 3px;
}
.hex > span {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  background: var(--purple); color: #fff7ea; font-family: var(--font-display);
}

/* ---------- bars ---------- */
.bar { height: 16px; border: 3px solid var(--line); border-radius: 8px; background: var(--parchment-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--olive); box-shadow: inset 0 -4px 0 var(--olive-dark); border-right: 3px solid var(--line); transition: width .5s cubic-bezier(.2,.8,.3,1.2); }
.bar.thin { height: 12px; border-width: 2.5px; }

/* ---------- HUD ---------- */
.hud { display: flex; align-items: center; gap: 10px; padding: 10px 12px; position: relative; }
.hud .name { font-family: var(--font-display); font-size: 19px; color: var(--on-plank); text-shadow: 0 2px 0 var(--line); }
.hud .meta { font-size: 11px; color: var(--on-plank-soft); }
.hud .stats { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.hud .pill { display: flex; align-items: center; gap: 4px; background: var(--parchment); color: var(--ink); border: 2.5px solid var(--line); border-radius: 999px; padding: 1px 9px 1px 4px; font-weight: 900; font-size: 13px; }

/* ---------- map ---------- */
.map-stage { position: relative; width: 100%; aspect-ratio: 390 / 470; border: 3px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--water); box-shadow: 0 5px 0 rgba(0,0,0,.45); }
.map-stage svg.world { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-node {
  position: absolute; width: 54px; height: 54px; margin: -27px 0 0 -27px; padding: 0;
  border: 3px solid var(--line); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.2), 0 5px 0 var(--line);
  transition: transform .15s;
}
.map-node.sel { transform: scale(1.12); box-shadow: inset 0 -5px 0 rgba(0,0,0,.2), 0 0 0 5px var(--yellow), 0 5px 0 var(--line); }
.map-node .count { position: absolute; top: -9px; right: -11px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px; border: 2.5px solid var(--line); background: var(--red); color: #fff7ea; font-size: 12px; font-weight: 900; line-height: 19px; text-align: center; }
.map-node .label { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 9px; white-space: nowrap; background: var(--parchment); border: 2.5px solid var(--line); border-radius: 6px 9px 5px 8px; padding: 1px 9px; font-family: var(--font-display); font-size: 13px; color: var(--ink); box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.sprite { position: absolute; width: 44px; height: 54px; pointer-events: none; transition: left .6s cubic-bezier(.3,.7,.3,1), top .6s cubic-bezier(.3,.7,.3,1); }
.sprite > svg { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- quest rows ---------- */
.quest { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--card); border: 3px solid var(--line); border-radius: var(--radius-rough); box-shadow: 0 4px 0 rgba(0,0,0,.4); }
.quest.boss { background: #fde3dc; }
.quest.done { background: var(--parchment-2); }
.quest.done .q-title { text-decoration: line-through; color: var(--ink-soft); }
.q-check { width: 36px; height: 36px; flex-shrink: 0; border: 3px solid var(--line); border-radius: 9px 11px 8px 12px; background: var(--card); padding: 0; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 -4px 0 #e5d9c2; }
.quest.done .q-check { background: var(--olive); box-shadow: inset 0 -4px 0 var(--olive-dark); }
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; background: none; border: 0; padding: 0; text-align: left; }
.q-title { font-size: 15px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.q-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.q-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.swords { display: inline-flex; gap: 1px; }

.avatar-dot { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 13px; color: var(--ink); flex-shrink: 0; }

/* ---------- tabs ---------- */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tab { min-height: 48px; border: 3px solid var(--line); border-radius: 9px 12px 8px 11px; background: var(--parchment-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; font-size: 12px; font-weight: 900; padding: 4px 2px; box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.tab small { font-size: 11px; color: var(--ink-soft); }
.tab[aria-selected="true"] { background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-dark), 0 3px 0 rgba(0,0,0,.4); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 13px; font-weight: 900; }
.input { width: 100%; min-height: 46px; border: 3px solid var(--line); border-radius: 9px 11px 8px 12px; background: var(--card); padding: 0 12px; font-weight: 800; font-size: 16px; }
.input::placeholder { color: #8e7a62; }
textarea.input { padding: 10px 12px; min-height: 80px; resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 40px; padding: 0 12px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 900; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--yellow); box-shadow: inset 0 -3px 0 var(--yellow-dark); }
.row { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--ink-soft); font-size: 13px; }
.err { color: var(--red-dark); font-weight: 900; font-size: 14px; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 10px);
  width: calc(100% - 24px); max-width: 496px; height: 74px; z-index: 20;
  display: flex; align-items: center; justify-content: space-around; padding: 0 6px;
}
.nav button { background: none; border: 0; color: var(--on-plank); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 58px; min-height: 56px; font-size: 11px; font-weight: 900; border-radius: 12px; text-shadow: 0 1px 0 var(--line); }
.nav button[aria-current="page"] { background: var(--parchment); color: var(--ink); border: 2.5px solid var(--line); text-shadow: none; box-shadow: inset 0 -3px 0 var(--parchment-edge); }
.nav .fab { width: 64px; height: 64px; min-width: 64px; margin-top: -34px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--line); box-shadow: inset 0 -5px 0 var(--yellow-dark), 0 5px 0 rgba(0,0,0,.5); color: var(--ink); }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 13, 9, .72); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease-out; }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; margin: 0 8px calc(var(--safe-bottom) + 8px); animation: rise .25s cubic-bezier(.2,.8,.3,1.1); display: flex; flex-direction: column; gap: 14px; padding-top: 26px; }
.sheet .close { position: absolute; top: 10px; right: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.toast { position: fixed; left: 50%; top: calc(var(--safe-top) + 90px); z-index: 60; transform: translateX(-50%); background: var(--yellow); border: 3px solid var(--line); border-radius: 10px 14px 9px 13px; box-shadow: inset 0 -5px 0 var(--yellow-dark), 0 5px 0 rgba(0,0,0,.5); padding: 8px 18px; font-family: var(--font-display); font-size: 26px; white-space: nowrap; pointer-events: none; animation: pop 1.6s ease-out forwards; }
@keyframes pop { 0% { transform: translate(-50%, 12px) scale(.5); opacity: 0; } 18% { transform: translate(-50%, 0) scale(1.15); opacity: 1; } 32% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -28px); opacity: 0; } }

/* ---------- reward screen ---------- */
.reward { position: fixed; inset: 0; z-index: 70; background: #3b2a4f; color: #fff7ea; overflow: hidden; display: flex; flex-direction: column; align-items: center; padding: calc(var(--safe-top) + 40px) 20px calc(var(--safe-bottom) + 24px); animation: fade .25s; }
.reward .burst { position: absolute; left: 50%; top: 34%; width: 1200px; height: 1200px; margin: -600px 0 0 -600px; border-radius: 50%; background: repeating-conic-gradient(#4d3866 0deg 12deg, #3b2a4f 12deg 24deg); animation: spin 40s linear infinite; }
.reward > *:not(.burst) { position: relative; }
.reward h1 { font-size: 56px; color: var(--yellow); -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; text-shadow: 0 6px 0 var(--line); text-align: center; line-height: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ach { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px 10px; background: var(--card); border: 3px solid var(--line); border-radius: var(--radius-rough); box-shadow: 0 4px 0 rgba(0,0,0,.4); font-size: 12px; font-weight: 900; text-align: center; line-height: 1.15; }
.ach.locked { background: var(--parchment-2); color: var(--ink-soft); }
.ach[aria-pressed="true"] { background: #fff0c4; transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.4); }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { border: 3px solid var(--line); border-radius: var(--radius-rough); padding: 12px; display: flex; flex-direction: column; gap: 2px; box-shadow: inset 0 -5px 0 rgba(0,0,0,.18), 0 4px 0 rgba(0,0,0,.4); }
.stat b { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1; }
.stat span { font-size: 13px; font-weight: 900; }

.empty { text-align: center; padding: 18px 10px; color: var(--ink-soft); }
.empty h3 { color: var(--ink); font-size: 20px; margin-bottom: 4px; }

.demo-banner { background: var(--teal); color: #fff7ea; border: 3px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; box-shadow: 0 4px 0 rgba(0,0,0,.4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   INVITE SCROLL
   ===================================================================== */
.scrim.center { align-items: center; padding: 16px; }
.scroll { position: relative; width: min(100%, 400px); margin: auto; animation: unroll .45s cubic-bezier(.2,.8,.3,1); }
@keyframes unroll { from { clip-path: inset(45% 0 45% 0); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
.scroll-rod { position: relative; height: 24px; margin: 0 -10px; border: 3px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, var(--rod) 0 45%, var(--rod-dark) 100%); z-index: 2; }
.scroll-rod::before, .scroll-rod::after { content: ''; position: absolute; top: 50%; width: 18px; height: 30px; margin-top: -15px;
  border: 3px solid var(--line); border-radius: 8px; background: var(--rod-dark); }
.scroll-rod::before { left: -14px; } .scroll-rod::after { right: -14px; }
.scroll-paper { position: relative; margin: -6px 6px; padding: 26px 22px 30px; text-align: center;
  background: var(--parchment); border-left: 3px solid var(--line); border-right: 3px solid var(--line);
  box-shadow: inset 12px 0 18px -10px rgba(0,0,0,.25), inset -12px 0 18px -10px rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; gap: 10px; }
.scroll-paper h2 { font-size: 34px; line-height: 1; }
.scroll-party { font-family: var(--font-display); font-size: 26px; line-height: 1.1; color: var(--red-dark); overflow-wrap: anywhere; }
.qr-frame { background: #f6ecd6; border: 3px solid var(--line); border-radius: 10px; padding: 10px; width: 220px; max-width: 100%; box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.qr-frame svg { display: block; width: 100%; height: auto; }
.scroll-code { font-family: var(--font-display); font-size: 30px; letter-spacing: .18em; padding: 2px 14px; border: 3px dashed var(--line); border-radius: 10px; background: var(--card); }
.seal { position: absolute; right: 8px; bottom: 6px; width: 76px; height: 76px; z-index: 3; transform: rotate(-12deg); filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.scroll .close { position: absolute; top: 6px; right: 6px; z-index: 4; }

/* ---------- theme picker ---------- */
.theme-grid { display: grid; gap: 12px; }
.theme-card { display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; width: 100%;
  background: var(--table); background-image: var(--table-image); color: var(--on-table);
  border: 3px solid var(--line); border-radius: 16px; font-family: var(--font-body); font-weight: var(--font-weight-body); }
.theme-card[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--yellow); }
.theme-card .tc-name { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
.theme-card .tc-desc { font-size: 13px; opacity: .9; }
.theme-card .tc-swatch { display: flex; gap: 4px; margin-top: 6px; }
.theme-card .tc-swatch i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); }
.theme-card .tc-art { flex-shrink: 0; width: 64px; height: 64px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: var(--parchment); border: 3px solid var(--line); }

/* =====================================================================
   THEME: STJÄRNRIKET (mythic) – elegant anime-fantasy. Ivory, gold filigree,
   twilight navy, soft glow. Thin gold frames instead of thick ink.
   ===================================================================== */
[data-theme="mythic"] {
  --table: #1c2244;
  --table-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1.6px) 0 0 / 34px 34px,
                 radial-gradient(rgba(255,240,200,.10) 1px, transparent 1.6px) 17px 17px / 34px 34px,
                 radial-gradient(circle at 50% -10%, #44509a 0, #1c2244 65%);
  --parchment: #f7f2e6; --parchment-2: #ece3cd; --parchment-edge: #c9a55a;
  --card: #fffdf8; --ink: #2b2f4a; --ink-soft: #5d6283; --line: #b08d48;
  --on-table: #f6e7bf; --on-plank: #f6e7bf; --on-plank-soft: #d9cfae;
  --title-shadow: 0 2px 14px rgba(0,0,0,.55);
  --font-display: 'Marcellus', Georgia, serif; --font-body: 'Quicksand', system-ui, sans-serif; --font-weight-body: 700;
  --red: #d96c7b; --red-dark: #a84a58; --teal: #4aa8c0; --teal-dark: #2f7d92;
  --olive: #7cc3a4; --olive-dark: #4f957a; --yellow: #e9c46a; --yellow-dark: #b8913f;
  --purple: #6b6fd4; --purple-dark: #474ba6;
  --tile-1: #f3dc9a; --tile-2: #f4c3cc; --tile-3: #d3cff5; --tile-4: #b5e2d2;
  --banner-sky: #cfe3f7; --banner-ground: #a8d98a; --highlight-panel: #fbf1d3; --locked: #ddd6c6;
  --rod: #e2c27a; --rod-dark: #a8823e; --seal: #4e6bb0; --seal-dark: #2f3a6e;
  --radius-rough: 14px;
  --m-water: #6fc6df; --m-sand: #f3e3bf; --m-grass: #a8d98a; --m-tuft: #74b062; --m-line: #2b2f4a; --m-path: #fffaf0;
  --m-mtn1: #aaa4e6; --m-mtn2: #cbc6f4; --m-star: #f0d48a; --m-flag: #e9c46a;
  --m-castle: #f7f2e6; --m-castle2: #e6dcc6; --m-roof: #4e6bb0; --m-window: #2b2f4a;
  --m-tree1: #5fae74; --m-tree2: #78c48a; --m-trunk: #9b7653;
  --m-house: #fffaf0; --m-house-roof: #e98a9b; --m-swamp: #7fc4b5; --m-swamp2: #5aa898; --m-pad: #a8d98a;
}
[data-theme="mythic"] .parchment, [data-theme="mythic"].parchment {
  border: 2px solid var(--line); border-radius: 18px;
  box-shadow: inset 0 0 0 4px var(--parchment), inset 0 0 0 5px rgba(176,141,72,.55), 0 10px 28px rgba(5,8,30,.45);
}
[data-theme="mythic"] .plank {
  background: linear-gradient(180deg, #34407a, #232b55); border: 2px solid #c9a55a; border-radius: 20px;
  box-shadow: inset 0 0 0 3px #232b55, inset 0 0 0 4px rgba(201,165,90,.45), 0 10px 26px rgba(5,8,30,.5);
}
[data-theme="mythic"] .nail { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); background: #e9c46a; border: 1px solid #fff6dc; }
[data-theme="mythic"] .ribbon {
  clip-path: none; border-radius: 999px; border: 2px solid #c9a55a; background: linear-gradient(180deg, #34407a, #232b55);
  color: #f6e7bf; text-shadow: none; box-shadow: 0 4px 12px rgba(5,8,30,.35); font-size: 19px; padding: 7px 20px;
}
[data-theme="mythic"] .btn {
  border: 2px solid #9c7a35; border-radius: 999px; background: linear-gradient(180deg, #f6dc98, #dcb562);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 4px 12px rgba(5,8,30,.3); color: #2b2f4a;
}
[data-theme="mythic"] .btn.red { background: linear-gradient(180deg, #e58c99, #c4606f); color: #fff; }
[data-theme="mythic"] .btn.teal { background: linear-gradient(180deg, #6cc1d6, #3c93ab); color: #fff; }
[data-theme="mythic"] .btn.olive { background: linear-gradient(180deg, #9ad9bb, #5fae8e); color: #1f3a30; }
[data-theme="mythic"] .btn.parch { background: linear-gradient(180deg, #fffdf8, #ece3cd); }
[data-theme="mythic"] .btn:active { transform: translateY(2px); }
[data-theme="mythic"] .quest, [data-theme="mythic"] .ach, [data-theme="mythic"] .stat, [data-theme="mythic"] .tab {
  border-width: 2px; border-radius: 14px; box-shadow: 0 4px 14px rgba(5,8,30,.18);
}
[data-theme="mythic"] .q-check { border-width: 2px; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--card); }
[data-theme="mythic"] .bar { border-width: 2px; border-radius: 999px; }
[data-theme="mythic"] .bar > i { background: linear-gradient(90deg, #7fd3e6, #b8a6f0); box-shadow: 0 0 10px rgba(127,211,230,.8); border-right: 0; }
[data-theme="mythic"] .hex { background: #c9a55a; }
[data-theme="mythic"] .hex > span { background: #2f3a6e; color: #f6e7bf; }
[data-theme="mythic"] .xp-tag { border-width: 2px; border-radius: 999px; box-shadow: none; background: #f3dc9a; }
[data-theme="mythic"] .map-stage { border: 2px solid #c9a55a; border-radius: 22px; box-shadow: 0 0 0 4px #232b55, 0 0 0 5px rgba(201,165,90,.5), 0 14px 30px rgba(5,8,30,.5); }
[data-theme="mythic"] .map-node { border-width: 2px; box-shadow: 0 0 0 3px rgba(255,255,255,.6), 0 6px 14px rgba(5,8,30,.35); }
[data-theme="mythic"] .map-node.sel { box-shadow: 0 0 0 4px #f6e7bf, 0 0 18px 6px rgba(246,231,191,.8); }
[data-theme="mythic"] .map-node .label { border-width: 2px; border-radius: 999px; font-size: 12px; }
[data-theme="mythic"] .nav .fab { background: radial-gradient(circle at 35% 30%, #fff1c4, #dcb562 70%); border: 2px solid #9c7a35; box-shadow: 0 0 18px rgba(246,220,152,.7), 0 6px 14px rgba(5,8,30,.5); }
[data-theme="mythic"] .toast { border-radius: 999px; border-width: 2px; background: linear-gradient(180deg, #f6dc98, #dcb562); box-shadow: 0 0 24px rgba(246,220,152,.8); }
[data-theme="mythic"] .reward { background: #1c2244; }
[data-theme="mythic"] .reward .burst { background: repeating-conic-gradient(rgba(246,220,152,.16) 0deg 6deg, transparent 6deg 24deg); }
[data-theme="mythic"] .reward h1 { color: #f6e7bf; -webkit-text-stroke: 0; text-shadow: 0 0 22px rgba(246,220,152,.9); font-size: 46px; }

/* =====================================================================
   THEME: JÄRNKRONAN (raid) – dark MMO. Stone and leather panels in bronze
   frames, crimson banners, gold lettering, purple XP glow.
   ===================================================================== */
[data-theme="raid"] {
  --table: #0f0b09;
  --table-image: repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 2px, transparent 2px 5px),
                 radial-gradient(circle at 50% -10%, #3a2a20 0, #0f0b09 70%);
  --parchment: #2a211c; --parchment-2: #1d1713; --parchment-edge: #5a4430;
  --card: #1f1915; --ink: #efe2c2; --ink-soft: #b9a98a; --line: #7c5e34;
  --on-table: #ecd9ae; --on-plank: #ecd9ae; --on-plank-soft: #b9a98a;
  --title-shadow: 0 2px 0 #000, 0 0 14px rgba(201,163,91,.35);
  --font-display: 'Cinzel', Georgia, serif; --font-body: 'Alegreya Sans', system-ui, sans-serif; --font-weight-body: 700;
  --red: #8e2a20; --red-dark: #561812; --teal: #2f5f8a; --teal-dark: #1c3c5a;
  --olive: #4f7a2a; --olive-dark: #30501a; --yellow: #c9a35b; --yellow-dark: #7c5e34;
  --purple: #6a3fb5; --purple-dark: #3f2475;
  --tile-1: #4a3818; --tile-2: #4f1c17; --tile-3: #33264f; --tile-4: #1d4038;
  --banner-sky: #24304a; --banner-ground: #34502a; --highlight-panel: #2f2416; --locked: #3a302a;
  --rod: #6a5a4a; --rod-dark: #3a3029; --seal: #8e2a20; --seal-dark: #4f120d;
  --radius-rough: 6px;
  --m-water: #1f3d55; --m-wave: #5d86a3; --m-sand: #6f5f45; --m-grass: #3f5c2e; --m-tuft: #2c4220;
  --m-line: #0b0806; --m-path: #c9a35b;
  --m-mtn1: #4b4a5e; --m-mtn2: #64637a; --m-snow: #cfd6e2; --m-star: #c9a35b; --m-cloud: #57607a;
  --m-flag: #c9a35b; --m-castle: #6d6c78; --m-castle2: #57566a; --m-roof: #7a1e1a; --m-window: #f2b632;
  --m-tree1: #23401f; --m-tree2: #2e5228; --m-trunk: #3b2a1c;
  --m-house: #5d4a36; --m-house-roof: #6a1a16; --m-door: #f2b632;
  --m-swamp: #2f4a3e; --m-swamp2: #1d3229; --m-pad: #4f7a2a; --m-reed: #6d8a3a; --m-cattail: #3b2a1c;
}
[data-theme="raid"] .parchment, [data-theme="raid"].parchment {
  border: 2px solid #8a6a3a; border-radius: 6px;
  background-image: linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.18));
  box-shadow: inset 0 0 0 2px #0a0706, inset 0 0 0 3px rgba(201,163,91,.35), 0 6px 0 #000, 0 10px 24px rgba(0,0,0,.6);
}
[data-theme="raid"] .plank {
  background: linear-gradient(180deg, #332a24, #1a1411); border: 2px solid #8a6a3a; border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(201,163,91,.35), inset 0 0 0 3px #0a0706, 0 6px 0 #000;
}
[data-theme="raid"] .nail { background: radial-gradient(circle at 35% 35%, #f0d08a, #7c5e34); border-color: #0a0706; }
[data-theme="raid"] .ribbon {
  background: linear-gradient(180deg, #a3332a, #6e1f17); border: 2px solid #c9a35b; color: #f6e7c1;
  box-shadow: inset 0 -3px 0 #4a120c; text-shadow: 0 2px 0 #000; font-weight: 700; font-size: 18px; letter-spacing: .04em;
}
[data-theme="raid"] h1, [data-theme="raid"] h2, [data-theme="raid"] h3 { font-weight: 700; letter-spacing: .03em; }
[data-theme="raid"] .btn {
  border: 2px solid #c9a35b; border-radius: 4px; background: linear-gradient(180deg, #a3332a, #6e1f17); color: #f6e7c1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 -3px 0 #4a120c, 0 4px 0 #000; text-shadow: 0 1px 0 #000;
  font-weight: 700; font-size: 16px; letter-spacing: .03em;
}
[data-theme="raid"] .btn.teal { background: linear-gradient(180deg, #3a6f9e, #1f4366); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 -3px 0 #132a40, 0 4px 0 #000; }
[data-theme="raid"] .btn.olive { background: linear-gradient(180deg, #5f8f33, #36561c); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 -3px 0 #22380f, 0 4px 0 #000; }
[data-theme="raid"] .btn.parch { background: linear-gradient(180deg, #3a312b, #221b17); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -3px 0 #120e0b, 0 4px 0 #000; }
[data-theme="raid"] .btn svg { stroke: #f6e7c1 !important; }
[data-theme="raid"] .quest { border-width: 2px; border-color: #5a4430; border-radius: 4px; background: #1f1915; box-shadow: inset 0 0 0 1px #0a0706, 0 3px 0 #000; }
[data-theme="raid"] .quest.boss { background: #2e1512; border-color: #8e2a20; }
[data-theme="raid"] .quest.done { background: #161210; }
[data-theme="raid"] .q-check { border-width: 2px; border-radius: 3px; background: #0f0b09; box-shadow: inset 0 0 0 1px #3a2c1f; }
[data-theme="raid"] .quest.done .q-check { background: #4f7a2a; }
[data-theme="raid"] .tab, [data-theme="raid"] .ach, [data-theme="raid"] .stat { border-width: 2px; border-radius: 4px; box-shadow: inset 0 0 0 1px #0a0706, 0 3px 0 #000; }
[data-theme="raid"] .tab { background: #1f1915; }
[data-theme="raid"] .tab[aria-selected="true"], [data-theme="raid"] .seg button[aria-pressed="true"] { background: linear-gradient(180deg, #a3332a, #6e1f17); color: #f6e7c1; box-shadow: inset 0 -3px 0 #4a120c; }
[data-theme="raid"] .tab[aria-selected="true"] small { color: #e9c9a0; }
[data-theme="raid"] .seg button { border-radius: 4px; border-width: 2px; }
[data-theme="raid"] .bar { border-width: 2px; border-radius: 2px; background: #0a0706; }
[data-theme="raid"] .bar > i { background: linear-gradient(180deg, #a77bff, #6a3fb5); box-shadow: 0 0 10px rgba(167,123,255,.7); border-right: 0; }
[data-theme="raid"] .hex { background: #c9a35b; }
[data-theme="raid"] .hex > span { background: #3a1510; color: #f0d08a; }
[data-theme="raid"] .xp-tag { background: #2a1f10; color: #f0d08a; border: 1.5px solid #c9a35b; border-radius: 3px; box-shadow: none; }
[data-theme="raid"] .chip { border-width: 1.5px; border-radius: 3px; }
[data-theme="raid"] .avatar-dot { color: #1a120c; }
[data-theme="raid"] .input { border-width: 2px; border-radius: 4px; }
[data-theme="raid"] .input::placeholder { color: #85765e; }
[data-theme="raid"] .map-stage { border: 3px solid #8a6a3a; border-radius: 6px; box-shadow: inset 0 0 40px rgba(0,0,0,.6), 0 0 0 3px #0a0706, 0 8px 0 #000; }
[data-theme="raid"] .map-node { border-width: 2px; border-color: #c9a35b; box-shadow: inset 0 -5px 0 rgba(0,0,0,.35), 0 0 0 3px #0a0706, 0 5px 0 #000; }
[data-theme="raid"] .map-node.sel { box-shadow: 0 0 0 3px #0a0706, 0 0 16px 6px rgba(242,182,50,.7); }
[data-theme="raid"] .map-node svg { stroke: #0b0806 !important; }
[data-theme="raid"] .map-node .label { border-width: 1.5px; border-color: #c9a35b; border-radius: 3px; font-size: 12px; background: #1a1411; color: #ecd9ae; }
[data-theme="raid"] .nav button[aria-current="page"] { background: linear-gradient(180deg, #a3332a, #6e1f17); color: #f6e7c1; border-color: #c9a35b; box-shadow: none; }
[data-theme="raid"] .nav button[aria-current="page"] svg { stroke: #f6e7c1 !important; }
[data-theme="raid"] .nav .fab { background: radial-gradient(circle at 35% 30%, #c4453a, #6e1f17 70%); border: 2px solid #c9a35b; box-shadow: 0 0 16px rgba(196,69,58,.6), 0 6px 0 #000; }
[data-theme="raid"] .nav .fab svg { stroke: #f6e7c1 !important; }
[data-theme="raid"] .hud .pill { border-width: 1.5px; border-radius: 3px; }
[data-theme="raid"] .toast { background: linear-gradient(180deg, #2a1f10, #120d08); color: #f0d08a; border: 2px solid #c9a35b; border-radius: 4px; box-shadow: 0 0 22px rgba(201,163,91,.5); }
[data-theme="raid"] .reward { background: #0f0b09; }
[data-theme="raid"] .reward .burst { background: repeating-conic-gradient(rgba(201,163,91,.12) 0deg 8deg, transparent 8deg 24deg); }
[data-theme="raid"] .reward h1 { color: #f0d08a; -webkit-text-stroke: 0; text-shadow: 0 3px 0 #000, 0 0 20px rgba(201,163,91,.7); font-size: 44px; }
[data-theme="raid"] .stat b, [data-theme="raid"] .stat span { color: #efe2c2; }
[data-theme="raid"] .scroll-party { color: #e0794f; }
[data-theme="raid"] .q-check svg, [data-theme="raid"] .quest .swords svg { stroke: #efe2c2 !important; }
[data-theme="raid"] .scroll-paper { background-image: linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.2)); }

/* =====================================================================
   TRADING CARDS
   ===================================================================== */
.tcg-card { --frame: #b8ad9c; --frame-2: #8a8072; position: relative; display: inline-block; aspect-ratio: 5 / 7; padding: .45em;
  border: .18em solid #2a1f17; border-radius: .8em; background: linear-gradient(160deg, var(--frame), var(--frame-2));
  box-shadow: 0 .3em 0 rgba(0,0,0,.45); color: #2a1f17; font-family: 'Lilita One', sans-serif; text-align: left; overflow: hidden;
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .12s; flex-shrink: 0; }
button.tcg-card { cursor: pointer; }
.tcg-card.r-uncommon { --frame: #8fcf7a; --frame-2: #4f9a4f; }
.tcg-card.r-rare { --frame: #7fb2f0; --frame-2: #2f62b8; }
.tcg-card.r-legendary { --frame: #ffe08a; --frame-2: #c98a12; box-shadow: 0 0 1.2em rgba(255,200,80,.55), 0 .3em 0 rgba(0,0,0,.45); }
.tcg-inner { display: flex; flex-direction: column; height: 100%; gap: .3em; background: #f6ecd6; border: .12em solid #2a1f17; border-radius: .5em; padding: .35em; }
.r-legendary .tcg-inner { background: linear-gradient(180deg, #fff6d8, #f4e0a6); }
.tcg-name { font-size: 1.05em; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcg-art { flex: 0 0 auto; aspect-ratio: 1; border: .12em solid #2a1f17; border-radius: .35em; overflow: hidden; }
.tcg-rarity { display: flex; align-items: center; gap: .3em; font-size: .7em; letter-spacing: .04em; }
.tcg-text { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .62em; line-height: 1.25; color: #5a4a3a; overflow: hidden; }
.tcg-count { position: absolute; top: .3em; right: .3em; background: #2a1f17; color: #fff; border-radius: 999px; padding: 0 .45em; font-size: .75em; z-index: 3; }
.tcg-back { padding: 0; border-radius: .8em; background: #3a2a4f; }
.tcg-card.locked { filter: grayscale(1) brightness(.45); }
.tcg-card.locked .tcg-text, .tcg-card.locked .tcg-name { visibility: hidden; }

/* Holographic foil for legendaries */
.tcg-foil { position: absolute; inset: 0; pointer-events: none; z-index: 2; border-radius: inherit; mix-blend-mode: soft-light; opacity: .95;
  background:
    repeating-linear-gradient(115deg, rgba(255,126,179,.8) 0%, rgba(255,211,110,.8) 7%, rgba(140,255,155,.8) 14%, rgba(110,198,255,.8) 21%, rgba(197,140,255,.8) 28%, rgba(255,126,179,.8) 35%),
    radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255,255,255,.7), transparent 45%);
  background-size: 300% 300%, 100% 100%; background-position: var(--fx, 0%) var(--fy, 0%), 0 0;
  animation: foil 6s linear infinite; }
.tcg-shine { position: absolute; inset: -40%; pointer-events: none; z-index: 2; mix-blend-mode: overlay;
  background: linear-gradient(105deg, transparent 42%, rgba(255,255,255,.9) 50%, transparent 58%); animation: shine 3.2s ease-in-out infinite; }
@keyframes foil { to { background-position: 300% 300%, 0 0; } }
@keyframes shine { 0% { transform: translateX(-60%); } 60%, 100% { transform: translateX(60%); } }

/* ---------- collection book ---------- */
.book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; justify-items: center; }
.book-grid .tcg-card { width: 100% !important; }
.slot-empty { width: 100%; aspect-ratio: 5 / 7; border: 3px dashed var(--line); border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: var(--ink-soft); font-size: 12px; text-align: center; background: var(--parchment-2); padding: 4px; }
.card-viewer { position: fixed; inset: 0; z-index: 80; background: rgba(15,10,8,.9); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; animation: fade .2s; touch-action: none; }

/* ---------- pack opening ---------- */
.pack-stage { position: fixed; inset: 0; z-index: 85; background: radial-gradient(circle at 50% 40%, #3a2a4f, #120d16 70%); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: calc(var(--safe-top) + 20px) 16px calc(var(--safe-bottom) + 20px); overflow-y: auto; }
.pack-stage h2 { font-family: 'Lilita One', sans-serif; font-size: 30px; color: #ffe08a; text-shadow: 0 3px 0 #000; text-align: center; }
.pack-wobble { animation: wobble 1.4s ease-in-out infinite; cursor: pointer; background: none; border: 0; padding: 0; }
@keyframes wobble { 0%,100% { transform: rotate(-3deg) scale(1); } 50% { transform: rotate(3deg) scale(1.04); } }
.pack-rip { animation: rip .5s ease-in forwards; }
@keyframes rip { to { transform: scale(1.4) rotate(8deg); opacity: 0; } }
.reveal-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 520px; }
.flip { perspective: 800px; background: none; border: 0; padding: 0; }
.flip-inner { position: relative; transition: transform .55s cubic-bezier(.3,.7,.3,1.2); transform-style: preserve-3d; }
.flip.open .flip-inner { transform: rotateY(180deg); }
.flip-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip-face.front { position: absolute; inset: 0; transform: rotateY(180deg); }
.flip.open.is-legendary { animation: legendpop .9s ease-out; }
@keyframes legendpop { 0% { filter: drop-shadow(0 0 0 #ffd36e); } 40% { filter: drop-shadow(0 0 30px #ffd36e); } 100% { filter: drop-shadow(0 0 10px #ffd36e); } }
.flip.open.is-rare { filter: drop-shadow(0 0 12px #7fb2f0); }

/* ---------- shop & adventure ---------- */
.shop-item { display: flex; gap: 14px; align-items: center; }
.level-step { display: flex; gap: 12px; align-items: flex-start; }
.level-dot { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; border: 3px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 18px; background: var(--parchment-2); }
.level-dot.done { background: var(--olive); }
.level-dot.current { background: var(--yellow); box-shadow: 0 0 0 4px rgba(242,182,50,.35); }
.story { font-style: italic; margin: 0; white-space: pre-line; }
.reward-chip { display: inline-flex; align-items: center; gap: 6px; border: 2.5px dashed var(--line); border-radius: 10px; padding: 4px 10px; font-size: 13px; background: var(--card); }
.admin-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; letter-spacing: .06em; background: var(--yellow); color: #2a1f17; border: 2px solid var(--line); border-radius: 6px; padding: 0 5px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 6px 4px; border-bottom: 1.5px solid var(--parchment-edge); vertical-align: top; }
.data-table th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.table-wrap { overflow-x: auto; }

/* ---- Magical summons (quests from a persona) and proof verdicts ---- */
.summon { --p: #f2b632; position: fixed; inset: 0; z-index: 75; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: calc(var(--safe-top) + 28px) 16px calc(var(--safe-bottom) + 24px); color: #fff7ea; text-align: center;
  background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--p) 45%, #1a1035) 0%, #1a1035 45%, #0b0718 100%); animation: fade .5s; }
.summon > *:not(.summon-sky) { position: relative; }
.summon-sky { position: fixed; inset: 0; pointer-events: none; }
.summon .spark { position: absolute; border-radius: 50%; background: #fff; box-shadow: 0 0 8px 2px var(--p); opacity: 0; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1); } }
.summon-circle { width: 220px; height: 220px; flex: none; display: grid; place-items: center; margin-top: 4px; animation: summonIn .9s cubic-bezier(.2, .9, .3, 1.3); }
.summon-circle .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--p) 80%, #fff); opacity: .7; animation: spin 18s linear infinite; }
.summon-circle .r2 { inset: 18px; border-style: dotted; border-width: 3px; animation-direction: reverse; animation-duration: 12s; }
.summon-circle .r3 { inset: 36px; border: 2px solid color-mix(in srgb, var(--p) 60%, transparent); box-shadow: 0 0 40px 6px color-mix(in srgb, var(--p) 55%, transparent), inset 0 0 30px color-mix(in srgb, var(--p) 40%, transparent); animation: glowPulse 2.4s ease-in-out infinite; }
.summon-sigil { filter: drop-shadow(0 0 10px var(--p)) drop-shadow(0 0 24px var(--p)); animation: bob 2.6s ease-in-out infinite; }
@keyframes summonIn { from { transform: scale(.2) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes glowPulse { 50% { box-shadow: 0 0 70px 14px color-mix(in srgb, var(--p) 65%, transparent), inset 0 0 40px color-mix(in srgb, var(--p) 55%, transparent); } }
.summon-title { font-family: var(--font-display); font-size: 36px; line-height: 1.05; margin: 6px 0 0; color: #fff7ea; text-shadow: 0 0 18px var(--p), 0 3px 0 rgba(0,0,0,.5); animation: rise .7s .35s both; }
.summon-sub { margin: 0; font-size: 17px; font-weight: 800; max-width: 420px; opacity: .92; animation: rise .7s .55s both; }
.summon-scroll { width: 100%; max-width: 440px; color: var(--ink); text-align: left; display: flex; flex-direction: column; gap: 8px; animation: unroll .7s .8s both; }
.summon-scroll ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 17px; }
.summon-note { margin: 0; font-style: italic; }
.summon-btn { width: 100%; max-width: 440px; min-height: 58px; font-size: 21px; margin-top: auto; animation: rise .6s 1.2s both; }
@media (prefers-reduced-motion: reduce) { .summon *, .summon { animation: none !important; } .summon .spark { opacity: .6; } }

/* ---- Photo proofs ---- */
.proof-img { width: 100%; max-height: 52dvh; object-fit: contain; border: 3px solid var(--line); border-radius: 12px; background: var(--card); }
.proof-drop { position: relative; min-height: 180px; border: 3px dashed var(--line); border-radius: 14px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center; cursor: pointer; }
.review-row { gap: 10px; width: 100%; background: var(--card); border: 3px solid var(--line); border-radius: 12px; padding: 10px; color: var(--ink); font: inherit; min-height: 56px; }
.chip.proof-pending { background: var(--highlight-panel); }
.chip.proof-approved { background: var(--tile-1); }
.chip.proof-rejected { background: var(--red); color: #fff7ea; }
.sigil-badge { --p: #f2b632; display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #3a2a66, #160f2c); border: 2px solid var(--line); box-shadow: 0 0 6px color-mix(in srgb, var(--p) 60%, transparent); }

/* =====================================================================
   THEME 4: ORBITAL (NASA-punk, for adults). Bone panels on deep space,
   condensed caps, mono data labels, signal orange + agency blue.
   ===================================================================== */
[data-theme="orbit"] {
  color-scheme: dark;
  --table: #0d1015; --table-2: #151a21;
  --table-image: radial-gradient(circle at 20% 12%, rgba(255,255,255,.06) 0 1px, transparent 2px), radial-gradient(circle at 70% 40%, rgba(255,255,255,.05) 0 1px, transparent 2px);
  --wood: #1a1f26; --wood-dark: #11151b; --wood-light: #2a2f37;
  --parchment: #ece8df; --parchment-2: #ddd8cc; --parchment-edge: #b9b3a6;
  --card: #f6f4ef; --ink: #1c2027; --ink-soft: #4f555e; --line: #2a2f37;
  --on-table: #e9e6df; --on-plank: #c3c8cf; --on-plank-soft: #9aa1ab;
  --title-shadow: none;
  --font-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Barlow', system-ui, sans-serif; --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-weight-body: 500;
  --red: #c4491b; --red-dark: #8f3412; --teal: #2c5f9e; --teal-dark: #1d4473;
  --olive: #1c2027; --olive-dark: #000; --yellow: #ece8df; --yellow-dark: #b9b3a6;
  --purple: #1c2027; --purple-dark: #000; --cyan: #4fa3c7;
  --tile-1: #ece8df; --tile-2: #dfe6ef; --tile-3: #e6e1ef; --tile-4: #e1ebe3;
  --highlight-panel: #f3e3cf; --locked: #d6d2c8;
  --radius-rough: 10px;
}
[data-theme="orbit"] body { background-size: 46px 46px, 63px 63px; }
[data-theme="orbit"] .parchment, [data-theme="orbit"].parchment { border: 2px solid var(--line); border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 1px 0 #000; }
[data-theme="orbit"] .plank { background: #1a1f26; background-image: none; border: 2px solid #2a2f37; border-radius: 12px; box-shadow: 0 1px 0 #000; }
[data-theme="orbit"] .nail { display: none; }
[data-theme="orbit"] .ribbon { clip-path: none; border: 0; border-radius: 5px; padding: 5px 10px; background: var(--ink); color: #ece8df; box-shadow: none; text-shadow: none;
  font-weight: 700; font-size: 16px; letter-spacing: .12em; text-transform: uppercase; }
[data-theme="orbit"] .ribbon.teal { background: var(--teal); box-shadow: none; text-shadow: none; }
[data-theme="orbit"] .ribbon.olive, [data-theme="orbit"] .ribbon.purple { background: var(--ink); box-shadow: none; text-shadow: none; }
[data-theme="orbit"] .panel-head { margin: -28px 0 10px -4px; }
[data-theme="orbit"] h1, [data-theme="orbit"] h2, [data-theme="orbit"] h3 { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
[data-theme="orbit"] .btn { border: 2px solid var(--line); border-radius: 8px; background: var(--ink); color: #ece8df; box-shadow: none; text-shadow: none;
  font-weight: 700; font-size: 16px; letter-spacing: .12em; text-transform: uppercase; }
[data-theme="orbit"] .btn:active { transform: translateY(1px); box-shadow: none; }
[data-theme="orbit"] .btn.red { background: var(--red); color: #fff; box-shadow: none; }
[data-theme="orbit"] .btn.teal { background: var(--teal); color: #fff; box-shadow: none; }
[data-theme="orbit"] .btn.olive { background: var(--teal); color: #fff; box-shadow: none; }
[data-theme="orbit"] .btn.parch { background: transparent; color: var(--ink); border-color: var(--ink); box-shadow: none; }
[data-theme="orbit"] .btn svg { stroke: currentColor !important; }
[data-theme="orbit"] .link-btn { text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-display); font-weight: 600; }
[data-theme="orbit"] .chip { border-width: 1.5px; border-radius: 4px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; background: transparent; padding: 1px 6px; }
[data-theme="orbit"] .chip .dot { border-width: 1.5px; }
[data-theme="orbit"] .xp-tag { background: transparent; border: 0; border-radius: 0; box-shadow: none; font-family: var(--font-mono); font-weight: 600; color: var(--ink-soft); font-size: 12px; }
[data-theme="orbit"] .quest.boss .xp-tag { color: var(--red); }
[data-theme="orbit"] .boss-tag { border: 0; border-radius: 3px; font-family: var(--font-mono); font-size: 10px; padding: 2px 5px; letter-spacing: .04em; }
[data-theme="orbit"] .hud .hex { background: transparent; clip-path: none; width: auto !important; height: auto !important; }
[data-theme="orbit"] .hud .hex > span { clip-path: none; background: transparent; color: var(--on-plank-soft); font-family: var(--font-mono); font-size: 11px !important; font-weight: 600; padding: 0; }
[data-theme="orbit"] .hud .hex > span::before { content: "RANG\00a0"; }
[data-theme="orbit"] .quest { border-width: 2px; border-radius: 10px; box-shadow: none; }
[data-theme="orbit"] .quest.boss { background: var(--card); }
[data-theme="orbit"] .quest.done { background: var(--parchment-2); }
[data-theme="orbit"] .q-check { border-width: 2px; border-radius: 6px; background: #fff; box-shadow: none; }
[data-theme="orbit"] .quest.done .q-check { background: var(--teal); box-shadow: none; }
[data-theme="orbit"] .q-check svg { stroke: #fff !important; }
[data-theme="orbit"] .tabs { background: #1a1f26; border: 1.5px solid #2a2f37; border-radius: 10px; padding: 4px; gap: 4px; }
[data-theme="orbit"] .tab { border: 0; border-radius: 7px; background: transparent; color: #9aa1ab; box-shadow: none; font-family: var(--font-display); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
[data-theme="orbit"] .tab small { color: inherit; font-family: var(--font-mono); text-transform: none; }
[data-theme="orbit"] .tab[aria-selected="true"] { background: var(--parchment); color: var(--ink); box-shadow: none; }
[data-theme="orbit"] .seg button { border-width: 1.5px; border-radius: 6px; font-weight: 600; background: #fff; }
[data-theme="orbit"] .seg button[aria-pressed="true"] { background: var(--ink); color: #ece8df; box-shadow: none; }
[data-theme="orbit"] .seg button[aria-pressed="true"] svg { stroke: #ece8df !important; }
[data-theme="orbit"] .bar { border: 0; border-radius: 1px; background: #cfc9bd; }
[data-theme="orbit"] .bar > i { background: var(--red); border: 0; border-radius: 1px; box-shadow: none; }
[data-theme="orbit"] .hud .bar { background: #3a4350; }
[data-theme="orbit"] .hud .name { text-shadow: none; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
[data-theme="orbit"] .hud .meta { font-family: var(--font-mono); }
[data-theme="orbit"] .hud .pill { border: 1.5px solid #3a4350; border-radius: 4px; background: #0d1015; color: #e9e6df; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
[data-theme="orbit"] .hud > button { background: #0d1015 !important; border-color: #3a4350 !important; }
[data-theme="orbit"] .avatar-dot { border-width: 2px; font-family: var(--font-display); }
[data-theme="orbit"] .input { border-width: 2px; border-radius: 8px; background: #fff; font-weight: 500; }
[data-theme="orbit"] .input::placeholder { color: #6b717a; }
[data-theme="orbit"] .map-stage { border: 2px solid #2a2f37; border-radius: 14px; background: #11161d; box-shadow: none; }
[data-theme="orbit"] .map-node { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 3px solid #ece8df; box-shadow: none; }
[data-theme="orbit"] .map-node.sel { transform: none; box-shadow: 0 0 0 5px rgba(196,73,27,.6); }
[data-theme="orbit"] .map-node svg { width: 18px; height: 18px; stroke: #0d1015 !important; fill: none !important; }
[data-theme="orbit"] .map-node .label { border: 0; border-radius: 3px; background: #ece8df; color: #1c2027; font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; box-shadow: none; padding: 2px 6px; }
[data-theme="orbit"] .map-node.sel .label { background: var(--red); color: #fff; }
[data-theme="orbit"] .map-node .count { border-width: 2px; border-radius: 4px; background: #0d1015; color: #ece8df; font-family: var(--font-mono); font-size: 11px; }
[data-theme="orbit"] .sprite { display: none; }
[data-theme="orbit"] .nav { border-radius: 14px; }
[data-theme="orbit"] .nav button { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; text-shadow: none; }
[data-theme="orbit"] .nav button[aria-current="page"] { background: transparent; color: #ece8df; border: 0; box-shadow: inset 0 -3px 0 var(--red); border-radius: 6px; }
[data-theme="orbit"] .nav button svg { stroke: currentColor !important; }
[data-theme="orbit"] .nav button[aria-current="page"] svg { stroke: #e3a32e !important; }
[data-theme="orbit"] .nav .fab { border-radius: 14px; width: 58px; height: 58px; min-width: 58px; background: var(--red); border: 2px solid #ece8df; box-shadow: none; }
[data-theme="orbit"] .nav .fab svg { stroke: #fff !important; }
[data-theme="orbit"] .toast { background: #ece8df; color: #1c2027; border: 2px solid #2a2f37; border-radius: 8px; font-family: var(--font-mono); font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
[data-theme="orbit"] .reward { background: #0a0d12; }
[data-theme="orbit"] .reward .burst { background: repeating-conic-gradient(rgba(227,163,46,.07) 0deg 4deg, transparent 4deg 18deg); }
[data-theme="orbit"] .reward h1 { color: #ece8df; -webkit-text-stroke: 0; text-shadow: none; font-size: 40px; letter-spacing: .1em; }
[data-theme="orbit"] .stat { border-width: 2px; border-radius: 10px; box-shadow: none; }
[data-theme="orbit"] .stat b { font-family: var(--font-mono); font-weight: 600; }
[data-theme="orbit"] .ach { border-width: 2px; border-radius: 10px; box-shadow: none; }
[data-theme="orbit"] .demo-banner { background: #1a222d; border: 1.5px solid var(--teal); box-shadow: none; color: #e9e6df; }
[data-theme="orbit"] .scrim { background: rgba(5,7,10,.72); }
[data-theme="orbit"] .sheet { border-radius: 16px; }
[data-theme="orbit"] .review-row { border-width: 2px; }

/* Incoming transmission (Orbital senders): replaces the magic summons. */
.tx { --p: #e3a32e; position: fixed; inset: 0; z-index: 75; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: calc(var(--safe-top) + 30px) 18px calc(var(--safe-bottom) + 24px); color: #e9e6df; font-family: 'Barlow', system-ui, sans-serif; font-weight: 500;
  background: #0a0d12; background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 4px); animation: fade .35s; }
.tx-top { max-width: 460px; width: 100%; display: flex; justify-content: space-between; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em; color: #9aa1ab; }
.tx-dot { color: var(--p); animation: txblink 1.2s steps(2) infinite; }
@keyframes txblink { 50% { opacity: .25; } }
.tx-radar { position: relative; width: 210px; height: 210px; flex: none; }
.tx-radar .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid #2f3742; }
.tx-radar .r2 { inset: 30px; border-style: dashed; }
.tx-radar .r3 { inset: 60px; border-color: #3a4350; }
.tx-radar .sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, color-mix(in srgb, var(--p) 35%, transparent), transparent 22%); animation: spin 4s linear infinite; }
.tx-radar .cross { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: #2f3742; }
.tx-radar .cross.h { left: 0; right: 0; top: 50%; bottom: auto; width: auto; height: 1px; }
.tx-emblem { position: absolute; inset: 68px; border-radius: 50%; background: #151a21; border: 3px solid var(--p); display: grid; place-items: center; }
.tx-from { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .14em; color: var(--p); }
.tx .summon-title { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 32px; letter-spacing: .04em; text-transform: uppercase; text-shadow: none; margin: 0; color: #e9e6df; animation: rise .5s .2s both; }
.tx .summon-sub { font-weight: 500; color: #c9c5bc; font-size: 16px; }
.tx .summon-scroll { background: #ece8df; color: #1c2027; border: 2px solid #2a2f37; border-radius: 12px; box-shadow: none; font-family: 'Barlow', sans-serif; animation: rise .5s .5s both; }
.tx .summon-note { border-top: 1.5px solid #cfc9bd; padding-top: 8px; color: #3b4048; }
[data-theme] .tx .btn.summon-btn { background: #c4491b; color: #fff; border: 2px solid #ece8df; border-radius: 10px; box-shadow: none; text-shadow: none; font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 20px; letter-spacing: .14em; text-transform: uppercase; animation: rise .5s .8s both; }
.tx .chip { border: 1.5px dashed #1c2027; border-radius: 4px; background: transparent; font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; }
.tx .stat { box-shadow: none; border-width: 2px; border-radius: 10px; }
.tx-meta { display: flex; justify-content: space-between; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #4f555e; letter-spacing: .06em; }
.tx-list { list-style: none; padding-left: 0 !important; counter-reset: tx; }
.tx-list li { counter-increment: tx; display: flex; gap: 8px; align-items: center; font-weight: 700; }
.tx-list li::before { content: counter(tx, decimal-leading-zero); font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #4f555e; font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .tx, .tx * { animation: none !important; } }

/* Light themes must stay light: stop browsers (Chrome/Samsung "auto dark") from darkening them. */
:root, [data-theme="saga"], [data-theme="mythic"] { color-scheme: only light; }
[data-theme="raid"], [data-theme="orbit"] { color-scheme: dark; }
[data-theme="orbit"] .map-node { background: #ece8df !important; }
[data-theme="orbit"] .map-node.sel { background: var(--red) !important; }
[data-theme="orbit"] .map-node.sel svg { stroke: #fff !important; }
[data-theme="orbit"] .panel-head .chip { background: var(--parchment); }
[data-theme="orbit"] .chip .dot { background: var(--ink) !important; border-color: var(--ink); width: 7px; height: 7px; }
.diff-bars { display: inline-flex; gap: 2px; align-items: flex-end; }
.diff-bars i { width: 4px; height: 12px; background: #cfc9bd; }
.diff-bars i.on { background: var(--ink); }
[data-theme="orbit"] .row > h1 + .chip { color: var(--on-table); border-color: #3a4350; }
[data-theme="orbit"] .btn.parch { background: var(--parchment); color: var(--ink); border-color: var(--line); }
[data-theme="orbit"] .btn.parch svg { stroke: var(--ink) !important; }
