* { box-sizing: border-box; }
:root {
  --bg: #0b0a0d;
  --panel: #151219;
  --panel2: #1c1821;
  --border: #352d3d;
  --text: #f1edf3;
  --muted: #a49baa;
  --accent: #b889ff;
  --accent2: #8050c9;
  --danger: #b84b5e;
}
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font-family: Inter, system-ui, Segoe UI, sans-serif;
  background: radial-gradient(circle at top, #21162b 0, var(--bg) 42%);
}
button, input { font: inherit; }
button {
  border: 1px solid var(--border); background: #211c26; color: var(--text);
  border-radius: 8px; padding: 10px 13px; cursor: pointer;
}
button:hover { background: #2b2432; border-color: #554861; }
button.primary { background: var(--accent2); border-color: var(--accent); }
button.primary:hover { background: #9562e0; }
button.danger { background: #702b3b; border-color: #a94357; }
input {
  width: 100%; padding: 11px 12px; color: var(--text);
  background: #0e0c11; border: 1px solid var(--border); border-radius: 8px; outline: none;
}
input:focus { border-color: var(--accent); }
label { display:block; margin: 14px 0 7px; font-size: 13px; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card {
  background: rgba(21,18,25,.96); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 25px 80px #0008;
}
.landing-card { width: min(460px, 100%); padding: 32px; }
.brand { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.brand.small { font-size: 13px; color: var(--accent); }
h1 { font-size: 32px; margin: 18px 0 8px; }
.actions { margin-top: 20px; }
.actions button { width: 100%; padding: 13px; }
.join-box { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.join-row { display:flex; gap:8px; }
.join-row button { white-space:nowrap; }
.game { min-height:100vh; display:flex; flex-direction:column; }
header {
  height: 64px; display:flex; align-items:center; justify-content:space-between;
  padding: 0 18px; background:#100e13; border-bottom:1px solid var(--border);
}
.header-right { display:flex; align-items:center; gap:8px; font-size:13px; }
.workspace { flex:1; display:grid; grid-template-columns: 1fr 340px; min-height:0; }
.map-panel { display:flex; flex-direction:column; min-width:0; }
.map {
  flex:1; min-height:0; position:relative; display:grid; place-items:center;
  background:#111; overflow:hidden;
  background-position:center; background-repeat:no-repeat; background-size:contain;
}
.map-placeholder { text-align:center; color:#756d79; }
.dice-bar {
  min-height:68px; display:flex; align-items:center; gap:7px; padding:10px;
  background:#120f15; border-top:1px solid var(--border); overflow-x:auto;
}
.dice-bar input { width:115px; margin-left:8px; }
.side { border-left:1px solid var(--border); background:#0f0d12; display:flex; flex-direction:column; min-height:0; }
.panel { padding:14px; border-bottom:1px solid var(--border); }
.panel-title { font-weight:700; margin-bottom:10px; }
.history, .chat { overflow-y:auto; }
.history { max-height:35vh; }
.roll { padding:8px 0; border-bottom:1px solid #27212b; font-size:13px; }
.roll strong { color:var(--accent); }
.roll .total { font-size:18px; font-weight:800; }
.chat-panel { flex:1; min-height:180px; display:flex; flex-direction:column; }
.chat { flex:1; min-height:0; }
.chat-message { margin:7px 0; font-size:13px; }
.chat-message b { color:var(--accent); }
.system { color:#7e7484; font-style:italic; font-size:12px; margin:7px 0; }
#chatForm { display:flex; gap:7px; margin-top:10px; }
#chatForm button { width:45px; }
.full { width:100%; margin-top:8px; }
.modal { position:fixed; inset:0; display:grid; place-items:center; background:#000b; padding:20px; }
.modal .card { width:min(380px,100%); padding:25px; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(55vh,1fr) auto; }
  .side { border-left:0; border-top:1px solid var(--border); max-height:45vh; }
  .header-right #online { display:none; }
}

:root{--accent:#e2bd78;--accent2:#76512c;--border:#483b31;--panel:#1c1917;} .brand{font-family:Georgia,serif;letter-spacing:.12em;color:#e2bd78} .side{overflow:auto;max-height:calc(100vh - 64px)} .map{min-height:55vh} #sceneVideo{position:absolute;width:100%;height:100%;object-fit:contain} select{background:#171310;color:#eee;border:1px solid #594735;padding:8px;width:100%} summary{cursor:pointer;color:#e2bd78;margin:8px 0} input[type=checkbox]{width:auto} input[type=range]{padding:0} #mediaLibrary button{text-align:left;overflow-wrap:anywhere} #mediaStatus{font-size:12px} .workspace{min-height:calc(100vh - 64px)}

#dmPanel{position:fixed;z-index:20;right:18px;top:72px;width:min(620px,94vw);max-height:85vh;overflow:auto;background:#191512;border:1px solid #8b6940;border-radius:12px;box-shadow:0 15px 70px #000b} #closeDM{float:right} .mediaLine{display:flex;gap:5px;align-items:center}.mediaLine .full{flex:1} .dice-bar select{width:auto}.dice-bar input[type=color]{width:40px;padding:3px}.dice-bar label{white-space:nowrap;margin:0} #nowPlaying progress{display:block;width:100%;accent-color:#cba56b} input[type=range]{accent-color:#cba56b} #roster{font-size:12px;margin-bottom:10px} .diceOverlay{position:absolute;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;gap:20px;z-index:5;perspective:700px;flex-wrap:wrap;align-content:center}.dieVisual{width:100px;height:100px;position:relative;transform-style:preserve-3d;animation:tumble 1.2s cubic-bezier(.15,.8,.25,1) both;filter:drop-shadow(0 12px 10px #0009)}.dieVisual svg{width:100%;height:100%}.diceCaption{width:100%;text-align:center;font:bold 24px Georgia;color:#fff;text-shadow:0 2px 6px #000,0 0 10px #000}.diceCaption.crit{color:#ffdb79}@keyframes tumble{0%{transform:translate(-35vw,-20vh) rotateX(600deg) rotateY(500deg) scale(.5)}75%{transform:translate(10px,12px) rotateX(25deg) rotateY(-20deg)}100%{transform:rotateX(0) rotateY(0)}} @media(prefers-reduced-motion:reduce){.dieVisual{animation:none}}.realDice{position:absolute;inset:0;z-index:8;pointer-events:none}.realDice canvas{width:100%;height:100%;display:block}.realDiceLabel{position:absolute;bottom:12%;width:100%;text-align:center;font:bold clamp(18px,3vw,32px) Georgia;color:#ffe9b9;text-shadow:0 2px 5px #000,0 0 12px #000}input[type=range]{appearance:none;height:6px;background:#514333;border-radius:9px;padding:0;border:0}input[type=range]::-webkit-slider-thumb{appearance:none;width:16px;height:16px;border-radius:50%;background:#d5ad70;border:1px solid #f4d8a0}input[type=range]::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background:#d5ad70;border:1px solid #f4d8a0}
.workspace.sideClosed{grid-template-columns:1fr}.workspace.sideClosed .side{display:none}.realDice canvas{width:100%;height:100%;display:block}
