/* Bonecasters — Loaded Dice look: charcoal, amber, bone, Josefin Sans. */
:root {
  --amber: #FBAD36;
  --amber-deep: #e0942b;
  --bg: #1c1b1a;
  --panel: #262524;
  --panel-2: #2e2d2b;
  --bone: #f3ede0;
  --muted: #8c8780;
  --line: #3a3937;
  --glow: rgba(251, 173, 54, .45);
  --iron: #8fa3b8;   /* shop faces */
  --ink: #6fb3a0;    /* SprueTube faces */
  --ember: #e0703a;  /* Loaded Games faces */
  --good: #6fae5a;
  --bad: #d0533f;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Josefin Sans', system-ui, sans-serif;
  background: radial-gradient(120% 90% at 50% -10%, #2a2826 0%, var(--bg) 55%);
  background-color: var(--bg);
  color: var(--bone);
  min-height: 100vh;
  display: flex; justify-content: center;
  padding: 12px 16px 24px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.4;
}
a { color: var(--amber); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .45; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.stage { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 12px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.amber { color: var(--amber); }
h2 { font-size: 20px; margin-bottom: 6px; }
h3 { font-size: 16px; margin: 10px 0 6px; }
h4 { font-size: 14px; margin: 12px 0 6px; display: flex; align-items: center; gap: 6px; }
p + p { margin-top: 6px; }
.eyebrow { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

/* header */
.head { position: relative; padding-top: 2px; }
.kicker { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
h1 { font-size: 30px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.1; }
h1 span { color: var(--amber); }
.head-btns { position: absolute; top: 4px; right: 0; display: flex; gap: 6px; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.icon-btn:hover { border-color: var(--amber); }
.status:empty { display: none; }
.status { text-align: center; color: var(--muted); padding: 20px 0; }

/* panels and buttons */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.panel > * + * { margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 14px; font-weight: 600; text-decoration: none; color: var(--bone); min-height: 40px;
}
.btn:not(:disabled):hover { border-color: var(--amber); }
.btn.gold { background: var(--amber); color: #1c1b1a; border-color: var(--amber); }
.btn.gold:not(:disabled):hover { background: #ffc15c; }
.btn.big { width: 100%; font-size: 17px; padding: 13px; text-transform: uppercase; letter-spacing: .06em; }
.btn.small { min-height: 32px; padding: 5px 10px; font-size: 13px; }

/* sign in */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strip img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }

/* birth roll */
.birth-hero { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.birth-hero img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; border: 2px solid var(--amber); background: var(--panel-2); }
.birth-hero h3 { font-size: 20px; color: var(--amber); margin: 4px 0 8px; }
.birth-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bcard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.bcard h4 { margin: 0; }
.bcard .btn { margin-top: auto; }
@media (max-width: 480px) { .birth-grid { grid-template-columns: 1fr; } }

/* champion strip */
.champ-strip { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.champ-strip .who { display: flex; flex-direction: column; min-width: 0; }
.champ-strip .who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bag { grid-column: 1 / -1; display: flex; gap: 6px; }

/* frames round a portrait */
.frame { border-radius: 10px; padding: 3px; background: var(--line); position: relative; }
.frame img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; width: 100%; background: var(--panel-2); }
.f-plain { background: var(--line); }
.f-iron { background: linear-gradient(135deg, #b7c4d1, #56677a); }
.f-ink { background: linear-gradient(135deg, #8fd1bf, #2d6a5b); }
.f-ember { background: linear-gradient(135deg, #ffb070, #a8401c); }
.f-gold { background: linear-gradient(135deg, #ffe08a, #c98a1c); box-shadow: 0 0 14px var(--glow); }
.f-scarred { background: repeating-linear-gradient(45deg, #5a4a43 0 6px, #2c2522 6px 9px); }
.frame.big { width: 150px; flex: none; }
.omen { position: absolute; left: 6px; right: 6px; bottom: 6px; text-align: center; font-size: 11px;
  background: rgba(28, 27, 26, .82); border-radius: 6px; padding: 3px; }
.card-big { display: flex; gap: 14px; align-items: flex-start; }
@media (max-width: 420px) { .card-big { flex-direction: column; align-items: center; text-align: center; } }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--amber); color: #1c1b1a; border-color: var(--amber); }
.tab { display: flex; flex-direction: column; gap: 12px; }

/* dice */
.die { width: 34px; height: 34px; border-radius: 8px; background: var(--bone); color: #1c1b1a;
  display: inline-grid; place-items: center; flex: none; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.die.big { width: 52px; height: 52px; border-radius: 11px; }
.die svg { width: 70%; height: 70%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.die.carved { color: #fff; }
.die.carved.iron, .chip.iron { background: var(--iron); }
.die.carved.ink, .chip.ink { background: var(--ink); }
.die.carved.ember, .chip.ember { background: var(--ember); }
.die.x { opacity: .35; }
.pips { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 68%; height: 68%; }
.pips i { border-radius: 50%; margin: 14%; }
.pips i.on { background: #1c1b1a; }
.die.rolling { animation: tumble .45s ease-out; }
@keyframes tumble { 0% { transform: rotate(-200deg) scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.chip { width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; color: #fff; }
.chip svg { width: 72%; height: 72%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chip.plain { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.iron { background: var(--iron); } .dot.ink { background: var(--ink); } .dot.ember { background: var(--ember); }

/* ghosts */
.left { font-weight: 600; }
.ghosts { display: grid; gap: 10px; }
.ghost { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.ghost.used { opacity: .55; }
.gart { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; width: 100%; background: var(--panel-2); }
.gbody h3 { margin: 0; }
.gbody { display: flex; flex-direction: column; gap: 4px; }
.gfaces { display: flex; gap: 4px; flex-wrap: wrap; margin: 2px 0 6px; }
.gbody .btn { margin-top: auto; align-self: flex-start; }
img.noart { opacity: 0; }

/* the arena */
.arena { display: flex; flex-direction: column; gap: 12px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.fighter { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.fighter img { width: 100%; max-width: 150px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.fighter b { font-size: 14px; }
.vs-mid { font-size: 22px; font-weight: 700; color: var(--amber); text-transform: uppercase; }
.hp { width: 100%; height: 10px; border-radius: 6px; background: #151413; border: 1px solid var(--line); overflow: hidden; }
.hp i { display: block; height: 100%; width: 100%; background: var(--good); transition: width .5s ease; }
.hp.foe i { background: var(--bad); }
.rolls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roll { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; min-height: 28px; }
.roll .die { width: 28px; height: 28px; border-radius: 7px; }
.tactics { text-align: center; }
.tactic-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.tactic-btns .btn { min-height: 48px; font-size: 16px; }
.log { max-height: 220px; overflow-y: auto; background: #151413; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.log:empty { display: none; }
.log div { padding: 2px 0; }
.log .y { color: #a9d79a; }
.log .f { color: #f0a08f; }
.log .s { color: var(--muted); }
.log .w { color: var(--amber); font-weight: 700; }

/* dice bag */
.bag { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.slot { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.slot .small { font-size: 11px; line-height: 1.2; }
.slot.picking { border-color: var(--amber); box-shadow: 0 0 0 2px var(--glow); }
.bench { display: grid; gap: 6px; }
.face { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.face > span:last-child { display: flex; flex-direction: column; }
.face.on { border-color: var(--amber); }
.face:not(:disabled):hover { border-color: var(--amber); }
.earn { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.earn.got { opacity: .7; }
.tag { font-size: 11px; padding: 3px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--line); }
.tag.live { color: var(--amber); border-color: var(--amber); }
.tag.got { color: var(--good); border-color: var(--good); }
.tag.soon { color: var(--muted); }

/* champion tab */
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font-size: 14px; }
.choice:has(.swatch) { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.choice.on { border-color: var(--amber); color: var(--amber); }
.swatch { width: 18px; height: 18px; border-radius: 5px; flex: none; }
.covs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cov { background: var(--panel-2); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 10px;
  padding: 10px; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.cov.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c); }
.covs > p { grid-column: 1 / -1; }

/* ledger */
.ledger { list-style: none; display: flex; flex-direction: column; }
.ledger li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ledger li:first-child { border-top: 0; }
.kind { color: var(--amber); text-align: center; }
.k-loss .kind, .k-haunt-loss .kind { color: var(--bad); }
.k-win .kind, .k-haunt-win .kind { color: var(--good); }

/* ladder */
.covstand { display: flex; flex-direction: column; gap: 6px; }
.crow { display: grid; grid-template-columns: 110px 1fr 36px; gap: 8px; align-items: center; font-size: 14px; }
.crow b { text-align: right; }
.bar { height: 10px; border-radius: 6px; background: #151413; overflow: hidden; }
.bar i { display: block; height: 100%; }
.ladder { list-style: none; display: flex; flex-direction: column; }
.ladder li { display: grid; grid-template-columns: 28px 30px 1fr auto; gap: 8px; align-items: center; padding: 6px 4px; border-top: 1px solid var(--line); }
.ladder li:first-child { border-top: 0; }
.ladder li.me { background: rgba(251, 173, 54, .1); border-radius: 8px; }
.rk { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { width: 30px; height: 40px; object-fit: cover; border-radius: 5px; background: var(--panel-2); }

/* help, toast, footer */
dialog { margin: auto; max-width: 480px; width: calc(100% - 32px); background: var(--panel); color: var(--bone);
  border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; font-size: 14px; }
dialog form { margin-top: 12px; }
dialog .btn { width: 100%; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--amber); color: #1c1b1a;
  font-weight: 700; padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
.foot { display: flex; justify-content: center; gap: 18px; font-size: 13px; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
