@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1123;
    --bg-secondary: #1a1a2e;
    --bg-surface: #16213e;
    --bg-glass: rgba(22, 33, 62, 0.75);
    --bg-row-even: rgba(255, 255, 255, 0.03);
    --text-primary: #e0e0e0;
    --text-secondary: #8892a4;
    --accent: #4a9eff;
    --accent-hover: #6db3ff;
    --accent-dim: rgba(74, 158, 255, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --stat-flash: rgba(74, 158, 255, 0.45);
    --radius: 8px;
    --radius-sm: 5px;
    --transition: 0.2s ease;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --font-heading: 'Rajdhani', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

html, body {
    height: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-stack);
    overflow: hidden;
}

h1, h2, h3, .header-title, .card-name, .brand-title, .dashboard-title {
    font-family: var(--font-heading);
}

/* Main area — full viewport */
.main {
    height: 100vh;
    padding: 6px 10px;
}

/* Content grid — full height, single column with drawer */
.content-grid {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
}

/* --- Left column --- */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
    flex: 1;
}

/* Left header (replaces separate header bar) */
.left-header {
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.back-btn:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.header-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
    transition: background var(--transition);
    flex-shrink: 0;
}

.status-dot.connected {
    background: #22c55e;
}

.status-dot.connecting {
    background: #eab308;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: auto;
}

/* Select groups */
.select-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.select-group label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.select-group select {
    appearance: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 24px 4px 8px;
    font-family: var(--font-stack);
    font-size: 12px;
    cursor: pointer;
    transition: border-color var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238892a4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    min-width: 160px;
}

.select-group select:hover,
.select-group select:focus {
    border-color: var(--accent);
    outline: none;
}

.select-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game info (inside left header) */
.game-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    font-size: 11px;
    align-items: baseline;
    padding-top: 4px;
}

.game-info-bar:empty,
.game-info-bar .sidebar-placeholder {
    padding-top: 0;
}

.gi-item {
    display: inline-flex;
    gap: 4px;
    align-items: baseline;
}

.gi-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gi-value {
    color: var(--text-primary);
}

/* Court container — left-aligned */
.court-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 0;
}

#court-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius);
}

/* --- Scoreboard overlay --- */
.info-overlay {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
}

.scoreboard-overlay {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 6px;
}

.sb-team {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
}

.sb-abbr {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.sb-score {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 30px;
    text-align: center;
}

.sb-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 12px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    gap: 1px;
}

.sb-quarter {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
}

.sb-clock {
    font-size: 16px;
    font-weight: 600;
}

.clock {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Debug info panel (bottom-left) */
.debug-info-container {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
    min-width: 160px;
}

.debug-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.debug-info-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.debug-info-value {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
}

/* Shot clock */
.shot-clock-container {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 10;
    pointer-events: none;
}

.shot-clock-label {
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.shot-clock {
    font-size: 22px;
    color: var(--accent);
}

/* --- Play-by-play section (below court) --- */
.pbp-section {
    flex-shrink: 0;
    flex-grow: 1;
    min-height: 80px;
    max-height: 20%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pbp-section-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    padding: 4px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.pbp-feed {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
    padding: 3px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) transparent;
}

.pbp-feed::-webkit-scrollbar {
    width: 5px;
}

.pbp-feed::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 3px;
}

.pbp-row {
    display: flex;
    gap: 8px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    line-height: 1.4;
    align-items: baseline;
    cursor: pointer;
    transition: background var(--transition);
    margin: 0 3px;
}

.pbp-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.pbp-row.pbp-current {
    background: var(--accent-dim);
}

.pbp-row.pbp-current:hover {
    background: rgba(74, 158, 255, 0.25);
}

.pbp-row.pbp-no-event {
    opacity: 0.5;
    cursor: default;
}

.pbp-row.pbp-no-event:hover {
    background: transparent;
}

.pbp-score {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 10px;
    min-width: 42px;
    text-align: center;
}

.pbp-time {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 52px;
    font-size: 10px;
}

.pbp-desc {
    color: var(--text-primary);
    flex: 1;
}

.sidebar-placeholder {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 4px 0;
}

/* --- Stats panel (slide-in drawer) --- */
.stats-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) transparent;
}

