:root {
    --primary: #38bdf8; /* Soft Sky Blue */
    --primary-dark: #0284c7;
    --secondary: #6366f1; /* Indigo */
    --dark: #0f172a;
    --darker: #020617;
    --light: #f8fafc;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --red: #f43f5e; /* Rose/Crimson */
    --blue: #3b82f6;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at top right, #1e293b, #020617);
    color: var(--light);
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    padding: 0 2rem 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

header.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem auto 3rem auto;
    background: var(--glass);
    padding: 1rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    max-width: 1400px;
    width: calc(100% - 4rem);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    flex: 0 0 auto;
}

.brand-logo-image {
    display: block;
    width: auto;
    height: 46px;
    max-width: min(220px, 38vw);
    object-fit: contain;
    flex: 0 0 auto;
}

.logo-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    position: relative;
    flex: 0 0 auto;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    position: relative;
}

.logo-copy {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding-top: 0.1rem;
}

.logo-core {
    color: #f8fafc;
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    margin-left: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 6px 24px rgba(255, 255, 255, 0.08);
}

.logo-product {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.94rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-left: 0.08rem;
    text-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.logo-bracket {
    width: 22px;
    height: 54px;
    display: block;
    border-radius: 2px;
    flex: 0 0 auto;
    filter: drop-shadow(0 0 14px rgba(255, 122, 0, 0.12));
}

.logo-bracket-left {
    border-left: 4px solid #ff4136;
    border-top: 4px solid #ff4136;
    border-bottom: 4px solid #ff4136;
}

.logo-bracket-right {
    border-right: 4px solid #ffd32a;
    border-top: 4px solid #ffd32a;
    border-bottom: 4px solid #ffd32a;
}

.main-nav {
    display: flex;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-link svg {
    fill: currentColor;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--darker);
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-session-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.1rem;
    padding: 0.55rem 0.8rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    line-height: 1.15;
}

.user-session-chip strong {
    font-size: 0.8rem;
    color: #f8fafc;
}

.user-session-chip span {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
}

.header-logout-btn {
    min-height: 42px;
    text-decoration: none;
    white-space: nowrap;
}

.header-subtitle {
    margin-left: 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    border-left: 1px solid var(--glass-border);
    padding-left: 1.2rem;
    min-width: 0;
}

.status-badge {
    padding: 0.6rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.status-badge.connected {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(74, 222, 128, 0.05);
}

main {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    flex: 1;
    min-height: 0;
}

.live-preview {
    --preview-ratio: 1.7777778;
    --preview-aspect-ratio: 16 / 9;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    align-self: start;
}

.video-container {
    width: 100%;
    height: auto;
    aspect-ratio: var(--preview-aspect-ratio, 16 / 9);
    position: relative;
    background: #000;
    min-height: 0;
}

.video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 5;
    pointer-events: none;
}

.preview-toolbar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.preview-expand-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(2, 6, 23, 0.72);
    color: white;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.35);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.preview-expand-btn:hover {
    transform: translateY(-1px);
    background: rgba(15, 23, 42, 0.88);
    border-color: rgba(56, 189, 248, 0.45);
}

.preview-expand-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18), 0 10px 24px rgba(2, 6, 23, 0.35);
}

.preview-stream-shell {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.22), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(99, 102, 241, 0.18), transparent 24%),
        linear-gradient(160deg, #050816, #020617 65%, #071224);
    overflow: hidden;
}

.preview-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.preview-frame-grid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mix-blend-mode: screen;
    pointer-events: none;
    opacity: 0.22;
}

.live-tag {
    background: var(--red);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 1px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.commentary-panel {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.btn {
    appearance: none;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-monitor {
    min-height: 48px;
    font-size: 0.92rem;
    font-weight: 700;
}

.btn-monitor.active {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.35);
    color: #86efac;
}

.btn-monitor.inactive {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.25);
    color: #fca5a5;
}

.btn-danger {
    background: rgba(244, 63, 94, 0.2);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.3);
    color: #fff;
}

.btn-mic {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--darker);
    font-size: 1.25rem;
    padding: 1.5rem 2rem;
    box-shadow: 0 10px 20px -5px rgba(56, 189, 248, 0.3);
    width: 100%;
}

