:root {
  --bg: #1b1410; --panel: #2a201a; --line: #4a3a2e; --text: #f6ebe0; --muted: #b9a594;
  --accent: #f2a7c3; --accent-ink: #3a1022; --ok: #7bd389; --warn: #f4c06a; --err: #ff7a7a;
  --bar-h: 36px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button, select, .primary { font: inherit; }

#bar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5; }
#bar[hidden] { display: none; }
#bar .brand { font-weight: 600; white-space: nowrap; }
#bar .spacer { flex: 1; }
#bar .who { color: var(--muted); max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bar button { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 10px; cursor: pointer; }
#bar button:hover { border-color: var(--accent); }
.sync { font-size: 12px; color: var(--muted); cursor: default; }
.sync.ok { color: var(--ok); } .sync.saving { color: var(--warn); } .sync.error { color: var(--err); }

#stage { position: fixed; inset: 0; }
#bar:not([hidden]) ~ #stage { top: var(--bar-h); }
#unity-canvas { width: 100%; height: 100%; display: block; background: #000; }
#loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#loading[hidden] { display: none; }
#loading .bar { width: min(320px, 70vw); height: 10px; border-radius: 5px; background: var(--panel); overflow: hidden; }
#progress { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 6, 4, .78); z-index: 10; }
.overlay[hidden] { display: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: min(420px, 100%);
  max-height: 100%; overflow: auto; text-align: center; }
.card.wide { width: min(560px, 100%); text-align: left; }
.card h1 { margin: 0 0 12px; font-size: 24px; }
.card h2 { margin: 0; font-size: 20px; }
.warn { color: var(--warn); font-weight: 600; }
.primary { display: inline-block; margin-top: 8px; padding: 10px 18px; border-radius: 8px; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.primary:hover { filter: brightness(1.08); }
.error { color: var(--err); }
.muted { color: var(--muted); }

.lb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lb-head button { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.lb-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.lb-controls select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { background: var(--bg); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.tabs button.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th:first-child, td:first-child { width: 3em; color: var(--muted); }
th:last-child, td:last-child { text-align: right; }
tr.me td { color: var(--accent); font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: min(560px, calc(100% - 32px));
  background: var(--panel); border: 1px solid var(--warn); border-radius: 8px; padding: 10px 14px; z-index: 20; }
#toast[hidden] { display: none; }

@media (max-width: 560px) {
  #bar .brand { display: none; }
}
