:root {
  --bg: #14110f;
  --panel: #1e1915;
  --panel-2: #28211b;
  --line: #3a3027;
  --ink: #ece2cf;
  --muted: #a39581;
  --gold: #d4a64a;
  --gold-dim: #8a6a2c;
  --sea: #4f9a8f;
  --blood: #b5523b;
  --private: #6b5ca5;
  --serif: 'EB Garamond', Georgia, serif;
  --display: 'Cinzel', Georgia, serif;
  --ui: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--ui); font-size: 16px; line-height: 1.5; min-height: 100dvh; }
#app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }

h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: .04em; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; color: var(--gold); }
h2 { font-size: 1.15rem; color: var(--gold); }
h3 { font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
p { margin: 0 0 .8em; }
a { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- controls ---------- */
button, .btn {
  font: 600 .95rem var(--ui); color: var(--bg); background: var(--gold);
  border: 0; border-radius: 10px; padding: .75em 1.1em; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: default; filter: none; }
button.ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold-dim); }
button.link { background: none; color: var(--gold); padding: .2em .4em; font-weight: 500; }
input, textarea, select {
  width: 100%; font: 1rem var(--ui); color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: .7em .8em;
}
textarea { resize: vertical; min-height: 4.5em; font-family: var(--serif); font-size: 1.08rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold-dim); outline-offset: 1px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: .9em 0 .3em; }
.row { display: flex; gap: .6em; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 48px 0 12px; }
.hero p { font-family: var(--serif); font-size: 1.2rem; color: var(--muted); font-style: italic; }

/* ---------- character creation ---------- */
.classes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.class-opt { text-align: left; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-weight: 400; }
.class-opt b { font-family: var(--display); color: var(--gold); display: block; }
.class-opt span { font-size: .8rem; color: var(--muted); }
.class-opt.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

/* ---------- game shell ---------- */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); box-shadow: 0 8px 12px -8px #000a; padding: 12px 0 6px; }
.top .title { font-family: var(--display); color: var(--gold); font-size: 1rem; }
.top .loc { font-family: var(--serif); font-size: 1.3rem; }
.tabs { display: flex; gap: 4px; margin-top: 8px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; color: var(--muted); border-radius: 0; padding: .6em 0; border-bottom: 2px solid transparent; font-weight: 600; }
.tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
.tabs .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blood); margin-left: 4px; vertical-align: middle; }