.stats-panel.drawer-open {
    transform: translateX(0);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

/* --- Stats drawer toggle button --- */
.stats-drawer-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 51;
    appearance: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: var(--text-secondary);
    width: 24px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.stats-drawer-toggle:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

.stats-drawer-toggle.drawer-open {
    right: 380px;
}

.stats-drawer-toggle svg {
    transition: transform 0.3s;
}

.stats-drawer-toggle.drawer-open svg {
    transform: rotate(180deg);
}

.stats-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

.stats-section.stats-section-grow {
    flex-shrink: 1;
    min-height: 0;
}

.stats-section-header {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    padding: 3px 10px;
    border-bottom: 1px solid var(--border);
}

/* --- Tabulator overrides — dark backgrounds --- */
.stats-section .tabulator {
    background: var(--bg-secondary);
    border: none;
    font-size: 11px;
}

.stats-section .tabulator .tabulator-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.stats-section .tabulator .tabulator-header .tabulator-col {
    background: var(--bg-secondary);
    border-right: none;
}

.stats-section .tabulator .tabulator-header .tabulator-frozen {
    background: var(--bg-secondary);
}

.stats-section .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    padding: 2px 4px;
}

.stats-section .tabulator .tabulator-tableholder {
    background: var(--bg-secondary);
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table {
    background: var(--bg-secondary);
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    background: var(--bg-secondary);
    border-bottom: none;
    min-height: 0;
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even) {
    background: var(--bg-row-even);
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    border-right: none;
    padding: 2px 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-primary);
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell.tabulator-frozen {
    background: inherit;
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell[tabulator-field="team"],
.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell[tabulator-field="player"] {
    font-family: var(--font-stack);
    color: var(--text-secondary);
    font-weight: 500;
}

.stats-section .tabulator .tabulator-footer {
    display: none;
}

/* Team stats — transposed layout, slightly larger font */
#team-stats-body .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    font-size: 10px;
}

#team-stats-body .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    font-size: 12px;
    padding: 3px 5px;
}

/* --- Stat change animation --- */
@keyframes stat-flash {
    0%   { background-color: rgba(74, 158, 255, 0.6); }
    50%  { background-color: rgba(74, 158, 255, 0.35); }
    100% { background-color: rgba(74, 158, 255, 0.12); }
}

.stat-changed {
    animation: stat-flash 5s ease-out forwards;
}

/* On-court and ball-holder indicators on player stats rows */
.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row.player-on-court .tabulator-cell[tabulator-field="player"] {
    color: var(--text-primary);
    font-weight: 600;
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:not(.player-on-court) {
    opacity: 0.45;
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row.player-has-ball {
    background: rgba(249, 115, 22, 0.18);
}

.stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row.player-has-ball .tabulator-cell[tabulator-field="player"] {
    color: #f97316;
}

/* Controls bar */
.controls-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    flex-shrink: 0;
}

.control-btn {
    appearance: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border-color var(--transition);
}

.control-btn:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.control-btn-play {
    width: 36px;
    height: 36px;
    font-size: 16px;
    border-radius: 50%;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.control-btn-play:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Timeline slider */
.timeline-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 4px;
}

.timeline-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: var(--bg-surface);
    outline: none;
    cursor: pointer;
    transition: opacity var(--transition);
}

.timeline-slider:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-secondary);
    cursor: pointer;
    transition: transform var(--transition);
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.timeline-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-secondary);
    cursor: pointer;
}

.frame-counter {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}

.select-group-speed select {
    min-width: 70px;
}