.btn-mic:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(56, 189, 248, 0.5);
    filter: brightness(1.05);
}

.btn-mic.active {
    background: linear-gradient(135deg, var(--red), #e11d48);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(244, 63, 94, 0.4);
    animation: mic-pulse 1.5s infinite;
}

@keyframes mic-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

.streaming-status-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.status-item svg {
    fill: currentColor;
}

.status-item.active {
    color: #4ade80;
}

.status-item.active svg {
    filter: drop-shadow(0 0 5px #4ade80);
}

.config-details {
    margin-bottom: 1.5rem;
}

.config-details summary {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    margin-bottom: 0.5rem;
    user-select: none;
}

.admin-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.3px;
}

.input-group input,
.input-group select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.input-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
}

.input-action-row input {
    min-width: 0;
}

.btn-copy-inline {
    white-space: nowrap;
    min-height: 48px;
    padding-inline: 1rem;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15), inset 0 2px 4px rgba(0,0,0,0.2);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.main-actions {
    display: flex;
}

.main-actions .btn {
    width: 100%;
}

.volume-meter {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.meter-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.1s ease;
}

.speakers-list {
    flex: 1;
    overflow-y: auto;
}

.speakers-list h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.speaker-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.speaker-item.speaking {
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.08);
    box-shadow: 0 12px 30px -18px rgba(56, 189, 248, 0.75);
}

.speaker-info {
    flex: 1;
    min-width: 0;
}

.speaker-name {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 0.2rem;
}

.speaker-status {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 0.55rem;
}

.speaker-item.speaking .speaker-status {
    color: #93c5fd;
    font-weight: 700;
}

.speaker-level-track {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.speaker-level-fill {
    height: 100%;
    min-width: 4px;
    border-radius: inherit;
    transition: width 90ms linear, opacity 90ms linear, background 120ms ease;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.22);
}

.speaker-item.empty {
    justify-content: center;
    color: rgba(255, 255, 255, 0.2);
    border-style: dashed;
}

footer {
    margin-top: 2rem;
    text-align: center;
}

.rtmp-info {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.rtmp-info code {
    background: var(--glass);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: var(--primary);
}

/* ==========================================================================
   Admin Specific Styles
   ========================================================================== */

.admin-page .app-container {
    height: auto;
    overflow: visible;
}

.admin-main {
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: 2rem;
    align-items: start;
    padding-bottom: 5rem;
}

@media (max-width: 992px) {
    .admin-main {
        grid-template-columns: 1fr;
    }
}

.create-room-panel {
    width: 100%;
}

.create-room-panel h2 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.room-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
    margin-top: 1.5rem;
}

