/* Greatest Dungeons — dark fantasy theme from the logo: black, blood red, bone white.
   Mobile first; everything works one-handed on a phone at the table. */
:root {
  --bg: #0b0b0c;
  --bg2: #111114;
  --card: #17171b;
  --card2: #1e1e23;
  --line: #2c2c33;
  --text: #f3efe8;
  --muted: #a9a399;
  --red: #9b0000;
  --red2: #c8191b;
  --red-soft: rgba(200, 25, 27, .14);
  --gold: #e0b95b;
  --green: #4fbf7a;
  --blue: #6aa8ff;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --display: 'Cinzel', Georgia, serif;
  --brand: 'Uncial Antiqua', Georgia, serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--body); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: #ff6b6b; }
a:hover { color: #ff9a9a; }
img { max-width: 100%; height: auto; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: .01em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: .4em 0 .3em; }
h2 { font-size: clamp(1.3rem, 4vw, 1.7rem); margin: 1.2em 0 .5em; }
h3 { font-size: 1.05rem; margin: 0 0 .5em; }
h4 { margin: .6em 0 .2em; font-size: .98rem; }
p { margin: .5em 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--red); color: #fff; padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: 1060px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 520px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .88rem; margin: .2em 0 .6em; }
.lede-sm { color: var(--muted); margin-top: 0; }
.big { font-size: 1.2rem; }
.inline { display: inline; margin: 0; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.ok-text { color: var(--green); font-weight: 600; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: rgba(11, 11, 12, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand img { display: block; height: 38px; width: auto; }
.topnav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.topnav a:hover { color: #ff8a8a; }
.topnav .muted-link { color: var(--muted); font-weight: 500; }
@media (max-width: 480px) { .brand img { height: 30px; } .topnav { gap: 10px; } .topnav a { font-size: .88rem; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--red2); background: linear-gradient(180deg, var(--red2), var(--red)); color: #fff; font: 600 .98rem var(--body); text-decoration: none; cursor: pointer; transition: transform .05s, filter .15s; }
.btn:hover { filter: brightness(1.12); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--red2); background: var(--red-soft); color: var(--text); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn-danger { background: #5a0b0b; border-color: #8c1a1a; }
.btn-block { width: 100%; }
.btn.dm { border-color: #3b3b8c; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 1.8rem; line-height: 1; cursor: pointer; padding: 4px 10px; min-width: 44px; min-height: 44px; }
.danger-link { color: #ff7a7a; border-color: #4a1f1f; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.cta-row.center { justify-content: center; }

/* Cards, notices */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.alert, .notice { border-radius: var(--radius); padding: 12px 14px; margin: 14px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alert { background: rgba(200, 25, 27, .12); border: 1px solid rgba(200, 25, 27, .5); }
.alert ul, .notice ul { margin: 4px 0 0; padding-left: 20px; width: 100%; }
.notice { background: rgba(224, 185, 91, .1); border: 1px solid rgba(224, 185, 91, .4); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--card2); border: 1px solid var(--line); white-space: nowrap; }
.status-approved .badge, .badge.status-approved { background: rgba(79, 191, 122, .14); border-color: rgba(79, 191, 122, .5); color: #9fe6b9; }
.status-pending .badge, .badge.status-pending { background: rgba(224, 185, 91, .14); border-color: rgba(224, 185, 91, .5); color: var(--gold); }
.status-rejected .badge, .badge.status-rejected { background: rgba(200, 25, 27, .14); border-color: rgba(200, 25, 27, .5); color: #ff9a9a; }
.status-retired .badge, .badge.status-retired { color: var(--muted); }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; font-size: .72rem; font-weight: 600; background: var(--card2); border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.tag.ok { color: #9fe6b9; border-color: rgba(79, 191, 122, .45); }
.tag.warn { color: #ffb36b; border-color: rgba(255, 150, 60, .45); }
.tag.magic { color: var(--gold); border-color: rgba(224, 185, 91, .45); }

/* Forms */
.form { display: grid; gap: 12px; }
label { display: grid; gap: 5px; font-weight: 600; font-size: .92rem; }
label .hint { font-weight: 400; margin: 0; }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
label.check input { margin-top: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--red2); }
input, select, textarea { width: 100%; font: 16px var(--body); color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--red2); outline: none; box-shadow: 0 0 0 3px var(--red-soft); }
input[readonly], textarea[readonly] { opacity: .8; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.inline-form { display: flex; gap: 10px; align-items: flex-end; }
.inline-form label { flex: 1; }
.danger-zone summary { cursor: pointer; color: #ff8a8a; font-weight: 600; }

/* Home */
.hero { text-align: center; padding: 34px 0 20px; background: radial-gradient(ellipse at 50% 0%, rgba(155, 0, 0, .35), transparent 65%); }
.hero-logo { width: min(640px, 100%); margin: 0 auto; display: block; }
.tagline { font-family: var(--display); font-size: clamp(1.2rem, 4.5vw, 1.7rem); color: var(--gold); margin: 6px 0; }
.lede { max-width: 640px; margin: 10px auto 18px; font-size: 1.08rem; color: #ddd6cb; }
.next { max-width: 520px; margin: 0 auto; text-align: center; border-color: rgba(200, 25, 27, .5); box-shadow: var(--shadow); }
.next .cta-row { justify-content: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--muted); margin: 0; }
.next-date { font-family: var(--display); font-size: 1.6rem; margin: 4px 0; }
.next-meta { color: #ddd6cb; margin: 2px 0; }
.section { padding: 8px 16px; }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature h3 { color: var(--gold); }
.steps { padding-left: 22px; }
.steps li { margin: 8px 0; }
.faq details summary { cursor: pointer; font-weight: 600; }
.faq .card { margin: 10px 0; }
.prose { max-width: 720px; }
.prose h2 { font-size: 1.3rem; }

/* Characters list */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.char-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.char-card { display: grid; gap: 4px; text-decoration: none; color: var(--text); position: relative; margin: 0; transition: border-color .15s, transform .1s; }
.char-card:hover { border-color: var(--red2); color: var(--text); transform: translateY(-1px); }
.char-card .badge { justify-self: start; }
.char-name { font-family: var(--display); font-weight: 700; font-size: 1.35rem; }
.char-sub { color: var(--muted); }
.char-note { font-size: .85rem; color: #ffb0b0; }
.levelup-flag { color: var(--gold); font-weight: 700; }
.empty { text-align: center; padding: 30px 16px; }

/* Wizard */
.wiz-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.wiz-head h1 { margin-bottom: 0; }
.save-state { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.steps-nav { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; position: sticky; top: 58px; background: var(--bg); z-index: 5; }
.steps-nav::-webkit-scrollbar { display: none; }
.step-pill { display: flex; align-items: center; gap: 6px; flex: none; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: 600 .85rem var(--body); cursor: pointer; min-height: 38px; }
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--card2); font-size: .78rem; }
.step-pill.done .step-n { background: rgba(79, 191, 122, .2); color: #9fe6b9; }
.step-pill.on { border-color: var(--red2); color: var(--text); background: var(--red-soft); }
.step-pill.on .step-n { background: var(--red2); color: #fff; }
.wiz-body h2 { margin-top: .6em; }
.wiz-foot { display: flex; justify-content: space-between; gap: 10px; margin: 24px 0 10px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 12px 0; }
.choice { display: grid; gap: 4px; text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font: inherit; }
.choice:hover { border-color: #55555f; }
.choice.on { border-color: var(--red2); background: linear-gradient(180deg, rgba(200, 25, 27, .2), var(--card)); box-shadow: 0 0 0 1px var(--red2) inset; }
.choice-name { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.choice-meta { font-size: .8rem; color: var(--gold); }
.choice-blurb { font-size: .88rem; color: var(--muted); }
.traits summary { cursor: pointer; font-weight: 700; }
.trait { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 8px; }
.trait div, .feature-item div, .spell-detail, .item-desc div { font-size: .93rem; color: #ddd6cb; }

/* Choice groups */
.group { border: 1px solid var(--line); border-left: 4px solid var(--red2); border-radius: var(--radius); padding: 14px; margin: 14px 0; background: var(--card); }
.group.complete { border-left-color: var(--green); }
.group-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.group-head h3 { margin: 0; }
.counter { font-size: .82rem; font-weight: 700; color: var(--gold); background: rgba(224, 185, 91, .1); padding: 2px 10px; border-radius: 999px; }
.counter.done { color: #9fe6b9; background: rgba(79, 191, 122, .12); }
.opt-search { margin: 8px 0; }
.opt-list { display: grid; gap: 6px; margin-top: 8px; }
.opt-list.long { max-height: 420px; overflow-y: auto; padding-right: 4px; overscroll-behavior: contain; }
.opt-level { margin: 10px 0 2px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.opt-wrap { border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; font-weight: 500; min-height: 48px; }
.opt input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--red2); margin: 0; }
.opt:has(input:checked) { background: var(--red-soft); border-radius: 10px; }
.opt.locked { opacity: .75; cursor: default; }
.opt-text { display: grid; }
.opt-name { font-weight: 600; }
.opt-meta { font-size: .8rem; color: var(--muted); }
.opt-more { padding: 0 12px 8px 46px; }
.opt-more summary { cursor: pointer; color: var(--muted); font-size: .82rem; }
.spell-stats { color: var(--gold); font-size: .85rem; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 8px 0 12px; }
.seg-btn { padding: 9px 14px; background: var(--bg2); border: 0; border-right: 1px solid var(--line); color: var(--muted); font: 600 .88rem var(--body); cursor: pointer; min-height: 40px; }
.seg-btn:last-child { border-right: 0; }
.seg-btn.on { background: var(--red2); color: #fff; }

/* Abilities */
.abil-table { display: grid; gap: 6px; }
.abil-row { display: grid; grid-template-columns: 1.4fr 1.2fr .8fr .7fr .8fr; gap: 8px; align-items: center; padding: 6px 0; }
.abil-head { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; border-bottom: 1px solid var(--line); }
.abil-row.primary .abil-name { color: var(--gold); }
.abil-name { font-weight: 600; }
.abil-bonus { color: var(--green); font-weight: 700; text-align: center; }
.abil-total { font-size: 1.3rem; font-weight: 700; text-align: center; }
.abil-mod { color: var(--muted); text-align: center; }
@media (max-width: 520px) { .abil-row { grid-template-columns: 1.2fr 1.3fr .6fr .7fr .7fr; font-size: .9rem; } .abil-row .tag { display: none; } }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 40px; height: 40px; background: var(--bg2); color: var(--text); border: 0; font-size: 1.2rem; cursor: pointer; }
.stepper button:disabled { opacity: .35; }
.stepper span { min-width: 34px; text-align: center; font-weight: 700; }
.points { font-weight: 700; color: var(--gold); }
.points.over { color: #ff7a7a; }

/* Sheet */
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h1 { margin-bottom: 0; }
.levelup-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(90deg, rgba(224, 185, 91, .22), rgba(200, 25, 27, .18)); border: 1px solid var(--gold); margin: 14px 0; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 14px -16px 0; padding: 0 16px; position: sticky; top: 58px; background: var(--bg); z-index: 5; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 12px 14px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font: 600 .95rem var(--body); cursor: pointer; min-height: 46px; }
.tab.on { color: var(--text); border-bottom-color: var(--red2); }
.tab.dm { color: #9fa8ff; }
.tab.dm.on { border-bottom-color: #6a74ff; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin: 14px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 6px; text-align: center; display: grid; }
.stat-v { font-size: 1.5rem; font-weight: 700; }
.stat-l { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-row.big .stat-v { font-size: 1.8rem; }
.abil-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
@media (min-width: 720px) { .abil-grid { grid-template-columns: repeat(6, 1fr); } }
.abil-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 4px; text-align: center; display: grid; gap: 2px; }
.abil-box .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.abil-box .mod { font-size: 1.7rem; font-weight: 700; }
.abil-box .score { justify-self: center; font-size: .85rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; }
.abil-box .save { font-size: .75rem; color: var(--muted); }
.abil-box .save.prof { color: var(--gold); }
.hp-card.down { border-color: var(--red2); }
.hp-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.hp-now { font-size: 2.6rem; font-weight: 800; }
.hp-max { color: var(--muted); font-weight: 600; }
.hp-temp { color: var(--blue); font-weight: 700; }
.hp-bar { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 8px 0 12px; border: 1px solid var(--line); }
.hp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--red2)); transition: width .3s; }
.hp-controls { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; }
@media (max-width: 420px) { .hp-controls { grid-template-columns: 1fr 1fr 1fr; } .hp-controls .hp-amt { grid-column: 1 / -1; } }
.insp { border: 1px solid var(--gold); background: rgba(224, 185, 91, .12); color: var(--gold); border-radius: 999px; padding: 6px 12px; font: 700 .85rem var(--body); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { border: 1px solid var(--line); background: var(--bg2); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: 600 .85rem var(--body); cursor: pointer; min-height: 36px; }
.chip.on { border-color: var(--red2); background: var(--red-soft); color: var(--text); }
.chips.small .chip { font-size: .72rem; padding: 2px 8px; min-height: 0; margin-left: 4px; }
.pip-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pip-row:first-of-type { border-top: 0; }
.pip-label { font-weight: 600; }
.pips { display: flex; flex-wrap: wrap; gap: 6px; }
.pip { width: 30px; height: 30px; border-radius: 8px; transform: rotate(45deg) scale(.8); border: 2px solid var(--red2); background: var(--red-soft); cursor: pointer; }
.pip.used { background: transparent; border-color: #45454d; }
.pip.good { border-color: var(--green); background: rgba(79, 191, 122, .15); }
.pip.good.used { background: var(--green); }
.pip.bad.used { background: var(--red2); }
.pip.good:not(.used), .pip.bad:not(.used) { background: transparent; }
.pip:disabled { cursor: default; }
.res-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.death { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num { font-weight: 700; white-space: nowrap; }
.skills { list-style: none; padding: 0; margin: 0; columns: 2 240px; column-gap: 20px; }
.skills li { display: flex; align-items: center; gap: 8px; padding: 5px 0; break-inside: avoid; border-bottom: 1px dashed #26262c; }
.skills .dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #55555f; flex: none; }
.skills .prof .dot { background: var(--red2); border-color: var(--red2); }
.skills .expert .dot { background: var(--gold); border-color: var(--gold); border-radius: 2px; transform: rotate(45deg); }
.skills .sk-name { flex: 1; }
.skills .num { font-weight: 700; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.spell-list { display: grid; gap: 6px; }
.spell { border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); padding: 0 12px; }
.spell summary { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; cursor: pointer; }
.spell.prepared { border-color: rgba(200, 25, 27, .6); }
.sp-name { font-weight: 600; }
.sp-meta { color: var(--muted); font-size: .82rem; }
.feature-item { border-top: 1px solid var(--line); padding: 8px 0; }
.feature-item summary { cursor: pointer; font-weight: 600; }
.coins { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.coin { font-weight: 800; padding: 6px 14px; border-radius: 999px; border: 1px solid; }
.coin.gp { color: var(--gold); border-color: rgba(224, 185, 91, .5); }
.coin.sp { color: #cfd6de; border-color: #59606a; }
.coin.cp { color: #d9925a; border-color: #7a4c2c; }
.items { display: grid; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.item.equipped { border-color: rgba(79, 191, 122, .45); }
.item-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.item-name { font-weight: 700; }
.qty { color: var(--muted); }
.item-desc summary { cursor: pointer; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.item-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.log { list-style: none; padding: 0; margin: 0; }
.log li { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.log-when { color: var(--muted); font-size: .82rem; }
.log-session .log-msg::before { content: '⚔ '; }
.log-level .log-msg::before { content: '★ '; color: var(--gold); }
.log-item .log-msg::before { content: '◈ '; color: var(--gold); }
.log-gold .log-msg::before { content: '● '; color: var(--gold); }
.hidden-log { opacity: .7; }
.dm-card { border-color: #33336b; }
.dm-card h3 { color: #b8beff; }
.dm-card > * + * { margin-top: 10px; }
.catalog { display: grid; gap: 4px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.cat-row { display: flex; justify-content: space-between; gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 8px; font: 500 .95rem var(--body); cursor: pointer; }
.cat-row:hover { border-color: var(--red2); }
.levelup .card { margin: 10px 0; }

/* DM desk */
.dm-grid { display: grid; gap: 0 20px; }
@media (min-width: 900px) { .dm-grid { grid-template-columns: 1fr 1.2fr; } }
.invite { text-align: center; border-color: var(--gold); }
.invite .cta-row { justify-content: center; }
.invite-code { font: 800 clamp(1.8rem, 7vw, 2.6rem) ui-monospace, 'Cascadia Mono', Menlo, monospace; letter-spacing: .06em; color: var(--gold); margin: 6px 0; text-align: center; word-break: break-all; }
.roster { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.roster-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); text-decoration: none; color: var(--text); }
.roster-row:hover { border-color: var(--red2); color: var(--text); }
.r-name { font-weight: 700; }
.r-meta { color: var(--muted); font-size: .85rem; grid-column: 1; }
.roster-row .badge { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.user-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.user-row.off { opacity: .55; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.card > summary { cursor: pointer; }
details.card > summary::after { content: ' ▾'; color: var(--muted); }
details[open].card > summary::after { content: ' ▴'; }

/* Modal + toast */
.modal-open { overflow: hidden; }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-back { align-items: center; padding: 20px; } }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { max-width: 760px; }
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 0 16px; }
.modal-head h2 { margin: 0; font-size: 1.3rem; }
.modal-body { padding: 8px 16px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 150%); background: #22222a; border: 1px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--shadow); transition: transform .25s; font-weight: 600; }
.toast.show { transform: translate(-50%, 0); }
.toast.error { border-color: var(--red2); background: #2a1215; }
ul.plain { padding-left: 18px; }

/* Footer */
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0 30px; color: var(--muted); font-size: .9rem; }
.footer a { color: var(--muted); }
.footer .srd { font-size: .72rem; opacity: .75; }
.footer-links a { margin: 0 2px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .topbar, .tabs, .footer, .btn, .item-btns, .hp-controls { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .stat, .abil-box { border-color: #999; background: #fff; }
}

/* Header links that only fit on wider screens */
@media (max-width: 760px) { .hide-sm { display: none; } }

/* DM desk inbox */
.msg { border-top: 1px solid var(--line); padding: 12px 0; }
.msg.done { opacity: .6; }
.msg-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.msg-body { white-space: pre-wrap; margin: 6px 0; }
@media (max-width: 420px) { .topnav .muted-link { display: none; } }
