/* Whitespace Live web client — dep2/static/style.css design language.
   Light palette on :root, dark palette via prefers-color-scheme, so the
   page follows the guest's browser/OS theme with no toggle to find. */

:root {
    --bg: #F5F4F8;
    --card-bg: #FFFFFF;
    --card-raised: #EFEEF5;
    --card-border: #D9D7E2;
    --ink: #171724;
    --muted: #626071;
    --signal: #7357FF;
    --signal-deep: #563CD5;
    --mineral: #5C8DFF;
    --mineral-ink: #334EA3;
    --danger: #C4516C;
    --warn: #7047B7;
    --radius: 18px;
    --shadow: 0 10px 30px rgba(23, 23, 36, 0.06);
    --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Ubuntu", "Cantarell", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #070812;
        --card-bg: #11111D;
        --card-raised: #181827;
        --card-border: #2F2E3A;
        --ink: #F7F5FF;
        --muted: #AAA7B8;
        --signal: #A89CFF;
        --signal-deep: #7357FF;
        --mineral: #5C8DFF;
        --mineral-ink: #A89CFF;
        --danger: #F07187;
        --warn: #C797FF;
        --shadow: none;
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 18px 22px 16px;
    gap: 14px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
}

.brand h1 {
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    font-weight: 700;
    line-height: 1.15;
}

.brand-sub {
    display: block;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--mineral-ink);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--card-raised);
    color: var(--muted);
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.status-connected { color: var(--mineral-ink); background: rgba(92, 141, 255, 0.12); }
.status-connected .status-dot { background: var(--mineral); }
.status-connecting { color: var(--warn); }
.status-connecting .status-dot { background: var(--warn); }
.status-disconnected { color: var(--danger); }

.app-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.login-card { max-width: 520px; margin: 6vh auto 0; width: 100%; }

.login-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--mineral-ink);
}

.login-card h2 {
    font-size: 1.7rem;
    letter-spacing: -0.03em;
    margin: 6px 0 8px;
}

.subtitle { color: var(--muted); margin-bottom: 20px; font-size: 0.95rem; }
.fine-print { color: var(--muted); font-size: 0.78rem; }
.fine-print code { font-size: 0.95em; }

.login-alt a { color: var(--signal); font-weight: 600; text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }

.create-note {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--card-raised);
    border: 1px solid var(--card-border);
    color: var(--muted);
    font-size: 0.82rem;
}

.create-note strong { display: block; color: var(--ink); margin-bottom: 2px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--mineral-ink);
}

.form-group input, .form-group select, .mic-settings-row select {
    background: var(--card-raised);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 11px 12px;
    color: var(--ink);
    font: inherit;
    outline: none;
    width: 100%;
}

.form-group input:focus, .mic-settings-row select:focus {
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(115, 87, 255, 0.16);
}

.advanced {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--card-raised);
}

.advanced summary {
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    list-style-position: inside;
}

.advanced[open] summary { margin-bottom: 10px; }

.advanced .form-group input { background: var(--card-bg); }

.btn {
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--ink);
    border-radius: 999px;
    padding: 9px 16px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: var(--signal);
    border-color: var(--signal);
    color: #fff;
    width: 100%;
    padding: 13px 16px;
}

.btn-primary:hover { background: var(--signal-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-danger {
    color: var(--danger);
    border-color: rgba(196, 81, 108, 0.35);
    background: transparent;
}

.btn-small { padding: 6px 12px; font-size: 0.78rem; }

.btn-control.btn-muted {
    color: var(--danger);
    border-color: rgba(196, 81, 108, 0.4);
}

.btn-control.btn-active {
    background: var(--signal);
    border-color: var(--signal);
    color: #fff;
}

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(243, 101, 125, 0.1);
    border: 1px solid rgba(243, 101, 125, 0.35);
    color: var(--danger);
    flex-shrink: 0;
}

.alert-info {
    background: rgba(92, 141, 255, 0.1);
    border-color: rgba(92, 141, 255, 0.3);
    color: var(--mineral-ink);
}

.hidden { display: none !important; }

/* Room — PIP-style call: one dominant stage view, the local camera as a
   corner PIP, extra remotes in a compact strip, controls floating over the
   stage. Clicking any tile swaps who holds the stage. */

.room-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.video-stage {
    position: relative;
    flex: 1;
    min-height: 320px;
    border-radius: 22px;
    overflow: hidden;
    background: #070812;
    border: 1px solid var(--card-border);
}

/* In-call chrome nearly disappears: a translucent whisper in the corner. */
.stage-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    opacity: 0.75;
}

.identity-badge {
    background: rgba(7, 8, 18, 0.55);
    color: #F7F5FF;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
    backdrop-filter: blur(6px);
}

