:root {
    --ink: #101313;
    --muted: #69706d;
    --paper: #f5f3ee;
    --card: #fffefa;
    --line: #deddd6;
    --lime: #c9ff56;
    --orange: #ff613a;
    --red: #ef3e3e;
    --shadow: 0 28px 80px rgba(17, 21, 20, .12);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.landing-page {
    background:
        radial-gradient(circle at 12% 14%, rgba(201,255,86,.48), transparent 24rem),
        radial-gradient(circle at 92% 84%, rgba(255,97,58,.22), transparent 26rem),
        var(--paper);
}

.landing-shell { min-height: 100vh; display: grid; place-items: center; padding: 48px 24px; }
.hero-card { width: min(1040px, 100%); }
.brand-mark, .wordmark span {
    width: 44px; height: 44px; display: inline-grid; place-items: center;
    border-radius: 14px; background: var(--ink); color: var(--lime); font-weight: 900;
}
.eyebrow { margin: 28px 0 12px; font-size: 12px; letter-spacing: .18em; font-weight: 800; color: var(--muted); }
.hero-card > h1 { margin: 0; max-width: 760px; font-size: clamp(44px, 7vw, 84px); line-height: .95; letter-spacing: -.055em; }
.lead { max-width: 610px; color: var(--muted); font-size: 18px; line-height: 1.65; }
.route-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 40px; }
.route-card { position: relative; padding: 30px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,254,250,.82); box-shadow: var(--shadow); }
.route-card h2 { margin: 38px 0 6px; font-size: 30px; letter-spacing: -.03em; }
.route-card p { margin: 0 0 24px; color: var(--muted); }
.route-number { position: absolute; top: 28px; right: 28px; color: var(--muted); font-size: 13px; font-weight: 800; }
.host-route { border-top: 5px solid var(--orange); }
.viewer-route { border-top: 5px solid var(--lime); }
label { display: block; margin: 15px 0 7px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; background: white; color: var(--ink); outline: none; }
input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(16,19,19,.08); }
select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 13px 38px 13px 14px; background: white; color: var(--ink); outline: none; }
select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(16,19,19,.08); }

.button { border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 800; cursor: pointer; transition: transform .18s ease, opacity .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button:disabled { opacity: .46; cursor: not-allowed; }
.route-card .button { margin-top: 18px; width: 100%; display: flex; justify-content: space-between; }
.button-primary { background: var(--ink); color: white; }
.button-secondary { background: var(--lime); color: var(--ink); }
.button-danger { background: var(--red); color: white; }
.button-wide { width: 100%; margin-top: 16px; }
.button-glass { color: white; background: rgba(16,19,19,.62); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.28); }

