:root {
  --bg: #0f1114; --panel: #171a1f; --panel2: #1f232a; --line: #2a2f37; --text: #eef0f3; --muted: #9aa3ae;
  --gold: #d6a446; --gold2: #f0c068; --red: #e5484d; --green: #3fb27f; --blue: #4c8dff;
  --radius: 12px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
a { color: var(--gold2); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: #ff8a8d; min-height: 1.2em; }
.ok { color: var(--green); }

button, .btn {
  font: inherit; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 8px; white-space: nowrap;
}
button:hover:not(:disabled), .btn:hover { border-color: #3b424d; background: #262b33; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1408; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--gold2); }
button.danger { color: #ff9a9c; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--panel2); }
button.big { padding: 13px 26px; font-size: 17px; }
input, select, textarea {
  font: inherit; color: var(--text); background: #0c0e11; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #6b5426; border-color: var(--gold); }
label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 5px; color: var(--text); }
.row { display: flex; gap: 12px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 140px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.brand { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-size: 13px; }
.brand span { color: var(--text); }

/* ---------- app shell ---------- */
.top { display: flex; align-items: center; gap: 24px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: #0c0e11; position: sticky; top: 0; z-index: 5; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 7px 14px; border-radius: 8px; }
.top nav a.on, .top nav a:hover { color: var(--text); background: var(--panel2); }
.top .who { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.page { max-width: 1100px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }

.ep { margin-bottom: 16px; }
.ep-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.ep-title { font-size: 18px; font-weight: 650; }
.ep-when { color: var(--muted); margin-top: 3px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { background: var(--panel2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 99px; font-size: 13px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }
.live { color: var(--red); font-weight: 700; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.recs { margin-top: 16px; border-top: 1px solid var(--line); }
.rec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.rec:last-child { border-bottom: 0; padding-bottom: 0; }
.rec-line { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.bar-out { height: 8px; background: #0c0e11; border-radius: 99px; overflow: hidden; margin: 10px 0 4px; border: 1px solid var(--line); }
.bar-in { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); width: 0; transition: width .4s; }
.export-opts { background: var(--panel2); border-radius: 10px; padding: 14px; margin-top: 10px; }
.export-opts .opt { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; margin-bottom: 8px; }
.export-opts .opt input { width: auto; margin: 0; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 8px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 50; }
.modal { width: 100%; max-width: 640px; }
.guest-row { background: var(--panel2); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.guest-row .their { color: var(--gold2); font-size: 13px; margin-top: -4px; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-head h2 { margin: 0 10px 0 0; min-width: 190px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal .dow { background: #0c0e11; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding: 8px; border-bottom: 1px solid var(--line); }
.cal .day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: #121418; color: #5d6570; }
.cal .day.today .num { background: var(--gold); color: #1a1408; border-radius: 99px; padding: 0 7px; font-weight: 700; }
.cal .num { font-size: 13px; display: inline-block; margin-bottom: 4px; }
.cal .evt { background: #2a2216; border-left: 3px solid var(--gold); padding: 3px 6px; border-radius: 5px; font-size: 12px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .evt:hover { background: #3a2e1a; }
.upcoming .item { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.upcoming .date { min-width: 70px; text-align: center; background: var(--panel2); border-radius: 10px; padding: 8px; }
.upcoming .date b { display: block; font-size: 22px; }
.tzline { font-size: 13px; color: var(--muted); }
.tzline b { color: var(--text); font-weight: 600; }

/* login */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: 100%; max-width: 380px; }

/* ---------- studio ---------- */
.prejoin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.prejoin .card { width: 100%; max-width: 760px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; }
@media (max-width: 760px) { .prejoin .card { grid-template-columns: 1fr; } }
.preview-wrap { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 16/9; }
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.meter { height: 6px; background: #0c0e11; border-radius: 99px; overflow: hidden; margin: 10px 0 14px; }
.meter div { height: 100%; width: 0; background: var(--green); transition: width .08s; }
.bgpick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bgpick button { flex-direction: column; gap: 4px; padding: 6px; font-size: 12px; width: 76px; }
.bgpick .sw { width: 62px; height: 36px; border-radius: 6px; background-size: cover; background-position: center; display: block; }
.bgpick button.on { border-color: var(--gold); background: #2a2216; }
.tip { background: var(--panel2); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.sched-note { color: var(--gold2); margin: 0 0 10px; }

.studio { height: 100vh; display: flex; flex-direction: column; }
.studio header { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.studio header .title { font-weight: 650; }
.recpill { display: none; align-items: center; gap: 8px; background: #3a1416; color: #ffb3b5; padding: 5px 12px; border-radius: 99px; font-weight: 700; font-variant-numeric: tabular-nums; }
.recpill.on { display: inline-flex; }
.recpill i { width: 10px; height: 10px; background: var(--red); border-radius: 50%; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.studio header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { flex: 1; display: grid; gap: 12px; padding: 14px; min-height: 0; align-content: center; }
.grid.n1 { grid-template-columns: minmax(0, 1100px); justify-content: center; }
.grid.n2 { grid-template-columns: 1fr 1fr; }
.grid.n3, .grid.n4 { grid-template-columns: 1fr 1fr; }
.grid.n5, .grid.n6 { grid-template-columns: 1fr 1fr 1fr; }
.tile { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; border: 3px solid transparent; transition: border-color .15s; max-height: 100%; }
.tile.speaking { border-color: var(--gold); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.me video { transform: scaleX(-1); }
.tile .name { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 7px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.tile .off { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 42px; font-weight: 700; color: var(--muted); background: #15181d; }
.tile.camoff .off { display: flex; }
.tile .up { position: absolute; right: 10px; top: 10px; background: rgba(0,0,0,.6); padding: 3px 9px; border-radius: 7px; font-size: 12px; }
.bar { display: flex; justify-content: center; gap: 10px; padding: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.bar button { min-width: 110px; justify-content: center; }
.bar button.offstate { background: #3a1416; border-color: #5a2023; color: #ffb3b5; }
.recbtn { background: var(--red) !important; border-color: var(--red) !important; color: #fff !important; font-weight: 700; min-width: 170px !important; }
.recbtn.stop { background: #fff !important; color: #111 !important; border-color: #fff !important; }
.countdown { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 160px; font-weight: 800; color: #fff; background: rgba(0,0,0,.45); z-index: 40; pointer-events: none; }
.panel { position: fixed; right: 20px; bottom: 90px; width: 380px; max-width: calc(100vw - 40px); z-index: 30; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.panel .who-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.menu { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); z-index: 35; width: 440px; max-width: calc(100vw - 30px); }
.banner { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); background: #3a2e1a; border: 1px solid #6b5426; padding: 8px 16px; border-radius: 10px; z-index: 45; }
.fatal { max-width: 460px; margin: 18vh auto; text-align: center; }