.roster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.roster-pill {
    background: rgba(7, 8, 18, 0.4);
    border: 1px solid rgba(247, 245, 255, 0.18);
    color: rgba(247, 245, 255, 0.85);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 0.68rem;
    font-weight: 600;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roster-pill.roster-local {
    border-color: rgba(168, 156, 255, 0.55);
}

.stage-note {
    width: 100%;
    color: rgba(247, 245, 255, 0.65);
    font-size: 0.72rem;
}

#media-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* The stage slot: whichever remote tile lives here fills the view. */
.stage-slot,
.stage-slot .participant-tile {
    position: absolute;
    inset: 0;
}

.stage-slot .participant-tile {
    border: 0;
    border-radius: 0;
    cursor: pointer;
}

/* The local tile: full-bleed when it holds the stage (alone in the room or
   self-pinned), a corner PIP otherwise. */
#tile-local.on-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
    border: 0;
    border-radius: 0;
}

#tile-local.pip {
    position: absolute;
    top: 52px;
    right: 14px;
    width: min(220px, 30%);
    height: auto;
    aspect-ratio: 16 / 10;
    z-index: 7;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(7, 8, 18, 0.45);
    cursor: pointer;
}

/* Extra remotes wait in a compact strip above the dock; click to promote. */
.filmstrip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 82px;
    z-index: 5;
    display: flex;
    gap: 8px;
    max-width: calc(100% - 24px);
    overflow-x: auto;
    padding: 2px;
}

.filmstrip:empty { display: none; }

.filmstrip .participant-tile {
    position: relative;
    width: 150px;
    height: 94px;
    flex-shrink: 0;
    border-radius: 14px;
    cursor: pointer;
}

.filmstrip .participant-tile .participant-overlay {
    padding: 6px 8px;
    font-size: 0.68rem;
}

.filmstrip .participant-tile .avatar-placeholder {
    width: 44px;
    height: 44px;
    font-size: 0.8rem;
}

.participant-tile {
    position: relative;
    background: #11111D;
    overflow: hidden;
    min-height: 0;
    height: 100%;
    border: 1px solid rgba(247, 245, 255, 0.14);
}

.video-wrapper { width: 100%; height: 100%; }

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-placeholder {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--signal);
    color: #fff;
    font-weight: 700;
    align-items: center;
    justify-content: center;
}

.participant-tile.no-video .avatar-placeholder { display: flex; }

.participant-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 12px 14px;
    background: linear-gradient(transparent, rgba(7, 8, 18, 0.72));
    color: #F7F5FF;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.track-indicators { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; }

/* Mic settings float above the dock as a small panel. */
.mic-settings-row {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 82px;
    z-index: 8;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    width: max-content;
    max-width: calc(100% - 24px);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    font-size: 0.82rem;
    box-shadow: 0 16px 40px rgba(7, 8, 18, 0.35);
}

.mic-settings-row > label:first-child {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--mineral-ink);
}

.mic-settings-row select {
    flex: 1;
    min-width: 140px;
    width: auto;
    padding: 6px 10px;
    border-radius: 10px;
}

.mic-settings-row .check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    white-space: nowrap;
    cursor: pointer;
}

/* Minimal floating dock overlaying the stage. */
.controls-dock {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 14px;
    z-index: 9;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100% - 24px);
    padding: 8px 10px;
    background: rgba(17, 17, 29, 0.62);
    border: 1px solid rgba(247, 245, 255, 0.16);
    border-radius: 999px;
    backdrop-filter: blur(10px);
    box-shadow: 0 16px 40px rgba(7, 8, 18, 0.35);
}

.controls-dock .btn-control {
    background: transparent;
    border-color: transparent;
    color: #F7F5FF;
}

.controls-dock .btn-control:hover {
    background: rgba(247, 245, 255, 0.12);
}

.controls-dock .btn-control.btn-muted {
    color: #F07187;
}

.controls-dock .btn-control.btn-active {
    background: var(--signal);
    color: #fff;
}

.controls-dock .btn-danger {
    color: #F07187;
    border-color: rgba(240, 113, 135, 0.45);
}

@media (max-width: 720px) {
    body { padding: 12px 12px 10px; }
    .brand h1 { font-size: 1.2rem; }
    .brand-mark { width: 34px; height: 34px; }
    .login-card { margin-top: 2vh; padding: 18px; }
    .video-stage { min-height: 260px; }
    .stage-note { display: none; }
    #tile-local.pip {
        top: 44px;
        right: 10px;
        width: 118px;
    }
    .filmstrip { bottom: 118px; }
    .filmstrip .participant-tile { width: 110px; height: 70px; }
    .mic-settings-row { bottom: 118px; }
    .controls-dock { border-radius: 18px; bottom: 10px; }
}
