/* Wickwyrd — base styles. Colours/fonts come from CSS variables set by js/theme.js. */
:root { /* Wickwyrd default: lantern gold, ember/oxblood, parchment text on umber/charcoal */
  --bg:#140f0b; --panel:#1f1712; --panel2:#2a1f17; --line:#5a4129; --text:#f1e3c6; --muted:#c4ab84; --accent:#f0b24e; --accent-dim:#6e2a17; --danger:#e0603a; --good:#9fc46b; --dm-bg:#231a14; --player-bg:#2e2119;
  --ember:#d9622b; --oxblood:#6e1f1a; --lantern:#ffcf6a; --candle-glow: 0 0 0 1px rgba(240,178,78,.55), 0 0 18px rgba(255,180,80,.35), 0 0 42px rgba(217,98,43,.18);
  --font-heading: 'Cinzel', Georgia, serif; --font-body: 'Lora', Georgia, serif; --font-mono: ui-monospace, monospace; --radius: 8px; --bw: 1px; --shadow: 0 2px 10px rgba(0,0,0,.35); --bg-image: none; --base-size: 17px; --story-size: 19.5px; --fx: .6; --gap: 12px; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); background-image: var(--bg-image); background-attachment: fixed; color: var(--text); font: var(--base-size)/1.5 var(--font-body); }