.room-table th {
    text-align: left;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.room-table td {
    padding: 1rem;
    background: var(--glass);
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
    font-size: 0.85rem;
}

.room-table td:first-child {
    border-left: 1px solid var(--glass-border);
    border-radius: 12px 0 0 12px;
}

.room-table td:last-child {
    border-right: 1px solid var(--glass-border);
    border-radius: 0 12px 12px 0;
}

.rooms-list-panel {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.rooms-list-panel h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.room-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 8px;
    display: inline-flex;
}

.url-info {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

.url-info code {
    color: var(--primary);
}

.create-room-panel {
    position: sticky;
    top: 2rem;
}

.status-pill {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.status-pill:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.status-error {
    background: rgba(255, 61, 0, 0.2);
    border: 1px solid #ff3d00;
    color: #ff3d00;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.status-pill.active {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.4);
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.status-pill.inactive {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--glass-border);
}

/* ==========================================================================
   New Dashboard Layout
   ========================================================================== */

.control-section {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    margin-bottom: 1rem;
    font-weight: 700;
}

.action-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.action-grid .btn {
    height: 100%;
}

.status-error-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

.info-tag {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

.info-tag code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: var(--primary);
}

.access-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.access-card input[readonly] {
    color: #e2e8f0;
    cursor: text;
}

.inline-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 0.25rem;
}

.inline-action-row .btn {
    min-width: 220px;
}

.inline-form {
    display: contents;
}

.input-group small {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

.vjs-theme-city .vjs-big-play-button {
    border: none;
    background: var(--primary);
    color: var(--darker);
    border-radius: 50%;
    width: 3em;
    height: 3em;
    line-height: 2.8em;
    top: 50%;
    left: 50%;
    margin-top: -1.5em;
    margin-left: -1.5em;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.rtmp-warning {
    backdrop-filter: blur(4px);
}

.preview-state-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 10;
    padding: 2rem;
    pointer-events: none;
    display: none; /* Hidden by default */
    backdrop-filter: blur(8px);
}

.preview-state-overlay.active {
    display: flex;
}

.commentator-page {
    min-height: 100vh;
}

.commentator-shell {
    max-width: 1680px;
}

.commentator-main {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(320px, 430px);
    gap: 1.5rem;
    align-items: start;
}

.commentator-preview-column {
    display: grid;
    gap: 1rem;
    min-width: 0;
    align-content: start;
}

.commentator-preview {
    min-width: 0;
    margin-bottom: 0;
}

.commentator-panel {
    min-height: 100%;
}

.commentator-match-box {
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(125, 211, 252, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
    padding: 1rem 1.15rem;
}

.commentator-match-status {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
    font-size: 0.84rem;
    line-height: 1.4;
}

.commentator-match-status.is-error {
    display: flex;
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(127, 29, 29, 0.22);
}

.commentator-match-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 0;
    text-align: center;
}

.commentator-match-line-top {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.92rem;
    font-weight: 700;
}

.commentator-match-line-bottom {
    margin-top: 0.52rem;
    color: rgba(255, 255, 255, 0.96);
}

.commentator-match-datetime,
.commentator-match-inline-meta strong,
.commentator-match-frames strong {
    color: #f8fafc;
}

.commentator-match-inline-meta {
    color: rgba(255, 255, 255, 0.72);
}

.commentator-match-separator {
    color: rgba(255, 255, 255, 0.28);
    font-weight: 700;
}

.commentator-match-player {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    max-width: min(32ch, 100%);
    word-break: break-word;
}

.commentator-match-player-white {
    color: #f8fafc;
}

.commentator-match-player-yellow {
    color: #fde68a;
}

.commentator-match-points {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
    min-width: 2ch;
}

.commentator-match-points-white {
    color: #f8fafc;
}

.commentator-match-points-yellow {
    color: #facc15;
}

.commentator-match-frames {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.42rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.84rem;
    font-weight: 700;
}

.commentator-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.commentator-header {
    gap: 1rem;
}

.commentator-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.commentator-logout-btn {
    min-height: 44px;
    padding: 0.8rem 1.2rem;
}

.commentator-nickname-chip {
    display: inline-flex;
    align-items: center;
    margin-top: 0.75rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.24);
    color: #bbf7d0;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.commentator-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-shell {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: min(100%, 460px);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 2rem;
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(16px);
    text-align: center;
}

.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.22);
    color: #7dd3fc;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.auth-card h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.auth-copy {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.auth-error {
    margin-bottom: 1rem;
    text-align: center;
}

.auth-form .input-group {
    width: 100%;
    align-items: center;
    text-align: center;
}

.auth-form .input-group input {
    text-align: center;
    caret-color: #f8fafc;
}

.auth-form .input-group input::placeholder {
    text-align: center;
}

.auth-form .input-group small {
    text-align: center;
    color: rgba(255, 255, 255, 0.34);
}

body.preview-expanded {
    overflow: hidden;
}

body.preview-expanded::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.74);
    backdrop-filter: blur(14px);
    z-index: 999;
}

body.preview-expanded .live-preview.is-expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(96vw, calc((100vh - 2rem) * 16 / 9), 1680px);
    margin: 0;
    z-index: 1000;
    border-radius: 28px;
    box-shadow: 0 35px 90px rgba(2, 6, 23, 0.65);
}

body.preview-expanded .live-preview.is-expanded .video-container {
    width: 100%;
}

.live-preview:fullscreen,
.live-preview:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    border: none;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.live-preview:fullscreen .video-container,
.live-preview:-webkit-full-screen .video-container {
    width: min(100vw, calc(100vh * 16 / 9));
    aspect-ratio: 16 / 9;
    margin: auto;
}

.live-preview:fullscreen .preview-expand-btn,
.live-preview:-webkit-full-screen .preview-expand-btn {
    background: rgba(2, 6, 23, 0.86);
}

