:root {
  --bg: #000;
  --fg: #fff;
  --muted: #c8c8c8;
  --panel: #161616;
  --line: #fff;
  --red: #ff2d2d;
  --green: #3ddc6b;
  --blue: #4da3ff;
  --testing: #ffd23f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 24px; }
body { display: flex; flex-direction: column; }
.hidden { display: none !important; }

button { font: inherit; color: var(--fg); background: var(--panel); border: 3px solid var(--line); border-radius: 18px; padding: 18px 24px; min-height: 72px; cursor: pointer; }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; }
button.small { min-height: 56px; font-size: 20px; padding: 10px 16px; }

/* Sign in */
#signin { margin: auto; width: min(560px, 92vw); text-align: center; display: flex; flex-direction: column; gap: 22px; }
#signin h1 { font-size: 44px; margin: 0; }
#signin input { font: inherit; font-size: 30px; padding: 20px; border-radius: 14px; border: 3px solid var(--line); background: #000; color: #fff; text-align: center; }
#signin .primary { background: var(--blue); color: #000; font-weight: 700; font-size: 30px; }
#signin .linkish { background: none; border: none; color: var(--muted); font-size: 18px; min-height: 0; text-decoration: underline; }
#signinMsg { color: #ffb3b3; min-height: 1.4em; }

/* App frame */
#app { flex: 1; display: flex; flex-direction: column; min-height: 0; }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 3px solid var(--line); font-size: 20px; }
#spaceName { font-weight: 700; }
#spaceName.testing { color: var(--testing); }
#syncStatus { color: var(--muted); text-align: right; }
main { flex: 1; overflow-y: auto; padding: 16px; }
nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px; border-top: 3px solid var(--line); }
nav button { min-height: clamp(64px, 11vh, 92px); font-size: 28px; font-weight: 700; }
nav button.active { background: var(--fg); color: #000; }

/* Talk */
#view-talk { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
#stateBanner { width: 100%; padding: 12px; border-radius: 20px; font-size: clamp(28px, 6vh, 42px); font-weight: 800; border: 4px solid var(--line); }
#stateBanner.off { background: #222; color: var(--fg); }
#stateBanner.on { background: var(--red); color: #fff; border-color: #fff; }
#stateBanner.paused { background: var(--testing); color: #000; }
#storyLine { font-size: clamp(18px, 3.4vh, 26px); color: var(--muted); }
#storyLine strong { color: var(--fg); }
#timer { font-size: clamp(34px, 7vh, 56px); line-height: 1; font-variant-numeric: tabular-nums; font-weight: 700; }
#recBtn { width: clamp(140px, 32vh, 340px); height: clamp(140px, 32vh, 340px); min-height: 0; padding: 0; border-radius: 50%; font-size: clamp(28px, 5vh, 40px); font-weight: 800; background: var(--green); color: #000; border-color: #fff; }
#talkMsg { min-height: 1.2em; }
#recBtn.recording { background: var(--red); color: #fff; }
.row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; width: 100%; }
.row button { flex: 1 1 220px; font-size: 28px; font-weight: 700; }

/* Lists */
h2 { font-size: 34px; margin: 4px 0 14px; }
.card { background: var(--panel); border: 3px solid #555; border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.card .title { font-size: 28px; font-weight: 700; }
.card .meta { color: var(--muted); font-size: 20px; margin: 4px 0 10px; }
.card .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card audio { width: 100%; margin-top: 12px; height: 56px; }
.empty { color: var(--muted); font-size: 26px; padding: 30px 0; text-align: center; }
.filter { background: #222; border: 2px solid var(--blue); border-radius: 14px; padding: 12px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 22px; }
.note { color: var(--muted); font-size: 20px; margin: 10px 0; }
.footer { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Overlay */
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; font-size: 38px; font-weight: 700; z-index: 10; }