body.density-compact { --gap: 7px; line-height: 1.35; } body.density-spacious { --gap: 18px; line-height: 1.65; }
h1, h2, h3, .brand, .panel-title { font-family: var(--font-heading); margin: 0 0 .4em; }
h1 { font-size: 1.15em; } h2 { font-size: 1.1em; } h3 { font-size: 1em; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .82em; } .big { font-size: 1.1em; } .center { text-align: center; } .right { text-align: right; }
.ok { color: var(--good); } .fail { color: var(--danger); } .warn { color: var(--danger); }
.grow { flex: 1; } .mono { font-family: var(--font-mono); font-size: .85em; }
.row { display: flex; gap: 8px; align-items: center; margin: 6px 0; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.section-title { font-family: var(--font-heading); font-size: .8em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px; display: flex; gap: 8px; align-items: center; }
button, .button { font: inherit; font-size: .92em; color: var(--text); background: var(--panel2); border: var(--bw) solid var(--line); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover:not(:disabled) { border-color: var(--accent); } button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
button.ghost, .button.ghost { background: transparent; } button.danger { color: var(--danger); } button.primary.danger, button.danger.primary { background: var(--danger); color: #fff; }
button.small { padding: 3px 8px; font-size: .8em; } button.big { padding: 10px 18px; font-size: 1em; }
button.link { background: none; border: 0; padding: 0 4px; color: var(--accent); }
button.glow { animation: glow 1.6s infinite alternate; } @keyframes glow { to { box-shadow: 0 0 16px var(--accent); } }
input, select, textarea { font: inherit; font-size: .92em; color: var(--text); background: var(--panel); border: var(--bw) solid var(--line); border-radius: var(--radius); padding: 6px 8px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; } input[type=range] { padding: 0; } input[type=color] { padding: 0; height: 30px; }
label { display: block; margin: 6px 0; font-size: .9em; } label.toggle { display: flex; gap: 8px; align-items: baseline; } label.toggle.dim { opacity: .5; }
label.slider { display: grid; grid-template-columns: 9em 1fr 4em; gap: 8px; align-items: center; }
.card { background: var(--panel); border: var(--bw) solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 6px 0; box-shadow: var(--shadow); }
.badge { font-size: .78em; padding: 3px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); } .badge.real { border-color: var(--good); } .badge.warn { border-color: var(--danger); color: var(--danger); }
.pill { display: inline-block; font-size: .75em; padding: 1px 7px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.pill.accent { border-color: var(--accent); color: var(--accent); } .pill.good, .pill.completed { border-color: var(--good); color: var(--good); } .pill.warn, .pill.failed { border-color: var(--danger); color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { display: inline-flex; gap: 4px; align-items: center; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel2); font-size: .85em; cursor: pointer; margin: 0; } .chip.on { border-color: var(--accent); background: var(--accent-dim); }
.bar { height: 7px; background: var(--panel2); border-radius: 9px; overflow: hidden; flex: 1; border: 1px solid var(--line); } .bar > div { height: 100%; background: var(--accent); transition: width .4s; } .bar.hp > div { background: var(--danger); }
.res { display: grid; grid-template-columns: 3.5em 1fr 4.5em; gap: 6px; align-items: center; font-size: .85em; margin: 3px 0; }
details > summary { cursor: pointer; margin: 4px 0; }
table.items { width: 100%; border-collapse: collapse; font-size: .9em; } table.items td, table.items th { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.warn-box { border: 1px solid var(--danger); color: var(--danger); padding: 8px; border-radius: var(--radius); margin: 8px 0; }

/* ---------- home ---------- */
#home { min-height: 100vh; padding: 0; }
.home-top { display: flex; gap: 10px; align-items: center; } .brand { font-size: 1.4em; }
.home-tabs, .subtabs { display: flex; gap: 4px; margin: 14px 0; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.home-tabs button, .subtabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.home-tabs button.active, .subtabs button.on { border-bottom-color: var(--accent); color: var(--accent); }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.adv .title, .card .title { font-family: var(--font-heading); font-size: 1.05em; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; }
.pack-option { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; } .pack-option.selected { border-color: var(--accent); background: var(--accent-dim); }
.pack-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.steps { display: flex; gap: 4px; margin-bottom: 8px; } .step { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: .8em; cursor: pointer; } .step.on { border-color: var(--accent); color: var(--accent); }
.meta-wrap { max-width: 800px; } .meta-log { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--panel2); border-radius: var(--radius); margin: 8px 0; }
.mmsg { padding: 6px 10px; border-radius: var(--radius); background: var(--panel); font-size: .9em; } .mmsg.user { align-self: flex-end; background: var(--player-bg); } .mmsg p { margin: .2em 0; }
.change { border-left: 3px solid var(--accent); padding: 4px 8px; margin: 4px 0; font-size: .85em; } .change.undone { opacity: .5; border-color: var(--line); } .change ul { margin: 2px 0; padding-left: 18px; }

/* ---------- game layout ---------- */
#game { --left-w: clamp(230px, 19vw, 300px); --right-w: clamp(300px, 25vw, 380px); display: grid; height: 100vh; grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); grid-template-rows: auto 1fr; grid-template-areas: "top top top" "left chat right"; }
body.layout-chat-left #game { grid-template-columns: minmax(0, 1fr) var(--left-w) var(--right-w); grid-template-areas: "top top top" "chat left right"; }
body.layout-chat-right #game { grid-template-columns: var(--right-w) var(--left-w) minmax(0, 1fr); grid-template-areas: "top top top" "right left chat"; }
body.layout-focus #game { grid-template-columns: minmax(0, 1fr) var(--right-w); grid-template-areas: "top top" "chat right"; } body.layout-focus #left { display: none; }
#topbar { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
#topbar .titlebox { min-width: 0; } #topbar h1 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#left { grid-area: left; overflow: auto; padding: var(--gap); border-right: 1px solid var(--line); }
#chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; }
#right { grid-area: right; display: flex; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
#scene .art { height: 130px; border-radius: var(--radius); background: var(--panel2) center/cover; display: grid; place-items: center; color: var(--muted); font-size: .8em; }
#scene .art.empty { background-image: linear-gradient(135deg, var(--panel2), var(--bg)); height: 60px; }
#sceneTitle { font-family: var(--font-heading); margin-top: 6px; }
.pc { display: flex; gap: 10px; cursor: pointer; } .pc .name { font-family: var(--font-heading); }
.portrait { width: 64px; height: 76px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel2); flex: none; } .portrait.big { width: 130px; height: 156px; } .portrait.pending { opacity: .5; filter: blur(1px); }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex: none; }
.mini { display: flex; gap: 8px; align-items: center; padding: 5px; border-radius: var(--radius); cursor: pointer; font-size: .9em; } .mini:hover { background: var(--panel2); }

/* chat */
#messages { flex: 1; overflow: auto; padding: var(--gap) calc(var(--gap) * 1.5); display: flex; flex-direction: column; gap: var(--gap); }
.msg { max-width: 860px; padding: 10px 14px; border-radius: var(--radius); border: var(--bw) solid var(--line); }
.msg p { margin: .35em 0; } .msg.dm { background: var(--dm-bg); align-self: flex-start; } .msg.player { background: var(--player-bg); align-self: flex-end; max-width: 75%; }
.msg .who { font-family: var(--font-heading); font-size: .75em; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; display: flex; justify-content: space-between; }
.msg .tools { opacity: 0; transition: opacity .2s; } .msg:hover .tools { opacity: 1; }
.msg.roll { font-family: var(--font-mono); font-size: .85em; background: transparent; border-style: dashed; align-self: center; } .msg.roll.crit { border-color: var(--accent); }
.msg.notes { background: transparent; border: 0; padding: 0 14px; display: flex; flex-wrap: wrap; gap: 6px; align-self: center; } .msg.notes span { font-size: .78em; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.msg.system { background: transparent; border-style: dotted; color: var(--muted); align-self: center; font-size: .9em; } .msg.system.error { color: var(--danger); border-color: var(--danger); }
.msg.achievement, .msg.levelup { align-self: center; border-color: var(--accent); color: var(--accent); font-size: .9em; }
.msg.recap { border-left: 3px solid var(--accent); }
.thinking { color: var(--muted); font-style: italic; align-self: flex-start; } .thinking::after { content: '…'; animation: dots 1.2s infinite; } @keyframes dots { 0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; } }
#pendingRoll, #choices, #dialogueBox, #combatBox { margin: 0 calc(var(--gap) * 1.5) 8px; }
#pendingRoll { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--panel); }
#choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice, .opt { text-align: left; } .choice .k, .opt .k { font-family: var(--font-mono); font-size: .75em; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
#dialogueBox { border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px; background: var(--panel); }
.dlg-head { display: flex; gap: 10px; align-items: center; } .dlg-line { font-size: 1.05em; font-style: italic; margin: 8px 0; }
.dlg-opts { display: flex; flex-direction: column; gap: 4px; } .opt .tone { font-size: .72em; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); min-width: 6em; }
.opt.tone-hostile .tone, .opt.tone-intimidate .tone { color: var(--danger); } .opt.tone-friendly .tone, .opt.tone-flirt .tone { color: var(--good); } .opt.tone-leave .tone { color: var(--muted); }
#combatBox { border: 1px solid var(--danger); border-radius: var(--radius); padding: 10px; background: var(--panel); }
.combatants { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; } .cbt { border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 8px; min-width: 130px; font-size: .85em; display: flex; flex-direction: column; gap: 3px; }
.cbt.enemy { cursor: pointer; } .cbt.tgt { border-color: var(--danger); box-shadow: 0 0 8px var(--danger); } .cbt.down { opacity: .45; } .cbt.player, .cbt.ally { border-color: var(--good); }
#inputForm { border-top: 1px solid var(--line); padding: 8px calc(var(--gap) * 1.5); background: var(--panel); }
.input-row { display: flex; gap: 8px; align-items: stretch; } .input-row textarea { resize: none; }
.creation { max-width: 860px; } .qb { margin: 8px 0; } .qb .q { font-weight: 600; margin-bottom: 4px; } .qb .opts { display: flex; flex-wrap: wrap; gap: 5px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; } .stat-grid label, .stat { text-align: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; margin: 0; display: flex; flex-direction: column; align-items: center; } .stat b { font-size: .75em; color: var(--muted); } .stat span { font-size: 1.2em; }
.trait-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 10px; } .trait { display: flex; gap: 6px; align-items: center; margin: 2px 0; }
.gen { font-size: .85em; }

