/* Public live board: teams and participants in real time */

:root {
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #eef2f7;
    --paper: #ffffff;
    --accent: #1d4ed8;
    --accent-soft: #dbeafe;
    --success: #15803d;
    --danger: #b42318;
}

[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
}

body.live-page {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 50% -160px, #dbeafe 0%, transparent 60%),
        linear-gradient(180deg, #eef2f7 0%, #f8fafc 55%, #eef2f7 100%);
    font-family: Inter, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.live-shell {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

/* ---------- Hero ---------- */

.live-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(26px, 4vw, 44px);
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(135deg, #0b1220 0%, #16233b 55%, #1e3a8a 100%);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.live-hero::before {
    content: "";
    position: absolute;
    inset: -40% -10% auto auto;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.35), transparent 62%);
    pointer-events: none;
}

.live-hero::after {
    content: "";
    position: absolute;
    inset: auto -120px -220px auto;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.live-hero-bar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: clamp(20px, 3vw, 34px);
}

.live-brand {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.26em;
    color: #93c5fd;
}

.live-brand span {
    color: #fff;
}

.live-state {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #e2e8f0;
    white-space: nowrap;
}

.live-state[data-status="active"] {
    color: #bbf7d0;
    border-color: rgba(74, 222, 128, 0.35);
    background: rgba(22, 163, 74, 0.16);
}

.live-state[data-status="completed"] {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.16);
}

.live-title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(30px, 4.4vw, 48px);
    line-height: 1.06;
    letter-spacing: -0.03em;
    font-weight: 850;
}

.live-topic {
    position: relative;
    z-index: 1;
    max-width: 62ch;
    margin: 14px 0 0;
    font-size: clamp(14px, 1.4vw, 17px);
    line-height: 1.55;
    color: #cbd5e1;
}

.live-pills {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: clamp(22px, 3vw, 30px);
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 15px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    font-size: 12.5px;
    font-weight: 600;
    color: #e2e8f0;
    font-variant-numeric: tabular-nums;
}

.live-pill-time {
    color: #94a3b8;
    font-weight: 500;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
    animation: live-pulse 2.4s infinite;
}

#conn-pill.is-online .live-dot {
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
}

#conn-pill.is-offline .live-dot {
    background: #ef4444;
    animation: none;
    box-shadow: none;
}

#conn-pill.is-connecting .live-dot {
    background: #f59e0b;
}

@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ---------- Toolbar ---------- */

.live-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin: 38px 2px 18px;
}

.live-eyebrow {
    margin: 0 0 7px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--accent);
}

.live-toolbar h2 {
    margin: 0;
    font-size: clamp(19px, 2vw, 23px);
    letter-spacing: -0.02em;
}

.live-hint {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

/* ---------- Team cards ---------- */

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.team-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.team-card.is-new {
    animation: card-in 0.35s ease both;
}

.team-card::before {
    content: "";
    height: 5px;
    background: var(--team, var(--accent));
}

.team-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.10);
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.team-card.is-updated {
    animation: card-flash 1.4s ease;
}

@keyframes card-flash {
    0% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28); }
    100% { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
}

.team-head {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 18px 20px 14px;
}

.team-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--team, var(--accent));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.team-head-text {
    min-width: 0;
    flex: 1;
}

.team-name {
    margin: 0;
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.team-sub {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.team-count {
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.team-list {
    margin: 0;
    padding: 0 12px 14px;
    list-style: none;
}

.team-member {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 8px;
    border-radius: 9px;
}

.team-member + .team-member {
    border-top: 1px solid #f1f5f9;
}

.member-index {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.member-name {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.team-note {
    margin: 0;
    padding: 14px 20px 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.team-note.is-free {
    margin-top: auto;
    padding-top: 0;
    color: #94a3b8;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

/* ---------- Empty state / footer ---------- */

.live-empty {
    margin-top: 6px;
    padding: 48px 24px;
    text-align: center;
    background: var(--paper);
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
}

.live-empty h3 {
    margin: 0 0 8px;
    font-size: 19px;
}

.live-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.live-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 38px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--muted);
    font-size: 12px;
}

.live-footer-brand {
    font-weight: 800;
    letter-spacing: 0.22em;
    font-size: 10.5px;
    color: #94a3b8;
}

@media (max-width: 640px) {
    .live-shell {
        width: calc(100% - 24px);
        padding: 14px 0 32px;
    }

    .live-hero {
        border-radius: 16px;
    }

    .live-pill {
        font-size: 11.5px;
        padding: 8px 12px;
    }

    .team-note {
        padding-bottom: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
