:root {
    color-scheme: dark;
    --ink: #eef6ff;
    --muted: #9eb0c3;
    --deep: #06111c;
    --deep-2: #0a1927;
    --surface: rgba(14, 31, 47, 0.92);
    --surface-2: #10263a;
    --line: rgba(164, 195, 224, 0.16);
    --teal: #56d5c9;
    --blue: #7aa7ff;
    --focus: #a8c5ff;
    --danger: #ff8b8b;
    --warning: #ffd179;
    --success: #79e2b8;
    --shadow: 0 32px 90px rgba(0, 0, 0, 0.44);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--deep); }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 16% 12%, rgba(68, 116, 189, 0.2), transparent 34rem),
        radial-gradient(circle at 86% 84%, rgba(42, 187, 170, 0.12), transparent 30rem),
        linear-gradient(145deg, #06111c 0%, #081722 62%, #07131d 100%);
    font-size: 1rem;
    line-height: 1.6;
}

body::before {
    position: fixed;
    inset: 0;
    pointer-events: none;
    content: "";
    opacity: 0.22;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 74%);
}

a { color: inherit; }

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.center-shell,
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.welcome-card,
.auth-card {
    position: relative;
    width: min(100%, 42rem);
    padding: clamp(2rem, 6vw, 4.4rem);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1.75rem;
    background: linear-gradient(145deg, rgba(16, 38, 58, .96), rgba(8, 24, 37, .96));
    box-shadow: var(--shadow);
}

.welcome-card::after,
.auth-card::after {
    position: absolute;
    width: 16rem;
    height: 16rem;
    top: -9rem;
    right: -7rem;
    border: 1px solid rgba(86, 213, 201, .18);
    border-radius: 50%;
    content: "";
    box-shadow: 0 0 0 2rem rgba(86, 213, 201, .025), 0 0 0 4rem rgba(122, 167, 255, .02);
}

.brand-mark {
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
    border: 2px solid var(--teal);
    border-radius: .8rem;
    box-shadow: inset 0 0 0 6px rgba(86, 213, 201, .07);
}

.brand-mark::before {
    position: absolute;
    left: 50%;
    bottom: -.6rem;
    width: 1.5rem;
    height: 2px;
    transform: translateX(-50%);
    background: var(--teal);
    content: "";
}