/* right panels */
#tabs { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; border-right: 1px solid var(--line); overflow: auto; width: 62px; flex: none; }
#tabs button { flex-direction: column; gap: 0; padding: 5px 2px; font-size: 1.05em; background: none; border: 1px solid transparent; position: relative; }
#tabs button span { font-size: .55em; color: var(--muted); max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tabs button.on { border-color: var(--accent); background: var(--accent-dim); } #tabs .dot { position: absolute; top: 1px; right: 3px; font-style: normal; font-size: .6em; background: var(--accent); color: var(--bg); border-radius: 99px; padding: 0 5px; }
#panelBody { flex: 1; overflow: auto; padding: 10px 12px; min-width: 0; }
.panel-title { display: flex; justify-content: space-between; align-items: center; } .closepanel { display: none; }
.sheet-top { display: flex; gap: 12px; } .name.big { font-size: 1.3em; font-family: var(--font-heading); }
.paperdoll { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 8px; } .slot { border: 1px dashed var(--line); border-radius: var(--radius); padding: 5px 7px; display: flex; flex-direction: column; font-size: .85em; } .slot.full { border-style: solid; border-color: var(--accent); }
.lvl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .lvl .bar { min-width: 80px; }
.skill { margin: 7px 0; } .skill .rank { font-family: var(--font-mono); font-size: .85em; }
.perk { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; margin: 5px 0; } .perk.owned { border-color: var(--good); } .perk.ready { border-color: var(--accent); box-shadow: 0 0 6px var(--accent-dim); } .perk.locked { opacity: .7; }
.objectives { list-style: none; padding-left: 4px; margin: 6px 0; } .objectives li { margin: 3px 0; } .objectives li.completed { color: var(--good); text-decoration: line-through; } .objectives li.failed { color: var(--danger); text-decoration: line-through; } .objectives li.locked { color: var(--muted); }
svg.map { width: 100%; background: var(--panel2); border-radius: var(--radius); } .map .road { stroke: var(--line); stroke-width: 2; } .map .node circle { fill: var(--muted); cursor: pointer; } .map .node.visited circle { fill: var(--accent); } .map .node.cur circle { fill: var(--good); stroke: var(--text); stroke-width: 2; }
.map text { fill: var(--text); font-size: 9px; text-anchor: middle; pointer-events: none; }
.loc-list { list-style: none; padding: 0; } .loc-list li { padding: 5px; border-bottom: 1px solid var(--line); cursor: pointer; } .loc-list li.cur { border-left: 3px solid var(--good); }
.recipe.ready { border-color: var(--good); }
.chron { list-style: none; padding: 0; } .chron li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .9em; }
.clock { text-align: center; } .clock .big { font-size: 2em; font-family: var(--font-heading); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; } .ach { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; display: flex; flex-direction: column; gap: 2px; opacity: .55; } .ach.earned { opacity: 1; border-color: var(--accent); } .ach .icon { font-size: 1.5em; }
.saves { list-style: none; padding: 0; } .saves li { display: flex; justify-content: space-between; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); } .saves li.named b { color: var(--accent); }
.people .mini { margin: 4px 0; }

