:root {
  --bg: #2a140a;
  --bg-2: #3a1d0e;
  --panel: rgba(58, 30, 14, 0.9);
  --panel-solid: #44230f;
  --gold: #ffd25e;
  --sand: #f0b85e;
  --sand-dk: #a86a2c;
  --papyrus: #fff0cf;
  --text: #fbe9c8;
  --dim: #e0bf8f;
  --faint: #8a5d36;
  --lapis: #4f86ec;
  --turq: #5fe0cf;
  --red: #ff7a5c;
  --green: #7fd36a;
  --stone: #3a2414;
  --line: rgba(255, 210, 94, 0.32);
  --pixel: 'Press Start 2P', monospace;
  --mono: 'Chakra Petch', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: repeating-linear-gradient(0deg, transparent 0 22px, rgba(0,0,0,.18) 22px 24px), repeating-linear-gradient(90deg, transparent 0 46px, rgba(0,0,0,.12) 46px 48px);
  color: var(--text);
  position: relative;
  display: flow-root;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--turq); text-decoration: none; }
a:hover { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { image-rendering: pixelated; }

/* ---------- background ---------- */
#scene { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.sail { animation: sail var(--dur) linear infinite; animation-delay: var(--delay); }
@keyframes sail { from { transform: translateX(var(--from)); } to { transform: translateX(var(--to)); } }
.bob { animation: bob-y 1.4s steps(2) infinite; }
.feed { animation: feed 1.2s steps(2) infinite; }
@keyframes feed { 50% { transform: translate(-2px, -1px); } }
.fan { animation: fan 1s steps(2) infinite; }
@keyframes fan { 50% { transform: rotate(14deg); } }
.sparkle { animation: blink 1.6s steps(1) infinite; }
.sparkle.s2 { animation-delay: .8s; }
@keyframes bob-y { 50% { transform: translateY(-1px); } }
@media (prefers-reduced-motion: reduce) { .sail, .bob, .glitch, .feed, .fan, .sparkle { animation: none; } }
#scene svg { width: 100%; height: 100%; display: block; }
.scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.10) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* ---------- layout ---------- */
#app {
  max-width: 780px; margin: clamp(24px, 5vh, 48px) auto 40px; padding: 24px 22px 42px;
  background: linear-gradient(180deg, rgba(44, 23, 11, 0.94), rgba(32, 16, 7, 0.96));
  border: 3px solid #d49b4b;
  box-shadow:
    inset 0 0 0 3px #241106,
    inset 0 0 0 5px rgba(212, 155, 75, 0.45),
    0 0 0 3px #241106,
    0 12px 28px rgba(0, 0, 0, 0.55);
  position: relative;
  display: flow-root;
}
/* golden corner medallions on the temple frame */
#app::before, #app::after {
  content: ''; position: absolute; left: -6px; right: -6px; height: 12px; pointer-events: none;
  background:
    linear-gradient(90deg, #ffd25e 0 12px, transparent 12px calc(100% - 12px), #ffd25e calc(100% - 12px) 100%);
  border-left: 3px solid #241106; border-right: 3px solid #241106;
}
#app::before { top: -6px; border-top: 3px solid #241106; }
#app::after { bottom: -6px; border-bottom: 3px solid #241106; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 26px;
}
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a {
  font-family: var(--pixel); font-size: 10px; letter-spacing: 1px; color: var(--dim);
  padding: 9px 10px; border: 2px solid transparent;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--gold); border-color: var(--line); background: rgba(0,0,0,.25); }

.logo {
  font-family: var(--pixel); color: var(--gold); letter-spacing: 2px; line-height: 1;
  text-shadow: -2px 0 var(--red), 2px 0 var(--turq), 0 3px 0 var(--sand-dk);
  font-size: 18px; display: inline-flex; align-items: center; gap: 10px;
}
.logo.big { font-size: clamp(26px, 8vw, 48px); text-shadow: -3px 0 var(--red), 3px 0 var(--turq), 0 5px 0 var(--sand-dk); }
.logo:hover { color: var(--gold); }
.glitch { animation: glitch 6s infinite steps(1); }
@keyframes glitch {
  0%, 92%, 100% { transform: none; }
  93% { transform: translate(2px, -1px); }
  95% { transform: translate(-3px, 1px); }
  97% { transform: translate(1px, 0); }
}