.topbar { height: 74px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(245,243,238,.9); }
.wordmark { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 850; letter-spacing: -.02em; }
.wordmark span { width: 34px; height: 34px; border-radius: 10px; }
.live-pill, .viewer-badge { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 8px 12px; background: #e8e7e1; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.live-pill i, .viewer-badge i { width: 8px; height: 8px; border-radius: 50%; background: #9a9e9b; }
.live-pill.is-live { color: white; background: var(--red); }
.live-pill.is-live i, .viewer-badge i { background: currentColor; box-shadow: 0 0 0 4px rgba(255,255,255,.16); }

.studio-layout { min-height: calc(100vh - 74px); display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 22px; padding: 22px; }
.stage-card, .studio-panel { background: var(--card); border: 1px solid var(--line); border-radius: 22px; }
.stage-card { display: flex; flex-direction: column; min-height: 620px; overflow: hidden; }
.video-surface { position: relative; flex: 1; min-height: 420px; overflow: hidden; background: #171b1a; }
.video-surface > div:not(.empty-state) { width: 100% !important; height: 100% !important; }
.video-surface video { object-fit: cover !important; }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; color: white; padding: 24px; z-index: 2; background: radial-gradient(circle at center, #303735 0, #171b1a 65%); }
.empty-state[hidden] { display: none; }
.empty-state h1 { margin: 16px 0 5px; font-size: 28px; }
.empty-state p { margin: 0; color: #aeb5b2; }
.camera-icon { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid #5b6461; border-radius: 18px; color: var(--lime); }
.stage-controls { min-height: 82px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; }
.icon-button { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 12px 15px; font-weight: 750; cursor: pointer; }
.icon-button[aria-pressed="true"] { color: white; background: var(--ink); border-color: var(--ink); }
.studio-panel { padding: 28px; }
.studio-panel .eyebrow { margin-top: 0; }
.studio-panel h1 { margin: 0; font-size: 42px; letter-spacing: -.05em; }
.panel-copy { color: var(--muted); line-height: 1.55; }
.permission-card { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #f5f4ef; }
.permission-card.is-ready { border-color: #a7d9b8; background: #f1faf4; }
.permission-card.is-error { border-color: #efb7b0; background: #fff4f2; }
.permission-heading { display: flex; align-items: flex-start; gap: 11px; }
.permission-heading strong { display: block; font-size: 14px; }
.permission-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.permission-icon { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: var(--lime); font-size: 9px; }
.permission-card.is-ready .permission-icon { color: white; background: #238557; }
.permission-card.is-error .permission-icon { color: white; background: var(--red); }
.permission-help { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(239,62,62,.2); font-size: 12px; line-height: 1.5; }
.permission-help[hidden] { display: none; }
.permission-help p { margin: 6px 0 0; color: #7f3730; }
.permission-help .permission-note { color: var(--muted); }
.camera-picker { margin-top: 16px; }
.camera-picker[hidden] { display: none; }
.camera-select-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.camera-switch-button { padding-inline: 14px; background: #e6e5df; color: var(--ink); }
.recording-card { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.recording-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.recording-heading strong { display: block; font-size: 14px; }
.recording-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.recording-dot { width: 11px; height: 11px; border-radius: 50%; background: #a6aaa7; }
.recording-dot[data-state="recording"] { background: var(--red); box-shadow: 0 0 0 5px rgba(239,62,62,.12); animation: recording-pulse 1.4s infinite; }
.recording-dot[data-state="starting"], .recording-dot[data-state="stopping"] { background: #e49a23; }
.recording-dot[data-state="stopped"] { background: #238557; }
.recording-dot[data-state="failed"] { background: var(--red); }
@keyframes recording-pulse { 50% { box-shadow: 0 0 0 9px rgba(239,62,62,0); } }
.recording-consent { margin: 11px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.45; }
.recording-retry-button { width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px solid #e5aaa3; border-radius: 10px; background: #fff4f2; color: #a92828; font-weight: 800; cursor: pointer; }
.recording-retry-button:hover:not(:disabled) { background: #ffe7e3; }
.recording-retry-button:disabled { opacity: .55; cursor: wait; }
.recording-retry-button[hidden] { display: none; }
.recording-files { margin-top: 16px; padding: 14px; border: 1px solid #b8d7c7; border-radius: 15px; background: #f4fbf7; }
.recording-files[hidden] { display: none; }
.recording-files-heading { display: flex; gap: 10px; align-items: flex-start; }
.recording-files-heading > span { color: #238557; font-size: 12px; line-height: 1.5; }
.recording-files-heading strong { display: block; font-size: 14px; }
.recording-files-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.recording-file-links { display: grid; gap: 8px; margin-top: 11px; }
.recording-file-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid #cbe3d6; border-radius: 10px; background: white; color: var(--ink); font-size: 12px; font-weight: 800; text-decoration: none; }
.recording-file-link:hover { border-color: #238557; }
.toggle { position: relative; display: block; width: 42px; height: 24px; margin: 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: #c9cbc8; cursor: pointer; transition: background .18s ease; }
.toggle span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .18s ease; }
.toggle input:checked + span { background: var(--ink); }
.toggle input:checked + span::after { transform: translateX(18px); background: var(--lime); }
.toggle input:disabled + span { opacity: .5; cursor: not-allowed; }
.metric-row { display: flex; align-items: center; justify-content: space-between; margin: 28px 0; padding: 20px 0; border-block: 1px solid var(--line); }
.metric-value { display: block; font-size: 36px; font-weight: 900; line-height: 1; }
.metric-label { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.channel-chip { border-radius: 999px; padding: 8px 11px; background: #ecebe5; font-size: 12px; font-weight: 750; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.copy-button { border: 0; border-radius: 11px; padding: 0 15px; color: var(--ink); background: var(--lime); font-weight: 850; cursor: pointer; }
.status-box { margin-top: 20px; border-radius: 12px; padding: 13px 14px; background: #efeee9; color: var(--muted); font-size: 13px; line-height: 1.45; }
.status-box[data-type="error"], .status-inline[data-type="error"] { color: #b22a2a; }
.status-box[data-type="success"], .status-inline[data-type="success"] { color: #23734c; }

.watch-page { background: #0c0f0e; color: white; }
.transparent-topbar { position: relative; z-index: 5; color: white; background: #0c0f0e; border-color: #252a28; }
.transparent-topbar .wordmark { color: white; }
.viewer-badge { background: #242927; color: white; }
.watch-layout { min-height: calc(100vh - 74px); padding: 22px; }
.watch-stage { position: relative; height: calc(100vh - 150px); min-height: 480px; overflow: hidden; border-radius: 24px; border: 1px solid #2c312f; background: #171b1a; }
.remote-surface { width: 100%; height: 100%; min-height: 100%; }
.pulse-rings { position: relative; width: 74px; height: 74px; }
.pulse-rings i { position: absolute; inset: 0; border: 1px solid var(--lime); border-radius: 50%; animation: pulse 2.4s infinite ease-out; }
.pulse-rings i:nth-child(2) { animation-delay: .8s; }
.pulse-rings i:nth-child(3) { animation-delay: 1.6s; }
@keyframes pulse { 0% { transform: scale(.25); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
.watch-overlay { position: absolute; inset: auto 0 0; z-index: 3; display: flex; align-items: end; justify-content: space-between; padding: 70px 28px 26px; background: linear-gradient(transparent, rgba(0,0,0,.72)); pointer-events: none; }
.watch-overlay > * { pointer-events: auto; }
.watch-overlay h2 { margin: 12px 0 0; font-size: 24px; }
.watch-footer { min-height: 54px; display: flex; align-items: center; justify-content: space-between; color: #aeb5b2; }
.status-inline { font-size: 13px; }
.text-button { border: 0; background: transparent; color: #c4cac7; cursor: pointer; text-decoration: underline; }

@media (max-width: 850px) {
    .route-grid, .studio-layout { grid-template-columns: 1fr; }
    .studio-panel { grid-row: 1; }
    .stage-card { min-height: 520px; }
    .studio-layout { padding: 14px; }
}

@media (max-width: 560px) {
    .landing-shell { padding: 30px 16px; }
    .route-grid { margin-top: 28px; }
    .route-card { padding: 24px; }
    .topbar { height: 64px; padding: 0 16px; }
    .studio-layout { min-height: calc(100vh - 64px); }
    .stage-controls { flex-wrap: wrap; }
    .permission-card { padding: 13px; }
    .camera-switch-button { padding-inline: 12px; }
    .watch-layout { padding: 10px; min-height: calc(100vh - 64px); }
    .watch-stage { height: calc(100vh - 126px); border-radius: 18px; }
    .watch-overlay { padding-inline: 18px; }
    .viewer-badge { font-size: 10px; }
}