.brand-mark span {
    position: absolute;
    width: .75rem;
    height: .75rem;
    left: 50%;
    top: 50%;
    border: 2px solid var(--blue);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.brand-mark-small { width: 1.8rem; height: 1.8rem; border-radius: .45rem; border-width: 1px; }
.brand-mark-small::before { bottom: -.3rem; width: .8rem; height: 1px; }
.brand-mark-small span { width: .4rem; height: .4rem; border-width: 1px; }

.eyebrow {
    margin: 2rem 0 .65rem;
    color: var(--teal);
    font-size: .77rem;
    font-weight: 750;
    letter-spacing: .16em;
}

h1 {
    max-width: 13ch;
    margin: 0;
    font-size: clamp(2.35rem, 7vw, 4.4rem);
    line-height: .98;
    letter-spacing: -.045em;
}

.auth-card h1 { font-size: clamp(2.2rem, 6vw, 3.7rem); }

.lede {
    max-width: 38rem;
    margin: 1.4rem 0 0;
    color: var(--muted);
    font-size: 1.08rem;
}

.lede.compact { font-size: 1rem; }

.assurance-row {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 2rem 0;
}

.assurance-row span,
.private-label {
    padding: .4rem .72rem;
    border: 1px solid var(--line);
    border-radius: 99rem;
    color: #bdd0e4;
    background: rgba(7, 20, 31, .7);
    font-size: .78rem;
}

.button {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    padding: .74rem 1.1rem;
    border: 0;
    border-radius: .75rem;
    text-decoration: none;
    font-weight: 730;
    cursor: pointer;
}

.button-primary {
    color: #04131a;
    background: linear-gradient(135deg, var(--teal), #91e4d7);
    box-shadow: 0 12px 30px rgba(33, 180, 163, .18);
}

.button:disabled { opacity: .48; cursor: not-allowed; }

.fine-print { margin: 1rem 0 0; color: #7f93a8; font-size: .82rem; }

.topbar {
    position: absolute;
    z-index: 2;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem clamp(1rem, 4vw, 3rem);
}

.wordmark { display: flex; align-items: center; gap: .85rem; font-weight: 720; text-decoration: none; }

.auth-form { display: grid; gap: .65rem; margin: 2rem 0 0; }
.auth-form label { color: #c9d9e8; font-size: .88rem; font-weight: 680; }
.auth-form input {
    width: 100%;
    min-height: 3.2rem;
    padding: .72rem .9rem;
    border: 1px solid var(--line);
    border-radius: .72rem;
    color: var(--ink);
    background: rgba(3, 15, 25, .74);
}
.auth-form .button { margin-top: .5rem; }

.security-note {
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: .8rem;
    margin-top: 1.4rem;
    padding: 1rem;
    border: 1px solid rgba(86, 213, 201, .16);
    border-radius: .9rem;
    background: rgba(40, 139, 129, .07);
}
.security-note p { margin: 0; color: #adbfce; font-size: .88rem; }
.shield-icon {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: .55rem;
    color: var(--teal);
    background: rgba(86, 213, 201, .1);
    font-weight: 800;
}

[hidden] { display: none !important; }

.app-body { min-height: 100vh; }
.app-topbar {
    position: relative;
    min-height: 5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(5, 17, 28, .72);
    backdrop-filter: blur(18px);
}

.status-chip,
.verified-badge {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: .32rem .7rem;
    border: 1px solid var(--line);
    border-radius: 99rem;
    color: #aabccd;
    background: rgba(3, 15, 24, .72);
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-chip::before,
.verified-badge::before {
    width: .46rem;
    height: .46rem;
    margin-right: .45rem;
    border-radius: 50%;
    background: #708399;
    content: "";
}

.status-chip[data-state="secure"]::before,
.verified-badge::before { background: var(--success); box-shadow: 0 0 0 .25rem rgba(121, 226, 184, .1); }
.status-chip[data-state="warning"]::before { background: var(--warning); }
.status-chip[data-state="live"]::before { background: var(--teal); box-shadow: 0 0 0 .25rem rgba(86, 213, 201, .12); }
.status-chip[data-state="error"]::before { background: var(--danger); }

.button-secondary { color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); }
.button-quiet { color: #b9c9d8; background: transparent; border: 1px solid transparent; }
.button-danger { color: #2b0909; background: linear-gradient(135deg, #ff8b8b, #ffb0a5); }
.button-wide { width: 100%; }
.text-button { padding: .35rem .2rem; border: 0; color: #a9bacb; background: transparent; text-decoration: underline; text-underline-offset: .25rem; cursor: pointer; }

.form-message {
    min-height: 1.45rem;
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: .88rem;
}
.form-message[data-state="error"] { color: var(--danger); }
.form-message[data-state="success"] { color: var(--success); }
.form-message[data-state="warning"] { color: var(--warning); }

.passkey-prompt {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: .9rem;
    align-items: center;
    margin-top: 2rem;
    padding: 1.2rem;
    border: 1px solid rgba(122, 167, 255, .22);
    border-radius: 1rem;
    background: rgba(62, 104, 169, .09);
}
.passkey-prompt .button { grid-column: 1 / -1; }
.passkey-prompt h2 { margin: 0; font-size: 1.05rem; }
.passkey-prompt p { margin: .2rem 0 0; color: var(--muted); font-size: .86rem; }
.passkey-symbol {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--blue);
    border-radius: 50%;
}
.passkey-symbol::before { position: absolute; width: 1.2rem; height: .28rem; right: -1rem; top: 1rem; background: var(--blue); content: ""; }
.passkey-symbol::after { position: absolute; width: .28rem; height: .7rem; right: -.78rem; top: 1rem; background: var(--blue); content: ""; box-shadow: .45rem 0 var(--blue); }

.dashboard-shell {
    width: min(100%, 92rem);
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3.5rem);
}

.dashboard-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}
.dashboard-heading .eyebrow { margin-top: 0; }
.dashboard-heading h1 { max-width: 16ch; font-size: clamp(2.3rem, 5vw, 4.6rem); }
.heading-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(19rem, .82fr);
    gap: 1rem;
    align-items: start;
}

.workspace-card {
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    background: linear-gradient(145deg, rgba(14, 34, 51, .96), rgba(8, 24, 37, .96));
    box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
}
.session-card { min-height: 35rem; padding: clamp(1.25rem, 3vw, 2rem); }
.security-panel { position: sticky; top: 1rem; padding: 1.4rem; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.card-heading h2 { margin: .15rem 0 0; font-size: 1.35rem; letter-spacing: -.02em; }
.card-kicker { margin: 0; color: #7890a8; font-size: .7rem; font-weight: 760; letter-spacing: .14em; }

.empty-session {
    display: grid;
    min-height: 25rem;
    place-items: center;
    align-content: center;
    padding: 2rem;
    text-align: center;
}
.empty-session p { max-width: 34rem; color: var(--muted); }

.invite-block { margin-top: 1.75rem; }
.invite-block label,
.readout-label { display: block; margin-bottom: .45rem; color: #9db0c3; font-size: .78rem; font-weight: 720; }
.readout {
    min-height: 3.4rem;
    padding: .82rem 1rem;
    overflow-wrap: anywhere;
    border: 1px solid rgba(122, 167, 255, .22);
    border-radius: .8rem;
    color: #d9e8f7;
    background: rgba(3, 14, 23, .78);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .87rem;
}
.pin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: .75rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: .8rem;
    background: rgba(8, 27, 42, .72);
}
.pin-row strong { color: var(--teal); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.75rem; letter-spacing: .16em; }
.pin-row p { max-width: 21rem; margin: 0; color: var(--muted); font-size: .86rem; text-align: right; }
.end-invitation { margin-top: .65rem; }

.approval-block,
.share-controls {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-top: 1.25rem;
    padding: 1.1rem;
    border: 1px solid rgba(255, 209, 121, .23);
    border-radius: .9rem;
    background: rgba(166, 115, 25, .08);
}
.approval-block h3,
.share-controls h3 { margin: 0; font-size: 1rem; }
.approval-block p,
.share-controls p { margin: .2rem 0 0; color: var(--muted); font-size: .86rem; }
.viewer-request-icon {
    width: 2.4rem;
    height: 2.4rem;
    border: 2px solid var(--warning);
    border-radius: 50%;
    box-shadow: inset 0 -.8rem 0 rgba(255, 209, 121, .12);
}
.approval-actions { grid-column: 1 / -1; display: flex; gap: .55rem; justify-content: flex-end; }
.share-controls { grid-template-columns: 1fr auto; border-color: rgba(86, 213, 201, .22); background: rgba(34, 143, 131, .07); }

.live-share { margin-top: 1.25rem; }
.preview-frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: 1px solid rgba(86, 213, 201, .24);
    border-radius: .9rem;
    background: #02070c;
}
.preview-frame video { display: block; width: 100%; height: 100%; object-fit: contain; }
.preview-label { position: absolute; left: .65rem; bottom: .65rem; padding: .25rem .5rem; border-radius: .4rem; background: rgba(0, 0, 0, .76); font-size: .72rem; }
.live-share .button { margin-top: .75rem; }

.verification-list { margin: 1.15rem 0 0; }
.verification-list div { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: .72rem 0; border-bottom: 1px solid rgba(164, 195, 224, .1); }
.verification-list dt { color: #91a5b9; font-size: .82rem; }
.verification-list dd { margin: 0; color: #d3e1ee; font-size: .82rem; font-weight: 680; text-align: right; }
.panel-footnote { margin: 1rem 0 0; color: #7f93a7; font-size: .76rem; }

.security-history { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(8, 24, 37, .7); }
.security-history details { flex: 1; }
.security-history summary { color: #b8c9d8; cursor: pointer; font-weight: 680; }
.security-history ol { display: grid; gap: .5rem; margin: 1rem 0 0; padding-left: 1.2rem; }
.security-history li { padding-left: .3rem; color: #9fb0c0; font-size: .82rem; }
.security-history li span { display: inline-block; min-width: 15rem; color: #c9d8e5; }
.security-history time { color: #71869c; }

.viewer-shell { width: min(100%, 95rem); margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); }
.join-card { width: min(100%, 38rem); margin: 4vh auto 0; padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); border-radius: 1.3rem; background: var(--surface); box-shadow: var(--shadow); }
.join-card h1 { max-width: 12ch; font-size: clamp(2rem, 6vw, 3.6rem); }
.pin-form { display: grid; gap: .6rem; margin-top: 1.6rem; }
.pin-form label { color: #c8d7e5; font-size: .85rem; font-weight: 680; }
.pin-form input {
    min-height: 4rem;
    padding: .7rem 1rem;
    border: 1px solid rgba(122, 167, 255, .28);
    border-radius: .8rem;
    color: var(--ink);
    background: rgba(3, 14, 23, .85);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.7rem;
    letter-spacing: .32em;
    text-align: center;
}

.viewer-stage { position: relative; display: grid; min-height: calc(100vh - 10rem); overflow: hidden; border: 1px solid var(--line); border-radius: 1.2rem; background: #02070c; box-shadow: var(--shadow); }
.viewer-stage video { width: 100%; height: 100%; min-height: calc(100vh - 10rem); object-fit: contain; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; padding: 2rem; text-align: center; background: radial-gradient(circle, rgba(18, 47, 70, .9), #02070c 70%); }
.stage-empty h2 { margin: 1.2rem 0 .3rem; font-size: 1.45rem; }
.stage-empty p { max-width: 34rem; margin: 0; color: var(--muted); }
.pulse-ring { width: 3rem; height: 3rem; border: 2px solid var(--teal); border-radius: 50%; box-shadow: 0 0 0 .7rem rgba(86, 213, 201, .08), 0 0 0 1.4rem rgba(86, 213, 201, .035); animation: breathe 2s ease-in-out infinite; }
.viewer-footer { position: absolute; right: .7rem; bottom: .7rem; left: .7rem; display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .7rem; border-radius: .6rem; background: rgba(0, 0, 0, .72); color: #c2d2e0; font-size: .76rem; }

@keyframes breathe { 50% { transform: scale(1.08); opacity: .7; } }

@media (max-width: 560px) {
    .topbar { position: static; }
    .private-label { display: none; }
    .auth-shell { min-height: calc(100vh - 5rem); padding-top: 1rem; }
    .welcome-card, .auth-card { border-radius: 1.2rem; }
    .assurance-row { display: grid; grid-template-columns: 1fr; }
    .button { width: 100%; }
    .app-topbar { position: relative; }
    .dashboard-heading { align-items: start; flex-direction: column; }
    .heading-actions { width: 100%; justify-content: stretch; }
    .heading-actions .button { flex: 1; }
    .pin-row, .security-history { align-items: stretch; flex-direction: column; }
    .pin-row p { text-align: left; }
    .share-controls { grid-template-columns: 1fr; }
    .approval-actions { flex-direction: column; }
    .security-history li span { display: block; min-width: 0; }
    .viewer-footer { align-items: start; flex-direction: column; gap: .15rem; }
}

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .security-panel { position: static; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