/* ---------- feed ---------- */
.feed { display: flex; flex-direction: column; gap: 14px; padding: 12px 0; }
.round-mark { text-align: center; font-family: var(--display); font-size: .75rem; color: var(--gold-dim); letter-spacing: .3em; margin-top: 8px; }
.narration { font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; white-space: pre-wrap; }
.action { font-size: .88rem; color: var(--muted); font-style: italic; border-left: 2px solid var(--line); padding-left: 10px; }
.dice { font: .78rem/1.5 var(--mono); color: var(--muted); background: var(--panel); border-radius: 8px; padding: 6px 10px; white-space: pre-wrap; }
.dice summary { cursor: pointer; font-family: var(--ui); }
.private { background: color-mix(in srgb, var(--private) 18%, var(--panel)); border: 1px solid var(--private); border-radius: 12px; padding: 10px 12px; font-family: var(--serif); font-size: 1.05rem; }
.private .tag { font: 600 .72rem var(--ui); text-transform: uppercase; letter-spacing: .12em; color: #b8acee; display: block; margin-bottom: 2px; }
.private .share { margin-top: 6px; font-size: .8rem; }
.system { text-align: center; font-size: .85rem; color: var(--muted); }
.scene-img { width: 100%; border-radius: 12px; display: block; border: 1px solid var(--line); }
.ending { text-align: center; border-color: var(--gold); }
.ending h2 { font-size: 1.5rem; }

/* ---------- act panel ---------- */
.act { position: static; background: var(--bg); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.status { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.status b { color: var(--ink); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chip { flex: none; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .45em .9em; font-weight: 500; font-size: .88rem; }
.chip:hover { border-color: var(--gold-dim); }
.chip.roll-first { color: var(--gold); border-color: var(--gold-dim); }
.act .controls { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.act .controls label { margin: 0; display: flex; gap: 6px; align-items: center; flex: 1; color: var(--muted); }
.act .controls input[type=checkbox] { width: auto; accent-color: var(--private); }

/* ---------- party ---------- */
.member { display: flex; gap: 12px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--panel-2); flex: none; border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--display); color: var(--gold-dim); font-size: 1.4rem; }
.avatar.big { width: 120px; height: 175px; font-size: 2.5rem; }
.hp { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.hp > i { display: block; height: 100%; background: var(--sea); }
.hp.low > i { background: var(--blood); }
.badge { font-size: .72rem; padding: .1em .5em; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--sea); border-color: var(--sea); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.msg b { color: var(--gold); font-weight: 600; margin-right: 6px; }

.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; text-align: center; }
.stats div { background: var(--panel-2); border-radius: 8px; padding: 4px 0; }
.stats small { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.stats em { display: block; font-style: normal; font-size: .75rem; color: var(--gold); }
ul.clean { padding-left: 1.1em; margin: 0; }
ul.clean li { margin-bottom: .4em; font-family: var(--serif); font-size: 1.05rem; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--blood); color: white; padding: .6em 1em; border-radius: 10px; z-index: 20; max-width: 90vw; }
#toast.ok { background: var(--sea); }

/* ---------- powers & sheet ---------- */
.powers { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.power { flex: none; display: flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--gold) 12%, var(--panel)); color: var(--ink); border: 1px solid var(--gold-dim); border-radius: 10px; padding: .4em .7em; font-weight: 600; font-size: .85rem; }
.power .ic { font-size: .95rem; }
.power.spent { opacity: .4; border-style: dashed; }
.pips { color: var(--gold); letter-spacing: 1px; font-size: .75rem; }
.vitals { font-size: .8rem; color: var(--sea); margin-top: 2px; }
.vitals.low { color: var(--blood); }
.hp.big { height: 10px; border-radius: 5px; margin-top: 10px; }
.vitbox { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; text-align: center; }
.vitbox div { background: var(--panel-2); border-radius: 8px; padding: 4px 2px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vitbox small { display: block; color: var(--muted); font-size: .66rem; text-transform: uppercase; font-weight: 400; }
.ability { border-top: 1px solid var(--line); padding: 10px 0; }
.ability:first-of-type { border-top: 0; padding-top: 0; }
.ability p { margin: 4px 0 8px; }
.ability .use { padding: .4em 1em; font-size: .85rem; }
.ability.spent b { opacity: .55; }
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px; }
.skills div { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); padding: 2px 0; border-bottom: 1px dotted var(--line); text-transform: capitalize; }
.skills div.trained { color: var(--ink); }
.skills b { color: var(--gold); }
.item { padding: 6px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; padding-top: 0; }
@media (max-width: 380px) { .avatar.big { width: 90px; height: 132px; } }

/* ---------- dice tray ---------- */
.tray { background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 70%, var(--bg))); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.tray-head { display: flex; justify-content: space-between; align-items: center; font: 600 .72rem var(--ui); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.tray-head .link { font-size: .8rem; text-transform: none; letter-spacing: 0; }
.tray-foot { font-size: .85rem; color: var(--blood); padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px; }

.roll { display: flex; gap: 12px; align-items: center; padding: 8px 4px; border-radius: 10px; transition: background .3s; }
.roll + .roll { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.roll-body { flex: 1; min-width: 0; }
.roll-head { font-size: .9rem; }
.roll-head b { color: var(--ink); }
.roll.foe .roll-head b { color: #e6a08f; }
.roll-stake { font-family: var(--serif); font-size: 1.02rem; color: var(--muted); line-height: 1.3; }
.roll-stake .need { font: .75rem var(--ui); color: var(--gold-dim); }
.roll-hint { font-size: .8rem; color: var(--gold); margin-top: 2px; }
.roll.foe .roll-hint, .roll.ally .roll-hint { color: var(--muted); font-style: italic; }
.roll-math { font: .85rem var(--mono); color: var(--muted); margin-top: 2px; }
.roll-math b { color: var(--ink); font-size: 1rem; }
.roll-math .vs { color: var(--gold-dim); }
.roll-out { font-weight: 600; font-size: .92rem; margin-top: 1px; }
.roll.win .roll-out { color: #7fc8a9; }
.roll.lose .roll-out { color: #e07a62; }
.mode { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; padding: .05em .45em; border-radius: 999px; border: 1px solid currentColor; vertical-align: 1px; }
.mode.advantage { color: #7fc8a9; }
.mode.disadvantage { color: #e07a62; }
.fx { font: 700 .85rem var(--ui); padding: .05em .45em; border-radius: 6px; margin-left: 4px; }
.fx small { font-weight: 400; opacity: .7; }
.fx.damage { color: #ffd9cf; background: color-mix(in srgb, var(--blood) 45%, transparent); }
.fx.heal { color: #d6f5e9; background: color-mix(in srgb, var(--sea) 45%, transparent); }

/* the die */
.dice-btn { flex: none; display: flex; gap: 2px; background: none; padding: 0; border-radius: 12px; cursor: default; }
.dice-btn:hover { filter: none; }
.die { position: relative; display: grid; place-items: center; width: 56px; height: 56px; transition: transform .2s, opacity .3s; }
.die svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.die .d-out { fill: color-mix(in srgb, var(--gold) 16%, var(--panel-2)); stroke: var(--gold-dim); stroke-width: 3; stroke-linejoin: round; }
.die .d-in { fill: color-mix(in srgb, var(--gold) 9%, transparent); stroke: var(--gold-dim); stroke-width: 1.5; stroke-linejoin: round; }
.die .d-edge { stroke: var(--gold-dim); stroke-width: 1.2; opacity: .7; }
.die .face { position: relative; top: 4px; font: 700 1.05rem var(--display); color: var(--gold); text-shadow: 0 1px 2px #0008; }
.roll.foe .die .d-out { fill: color-mix(in srgb, var(--blood) 22%, var(--panel-2)); stroke: #8b4a3a; }
.roll.foe .die .d-in, .roll.foe .die .d-edge { stroke: #8b4a3a; }
.roll.foe .die .face { color: #f0b3a4; }
.roll.ally .die, .roll.foe .die { width: 44px; height: 44px; }
.roll.ally .die .face, .roll.foe .die .face { font-size: .9rem; top: 3px; }
.dice-btn .die + .die { margin-left: -6px; }
.die.dropped { opacity: .35; transform: scale(.85); }
.die.crit .d-out { fill: color-mix(in srgb, var(--gold) 45%, var(--panel-2)); stroke: var(--gold); }
.die.crit { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--gold) 70%, transparent)); }
.die.crit .face { color: #fff6dd; }
.die.fumble .d-out { fill: color-mix(in srgb, var(--blood) 50%, var(--panel-2)); stroke: var(--blood); }
.die.fumble .face { color: #ffd9cf; }

/* your die is waiting: bob gently, wobble on hover, invite the tap */
.roll.mine.pending { background: color-mix(in srgb, var(--gold) 7%, transparent); }
.roll.mine.pending .dice-btn { cursor: pointer; }
.roll.mine.pending .die { animation: bob 2.4s ease-in-out infinite; }
.roll.mine.pending .dice-btn:hover .die, .roll.mine.pending .dice-btn:focus-visible .die { animation: wobble .55s ease-in-out infinite; }
.roll.mine.pending .dice-btn:hover .d-out { stroke: var(--gold); }
.roll.mine.pending .dice-btn:active .die { transform: scale(.92); }
.dice-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.roll.rolling .die { animation: tumble .8s cubic-bezier(.3,.7,.4,1) both; }
.roll.landed .die:not(.dropped) { animation: land .45s cubic-bezier(.2,1.6,.4,1) both; }
.roll.landed .die.fumble { animation: shake .5s ease both; }
.roll.landed .roll-out { animation: fadeup .4s ease both; }
.roll.landed.win { background: color-mix(in srgb, var(--sea) 10%, transparent); }
.roll.landed.lose { background: color-mix(in srgb, var(--blood) 8%, transparent); }

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-4deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(0) scale(1.06); } 25% { transform: rotate(-12deg) scale(1.08) translateY(-2px); } 75% { transform: rotate(10deg) scale(1.08) translateY(-1px); } }
@keyframes tumble { 0% { transform: rotate(0) scale(1); } 30% { transform: rotate(260deg) scale(1.2) translateY(-8px); } 70% { transform: rotate(560deg) scale(.95); } 100% { transform: rotate(720deg) scale(1); } }
@keyframes land { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px) rotate(-6deg); } 40%, 80% { transform: translateX(5px) rotate(6deg); } }
@keyframes fadeup { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* the story stays hidden until you've rolled */
.veil { position: relative; }
.veil-body { display: flex; flex-direction: column; gap: 14px; filter: blur(8px); opacity: .4; user-select: none; max-height: 220px; overflow: hidden; transition: filter .7s, opacity .7s, max-height .9s ease; }
.veil-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; transition: opacity .4s; pointer-events: none; }
.veil-msg span { font: 600 .9rem var(--ui); color: var(--gold); background: color-mix(in srgb, var(--bg) 80%, transparent); border: 1px solid var(--gold-dim); border-radius: 999px; padding: .5em 1em; }
.veil.lifted .veil-body { filter: none; opacity: 1; user-select: auto; max-height: 4000px; }
.veil.lifted .veil-msg { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .roll .die, .roll.landed .die, .roll .roll-out { animation: none !important; }
  .veil-body { transition: none; }
}

.nat { color: var(--gold); text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; }
.nat.bad { color: #e07a62; }

/* ---------- accounts & home ---------- */
.seg { display: flex; background: var(--panel-2); border-radius: 10px; padding: 3px; margin-bottom: 4px; }
.seg button { flex: 1; background: none; color: var(--muted); padding: .55em; border-radius: 8px; }
.seg button.on { background: var(--panel); color: var(--gold); box-shadow: 0 1px 0 var(--line); }
.invite-note { border-color: var(--gold-dim); font-size: .95rem; }
.home-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 0 4px; }
.home-top .title { font-family: var(--display); color: var(--gold); font-size: 1.3rem; }
.campaign { display: flex; width: 100%; gap: 12px; align-items: center; text-align: left; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; font-weight: 400; }
.campaign:hover { border-color: var(--gold-dim); filter: none; }
.campaign .avatar { width: 44px; height: 44px; font-size: 1.1rem; }
.campaign-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.campaign-body b { font-family: var(--display); color: var(--gold); font-weight: 700; }
.campaign .badge { flex: none; }
.back { padding: 0; font-size: .8rem; color: var(--muted); }

/* ---------- heroes & builder ---------- */
.hero-card { display: flex; width: 100%; gap: 12px; align-items: center; text-align: left; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; font-weight: 400; }
.hero-card:hover { border-color: var(--gold-dim); filter: none; }
.hero-card .avatar { width: 52px; height: 52px; }
.hero-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hero-body b { font-family: var(--display); color: var(--gold); }
.steps { display: flex; gap: 4px; margin: 6px 0 14px; }
.steps button { flex: 1; background: var(--panel-2); color: var(--muted); border-radius: 8px; padding: .5em .2em; font-size: .78rem; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.steps button i { font-style: normal; font-family: var(--display); font-size: .9rem; }
.steps button.seen { color: var(--ink); }
.steps button.on { background: var(--panel); color: var(--gold); box-shadow: 0 0 0 1px var(--gold-dim) inset; }
.steps button:disabled { opacity: .4; }
.step-nav { display: flex; justify-content: space-between; margin: 18px 0 8px; }
.presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.preset { display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 4px; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 0 0 10px; overflow: hidden; font-weight: 400; }
.preset:hover { border-color: var(--gold); filter: none; }
.preset img, .preset-ph { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; display: grid; place-items: center; font-size: 2.4rem; color: var(--gold-dim); background: var(--panel); margin-bottom: 4px; }
.preset.blank .preset-ph { aspect-ratio: auto; height: 90px; }
.preset b { font-family: var(--display); color: var(--gold); padding: 0 10px; }
.preset span, .preset em { padding: 0 10px; }
.preset em { color: var(--muted); font-family: var(--serif); font-size: .95rem; }
.classes.big { grid-template-columns: 1fr; }
.classes.big .class-opt ul { margin-top: 6px; color: var(--muted); }
.classes.big .class-opt li { font-family: var(--ui); font-size: .82rem; margin-bottom: .25em; }
.classes.big .class-opt li b { display: inline; color: var(--ink); font-family: var(--ui); }
.look-sentence { font-family: var(--serif); font-size: 1.1rem; font-style: italic; color: var(--ink); background: var(--panel-2); border-left: 3px solid var(--gold-dim); padding: 8px 12px; border-radius: 0 10px 10px 0; }
.pickers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 12px; }
.pickers label { margin-top: .6em; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip.on { border-color: var(--gold); color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--panel-2)); }
.studio { display: flex; gap: 14px; align-items: flex-start; margin-top: 10px; }
.easel { flex: none; width: 46%; max-width: 240px; aspect-ratio: 832 / 1216; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.easel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.easel-ph { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: .9rem; text-align: center; padding: 10px; }
.studio-side { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.take { padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--panel-2); aspect-ratio: 832 / 1216; }
.take img { width: 100%; height: 100%; object-fit: cover; display: block; }
.take.on { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 40%, transparent); }
.take:hover { filter: brightness(1.1); }

/* ---------- xp & levels ---------- */
.xpbar { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.xpbar .lvl { font: 700 .72rem var(--display); color: var(--gold); letter-spacing: .04em; }
.xpbar i { flex: 1; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; display: block; }
.xpbar i b { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .8s ease; }
.xpbar.mini { margin-top: 3px; min-width: 120px; }
.xpbar.mini .small { font-size: .68rem; }
.xp-line { font-size: .8rem; color: var(--gold-dim); }
.levelup { background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 22%, var(--panel)), var(--panel)); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 14px; font-family: var(--serif); font-size: 1.05rem; color: var(--ink); animation: fadeup .6s ease both; }
.ability.locked { opacity: .55; }

/* ---------- cleaner feed ---------- */
.feed { gap: 18px; }
.rnd { display: flex; flex-direction: column; gap: 12px; }
.rnd-head { text-align: center; font-family: var(--display); font-size: .75rem; color: var(--gold-dim); letter-spacing: .3em; margin-top: 6px; }
.rnd.old .narration { font-size: 1.08rem; }
.did { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--muted); }
.did .avatar { width: 32px; height: 32px; border-radius: 8px; font-size: .95rem; }
.did b { color: var(--ink); }
.did.me b { color: var(--gold); }
.did-text { font-style: italic; }
.did .badge { font-size: .65rem; margin-left: 4px; }
.old-dice summary { cursor: pointer; font-size: .82rem; color: var(--muted); font-family: var(--ui); list-style: none; }
.old-dice summary::before { content: '▸ '; }
.old-dice[open] summary::before { content: '▾ '; }
.old-dice .tray { margin-top: 8px; }
.pc { color: var(--gold); font-weight: 600; }
.pc.me { text-decoration: underline dotted var(--gold-dim); text-underline-offset: 3px; }
.declared-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.declared { font-size: .8rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: .2em .7em; color: var(--ink); }
.declared-note { color: var(--gold); margin-top: 4px; }

.classes.big .class-opt span { display: block; }
.pickers > div label { margin-top: .6em; }
@media (min-width: 600px) { .presets { grid-template-columns: repeat(4, 1fr); } .preset em { font-size: .88rem; } }

.rnd-head .flag { padding: 0 .3em; font-size: .75rem; opacity: .45; vertical-align: middle; }
.rnd-head .flag:hover { opacity: 1; }
.report { background: var(--panel); border: 1px solid var(--blood); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.report textarea { min-height: 3em; font-family: var(--ui); font-size: .95rem; }

.sheet-top { display: flex; gap: 14px; align-items: flex-start; }
.sheet-portrait { flex: none; width: 38%; max-width: 200px; aspect-ratio: 832 / 1216; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.sheet-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }

.art-pending { font-size: .85rem; color: var(--muted); font-style: italic; border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; text-align: center; }

.nudge { font-size: .85rem; background: color-mix(in srgb, var(--gold) 10%, var(--panel)); border: 1px solid var(--gold-dim); border-radius: 10px; padding: 6px 10px; margin-bottom: 8px; }
.nudge .link { padding: 0 .3em; }

/* ---------- rounds: story first ---------- */
.rnd-head { display: flex; align-items: center; justify-content: center; gap: 6px; }
.did-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.did-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 85vw; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 3px; font-size: .8rem; color: var(--muted); }
.did-chip .avatar { width: 22px; height: 22px; border-radius: 50%; font-size: .7rem; }
.did-chip b { color: var(--ink); }
.did-chip.me b { color: var(--gold); }
.did-chip i { font-style: normal; font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-dim); }
.did-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
.rolls-line summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--muted); }
.rolls-line summary::-webkit-details-marker { display: none; }
.rolls-line .rl.win { color: #7fc8a9; }
.rolls-line .rl.lose { color: #e07a62; }
.rolls-line[open] summary { margin-bottom: 8px; }
.rnd.latest .narration { font-size: 1.18rem; }

/* ---------- battle mode ---------- */
.battle { display: flex; gap: 10px; align-items: center; overflow-x: auto; scrollbar-width: none; margin-top: 6px; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--blood) 60%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--blood) 10%, var(--panel)); }
.battle-tag { flex: none; font: 700 .72rem var(--display); letter-spacing: .14em; text-transform: uppercase; color: #ffb3a3; }
.battle-tag.over { color: var(--muted); }
.foe { flex: none; display: flex; flex-direction: column; gap: 2px; min-width: 110px; font-size: .8rem; }
.foe b { color: var(--ink); font-weight: 600; }
.foe-hp { display: block; height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.foe-hp b { display: block; height: 100%; background: var(--blood); }
.foe small { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
body.in-battle .act { border-top-color: color-mix(in srgb, var(--blood) 60%, var(--line)); }
body.in-battle .top .loc::after { content: ' ⚔'; color: var(--blood); }

.report[hidden] { display: none; }

/* ---------- the scene (Story tab) ---------- */
#now { display: flex; flex-direction: column; gap: 12px; padding: 10px 0 6px; }
.hero-bar { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.hero-name { font-family: var(--display); color: var(--gold); font-size: 1.05rem; }
.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); }
.bar i { display: block; height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.bar i b { display: block; height: 100%; }
.bar .hp b { background: #d8705a; }
.bar .hp.low b { background: var(--blood); }
.bar .pw b { background: #5b8bd6; }
.bar .num { color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-bar .xpbar { margin-top: 8px; }
.scene { margin: 0; position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.scene img { width: 100%; display: block; aspect-ratio: 3 / 2; object-fit: cover; }
.scene figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 12px 8px; font: .78rem var(--ui); color: #f3e9d6; background: linear-gradient(transparent, #000b); }
.where { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-size: .95rem; color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.where .muted { font: .78rem var(--ui); }
#now .narration { font-size: 1.15rem; margin: 0; }
#now .private { font-size: 1rem; }
.ask { margin: 8px 0 6px; color: var(--gold); letter-spacing: .08em; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 500; font-size: .95rem; }
.choice:hover { border-color: var(--gold-dim); filter: none; background: var(--panel-2); }
.choice .num { flex: none; font-family: var(--display); color: var(--gold); font-size: .9rem; }
.choice > span:nth-child(2) { flex: 1; }
.choice .chev { flex: none; color: var(--muted); font-size: 1.2rem; }
.say-row { display: flex; gap: 8px; margin-top: 8px; }
.say-row input { border-radius: 999px; font-family: var(--serif); font-size: 1.05rem; padding: .7em 1.1em; }
.send { flex: none; width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 1.2rem; }
.priv { margin: 6px 0 0; display: flex; gap: 6px; align-items: center; font-size: .78rem; }
.priv input { width: auto; accent-color: var(--private); }
.act .powers { margin-bottom: 2px; }
