:root {
  /* Dragon palette: jade scales, ember mane, mountain mist. */
  --bg: #f3f7f8;
  --surface: #ffffff;
  --surface-2: #e8f0f1;
  --ink: #16232a;
  --ink-2: #4d626b;
  --ink-3: #7d9198;
  --line: #d8e5e7;
  --brand: #dd5f38;
  --brand-ink: #b4441f;
  --brand-soft: #fdeae2;
  --accent: #218a86;
  --accent-soft: #dcf0ee;
  --warn: #a5751a;
  --warn-soft: #fdf3de;
  --jade: #218a86;
  --ember: #dd5f38;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35,32,28,.05), 0 8px 24px -12px rgba(35,32,28,.18);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  --serif: ui-serif, Iowan Old Style, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a1d; --surface: #142327; --surface-2: #1c2f34;
    --ink: #e8f2f3; --ink-2: #a9c0c5; --ink-3: #7b959b; --line: #263c42;
    --brand: #ff8a63; --brand-ink: #ffa585; --brand-soft: #3a1f16;
    --accent: #55c5be; --accent-soft: #10312f;
    --warn: #dcae5c; --warn-soft: #332813;
    --jade: #55c5be; --ember: #ff8a63;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); font-family: var(--serif); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small { color: var(--ink-2); }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }

header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
header.top .bar { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo span { color: var(--brand); }
header.top nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
header.top nav a { padding: 6px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: .92rem; }
header.top nav a:hover { background: var(--surface-2); color: var(--ink); }

main { padding: 32px 0 80px; }

.hero { padding: 44px 0 26px; }
.hero p.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 62ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 600; color: var(--brand); margin-bottom: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.idea-card { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; text-align: left; width: 100%; font: inherit; color: inherit; }
.idea-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(35,32,28,.06), 0 16px 30px -14px rgba(35,32,28,.28); }
.idea-card .emoji { font-size: 1.9rem; line-height: 1; }
.idea-card h3 { margin: 10px 0 4px; }
.idea-card p { color: var(--ink-2); font-size: .93rem; margin-bottom: 12px; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.brand { background: var(--brand-soft); color: var(--brand-ink); }
.tag.good { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none; transition: filter .12s;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.subtle { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn.danger { background: transparent; color: var(--brand-ink); border-color: var(--line); }

label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
label .hint { font-weight: 400; color: var(--ink-3); }
input, select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

.stat { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.stat .n { font-size: 1.5rem; font-weight: 700; font-family: var(--serif); }
.stat .k { font-size: .78rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }

.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.task { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.task:last-child { border-bottom: 0; }
.task input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--accent); }
.task .body { flex: 1; min-width: 0; }
.task .t { font-weight: 600; }
.task.done .t { text-decoration: line-through; color: var(--ink-3); }
.task .d { font-size: .88rem; color: var(--ink-2); margin-top: 3px; }
.task .meta { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.task .owner { max-width: 160px; padding: 3px 8px; font-size: .82rem; border-radius: 7px; }

.section-head { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 6px; }
.section-head h3 { margin: 0; }
.section-head .count { font-size: .82rem; color: var(--ink-3); }

.list { margin: 0; padding-left: 1.15em; }
.list li { margin-bottom: .45em; color: var(--ink-2); }
.list li::marker { color: var(--brand); }

.notice { padding: 14px 16px; border-radius: 12px; font-size: .93rem; margin-bottom: 18px; border: 1px solid transparent; }
.notice.info { background: var(--surface-2); color: var(--ink-2); }
.notice.good { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.err  { background: var(--brand-soft); color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px;
  font: inherit; font-weight: 600; font-size: .93rem; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); }

.ticket-row { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ticket-row:last-child { border-bottom: 0; }
.ticket-row .info { flex: 1; min-width: 0; }
.ticket-row .price { font-weight: 700; font-family: var(--serif); font-size: 1.05rem; white-space: nowrap; }
.qty { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: var(--surface-2); color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.qty button:disabled { opacity: .35; cursor: not-allowed; }
.qty span { width: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; letter-spacing: .08em;
  background: var(--surface-2); padding: 6px 10px; border-radius: 8px; display: inline-block; word-break: break-all;
}
.ticket-stub {
  border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center;
  background: var(--surface); margin-bottom: 12px;
}
.ticket-stub .who { font-weight: 600; margin-bottom: 8px; }

.muted { color: var(--ink-2); }
.center { text-align: center; }
.stack > * + * { margin-top: 16px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--ink-3); font-size: .87rem; }

/* ---------- Game layer: slots, claims, scoreboard ---------- */

.hoard {
  background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 26px;
}
.hoard .n { font-family: var(--serif); font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 700; line-height: 1; }
.hoard .k { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.hoard .row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 18px; }

.slotbar { display: flex; gap: 4px; margin: 10px 0 12px; }
.slotpip {
  flex: 1; height: 7px; border-radius: 999px; background: var(--line); min-width: 10px;
}
.slotpip.taken { background: var(--brand); }
.slotpip.open  { background: color-mix(in srgb, var(--accent) 45%, transparent); }

.idea-card.gone { opacity: .58; }
.idea-card.gone .emoji { filter: grayscale(1); }
.idea-card.last { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }

.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.comp {
  text-align: center; padding: 14px 8px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid transparent;
}
.comp.earned { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.comp .ce { font-size: 1.6rem; line-height: 1; filter: grayscale(1); opacity: .45; }
.comp.earned .ce { filter: none; opacity: 1; }
.comp .cn { font-size: .78rem; font-weight: 600; margin-top: 6px; line-height: 1.25; }

.rank { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rank:last-child { border-bottom: 0; }
.rank .pos { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: var(--ink-3); width: 26px; flex: 0 0 auto; }
.rank .em { font-size: 1.4rem; flex: 0 0 auto; }
.rank .who { flex: 1; min-width: 0; }
.rank .amt { font-family: var(--serif); font-weight: 700; white-space: nowrap; }
.rank.top1 .pos { color: var(--brand); }


/* ---------- Dragon motif ---------- */

.dragon-hero { position: relative; overflow: hidden; border-radius: var(--radius); }
.dragon-art { display: block; width: 100%; height: auto; max-height: 240px; }
.dragon-art .scale-body { fill: none; stroke: url(#jadeGrad); stroke-linecap: round; }
.dragon-art .mane { fill: none; stroke: url(#emberGrad); stroke-linecap: round; opacity: .95; }
.dragon-art .whisker { fill: none; stroke: var(--ember); stroke-linecap: round; opacity: .8; }
.dragon-art .mist { fill: var(--accent); opacity: .07; }

.logo .dmark { display: inline-block; transform: translateY(1px); margin-right: 5px; }

.support {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius); padding: 18px 20px;
}
.support h3 { margin: 0 0 8px; font-size: 1.02rem; }
.support ul { margin: 0; padding-left: 1.1em; }
.support li { margin-bottom: .35em; color: var(--ink-2); font-size: .93rem; }

.ease { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* ---------- Icons ---------- */
.ic { display: inline-block; vertical-align: -.15em; flex: 0 0 auto; }
.idea-card .emoji { color: var(--jade); height: 30px; }
.idea-card.gone .emoji { color: var(--ink-3); filter: none; }
.ideamark { color: var(--jade); line-height: 0; margin-bottom: 6px; }
.comp .ce { color: var(--ink-3); filter: none; opacity: .5; line-height: 0; }
.comp.earned .ce { color: var(--accent); opacity: 1; }
.rank .em { color: var(--jade); line-height: 0; }
.logo .dmark { color: var(--brand); line-height: 0; }
.notice .ic { vertical-align: -.25em; margin-right: 4px; }
