/* RealMark browser participant client. System font stack (a bundled OFL display face is a tracked follow-up). */
:root {
  --bg: #17130f; --bg2: #221b14; --panel: #2b2218ee; --ink: #f4ead6; --muted: #bfae8e; --gold: #f2b84b; --gold2: #ffd98a; --ember: #ff7a3d; --jade: #4fd1a5; --danger: #ff5d5d;
  --line: #5a4630; --r: 12px; --display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; --ui: system-ui, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.35 var(--ui); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
#join { align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 20%, #3c2c1a 0%, #17130f 60%); padding: 16px; }
.card { width: min(420px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 28px 26px; box-shadow: 0 20px 60px #000a, inset 0 1px #fff1; text-align: center; }
.crest { width: 64px; height: 64px; margin: 0 auto 6px; color: var(--gold); }
h1 { margin: 0; font: 700 34px var(--display); letter-spacing: 2px; color: var(--gold2); text-shadow: 0 2px 0 #000a; }
.sub { margin: 2px 0 18px; color: var(--muted); font-family: var(--display); font-style: italic; }
label { display: block; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; background: #120e0a; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; }
input:focus-visible, button:focus-visible, select:focus-visible, canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button { font: inherit; cursor: pointer; color: var(--ink); }
button.primary { width: 100%; margin-top: 16px; padding: 12px; border: 0; border-radius: 10px; background: linear-gradient(#ffd070, #e59b25); color: #2a1a05; font-weight: 800; letter-spacing: 1px; box-shadow: 0 3px 0 #8a5a10; }
button.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a5a10; }
.msg { min-height: 1.3em; color: var(--danger); margin: 10px 0 0; }
.fine { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
#app { background: #0e0b08; }
#topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: linear-gradient(#2d2217, #1f1810); border-bottom: 1px solid var(--line); z-index: 3; }
.brand { display: flex; align-items: center; gap: 8px; font: 700 17px var(--display); color: var(--gold2); min-width: 0; } .brand svg { width: 24px; height: 24px; color: var(--gold); flex: none; } .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; }
.grow { flex: 1; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); } .pill.ok { color: var(--jade); border-color: #2f8f70; } .pill.bad { color: var(--danger); border-color: #8f2f2f; }
button.icon { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #1a140d; display: grid; place-items: center; font-weight: 700; } button.icon svg { width: 22px; height: 22px; }
main { position: relative; flex: 1; min-height: 0; } canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; background: #1e1b18; }
#toolbar { display: flex; gap: 6px; justify-content: center; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); background: linear-gradient(#1f1810, #2d2217); border-top: 1px solid var(--line); overflow-x: auto; z-index: 3; }
.tool { flex: none; min-width: 56px; padding: 6px 8px; border-radius: 12px; border: 1px solid var(--line); background: #1a140d; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); }
.tool svg { width: 26px; height: 26px; } .tool i { font-style: normal; font-size: 10px; letter-spacing: .5px; text-transform: uppercase; }
.tool.active { color: #2a1a05; background: linear-gradient(#ffd070, #e59b25); border-color: #ffd98a; } .sep { width: 1px; background: var(--line); margin: 4px 4px; flex: none; }
.readout { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: #000c; border: 1px solid var(--gold); color: var(--gold2); padding: 6px 14px; border-radius: 99px; font: 700 16px var(--display); z-index: 2; pointer-events: none; }
.paused { position: absolute; inset: 0; background: #0009; backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 4; text-align: center; }
.paused div { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--gold); border-radius: 16px; padding: 22px 30px; } .paused svg { width: 44px; height: 44px; color: var(--gold); } .paused b { font: 700 24px var(--display); color: var(--gold2); } .paused span { color: var(--muted); }
#toasts { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 5; align-items: flex-end; pointer-events: none; }
.toast { background: #000d; border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 8px 12px; border-radius: 8px; max-width: 80vw; animation: in .2s ease; } .toast.err { border-left-color: var(--danger); } .toast.ok { border-left-color: var(--jade); }
@keyframes in { from { opacity: 0; transform: translateY(-6px); } }
.panel { position: absolute; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; backdrop-filter: blur(6px); box-shadow: 0 12px 40px #000a; }
#dice { left: 50%; transform: translateX(-50%); bottom: 84px; width: min(460px, calc(100vw - 16px)); max-height: 70vh; overflow: auto; }
.panel .row { display: flex; align-items: center; gap: 8px; margin: 6px 0; } .row input { flex: 1; min-width: 0; } .row select { width: auto; } .row button.primary { width: auto; margin: 0; padding: 10px 18px; flex: none; }
.diceRow { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; } .die { width: 52px; height: 52px; border: 0; background: none; position: relative; color: var(--gold); } .die svg { width: 100%; height: 100%; } .die b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 12px var(--display); color: var(--ink); } .die:hover, .die:focus-visible { color: var(--gold2); transform: translateY(-2px); }
.stage { min-height: 96px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; padding: 8px; background: radial-gradient(#3a2a18, #1a120a); border-radius: 12px; border: 1px solid var(--line); }
.rolled { width: 62px; height: 62px; position: relative; color: var(--gold); } .rolled svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 2px #0008); } .rolled b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 22px var(--display); color: #fff; text-shadow: 0 1px 2px #000; } .rolled.dropped { opacity: .35; } .rolled.spin { animation: tumble .12s linear infinite; }
@keyframes tumble { to { transform: rotate(90deg) scale(.9); } }
.total { flex-basis: 100%; text-align: center; font: 800 30px var(--display); color: var(--gold2); } .total small { display: block; font: 12px var(--ui); color: var(--muted); }
.log { list-style: none; padding: 0; margin: 8px 0 0; max-height: 130px; overflow: auto; font-size: 13px; } .log li { padding: 4px 6px; border-bottom: 1px dashed #5a463055; } .log b { color: var(--gold2); }
.side { right: 8px; top: 56px; bottom: 84px; width: min(340px, calc(100vw - 16px)); overflow: auto; } .side h2 { margin: 0 0 6px; font: 700 20px var(--display); color: var(--gold2); } .side h3 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.bar { height: 22px; background: #120e0a; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; } .bar > div { height: 100%; background: linear-gradient(#d34, #a11); } .bar span { position: absolute; inset: 0; text-align: center; font-weight: 700; line-height: 22px; text-shadow: 0 1px 2px #000; }
.stepper { display: flex; gap: 6px; margin-top: 6px; } .stepper button { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: #1a140d; font-weight: 700; }
.field { display: flex; align-items: center; gap: 8px; margin: 4px 0; } .field label { flex: 1; margin: 0; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); } .field input { width: 84px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; } .chip { padding: 2px 9px; border-radius: 99px; background: #3a2a18; border: 1px solid var(--line); font-size: 12px; }
#turnStrip { display: flex; gap: 4px; overflow-x: auto; max-width: 46vw; } .turn { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; color: var(--muted); } .turn.cur { background: var(--gold); color: #2a1a05; border-color: var(--gold2); font-weight: 800; }
@media (max-width: 520px) { .brand span { display: none; } .tool { min-width: 48px; } #dice { bottom: 76px; } .side { top: 52px; } }
@media (prefers-reduced-motion: reduce) { .rolled.spin, .toast { animation: none; } }