.glass-panel {
    background: rgba(15, 17, 35, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    pointer-events: none;
}

.toast {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-primary);
    animation: toast-in 0.3s ease, toast-out 0.3s ease 3s forwards;
    pointer-events: auto;
}

.toast.toast-error {
    border-color: #ef4444;
    color: #fca5a5;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-10px); }
}

/* Version bar — subtle footer on game/players pages */
.app-version-bar {
    text-align: center;
    padding: 4px 0;
    flex-shrink: 0;
}

.app-version {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.4;
    letter-spacing: 0.5px;
}

/* ================================================================
   Fullscreen mode
   ================================================================ */
.fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 12;
    appearance: none;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}

.fullscreen-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.fs-controls-overlay {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    transition: opacity 0.3s;
}

.fs-controls-overlay .fs-ctrl {
    flex-shrink: 0;
}

.fs-controls-overlay .fs-timeline {
    flex: 1;
    margin: 0 4px;
}

.fs-exit-btn {
    margin-left: auto;
}

/* Fullscreen (always CSS-based pseudo-fullscreen) */
.body-pseudo-fs {
    overflow: hidden !important;
}

.court-container.pseudo-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    background: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0 !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    flex: none !important;
}

.court-container.pseudo-fullscreen #court-canvas {
    max-width: 100vw;
    max-height: 100vh;
}

.court-container.pseudo-fullscreen .fs-controls-overlay {
    display: flex;
}

.court-container.pseudo-fullscreen .fullscreen-btn {
    display: none;
}

.court-container.pseudo-fullscreen .fs-controls-overlay.fs-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Event text overlay — shown in fullscreen and mobile landscape */
.fs-event-text {
    display: none;
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    max-width: 80%;
    padding: 5px 14px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s;
}

.court-container.pseudo-fullscreen .fs-event-text {
    display: block;
}

@media (max-width: 768px) and (orientation: landscape) {
    .fs-event-text {
        display: block;
    }
}

/* ================================================================
   Mobile responsive — Game page
   ================================================================ */
@media (max-width: 768px) {
    html, body {
        overflow: auto;
    }

    .main {
        height: auto;
        min-height: 100vh;
        padding: 4px 6px;
    }

    .content-grid {
        height: auto;
        gap: 6px;
    }

    .left-column {
        min-height: auto;
    }

    .header-top {
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-controls {
        margin-left: 0;
        width: 100%;
    }

    .select-group {
        flex: 1;
    }

    .select-group select {
        min-width: 0;
        width: 100%;
    }

    .court-container {
        aspect-ratio: 106 / 62;
        flex: none;
        width: 100%;
        max-height: 60vh;
    }

    .controls-bar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 6px 8px;
    }

    .timeline-group {
        order: 10;
        flex-basis: 100%;
        margin: 2px 0 0;
    }

    .select-group-speed {
        margin-left: auto;
    }

    .select-group-speed select {
        min-width: 60px;
    }

    .pbp-section {
        max-height: 160px;
    }

    .stats-panel {
        width: 100%;
    }

    .stats-drawer-toggle.drawer-open {
        right: 0;
        display: none;
    }

    .stats-panel.drawer-open {
        box-shadow: none;
    }

    .stats-section .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
        font-size: 8px;
        padding: 2px 2px;
    }

    .stats-section .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
        padding: 2px 2px;
        font-size: 9px;
    }

    .scoreboard-overlay {
        padding: 3px 4px;
    }

    .sb-score {
        font-size: 17px;
    }

    .sb-abbr {
        font-size: 11px;
    }

    .sb-clock {
        font-size: 13px;
    }

    .sb-team {
        gap: 5px;
        padding: 0 6px;
    }

    .debug-info-container {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 13px;
    }

    .select-group label {
        font-size: 9px;
    }

    .select-group select {
        font-size: 11px;
        padding: 3px 20px 3px 6px;
    }

    .control-btn {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    .control-btn-play {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .frame-counter {
        font-size: 10px;
        min-width: 50px;
    }
}