.label {
  font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--turq);
}
.label.dim { color: var(--dim); font-weight: 500; }
.section { margin: 28px 0; }
.section-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.section-head::after { content: ''; flex: 1; border-top: 2px dashed var(--line); }
.section-head .label { white-space: nowrap; }
.section-head .label.dim { order: 2; white-space: normal; text-align: right; min-width: 0; font-size: 13px; letter-spacing: 0.5px; text-transform: none; }
.section-title {
  font-family: var(--pixel); font-size: clamp(14px, 4vw, 22px); color: var(--papyrus);
  letter-spacing: 4px; text-align: center; margin: 8px 0 4px; opacity: .35;
}
.muted { color: var(--dim); }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.panel {
  background: var(--panel); border: 2px solid var(--line);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  padding: 16px;
}

/* ---------- hero number ---------- */
.hero { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.hero .num {
  font-family: var(--pixel); font-size: clamp(44px, 14vw, 76px); color: #fff; line-height: 1;
  text-shadow: 4px 4px 0 var(--sand-dk);
}
.hero .unit { color: var(--turq); font-size: 18px; letter-spacing: 2px; padding-bottom: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 18px; }
.stat { border: 2px solid var(--line); background: rgba(0,0,0,.25); padding: 10px 12px; }
.stat span { color: var(--dim); font-size: 18px; }
.stat b { display: block; font-family: var(--pixel); font-size: 18px; color: var(--gold); margin-top: 6px; }

/* ---------- forms ---------- */
.btn {
  font-family: var(--pixel); font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  background: var(--sand); color: #2a1206; border: 0; padding: 12px 14px; cursor: pointer;
  box-shadow: inset -3px -3px 0 var(--sand-dk), inset 3px 3px 0 #ffe7a8, 3px 3px 0 #000;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translate(2px, 2px); box-shadow: inset -3px -3px 0 var(--sand-dk), inset 3px 3px 0 #ffe08a, 1px 1px 0 #000; }
.btn.ghost { background: transparent; color: var(--sand); box-shadow: inset 0 0 0 2px var(--sand); }
.btn.ghost:hover { background: rgba(232,176,75,.1); }
.btn.danger { background: var(--red); box-shadow: inset -3px -3px 0 #8f2a3b, inset 3px 3px 0 #ff9aa9, 3px 3px 0 #000; }
.btn.small { font-size: 8px; padding: 8px 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=password], input[type=number], select, textarea {
  background: #1c0d05; border: 2px solid var(--faint); padding: 10px 12px; width: 100%;
  outline: none; border-radius: 0; font-size: 16px;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { min-height: 110px; resize: vertical; font-size: 15px; }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 4px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--sand); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  font-family: var(--pixel); font-size: 9px; padding: 10px 12px; cursor: pointer;
  background: transparent; border: 2px solid var(--faint); color: var(--dim);
}
.tab.on { border-color: var(--gold); color: var(--gold); background: rgba(232,176,75,.08); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table td, .table th { padding: 9px 6px; border-bottom: 1px solid rgba(232,176,75,.12); text-align: left; vertical-align: middle; }
.table th { font-weight: normal; color: var(--dim); font-size: 17px; letter-spacing: 1px; text-transform: uppercase; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.me td { background: rgba(62,214,196,.07); }
.pos { font-family: var(--pixel); font-size: 11px; color: var(--dim); width: 34px; }
.pos.p1 { color: var(--gold); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pts { font-family: var(--pixel); font-size: 12px; color: var(--papyrus); }
.tag { font-size: 16px; letter-spacing: 1px; text-transform: uppercase; padding: 1px 6px; border: 1px solid currentColor; white-space: nowrap; }

.avatar { width: 28px; height: 28px; flex: none; display: block; }

/* ---------- game cards ---------- */
.game-dot { width: 12px; height: 12px; display: inline-block; flex: none; box-shadow: 2px 2px 0 #000; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { border: 2px solid var(--line); background: var(--panel); padding: 14px; position: relative; }
.card h3 { margin: 0 0 6px; font-family: var(--pixel); font-size: 11px; letter-spacing: 1px; display: flex; gap: 8px; align-items: center; }
.card .score { font-family: var(--pixel); font-size: 26px; color: #fff; margin: 10px 0 6px; }
.card .better { color: var(--turq); font-size: 19px; }
.card .better b { color: #fff; }
.card .x { position: absolute; top: 8px; right: 8px; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 18px; }
.card .x:hover { color: var(--red); }

.histo { display: flex; align-items: flex-end; gap: 3px; height: 60px; margin-top: 10px; border-bottom: 2px solid var(--faint); }
.histo div { flex: 1; background: var(--faint); min-height: 2px; position: relative; }
.histo div.me { background: var(--red); }
.histo-labels { display: flex; gap: 3px; font-size: 16px; color: var(--dim); }
.histo-labels .me { color: var(--red); }
.histo-labels span { flex: 1; text-align: center; }

/* ---------- throne room ---------- */
.throne-room {
  position: relative; padding: 22px 12px 14px; text-align: center;
  background:
    linear-gradient(to bottom, transparent 70%, rgba(168,116,42,.25) 70%),
    radial-gradient(ellipse at 50% 30%, rgba(245,197,66,.16), transparent 60%);
  border: 2px solid var(--line);
}
.podium { display: grid; grid-template-columns: 1fr 1.4fr 1fr; align-items: end; gap: 8px; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.seat .name { font-family: var(--pixel); font-size: 10px; color: var(--papyrus); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .title { font-size: 18px; letter-spacing: 2px; text-transform: uppercase; }
.seat .p { font-family: var(--pixel); font-size: 11px; color: var(--gold); }
.throne-wrap { position: relative; width: 128px; height: 136px; }
.throne-wrap .throne { position: absolute; inset: 0; width: 128px; height: 136px; }
.throne-wrap .avatar { position: absolute; width: 48px; height: 48px; left: 40px; top: 30px; }
.throne-wrap .crown { position: absolute; width: 44px; height: 28px; left: 42px; top: -4px; animation: bob 1.6s infinite steps(2); }
@keyframes bob { 50% { transform: translateY(-3px); } }
.pedestal { width: 84px; background: var(--sand-dk); box-shadow: inset 0 4px 0 var(--sand), inset -4px 0 0 #7a521c, 4px 4px 0 #000; }
.pedestal.h2 { height: 46px; }
.pedestal.h3 { height: 28px; }
.seat .avatar.mid { width: 44px; height: 44px; }

.dungeon {
  margin-top: 14px; padding: 14px; position: relative;
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(0,0,0,.35) 22px 24px),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(0,0,0,.25) 46px 48px),
    var(--stone);
  border: 2px solid #170b04;
}
.cells { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.cell { position: relative; width: 86px; height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 6px; background: #170b04; }
.cell .avatar { width: 40px; height: 40px; filter: grayscale(.6) brightness(.8); }
.cell .name { font-size: 17px; color: var(--dim); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(#6b6584, #6b6584) 0 14px / 100% 4px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 10px, #6b6584 10px 14px);
  box-shadow: inset 0 0 0 3px #4a4560;
}

.kings { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.king { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); padding: 8px 10px; background: rgba(0,0,0,.2); }
.crown-s { width: 22px; height: 14px; flex: none; }

/* ---------- heatmap ---------- */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 6px; }
.heat i { width: 12px; height: 12px; background: #4a2a14; display: block; }
.heat i.l1 { background: #7a4c1e; } .heat i.l2 { background: var(--sand-dk); } .heat i.l3 { background: var(--sand); } .heat i.l4 { background: var(--gold); box-shadow: 0 0 0 1px #fff3 inset; }
.heat i.future { background: transparent; }

.bars .bar { display: grid; grid-template-columns: 28px 1fr 34px; gap: 8px; align-items: center; font-size: 17px; }
.bars .bar div { height: 12px; background: var(--sand); box-shadow: 2px 2px 0 #000; min-width: 2px; }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(140%);
  background: var(--panel-solid); border: 2px solid var(--gold); padding: 10px 16px; z-index: 60;
  font-size: 20px; transition: transform .2s steps(4), visibility .2s; max-width: calc(100% - 32px); box-shadow: 4px 4px 0 #000;
  visibility: hidden;
}
#toast.show { transform: translateX(-50%) translateY(0); visibility: visible; }
#toast.err { border-color: var(--red); }

.preview-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.preview-item .v { margin-left: auto; font-family: var(--pixel); font-size: 12px; }

.auth { max-width: 420px; margin: 0 auto; }
.empty { color: var(--dim); text-align: center; padding: 18px; border: 2px dashed var(--faint); }

/* ---------- clearer helper text ---------- */
.help { color: var(--dim); font-size: 19px; margin: 0 0 10px; line-height: 1.3; }
.help b { color: var(--papyrus); font-weight: normal; }
.help.warn { color: var(--red); margin-top: 12px; }
.tagline { font-family: var(--pixel); font-size: 12px; color: var(--turq); margin: 20px 0 10px; line-height: 1.6; }
.day-title { font-family: var(--pixel); font-size: clamp(13px, 3.6vw, 17px); color: var(--papyrus); margin: 0 0 14px; line-height: 1.5; }
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 6px; padding: 12px; border: 2px solid var(--line); background: rgba(0,0,0,.3); }
.center-tabs { justify-content: center; margin-top: 12px; }
.code { color: var(--gold); font-family: var(--pixel); font-size: 12px; font-weight: normal; letter-spacing: 2px; }
details summary { cursor: pointer; color: var(--turq); font-size: 19px; }
label.field span { color: var(--dim); font-size: 19px; }
.group-list { display: grid; gap: 8px; }
.group-link { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: center; padding: 12px 14px; border: 2px solid var(--line); background: var(--panel); color: var(--text); }
.group-link:hover { border-color: var(--gold); color: var(--text); }
.group-link .gname { font-family: var(--pixel); font-size: 12px; color: var(--gold); line-height: 1.4; }
.group-link .help { margin: 0; }
.group-link .arrow { font-family: var(--pixel); color: var(--gold); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 8px 0 0; font-size: 19px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; text-align: right; }
.game-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }


/* ---------- simplified UI ---------- */
[hidden] { display: none !important; }
.gold { color: var(--gold); } .red { color: var(--red); } .turq { color: var(--turq); }
.tag.gold, .tag.red, .tag.turq, .tag.muted { border-color: currentColor; }
.kicker { color: var(--dim); font-size: 15px; margin-bottom: 4px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 2px solid var(--line); background: rgba(0,0,0,.25); padding: 4px 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.linkish { background: none; border: 0; padding: 0; color: var(--dim); cursor: pointer; font-size: 14px; text-decoration: underline dotted; text-underline-offset: 4px; margin-top: 10px; display: inline-block; }
.linkish:hover { color: var(--gold); }
#manual { margin-top: 10px; }
.warn { color: var(--red); margin: 10px 0 0; }
.paste { display: flex; gap: 8px; align-items: stretch; }
.paste textarea { min-height: 64px; flex: 1; }
.paste .btn { flex: none; }
.preview { margin-top: 10px; border: 2px solid var(--line); padding: 4px 12px 12px; background: rgba(0,0,0,.2); }
.btn.wide { width: 100%; margin-top: 12px; }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { position: relative; border: 2px solid var(--line); background: var(--panel); padding: 12px; min-height: 92px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.tile .tname { display: flex; align-items: center; gap: 8px; font-family: var(--pixel); font-size: 10px; line-height: 1.4; }
.tile.todo { opacity: .75; justify-content: space-between; }
.tile.todo:hover { opacity: 1; border-color: var(--gold); color: var(--text); }
.tile .play { font-family: var(--pixel); font-size: 9px; color: var(--gold); }
.tile.done .tname { padding-right: 16px; }
.tile.done { border-color: var(--sand-dk); background: linear-gradient(rgba(255,210,94,.08), transparent), var(--panel); }
.tile .score { font-family: var(--pixel); font-size: 14px; line-height: 1.4; color: #fff; margin-top: 4px; }
.tile .better { color: var(--turq); font-size: 18px; }
.tile .histo { height: 26px; margin-top: 2px; border-bottom-width: 1px; }
.tile .x { position: absolute; top: 6px; right: 6px; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 16px; }
.tile .x:hover { color: var(--red); }
details.more { margin-top: 12px; }
details.more summary, details.admin summary { cursor: pointer; color: var(--dim); font-size: 19px; margin-bottom: 10px; }
details.admin { border: 2px dashed var(--line); padding: 12px; }

.group-link { grid-template-columns: 1fr auto auto; }
.group-name { font-size: clamp(16px, 4.5vw, 24px); margin: 0; }

.bar { display: flex; align-items: center; gap: 8px; margin: 20px 0 14px; padding: 8px; border: 2px solid var(--line); background: rgba(0,0,0,.3); flex-wrap: wrap; }
.navbtn { font-family: var(--pixel); font-size: 16px; color: var(--gold); width: 38px; height: 38px; display: grid; place-items: center; border: 2px solid var(--line); }
.navbtn.off { opacity: .25; }
.bar-day { font-family: var(--pixel); font-size: 13px; color: var(--papyrus); flex: 1; text-align: center; min-width: 110px; }
.seg { display: inline-flex; border: 2px solid var(--faint); }
.seg button { font-family: var(--pixel); font-size: 9px; padding: 10px 12px; background: transparent; border: 0; color: var(--dim); cursor: pointer; }
.seg button.on { background: var(--sand); color: #2a1206; }
.auth .seg { display: flex; margin-bottom: 14px; } .auth .seg button { flex: 1; }
.auth input { margin-bottom: 10px; }
.seat .title { color: var(--turq); }

.table.compact td { padding: 6px 4px; }
.pts small { font-family: var(--mono); font-size: 16px; color: var(--turq); }
.waiting { display: flex; gap: 4px; margin: 8px 0 0; opacity: .55; }
.avatar.tiny { width: 18px; height: 18px; }
.avatar.big { width: 64px; height: 64px; }
.king span { color: var(--dim); }
.king b { margin-left: auto; font-weight: normal; color: var(--papyrus); }
.card h3 a { color: inherit; }

/* ---------- featured + other games ---------- */
.tiles.featured { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tiles.featured .tile { min-height: 158px; padding: 12px 12px 10px; }
.tiles.featured .tile .tname { font-size: 10px; justify-content: center; text-align: center; }
.tiles.featured .tile .score { font-size: 22px; text-align: center; position: relative; z-index: 1; margin: auto 0 2px; text-shadow: 2px 2px 0 rgba(0,0,0,.6); }
.tiles.featured .tile .better { text-align: center; position: relative; z-index: 1; font-size: 13px; }
.tiles.featured .tile .histo { height: 28px; position: relative; z-index: 1; }
.tiles.featured .tile.todo { opacity: 1; }
.tiles.featured .tile.todo .play { font-size: 9px; }
.tile-art { flex: 1; display: grid; place-items: center; margin: 4px 0; pointer-events: none; }
.tile-art .game-art { width: 56px; height: 56px; filter: drop-shadow(2px 3px 0 rgba(0,0,0,.45)); }
.tile-art.bg-art { position: absolute; inset: 28px 0 18px; margin: 0; opacity: .22; }
.tile-art.bg-art .game-art { width: 64px; height: 64px; }
.minis { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.mini { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--dim); font-size: 15px; min-width: 0; }
.mini span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini i { font-style: normal; color: var(--gold); font-family: var(--pixel); font-size: 10px; }
.mini:hover { color: var(--text); border-color: var(--sand-dk); }
.mini.done { color: var(--text); border-color: var(--sand-dk); }
.mini.done b { font-weight: 600; color: #fff; white-space: nowrap; }
.mini .x { position: static; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 14px; padding: 0 0 0 4px; }
.mini .x:hover { color: var(--red); }

.card.feat { border-color: var(--gc); border-width: 3px; box-shadow: inset 0 4px 0 var(--gc); }
.card h3 .emo { font-size: 16px; }

/* ---------- home: me + live board + brand tiles ---------- */
.me-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.me-main { flex: 1; min-width: 0; }
.me-pos { font-family: var(--pixel); font-size: clamp(20px, 5vw, 30px); color: #fff; line-height: 1.25; text-shadow: 3px 3px 0 #1a0b04; }
.me-sub { color: var(--dim); font-size: 15px; margin-top: 4px; }
.me-sub b { color: var(--gold); font-weight: 700; }
.live-board { display: block; margin-top: 18px; padding: 12px 14px; border: 2px solid var(--sand-dk); background: rgba(0,0,0,.28); color: var(--text); }
.live-board:hover { border-color: var(--gold); color: var(--text); }
.live-board .table { margin-top: 6px; }
.live-board .played { font-size: 14px; letter-spacing: 2px; white-space: nowrap; }
.dot-empty { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--faint); margin: 0 3px; vertical-align: middle; }
.gtile {
  background: radial-gradient(circle at 50% 50%, rgba(255, 250, 225, 0.32), rgba(255, 250, 225, 0.04) 60%, rgba(0, 0, 0, 0.14)), var(--gc) !important;
  border: 2px solid #e0b468 !important;
  color: #fff5dc !important;
  box-shadow:
    inset 0 0 0 2px rgba(26, 11, 4, 0.65),
    inset 0 0 0 4px rgba(255, 230, 175, 0.22),
    0 4px 0 #1a0b04;
  opacity: 1 !important;
  overflow: hidden;
}
.gtile .tname { font-size: 10px; color: #fff5dc; text-shadow: 1px 2px 0 rgba(0,0,0,.65); position: relative; z-index: 1; }
.gtile .emo { font-size: 14px; line-height: 1; }
.gtile .score { color: #fff !important; }
.gtile .better, .gtile .better b { color: #fff5dc; text-shadow: 1px 1px 0 rgba(0,0,0,.55); }
.gtile .play { color: #fff5dc !important; font-size: 9px !important; text-shadow: 1px 2px 0 rgba(0,0,0,.65); position: relative; z-index: 1; }
.gtile.todo:hover { filter: brightness(1.08); transform: translateY(-2px); border-color: var(--gold) !important; }
.gtile .histo { border-bottom-color: rgba(255,255,255,.35); }
.gtile .histo div { background: rgba(0,0,0,.35); }
.gtile .histo div.me { background: var(--gold); }
.gtile .x { color: rgba(255,245,220,.7); z-index: 2; }
.gtile .x:hover { color: #fff; }
.more-btn { width: 100%; margin-top: 12px; padding: 10px 14px; background: rgba(0,0,0,.28); border: 2px dashed var(--sand-dk); color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; }
.more-btn:hover { border-color: var(--gold); }
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 41; background: var(--panel-solid); border-left: 3px solid var(--sand-dk); padding: 18px 16px; overflow-y: auto; transform: translateX(105%); transition: transform .2s steps(5); box-shadow: -6px 0 0 rgba(0,0,0,.4); }
.drawer.open { transform: none; }
.drawer .minis { grid-template-columns: 1fr; }

.btn.google { display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: #1f1f1f; box-shadow: inset -3px -3px 0 #c9c9c9, inset 3px 3px 0 #fff, 3px 3px 0 #000; margin-top: 0; font-size: 11px; padding: 14px; }
.btn.google:hover { color: #1f1f1f; }

/* ---------- servants (last three) ---------- */
.servants { margin-top: 14px; padding: 12px; border: 2px dashed var(--line); background: rgba(0,0,0,.2); }
.servants .label { color: var(--dim); }
.cell.servant { background: rgba(255,210,94,.06); border: 2px solid var(--line); height: auto; padding: 8px 4px; width: 104px; }
.cell.servant::after { display: none; }
.cell.servant .avatar { filter: none; }
.cell.servant .role { font-size: 14px; color: var(--sand); text-align: center; }

/* ---------- teams & leagues ---------- */
.flag { display: inline-block; width: 14px; height: 18px; flex: none; background: var(--tc, #f5c542); clip-path: polygon(0 0, 100% 0, 100% 75%, 50% 100%, 0 75%); box-shadow: inset 0 3px 0 rgba(255,255,255,.35); }
.flag.big { width: 28px; height: 36px; }
.flag.huge { width: 48px; height: 60px; margin-top: 6px; }
.chip.team { display: inline-flex; align-items: center; gap: 8px; border-color: var(--tc); color: var(--text); }
.chip.team .flag { width: 10px; height: 13px; }
.team-tabs { display: flex; flex-wrap: wrap; width: 100%; }
.team-tabs button { flex: 1 1 auto; }
.league-tabs a { flex: 1; text-align: center; font-family: var(--pixel); font-size: 9px; padding: 12px 6px; color: var(--dim); }
.league-tabs a.on { background: var(--sand); color: #2a1206; }
.team-list { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 12px; }
.team-opt { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; background: rgba(0,0,0,.25); border: 2px solid var(--line); color: var(--text); cursor: pointer; font-size: 15px; font-weight: 600; }
.team-opt span { flex: 1; min-width: 0; }
.team-opt small { display: block; color: var(--dim); font-size: 13px; font-weight: 500; }
.team-opt em { font-style: normal; color: var(--dim); font-size: 13px; font-weight: 500; white-space: nowrap; }
.team-opt:hover { border-color: var(--sand); }
.team-opt.on { border-color: var(--gold); background: rgba(255,210,94,.14); box-shadow: inset 0 0 0 2px var(--gold); }
.picked-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--gold); background: rgba(255,210,94,.1); }
.picked-card b { font-weight: 700; color: var(--papyrus); font-size: 17px; }
.quick-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; color: var(--dim); }
.quick-links button { background: rgba(0,0,0,.25); border: 1px solid var(--line); color: var(--papyrus); padding: 4px 10px; cursor: pointer; font-size: 13px; }
.quick-links button:hover, .quick-links button.on { border-color: var(--gold); color: var(--gold); }
.throne-room .crown { position: static; width: 44px; height: 28px; margin: 0 auto -2px; display: block; }
.waiting-row td { opacity: .55; }
.podium .seat:nth-child(2) .name { white-space: normal; line-height: 1.4; }

/* ---------- dynasty (reign streak) ---------- */
.dynasty { margin-top: 12px; padding: 10px 14px; border: 2px solid var(--gold); background: linear-gradient(rgba(255,210,94,.1), rgba(0,0,0,.25)); box-shadow: 4px 4px 0 #000; }
.dyn-now { display: flex; gap: 14px; align-items: center; }
.dyn-days { flex: none; text-align: center; min-width: 74px; }
.dyn-days b { display: block; font-family: var(--pixel); font-size: 28px; color: var(--gold); text-shadow: 3px 3px 0 var(--sand-dk); line-height: 1.1; }
.dyn-days span { font-family: var(--pixel); font-size: 7px; color: var(--dim); }
.dyn-text { font-size: 15px; line-height: 1.4; min-width: 0; }
.dyn-text b { font-weight: 700; color: var(--papyrus); }
.dyn-text b.gold { color: var(--gold); }
.dyn-record { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--dim); }
.dyn-record:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.dyn-record b { color: var(--papyrus); font-weight: 700; }

/* ---------- friends ---------- */
.badge { display: inline-block; min-width: 16px; padding: 2px 4px; margin-left: 4px; background: var(--red); color: #fff; font-family: var(--pixel); font-size: 8px; text-align: center; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.friend-row .avatar { width: 32px; height: 32px; }
.friend-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.friend-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--text); }
.friend-chip:hover { border-color: var(--gold); color: var(--text); }
.table-scroll { overflow-x: auto; }
.friends-table th.num { font-size: 18px; }
.fcell b { display: block; font-weight: normal; color: #fff; white-space: nowrap; }
.fcell small { color: var(--gold); font-size: 15px; }
.empty-cell { color: var(--faint); }
#found { margin-top: 8px; }

/* ---------- friend invites ---------- */
.invite-box { display: grid; gap: 10px; padding: 14px; border: 3px solid var(--gold); background: linear-gradient(rgba(255,210,94,.12), rgba(0,0,0,.25)); box-shadow: 4px 4px 0 #000; font-size: 19px; }
.invite-link { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-link input { flex: 1 1 200px; font-size: 16px; }
.invited { display: flex; gap: 14px; align-items: center; margin: 18px 0 14px; padding: 12px 14px; border: 3px solid var(--gold); background: rgba(0,0,0,.3); font-size: 19px; }
.invited .avatar.big { width: 56px; height: 56px; flex: none; }

.chip.founder { color: #2a1206; background: linear-gradient(90deg, #ffe680, #f5c542, #ffe680); border-color: #c98a2a; font-weight: 700; box-shadow: 2px 2px 0 #000; }
.opt .founder-tag { color: #ffe680; }

.cheat-flag { margin-left: 4px; font-size: .85em; cursor: help; }

.inapp { margin: 16px 0 12px; padding: 12px 14px; border: 3px solid #ff9f43; background: rgba(0,0,0,.35); font-size: 17px; line-height: 1.4; }
.inapp b { color: #ffd25e; }
.inapp p { margin: 6px 0 10px; }

/* ---------- grand prix ---------- */
.seg.periods { display: flex; margin: 18px 0 0; }
.seg.periods button { flex: 1; padding: 12px 6px; }
.period-label { font-family: var(--pixel); font-size: 10px; color: var(--dim); letter-spacing: 2px; margin-bottom: 10px; }
.period-label.live { color: var(--red); }
.period-label.live::before { content: '● '; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.throne-room { margin-top: 14px; }
details.how { margin-top: 10px; color: var(--dim); }
details.how summary { cursor: pointer; font-size: 18px; }
details.how p { font-size: 18px; margin: 8px 0 0; }
details.how b { color: var(--papyrus); font-weight: normal; }
.hall { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.hall-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--text); }
.hall-item:hover { border-color: var(--gold); color: var(--text); }
.hall-item div { flex: 1; min-width: 0; font-size: 18px; }
.hall-item b { font-weight: normal; color: var(--papyrus); }
.hall-item.big { border-color: var(--gold); background: rgba(255,210,94,.1); }
.card .crown-s { width: 16px; height: 10px; }

/* ---------- character creator ---------- */
.me-avatar { flex: none; }
.avatar.hero-av { width: 72px; height: 72px; box-shadow: 0 0 0 3px var(--sand-dk), 4px 4px 0 3px #000; }
.chip.lvl { color: var(--gold); border-color: var(--sand-dk); }
.xp { margin-top: 12px; }
.xp-track { height: 12px; background: #1c0d05; border: 2px solid var(--faint); margin-top: 6px; }
.xp-track div { height: 100%; background: repeating-linear-gradient(90deg, var(--gold) 0 6px, var(--sand) 6px 8px); }
.creator { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.creator-side { flex: 1 1 220px; }
.stage { padding: 10px; background: radial-gradient(circle, rgba(255,210,94,.25), transparent 70%); }
.avatar.preview { width: 168px; height: 168px; box-shadow: 0 0 0 4px var(--sand-dk), 6px 6px 0 4px #000; }
.slots { display: flex; flex-wrap: wrap; margin-top: 20px; }
.slots button { flex: 1 1 auto; }
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); margin-top: 14px; }
.opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; background: var(--panel); border: 2px solid var(--line); color: var(--text); cursor: pointer; font-size: 17px; }
.opt:hover { border-color: var(--sand); }
.opt.on { border-color: var(--gold); background: rgba(255,210,94,.12); box-shadow: inset 0 0 0 2px var(--gold); }
.opt-av { width: 64px; height: 64px; }
.opt.locked { cursor: not-allowed; }
.opt.locked .opt-av { filter: grayscale(1) brightness(.45); }
.opt .lock { position: absolute; top: 30px; left: 0; right: 0; font-style: normal; font-family: var(--pixel); font-size: 8px; color: var(--gold); text-shadow: 2px 2px 0 #000; }

/* ---------- group chat ---------- */
.chat-box { border: 2px solid var(--line); background: rgba(0,0,0,.28); padding: 12px; }
.chat-feed { max-height: 250px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; margin-bottom: 10px; }
.chat-msg { display: flex; align-items: flex-start; gap: 10px; }
.chat-av .avatar { width: 28px; height: 28px; flex: none; margin-top: 2px; }
.chat-bubble { flex: 1; min-width: 0; background: rgba(58, 30, 14, 0.75); border: 1px solid var(--line); padding: 6px 10px; }
.chat-msg.mine .chat-bubble { border-color: var(--gold); background: rgba(255, 210, 94, 0.1); }
.chat-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.chat-meta b { color: var(--gold); font-weight: 700; }
.chat-meta span { color: var(--dim); font-size: 12px; }
.chat-text { font-size: 15px; color: var(--papyrus); word-break: break-word; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; padding: 8px 10px; font-size: 15px; }

@media (max-width: 560px) {
  .topbar nav { gap: 2px; }
  .topbar nav a { font-size: 8px; padding: 8px 5px; letter-spacing: 0; }
  .avatar.preview { width: 128px; height: 128px; }
  .hero-row { align-items: center; }
  .bar .seg { width: 100%; } .bar .seg button { flex: 1; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles.featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .me-strip .chips { width: 100%; }
  .me-pos { font-size: 22px; }
  .me-sub { font-size: 18px; }
  .avatar.hero-av { width: 60px; height: 60px; }
  .gtile .tname { font-size: 10px; flex-wrap: wrap; }
  .tiles.featured .tile .score { font-size: 17px; }
  .tiles.featured .tile { min-height: 128px; padding: 12px; }
  .minis { grid-template-columns: repeat(2, 1fr); }
  .paste { flex-direction: column; }
  #app { padding: 18px 14px 50px; }
  .group-link { grid-template-columns: 1fr auto; }
  .group-link .dots, .group-link .help { grid-column: 1; }
  body { font-size: 19px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar nav { justify-content: flex-start; }
  .throne-wrap { transform: scale(.85); transform-origin: bottom center; }
  .pedestal { width: 64px; }
  .table td, .table th { padding: 8px 3px; }
  .hide-sm { display: none; }
}

/* home: the paste box is the main action – make it stand out */
.paste-box { margin-top: 18px; padding: 14px 16px 12px; border: 3px solid var(--gold); background: rgba(232,176,75,.10); box-shadow: 0 0 0 3px rgba(0,0,0,.35) inset; }
.paste-title { font-family: var(--pixel); color: var(--gold); letter-spacing: 1px; font-size: 12px; }
.paste-help { margin: 6px 0 10px; font-size: 16px; line-height: 1.4; }
.paste-box #paste { border-color: var(--gold); font-size: 17px; }

/* ---------- share modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72); z-index: 55;
  display: grid; place-items: center; padding: 16px;
}
.modal {
  width: min(480px, 100%); background: var(--panel-solid); border: 3px solid var(--gold);
  box-shadow: 0 0 0 3px #241106, 8px 8px 0 rgba(0, 0, 0, 0.65); padding: 18px;
}
.share-preview {
  margin: 12px 0 0; padding: 12px; background: #1c0d05; border: 2px solid var(--line);
  font-family: var(--mono); font-size: 15px; color: var(--papyrus); white-space: pre-wrap; word-break: break-word;
  line-height: 1.45;
}