.preview-state-overlay .loader {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.vjs-error-display {
    display: none !important; /* Let our custom overlay handle errors */
}

/* Console Log */
.console-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}
.console-box {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #000;
    border-radius: 8px;
    margin-top: 0.5rem;
}
.console-box.active {
    max-height: 300px;
}
.console-content {
    color: #0f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    padding: 1.5rem;
    white-space: pre-wrap;
    line-height: 1.4;
    max-height: 300px;
    overflow-y: auto;
}
.console-content::-webkit-scrollbar {
    width: 6px;
}
.console-content::-webkit-scrollbar-track {
    background: transparent;
}
.console-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

@media (min-width: 961px) {
    body.dashboard-page {
        height: 100vh;
        overflow: hidden;
    }

    body.dashboard-page header.main-header {
        max-width: 1740px;
        width: calc(100% - 1.5rem);
        margin: 0.5rem auto 0.55rem auto;
        padding: 0.72rem 1rem;
    }

    body.dashboard-page .app-container {
        max-width: 1740px;
        height: calc(100vh - 92px);
        padding: 0 0.75rem 0.6rem 0.75rem;
        overflow: hidden;
    }

    .dashboard-main {
        display: grid;
        grid-template-columns: minmax(0, 1.48fr) minmax(340px, 0.84fr);
        gap: 0.7rem;
        align-items: stretch;
        min-height: 0;
        height: 100%;
    }

    .dashboard-preview-column {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 0.65rem;
        min-height: 0;
    }

    .dashboard-preview {
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.45rem;
    }

    .dashboard-preview .video-container {
        width: min(100%, calc(46vh * var(--preview-ratio, 1.7777778)));
        max-height: 46vh;
        margin: 0 auto;
    }

    .dashboard-support-grid {
        display: grid;
        grid-template-columns: minmax(0, 0.98fr) minmax(0, 1.02fr);
        gap: 0.65rem;
        min-height: 0;
    }

    .dashboard-page .control-section {
        margin-bottom: 0;
    }

    .dashboard-card {
        padding: 0.72rem 0.82rem;
    }

    .dashboard-card .section-title {
        margin-bottom: 0.5rem;
        font-size: 0.68rem;
    }

    .dashboard-info-card .info-tag {
        margin-top: 0.38rem;
        line-height: 1.34;
        font-size: 0.69rem;
    }

    .dashboard-delay-group {
        margin-top: 0.45rem;
    }

    .dashboard-delay-group input {
        padding: 0.58rem 0.8rem;
        font-size: 0.86rem;
    }

    .dashboard-access-card .access-card {
        gap: 0.55rem;
    }

    .dashboard-access-card input[readonly] {
        padding: 0.58rem 0.8rem;
        font-size: 0.78rem;
    }

    .dashboard-access-card .input-action-row {
        gap: 0.45rem;
    }

    .dashboard-access-card .btn-copy-inline {
        min-height: 40px;
        padding: 0.62rem 0.72rem;
        font-size: 0.75rem;
    }

    .dashboard-access-card .inline-action-row {
        gap: 0.45rem;
        margin-top: 0.05rem;
    }

    .dashboard-access-card .inline-action-row .btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 0.62rem 0.72rem;
        font-size: 0.75rem;
    }

    .dashboard-control-panel {
        min-height: 0;
        padding: 0.78rem;
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 0.58rem;
        overflow: hidden;
    }

    .dashboard-panel-header {
        margin-bottom: 0;
        gap: 0.6rem;
    }

    .dashboard-panel-header h2 {
        font-size: 1.35rem;
    }

    .dashboard-live-controls {
        padding: 0.68rem;
    }

    .dashboard-live-controls .streaming-status-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.38rem;
        margin-bottom: 0.5rem;
        padding: 0.45rem;
    }

    .dashboard-live-controls .status-item {
        justify-content: center;
        text-align: center;
        min-width: 0;
        font-size: 0.64rem;
    }

    .dashboard-live-controls .action-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
        margin-bottom: 0.45rem;
    }

    .dashboard-live-controls .main-actions {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        width: 100%;
    }

    .dashboard-start-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .dashboard-live-controls .btn {
        min-height: 40px;
        padding: 0.72rem 0.8rem;
        font-size: 0.8rem;
    }

    .dashboard-live-btn {
        min-height: 42px;
        font-size: 0.88rem;
        padding: 0.75rem 0.85rem;
    }

    .dashboard-mic-btn,
    .dashboard-monitor-btn,
    .dashboard-stop-btn {
        padding: 0.72rem 0.8rem;
        font-size: 0.79rem;
    }

    .dashboard-lower-grid {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 0.55rem;
        min-height: 0;
    }

    .dashboard-participants-shell {
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 0.62rem;
    }

    .dashboard-speakers-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding-right: 0.2rem;
    }

    .dashboard-speakers-list h3 {
        margin-bottom: 0.45rem;
        font-size: 0.76rem;
    }

    .dashboard-speakers-list .speaker-item {
        padding: 0.58rem;
        margin-bottom: 0.4rem;
    }

    .dashboard-console-section {
        padding: 0.55rem 0.68rem;
    }

    .dashboard-console-header {
        margin-bottom: 0;
        cursor: pointer;
    }

    .dashboard-console-section .section-title {
        margin-bottom: 0;
    }

    .dashboard-console-section .console-box.active {
        max-height: 110px;
    }

    .dashboard-console-section .console-content {
        max-height: 110px;
        padding: 0.68rem;
        font-size: 0.64rem;
    }
}

