:root {
    --bg-primary: #06060a;
    --bg-secondary: #0c0c14;
    --bg-card: rgba(14, 14, 24, 0.85);
    --bg-glass: rgba(16, 16, 28, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);

    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #555570;

    --accent-cyan: #00d4ff;
    --accent-cyan-dim: rgba(0, 212, 255, 0.15);
    --accent-orange: #ff6b2b;
    --accent-orange-dim: rgba(255, 107, 43, 0.15);
    --accent-green: #00e676;
    --accent-red: #ff3d5a;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

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

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-orange));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 16px rgba(0, 212, 255, 0.25);
}

.logo h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--text-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
}

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

.btn-badge {
    padding: 8px 16px;
    background: var(--accent-cyan-dim);
    border: 1px solid var(--accent-cyan);
    border-radius: 20px;
    color: var(--accent-cyan);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-badge:hover {
    background: var(--accent-cyan);
    color: #06060a;
    box-shadow: 0 0 16px var(--accent-cyan);
}

.btn-badge.github {
    background: var(--bg-glass);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-badge.github:hover {
    background: var(--border-hover);
    border-color: #fff;
}

main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 380px;
    height: calc(100vh - 67px);
    overflow: hidden;
}

#video-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.04) 0%, transparent 70%);
}

.player-wrapper {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

.live-badge {
    background: var(--accent-cyan-dim);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
}

.player-title {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.video-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    aspect-ratio: 4 / 3;
}

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

.video-overlay {
    position: absolute;
    top: 14px;
    left: 14px;
}

.overlay-badge {
    padding: 6px 12px;
    background: rgba(255, 107, 43, 0.9);
    color: white;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(255, 107, 43, 0.4);
}

.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 30px;
    backdrop-filter: blur(12px);
}

.control-btn {
    padding: 6px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    border-color: var(--accent-cyan);
}

.control-btn.active {
    background: var(--accent-orange-dim);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.demo-info {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-cyan);
}

#alerts-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 { font-size: 15px; font-weight: 600; }

.count-badge {
    background: var(--accent-orange-dim);
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
}

.alerts-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-card {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    animation: slideIn 0.3s ease;
}

.alert-card.boundary {
    border-left: 3px solid var(--accent-orange);
}

.alert-card.foul {
    border-left: 3px solid var(--accent-red);
}

.alert-card.possession {
    border-left: 3px solid var(--accent-cyan);
}

.alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.alert-type {
    font-size: 12px;
    font-weight: 600;
}

.alert-card.boundary .alert-type { color: var(--accent-orange); }
.alert-card.foul .alert-type { color: var(--accent-red); }
.alert-card.possession .alert-type { color: var(--accent-cyan); }

.alert-time {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.alert-detail {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-glass);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-footer p {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-cta {
    display: block;
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
    color: #06060a;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    border-radius: var(--radius);
    transition: opacity 0.2s;
}

.btn-cta:hover { opacity: 0.9; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 900px) {
    main { grid-template-columns: 1fr; grid-template-rows: 1fr 320px; }
    #alerts-panel { border-left: none; border-top: 1px solid var(--border); }
}