/* gallery & photo */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.gallery figure { margin: 0; cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; } .gallery img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; } .gallery figcaption { padding: 5px 7px; font-size: .8em; display: flex; flex-direction: column; }
.lightbox img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto 8px; }
.photo-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(250px, 1fr); gap: 14px; } .photo-wrap canvas { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #000; }

/* randomizer */
.rand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; } .rand { flex-direction: column; } .rand .icon { font-size: 1.6em; }
.rand-overlay { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.55); display: grid; place-content: center; justify-items: center; gap: 10px; color: #fff; transition: opacity .5s; cursor: pointer; } .rand-overlay.done .rand-result { transform: scale(1); opacity: 1; }
.rand-result { font-family: var(--font-heading); font-size: 2em; transform: scale(.5); opacity: 0; transition: all .4s; color: var(--accent); }
.rand-stage { display: flex; gap: 14px; perspective: 800px; }
.coin { width: 120px; height: 120px; position: relative; transform-style: preserve-3d; animation: coinflip 1.6s ease-out forwards; } .coin .face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-size: 2.6em; font-weight: 700; background: radial-gradient(circle at 35% 35%, #ffe28a, #b8860b); color: #6b4e00; backface-visibility: hidden; border: 4px solid #8a6508; } .coin .t { transform: rotateY(180deg); }
@keyframes coinflip { from { transform: rotateY(0) translateY(0); } 50% { transform: rotateY(900deg) translateY(-80px); } to { transform: rotateY(var(--end, 1800deg)); } }
.coin.flip-tails { --end: 1980deg; } .coin.flip-heads { --end: 1800deg; }
.pcard { width: 110px; height: 160px; position: relative; transform-style: preserve-3d; animation: cardflip 1.2s .2s ease-out forwards; transform: rotateY(180deg); } .pcard > div { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; display: grid; place-items: center; font-size: 1.6em; }
.pcard .front { background: #fafafa; color: #111; border: 2px solid #ccc; text-align: center; padding: 6px; } .pcard.red .front { color: #c0392b; } .pcard .back { background: repeating-linear-gradient(45deg, var(--accent) 0 6px, var(--accent-dim) 6px 12px); transform: rotateY(180deg); }
.pcard.tarot { width: 130px; height: 210px; } .pcard.tarot .front { font-size: 1.1em; background: linear-gradient(#f7ecd0, #e5d3a6); font-family: var(--font-heading); } .pcard.rev .front { transform: rotate(180deg); } .pcard small { display: block; font-size: .6em; }
@keyframes cardflip { to { transform: rotateY(0); } }
.wheel-wrap { position: relative; } .pointer { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); z-index: 2; color: var(--accent); font-size: 1.5em; }
.wheel { width: 260px; height: 260px; border-radius: 50%; position: relative; border: 4px solid #fff; background: conic-gradient(var(--accent) 0 calc(100% / var(--n)), var(--accent-dim) 0 calc(200% / var(--n)), var(--accent) 0 calc(300% / var(--n)), var(--accent-dim) 0 calc(400% / var(--n)), var(--accent) 0 calc(500% / var(--n)), var(--accent-dim) 0 calc(600% / var(--n)), var(--accent) 0 calc(700% / var(--n)), var(--accent-dim) 0); animation: spin 2.4s cubic-bezier(.15,.8,.2,1) forwards; }
.wheel span { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; transform: rotate(calc((var(--i) + .5) * 360deg / var(--n) - 90deg)) translate(40px, -6px); font-size: .75em; color: #fff; white-space: nowrap; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(var(--deg)); } }
.straws { display: flex; gap: 10px; align-items: flex-end; height: 160px; } .straws i { width: 10px; height: 150px; background: #e8d28a; border-radius: 4px; } .straws i.pick { animation: pull 1.2s forwards; } .straws i.short { height: 70px; }
@keyframes pull { to { transform: translateY(-40px); box-shadow: 0 0 12px var(--accent); } }
.bag { font-size: 5em; position: relative; } .token { position: absolute; left: 50%; top: 10%; width: 40px; height: 40px; border-radius: 50%; border: 2px solid #333; animation: pop 1.2s forwards; } .token.white { background: #fff; } .token.black { background: #111; border-color: #888; } .token.gold { background: gold; } .token.red { background: #c0392b; }
@keyframes pop { from { transform: translate(-50%, 40px) scale(.3); } to { transform: translate(-50%, -70px) scale(1); } }
.oracle { font-size: 4em; font-family: var(--font-heading); animation: pop2 1s; } .oracle small { font-size: .3em; display: block; text-align: center; } @keyframes pop2 { from { transform: scale(.2); opacity: 0; } }

/* modal, toasts, coach */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { position: relative; background: var(--panel); border: var(--bw) solid var(--line); border-radius: var(--radius); padding: 18px 20px; max-width: 620px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); } .modal-box.wide { max-width: 1050px; }
.modal-box .close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 1.4em; }
.shortcut-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; } kbd, .kbd { font-family: var(--font-mono); font-size: .8em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; background: var(--panel2); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 70; max-width: 360px; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); transform: translateX(120%); transition: transform .35s; font-size: .9em; } .toast.in { transform: none; }
.toast.level { border-left-color: gold; font-weight: 600; } .toast.achievement { border-left-color: gold; } .toast.warn { border-left-color: var(--danger); } .toast.good { border-left-color: var(--good); } .toast.tip { border-left-color: var(--accent); } .toast p { margin: 0; }
.coach { position: fixed; z-index: 65; width: 340px; background: var(--panel); border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 0 24px var(--accent-dim), var(--shadow); font-size: .92em; }
.coach-step { font-size: .72em; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; } .coach p { margin: .3em 0; }
.coach-target { outline: 3px solid var(--accent) !important; outline-offset: 2px; border-radius: var(--radius); animation: pulse 1.4s infinite; } @keyframes pulse { 50% { outline-color: transparent; } }

/* narrower windows (1280px at 125%, 1366px…): right panel collapses to its tab strip, the
   character summary stays visible on the left; below 860px it is reachable via the full sheet (H). */
@media (max-width: 1100px) {
  #game { grid-template-columns: clamp(200px, 22vw, 240px) minmax(0, 1fr) 62px !important; grid-template-areas: "top top top" "left chat right" !important; }
  #right { position: relative; } #panelBody { display: none; }
  body.panel-open #panelBody { display: block; position: fixed; right: 62px; top: 52px; bottom: 0; width: min(420px, 90vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 40; box-shadow: var(--shadow); }
  .closepanel { display: inline-flex; } .photo-wrap { grid-template-columns: 1fr; }
}
#sceneArt.empty:empty { display: none; }
/* no sideways page scroll; stronger backdrop behind randomizer results */
body { overflow-x: hidden; } #game { overflow: hidden; max-width: 100vw; }
.rand-overlay { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.badge.clickable { cursor: pointer; } .badge.clickable:hover { filter: brightness(1.15); text-decoration: underline; }

/* ---------- required rolls, suggested actions, creation gate, character summary ---------- */
#pendingRoll { align-items: center; } #pendingRoll .roll-title { font-family: var(--font-heading); } #pendingRoll .grow { min-width: 0; }
#choices { flex-direction: row; max-height: 34vh; overflow: auto; }
#choices .choices-title { flex-basis: 100%; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1 1 210px; max-width: 100%; white-space: normal; }
.choice .choice-head { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; } .choice .choice-desc { line-height: 1.25; }
#dialogueBox { max-height: 42vh; overflow: auto; }
#creationGate { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 0 calc(var(--gap) * 1.5) 8px; padding: 8px 12px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--panel); }
#creationGate.hidden { display: none; } #creationGate .gate-text { min-width: 0; }
#creationPanel.flash { box-shadow: 0 0 0 3px var(--accent); transition: box-shadow .3s; }
/* before character creation nothing in-game is actionable, wherever it appears */
body.precreation #combatBox, body.precreation #pendingRoll, body.precreation #dialogueBox,
body.precreation [data-w], body.precreation [data-until], body.precreation [data-rest], body.precreation [data-camp],
body.precreation [data-life], body.precreation [data-craft], body.precreation [data-t], body.precreation [data-mode],
body.precreation [data-train], body.precreation [data-read], body.precreation [data-use], body.precreation [data-equip], body.precreation [data-unequip],
body.precreation [data-p], body.precreation [data-x="talk"], body.precreation [data-x="invite"], body.precreation [data-x="train"], body.precreation [data-x="shop"],
body.precreation [data-cact], body.precreation [data-dchoice], body.precreation [data-choice] { display: none !important; }
#pcCard .sum { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.sum .pc .name { font-size: 1.05em; } .sum-res .res { grid-template-columns: 3em 1fr 4em; }
.sum-sec > summary { cursor: pointer; font-family: var(--font-heading); font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 0; }
.sum-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px; margin-top: 4px; }
.sum-stat { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 0; line-height: 1.15; }
.sum-stat b { font-size: .68em; color: var(--muted); } .sum-stat span { font-size: 1.05em; } .sum-stat i { font-style: normal; font-size: .72em; color: var(--accent); min-height: 1em; }
.sum-skill { display: flex; gap: 6px; font-size: .85em; } .sum-gear { font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-empty { display: flex; gap: 10px; align-items: center; } .sum-empty .portrait { filter: grayscale(1) brightness(.6); }
#topbar #backHome { white-space: nowrap; }
@media (max-width: 860px) { #game { grid-template-columns: minmax(0, 1fr) 62px !important; grid-template-areas: "top top" "chat right" !important; } #left { display: none; } }
/* short windows (720p at 125-150% scaling): keep the story readable */
@media (max-height: 620px) {
  #scene .art { height: 70px; } #choices { max-height: 26vh; } #dialogueBox { max-height: 34vh; }
  .choice .choice-desc { display: none; } .input-row textarea { min-height: 2.4em; }
  #topbar { padding: 4px 10px; } #topbar h1 { font-size: 1.05em; }
}

/* ---------- top-bar time display (always visible; click → time & calendar window) ---------- */
#topTime { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; max-width: 46vw; overflow: hidden; padding: 4px 10px; border: var(--bw) solid var(--line); border-radius: 99px; background: var(--panel2); font-size: .9em; line-height: 1.2; flex: 0 1 auto; }
#topTime:hover { border-color: var(--accent); }
#topTime .tt-clock { font-family: var(--font-mono); font-size: 1.05em; }
#topTime .tt-day, #topTime .tt-date { color: var(--muted); }
#topTime .tt-ev { color: var(--accent); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#topTime .tt-etext { display: inline; }
#topbar { min-width: 0; } #topbar > button { flex: none; }
#topbar .titlebox { flex: 0 1 auto; }
@media (max-width: 1500px) { #topTime .tt-stext { display: none; } }
@media (max-width: 1280px) { #topTime .tt-etext, #topTime .tt-day { display: none; } #settingsBtn .sb-label { display: none; } }
@media (max-width: 980px) { #topTime .tt-date { display: none; } #backHome { font-size: 0; } #backHome::before { content: '←'; font-size: 16px; } }
.time-win .clock .big { font-size: 1.8em; font-family: var(--font-heading); }

/* ---------- Settings window (tabs) ---------- */
.settings-win h2 { margin: 0 0 8px; padding-right: 30px; }
.set-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: var(--bw) solid var(--line); margin: 0 0 12px; position: sticky; top: -18px; background: var(--panel); z-index: 2; padding: 4px 0 0; }
.set-tabs button { border: var(--bw) solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: none; padding: 6px 12px; white-space: nowrap; color: var(--muted); }
.set-tabs button.on { border-color: var(--line); background: var(--panel2); color: var(--text); font-weight: 600; box-shadow: inset 0 3px 0 var(--accent); }
.set-body { min-height: 300px; }
.set-body .card { margin: 8px 0; } .set-body h3 { margin: 0 0 6px; font-family: var(--font-heading); }
.set-body .row.snd { align-items: center; gap: 12px; } .set-body .row.snd .toggle { min-width: 170px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; }
.gold-sec { border-left: 4px solid var(--accent); } .gold-amt { font-size: 1.6em; font-family: var(--font-heading); } .gold-amt span { font-size: .6em; color: var(--muted); }
.cost-sec { border-left: 4px solid var(--good); }
.theme-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.theme-swatches .swatch { display: flex; align-items: center; gap: 6px; border: 2px solid; border-radius: 6px; padding: 8px; text-align: left; font-size: .9em; }
.theme-swatches .swatch i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.user-themes { list-style: none; padding: 0; } .user-themes li { padding: 3px 0; }
.home-top #homeSettings { white-space: nowrap; }
@media (max-width: 900px) { .set-tabs button { padding: 5px 8px; font-size: .9em; } .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- tutorial coach mark: always NEXT TO its target (placed by tutorial.js placeCoach) ---------- */
#coach.coach { width: auto; max-width: 340px; overflow: auto; pointer-events: auto; }
#coach .coach-arrow { position: absolute; width: 14px; height: 14px; background: var(--panel); border: 2px solid var(--accent); transform: rotate(45deg); pointer-events: none; }
#coach[data-place="below"] .coach-arrow { top: -9px; margin-left: -7px; border-right: 0; border-bottom: 0; }
#coach[data-place="above"] .coach-arrow { bottom: -9px; margin-left: -7px; border-left: 0; border-top: 0; }
#coach[data-place="right"] .coach-arrow { left: -9px; margin-top: -7px; border-right: 0; border-top: 0; }
#coach[data-place="left"] .coach-arrow { right: -9px; margin-top: -7px; border-left: 0; border-bottom: 0; }
#coach[data-place="corner"] .coach-arrow, #coach[data-place="none"] .coach-arrow { display: none; }
.coach-target { position: relative; z-index: 64; }

/* ---------- main menu (title screen) ---------- */
#home { background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--bg); }
.mm-wrap { max-width: 1100px; margin: 0 auto; padding: clamp(14px, 4vh, 48px) 18px 18px; min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
.mm-head { text-align: center; margin-bottom: clamp(10px, 3vh, 30px); position: relative; width: 100%; }
.mm-head .brand { font-family: var(--font-heading); font-size: clamp(1.7em, 4.2vh, 2.6em); letter-spacing: .06em; display: inline-flex; gap: .4em; align-items: center; text-shadow: 0 2px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.mm-crest { color: var(--accent); }
.mm-sub { font-size: .9em; letter-spacing: .12em; text-transform: uppercase; }
.mm-badges { position: absolute; right: 0; top: 0; display: flex; gap: 6px; align-items: center; }
.main-menu { display: flex; flex-direction: column; gap: clamp(4px, 1vh, 8px); width: min(460px, 100%); }
.mm-item { display: flex; align-items: center; gap: 14px; text-align: left; padding: clamp(7px, 1.4vh, 12px) 18px; border: var(--bw) solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--panel) 88%, transparent); color: var(--text); font-size: 1.05em; transition: transform .12s, border-color .12s, background .12s; }
.mm-item .mm-icon { width: 1.6em; text-align: center; font-size: 1.15em; color: var(--accent); }
.mm-item .mm-text { display: flex; flex-direction: column; min-width: 0; } .mm-item b { font-family: var(--font-heading); letter-spacing: .03em; }
.mm-item small { color: var(--muted); font-size: .78em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-item:hover, .mm-item:focus-visible { border-color: var(--accent); background: var(--panel2); transform: translateX(6px); outline: none; box-shadow: inset 4px 0 0 var(--accent); }
.mm-item[data-mm="quit"] { margin-top: 6px; opacity: .85; }
.home-screen { width: 100%; } .screen-top { display: flex; align-items: center; gap: 12px; border-bottom: var(--bw) solid var(--line); padding-bottom: 8px; margin-bottom: 10px; } .screen-top h2 { margin: 0; font-family: var(--font-heading); }
.gal-group { margin: 14px 0 22px; } .gal-group h3 { font-family: var(--font-heading); border-bottom: var(--bw) solid var(--line); padding-bottom: 4px; margin: 0 0 8px; }
.quit-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
@media (max-height: 560px) { .mm-sub { display: none; } .mm-item small { display: none; } }

/* ---------- Create your adventure (one screen: sidebar + scrollable sections + sticky Start) ---------- */
#setup { display: grid; grid-template-columns: clamp(170px, 17vw, 240px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top top" "nav body"; height: 100vh; }
#setup.hidden { display: none; }
.setup-top { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: var(--bw) solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; min-width: 0; }
.setup-top h1 { margin: 0; font-family: var(--font-heading); font-size: 1.25em; white-space: nowrap; }
#setupHint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#setupStart { white-space: nowrap; flex: none; } #setupStart:disabled { opacity: .55; cursor: not-allowed; }
.setup-nav { grid-area: nav; border-right: var(--bw) solid var(--line); padding: 12px 8px; overflow: auto; background: color-mix(in srgb, var(--panel) 60%, transparent); }
.setup-nav ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.setup-nav a { display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; border: var(--bw) solid transparent; }
.setup-nav a.on { border-color: var(--accent); background: var(--panel2); }
.setup-nav .num, .setup-sec h2 .num { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; border: 1px solid var(--line); font-size: .85em; flex: none; }
.setup-nav a.done .num { background: var(--good); color: var(--bg); border-color: var(--good); }
.setup-tip { margin-top: 14px; padding: 0 6px; }
.setup-body { grid-area: body; overflow: auto; padding: 14px clamp(10px, 2vw, 28px) 40vh; scroll-behavior: smooth; }
.setup-sec { margin: 0 0 16px; padding: 14px 16px; scroll-margin-top: 10px; }
.setup-sec h2 { margin: 0 0 8px; font-family: var(--font-heading); font-size: 1.2em; display: flex; align-items: center; gap: 8px; } .ok-mark { color: var(--good); }
.uni-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.uni-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel2); cursor: pointer; min-height: 150px; }
.uni-card:hover, .uni-card:focus-visible { border-color: var(--accent); outline: none; }
.uni-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim), var(--shadow); }
.uni-card .small { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.uni-preview { height: 44px; border-radius: 6px; background: var(--u-bg); border: 1px solid var(--u-accent); display: flex; gap: 4px; align-items: flex-end; padding: 5px; position: relative; overflow: hidden; }
.uni-preview i { display: block; width: 22%; height: 60%; background: var(--u-panel); border-radius: 3px; border-top: 3px solid var(--u-accent); }
.uni-preview span { position: absolute; right: 6px; top: 4px; font-size: .68em; color: var(--u-text); opacity: .85; }
.uni-card.create { border-style: dashed; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel2)); align-items: center; justify-content: center; text-align: center; }
.uni-plus { font-size: 2em; }
.uni-actions { display: flex; gap: 8px; margin-top: auto; } .sel-mark { position: absolute; top: 6px; left: 8px; font-size: .75em; background: var(--accent); color: var(--bg); border-radius: 99px; padding: 0 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 0; border: var(--bw) solid var(--line); border-radius: var(--radius); overflow: hidden; width: fit-content; max-width: 100%; }
.seg button { border: 0; border-right: var(--bw) solid var(--line); border-radius: 0; padding: 8px 16px; background: var(--panel2); }
.seg button:last-child { border-right: 0; } .seg button.on { background: var(--accent); color: var(--bg); }
.diff-desc { margin: 6px 0 10px; min-height: 1.4em; }
.diff-cat { border: var(--bw) solid var(--line); border-radius: var(--radius); margin: 6px 0; padding: 4px 10px; } .diff-cat legend { font-weight: 600; padding: 0 4px; }
.pc-done { display: flex; gap: 14px; align-items: flex-start; } .pc-done .portrait { width: 110px; flex: none; }
#opText { width: 100%; font-family: var(--font-body); font-size: 1.02em; line-height: 1.55; }
.op-meta { margin: 6px 0; }
.big-choice { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px; cursor: pointer; }
.creation.in-setup { border: 0; padding: 0; background: none; box-shadow: none; }
@media (max-width: 900px) {
  #setup { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top" "nav" "body"; }
  .setup-nav { border-right: 0; border-bottom: var(--bw) solid var(--line); padding: 4px 8px; } .setup-nav ol { flex-direction: row; overflow-x: auto; } .setup-nav a { white-space: nowrap; padding: 4px 8px; } .setup-tip { display: none; }
  .setup-top h1 { font-size: 1.05em; } #setupHint { display: none; }
}

/* ---------- practice-mode banner + Say/Do toggle ---------- */
.practice-banner { display: block; width: 100%; margin: 0 0 6px; padding: 7px 12px; text-align: left; border: 2px dashed var(--warn, #e0a030); border-radius: var(--radius); background: color-mix(in srgb, var(--warn, #e0a030) 18%, var(--panel)); color: var(--text); font-size: .92em; cursor: pointer; }
.practice-banner:hover { background: color-mix(in srgb, var(--warn, #e0a030) 30%, var(--panel)); }
.practice-banner.hidden { display: none; }




.msg.player .say-to { font-size: .75em; color: var(--muted); }
.msg.player q { font-style: italic; } .msg.player q::before { content: '“'; } .msg.player q::after { content: '”'; }

/* ---------- streaming narration + thinking tag ---------- */
.msg.dm.streaming .caret { display: inline-block; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .msg.dm.streaming .caret { animation: none; } }
.msg.dm.interrupted { border: 1px dashed var(--danger); opacity: .95; }
.think-tag { font-size: .7em; margin-left: .6em; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 .5em; cursor: help; }

/* ---------- dice overlay (above EVERYTHING) + roll result cards ----------
   Root cause of "I can't see my roll": the dice canvas had no CSS at all, so it was a static block appended
   after the full-height app — i.e. drawn below the bottom of the window. Now it is a fixed overlay. */
.dice-overlay { position: fixed; inset: 0; z-index: 100000; cursor: pointer; background: radial-gradient(ellipse at 50% 42%, rgba(0,0,0,.18), rgba(0,0,0,.55)); animation: diceFade .2s ease-out both; }
.dice-overlay canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dice-overlay.closing { background: transparent; transition: background .35s; }
@keyframes diceFade { from { opacity: 0; } to { opacity: 1; } }
.dice-result { position: absolute; left: 50%; top: 64%; transform: translate(-50%, 0) scale(.6); opacity: 0; text-align: center; min-width: 240px; padding: 12px 28px 10px; border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 3px solid var(--accent); box-shadow: 0 10px 40px rgba(0,0,0,.55); color: var(--text); transition: transform .35s cubic-bezier(.2,.9,.3,1.3), opacity .25s; pointer-events: none; }
.dice-result.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.dice-overlay.closing .dice-result { transition: transform .4s ease-in, opacity .4s ease-in; opacity: 0; }
.dice-overlay.instant .dice-result, .dice-overlay.reduced .dice-result { top: 50%; transform: translate(-50%, -50%); transition: opacity .2s; }
.dice-result .dr-total { font-family: var(--font-heading); font-size: 64px; font-weight: 800; line-height: 1.05; }
.dice-result .dr-sub { font-size: 17px; color: var(--muted); }
.dice-result .dr-oc { font-family: var(--font-heading); font-size: 22px; font-weight: 700; margin-top: 2px; }
.dice-result .dr-skip { font-size: 12px; color: var(--muted); opacity: .7; margin-top: 4px; }
.dice-result.oc-crit { border-color: #f2c230; box-shadow: 0 0 0 4px rgba(242,194,48,.35), 0 0 50px rgba(242,194,48,.55); } .dice-result.oc-crit .dr-total, .dice-result.oc-crit .dr-oc { color: #f2c230; text-shadow: 0 0 18px rgba(242,194,48,.6); }
.dice-result.oc-fumble { border-color: #e5483c; box-shadow: 0 0 0 4px rgba(229,72,60,.35), 0 0 50px rgba(229,72,60,.5); } .dice-result.oc-fumble .dr-total, .dice-result.oc-fumble .dr-oc { color: #ff6a5c; }
.dice-result.oc-success .dr-oc { color: var(--good); } .dice-result.oc-fail .dr-oc { color: var(--danger); } .dice-result.oc-partial .dr-oc { color: var(--accent); }
.msg.roll.roll-card { align-self: center; font-family: var(--font-body); font-size: 1em; border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--line)); border-style: solid; background: var(--panel); padding: 10px 16px; min-width: min(520px, 100%); max-width: min(75ch, 100%); }
.roll-card .rc-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.roll-card .rc-body { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.rc-die { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 2.3em; height: 2.3em; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); font-weight: 800; font-size: 1.15em; line-height: 1; }
.rc-die small { font-size: .5em; font-weight: 500; color: var(--muted); } .rc-die.dropped { opacity: .45; text-decoration: line-through; } .rc-die.nat20 { border-color: #f2c230; color: #c99a10; } .rc-die.nat1 { border-color: #e5483c; color: #d23b2f; }
.rc-mod { font-weight: 700; font-size: 1.1em; } .rc-eq { color: var(--muted); } .rc-total { font-family: var(--font-heading); font-size: 1.6em; font-weight: 800; color: var(--accent); }
.rc-dc { color: var(--muted); } .rc-oc { font-weight: 700; padding: 2px 10px; border-radius: 99px; border: 2px solid currentColor; }
.rc-oc.oc-crit { color: #c99a10; } .rc-oc.oc-fumble { color: #d23b2f; } .rc-oc.oc-success { color: var(--good); } .rc-oc.oc-fail { color: var(--danger); } .rc-oc.oc-partial { color: var(--accent); }
.msg.roll.just-rolled { animation: rollPop .9s ease-out; } @keyframes rollPop { 0% { box-shadow: 0 0 0 6px var(--accent); transform: scale(1.03); } 100% { box-shadow: none; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg.roll.just-rolled { animation: none; box-shadow: 0 0 0 3px var(--accent); } }
/* background jobs chip + portrait shimmer while painting */
.bg-jobs { display: inline-flex; align-items: center; gap: 6px; font-size: .82em; color: var(--muted); white-space: nowrap; padding: 3px 10px; border-radius: 99px; border: 1px dashed var(--line); max-width: 260px; overflow: hidden; }
.bg-jobs.hidden { display: none; } .bg-jobs .bj-text { overflow: hidden; text-overflow: ellipsis; }
.bg-jobs .spin { display: inline-block; animation: bjSpin 2s linear infinite; } @keyframes bjSpin { to { transform: rotate(360deg); } }
.portrait.pending { opacity: 1; filter: none; background: linear-gradient(100deg, var(--panel2) 30%, color-mix(in srgb, var(--accent) 25%, var(--panel2)) 50%, var(--panel2) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (max-width: 1280px) { .bg-jobs .bj-text { display: none; } }
@media (prefers-reduced-motion: reduce) { .bg-jobs .spin, .portrait.pending { animation: none; } }

/* Storyteller model picker (Settings → Cost options) */
.model-list { display: flex; flex-direction: column; gap: 6px; }
.model-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: var(--bw) solid var(--line); border-radius: var(--radius); background: var(--panel2); cursor: pointer; }
.model-opt.on { border-color: var(--accent); }
.model-opt input { margin-top: 4px; }
.model-opt .right { white-space: nowrap; text-align: right; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