@media (min-width: 961px) and (max-width: 1480px) {
    .dashboard-main {
        grid-template-columns: minmax(0, 1.34fr) minmax(320px, 0.94fr);
    }

    .dashboard-control-panel {
        padding: 0.8rem;
    }

    .dashboard-panel-header h2 {
        font-size: 1.45rem;
    }

    .dashboard-live-controls .streaming-status-bar {
        gap: 0.5rem;
    }
}

@media (max-width: 960px) {
    header.main-header {
        width: calc(100% - 2rem);
        margin: 1rem auto 1.5rem auto;
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .app-container {
        padding: 0 1rem 1rem 1rem;
    }

    .logo {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.85rem;
    }

    .logo-lockup {
        transform: scale(0.96);
        transform-origin: center;
    }

    .brand-logo-image {
        height: 40px;
        max-width: min(200px, 62vw);
    }

    .brand-lockup {
        gap: 0.55rem;
    }

    .logo-mark {
        gap: 0.08rem;
    }

    .logo-copy {
        min-width: 62px;
    }

    .logo-core {
        font-size: 1.45rem;
        letter-spacing: 0.06em;
        margin-left: 0.03em;
    }

    .logo-product {
        font-size: 0.82rem;
        letter-spacing: 0.14em;
    }

    .header-subtitle {
        width: 100%;
        text-align: center;
        border-left: none;
        border-top: 1px solid var(--glass-border);
        padding-left: 0;
        padding-top: 0.8rem;
        font-size: 0.82rem;
    }

    main {
        grid-template-columns: 1fr;
    }

    .commentator-main {
        grid-template-columns: 1fr;
    }

    .commentator-match-box {
        padding: 0.95rem 1rem;
    }

    .commentator-match-line {
        gap: 0.28rem;
    }

    .commentator-match-line-top {
        font-size: 0.84rem;
    }

    .commentator-match-line-bottom {
        font-size: 0.9rem;
    }

    .commentator-match-player {
        max-width: 100%;
        font-size: 0.95rem;
    }

    .commentator-match-points {
        font-size: 1.05rem;
    }

    .commentator-match-frames {
        font-size: 0.76rem;
        padding: 0.36rem 0.58rem;
    }

    .commentary-panel {
        padding: 1.25rem;
    }

    .preview-toolbar {
        top: 0.75rem;
        right: 0.75rem;
    }

    .preview-expand-btn {
        padding: 0.62rem 0.85rem;
        font-size: 0.76rem;
    }

    body.preview-expanded .live-preview.is-expanded {
        width: min(100vw, calc((100vh - 1rem) * 16 / 9));
        border-radius: 0;
    }

    .commentator-header {
        align-items: stretch;
    }

    .commentator-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .inline-action-row .btn {
        width: 100%;
        min-width: 0;
    }
}
