/* Colors, fonts and corner radius all come from the active theme pack (themes/*.json),
   injected as :root variables by App.razor. The values here are only the fallback look. */
:root {
    --bg: #101216; --panel: #181b21; --panel-2: #20242c; --border: #2e3440;
    --text: #dfe3ea; --muted: #8a93a3; --accent: #4f8cff; --accent-text: #fff;
    --font-body: system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-head: system-ui, -apple-system, 'Segoe UI', sans-serif;
    --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--font-head); margin: 0 0 .5rem; letter-spacing: .02em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }

/* ── Shell ─────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 1.25rem; padding: 0 1rem; height: 48px; background: var(--panel); border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: .15rem; flex: 1; }
.nav a { padding: .35rem .7rem; color: var(--muted); border-radius: var(--radius); white-space: nowrap; }
.nav a:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
.nav a.active { color: var(--accent-text); background: var(--accent); }
.whoami { display: flex; align-items: center; gap: .6rem; white-space: nowrap; font-size: .9rem; }
.main { flex: 1; min-height: 0; overflow: auto; }
.page { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* ── Controls ──────────────────────────────────────── */
button, .btn { font: inherit; cursor: pointer; padding: .4rem .8rem; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: var(--radius); display: inline-block; }
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.link { border: none; background: none; color: var(--accent); padding: 0; }
button.tiny { padding: .1rem .45rem; font-size: .8rem; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: .4rem .55rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=color] { padding: 2px; height: 34px; width: 56px; }
input[type=checkbox] { width: auto; }
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .2rem; text-transform: uppercase; letter-spacing: .06em; }
.field { margin-bottom: .8rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 140px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.error { color: #ff7b72; margin-bottom: .75rem; } .ok { color: #6fcf7c; }
.badge { font-size: .7rem; padding: .05rem .4rem; border: 1px solid var(--accent); color: var(--accent); border-radius: 99px; text-transform: uppercase; letter-spacing: .08em; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ── Login ─────────────────────────────────────────── */
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.center .card { width: 100%; max-width: 360px; }

/* ── Two-pane screens (play, channels, maps) ───────── */
.split { display: grid; grid-template-columns: 290px 1fr; height: 100%; min-height: 0; }
.side { background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto; padding: 1rem; }
.side section { margin-bottom: 1.4rem; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li { padding: .15rem 0; }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane-head { padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: var(--panel); flex: none; }
.exit-btn { display: block; width: 100%; text-align: left; margin-bottom: .3rem; }
.exit-btn small { color: var(--muted); float: right; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .4rem; }
.chan { display: block; padding: .3rem .6rem; border-radius: var(--radius); color: var(--muted); }
.chan.on { background: var(--panel-2); color: var(--text); }
.rec { color: #ff7b72; }

/* ── Feed ──────────────────────────────────────────── */
.feed { flex: 1; overflow-y: auto; padding: 1rem; min-height: 0; }
.msg { padding: .3rem .7rem; margin-bottom: .35rem; border-left: 3px solid var(--c, var(--border)); }
.msg .meta { font-size: .72rem; color: var(--muted); }
.msg .who { color: var(--c, var(--text)); font-weight: 700; }
.msg.ooc { opacity: .8; font-size: .9rem; }
.msg.system { border-left-color: transparent; color: var(--muted); font-style: italic; font-size: .88rem; text-align: center; }
.msg.roll { background: var(--panel); }
.msg.page { background: var(--panel-2); border-left-style: dashed; }
.msg.local { border-left-color: var(--muted); color: var(--muted); white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.composer { display: flex; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--border); background: var(--panel); flex: none; align-items: flex-end; }
.composer select { width: 96px; flex: none; }
.composer textarea { flex: 1; resize: none; height: 4.2rem; }

/* ── Maps ──────────────────────────────────────────── */
.map-wrap { flex: 1; overflow: auto; padding: 1rem; min-height: 0; }
.map-stage { position: relative; width: 100%; max-width: 1100px; margin: 0 auto; border: 1px solid var(--border); user-select: none; touch-action: none; overflow: hidden; border-radius: var(--radius); }
.map-stage img.backdrop { display: block; width: 100%; pointer-events: none; }
.map-stage.blank { aspect-ratio: 16 / 10; background: var(--panel);
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 40px 40px; }
.pin, .chip, .token { position: absolute; transform: translate(-50%, -50%); }
.pin { padding: .2rem .55rem; background: var(--panel-2); border: 1px solid var(--accent); border-radius: var(--radius); font-size: .8rem; white-space: nowrap; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.pin.here { background: var(--accent); color: var(--accent-text); }
.pin[data-drag] { cursor: move; border-style: dashed; }
.chip, .token { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: #fff; background: var(--c, #666); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.5); text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.chip { margin-top: 30px; margin-left: calc(var(--i, 0) * 24px - var(--n, 0) * 12px); }
.token { border-radius: 6px; }
.chip[data-drag], .token[data-drag] { cursor: grab; }
.dragging { cursor: grabbing !important; z-index: 10; opacity: .85; margin: 0 !important; }

/* ── Sheets ────────────────────────────────────────── */
.sheet-grid { display: grid; gap: .6rem 1.2rem; }
.sheet-val { white-space: pre-wrap; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--text); display: inline-block; }
.dots i.on { background: var(--text); }
.dots.edit i { cursor: pointer; }
.dots.edit i:hover { border-color: var(--accent); }

/* ── Logs ──────────────────────────────────────────── */
.log { font-size: 1.02rem; line-height: 1.7; }
.log .msg { margin-bottom: .8rem; }

@media (max-width: 760px) {
    .split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .side { max-height: 34vh; border-right: none; border-bottom: 1px solid var(--border); }
}
