* {
            box-sizing: border-box;
        }

        :root {
            --bg: #0d0d0f;
            --surface: #17171a;
            --surface-2: #202024;
            --surface-3: #29292e;
            --text: #ffffff;
            --muted: #929299;
            --accent: #7657ff;
            --accent-hover: #866cff;
            --danger: #d94b4b;
            --border: rgba(255,255,255,0.07);
        }

        html {
            background: var(--bg);
        }

        body {
            margin: 0;
            min-height: 100vh;
            font-family:
                Inter,
                system-ui,
                -apple-system,
                BlinkMacSystemFont,
                "Segoe UI",
                sans-serif;
            background:
                radial-gradient(
                    circle at top,
                    rgba(118,87,255,0.10),
                    transparent 500px
                ),
                var(--bg);
            color: var(--text);
        }

        button,
        input,
        select {
            font: inherit;
        }

        button {
            border: 0;
        }

        main {
            width: min(1100px, calc(100% - 32px));
            margin: 0 auto;
            padding: 42px 0 70px;
        }

        /* ---------------------------------------------------------
           HEADER
        --------------------------------------------------------- */

        .header {
            margin-bottom: 32px;
        }

        .title {
            margin: 0;
            font-size: clamp(2rem, 5vw, 3rem);
            letter-spacing: -0.04em;
        }

        .subtitle {
            margin: 8px 0 0;
            color: var(--muted);
            font-size: 1rem;
        }

        /* ---------------------------------------------------------
           LIVE CAMERA
        --------------------------------------------------------- */

        .live-section {
            margin-bottom: 42px;
        }

        .live-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 16px;
        }

        .section-title {
            margin: 0;
            font-size: 1.15rem;
        }

        .live-status {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.08em;
            color: #ff4d4d;
        }

        .live-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #ff4d4d;
            box-shadow: 0 0 10px rgba(255,77,77,.65);
            animation: live-pulse 1.5s ease-in-out infinite;
        }

        @keyframes live-pulse {
            0%, 100% {
                opacity: 1;
            }

            50% {
                opacity: .35;
            }
        }

        .live-player {
            position: relative;
            width: 100%;
            aspect-ratio: 16 / 9;
            overflow: hidden;
            border-radius: 16px;
            background: #090909;
            box-shadow: 0 12px 35px rgba(0,0,0,.25);
        }

        .live-player img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: contain;
            background: #090909;
        }

        .live-loading {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(255,255,255,.65);
            font-size: 14px;
            pointer-events: none;
        }

        .live-player.live-connected .live-loading {
            display: none;
        }

        /* ---------------------------------------------------------
           GAME
        --------------------------------------------------------- */

        .game-section {
            margin-bottom: 22px;
            padding: 22px;
            border: 1px solid var(--border);
            border-radius: 22px;
            background: rgba(23,23,26,.88);
            backdrop-filter: blur(10px);
        }

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

        .game-status {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #55d88a;
            font-size: .8rem;
            font-weight: 800;
            letter-spacing: .07em;
            text-transform: uppercase;
        }

        .game-status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #55d88a;
            box-shadow: 0 0 10px rgba(85,216,138,.55);
        }

        .game-empty {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
        }

        .game-empty-text {
            color: var(--muted);
            font-size: .92rem;
        }

        .game-active {
            margin-top: 16px;
            padding: 18px;
            border-radius: 16px;
            background: var(--surface-2);
            border: 1px solid var(--border);
        }

        .game-matchup {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            gap: 18px;
            text-align: center;
        }

        .game-team {
            font-size: 1.15rem;
            font-weight: 750;
        }

        .game-vs {
            color: var(--muted);
            font-size: .8rem;
            font-weight: 800;
            letter-spacing: .08em;
        }

        .game-type {
            margin-top: 8px;
            color: var(--muted);
            font-size: .8rem;
        }

        .game-score-status {
            margin-top: 14px;
            text-align: center;
            color: var(--muted);
            font-size: .84rem;
            font-weight: 700;
        }

        .game-score {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: stretch;
            gap: 12px;
            margin-top: 12px;
        }

        .game-score-button {
            min-height: 100px;
            padding: 14px;
            border: 1px solid var(--border);
            border-radius: 16px;
            background: var(--surface-2);
            color: var(--text);
            cursor: pointer;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition:
                transform .15s ease,
                background .15s ease,
                border-color .15s ease;
        }

        .game-score-button:hover {
            background: var(--surface-3);
            border-color: var(--accent);
            transform: translateY(-2px);
        }

        .game-score-button:active {
            transform: scale(.97);
        }

        .game-score-player {
            font-size: .9rem;
            font-weight: 700;
            text-align: center;
            word-break: break-word;
        }

        .game-score-number {
            font-size: 2.1rem;
            font-weight: 850;
            line-height: 1;
        }

        .game-score-divider {
            align-self: center;
            color: var(--muted);
            font-size: 1.8rem;
            font-weight: 700;
        }

        .game-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 16px;
        }

        .game-button {
            min-height: 44px;
            padding: 0 16px;
            border-radius: 12px;
            background: var(--accent);
            color: white;
            font-weight: 700;
            cursor: pointer;
        }

        .game-button:hover {
            background: var(--accent-hover);
        }

        .game-button.secondary {
            background: var(--surface-3);
        }

        .game-button.danger {
            background: var(--danger);
        }

        .game-form {
            margin-top: 18px;
        }

        .game-type-buttons {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 18px;
        }

        .game-type-button {
            min-height: 48px;
            border-radius: 12px;
            background: var(--surface-2);
            color: var(--muted);
            border: 1px solid var(--border);
            font-weight: 750;
            cursor: pointer;
        }

        .game-type-button.active {
            background: var(--accent);
            color: white;
            border-color: transparent;
        }

        .game-teams {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 14px;
        }

        .game-team-form {
            padding: 16px;
            border-radius: 14px;
            background: var(--surface-2);
            border: 1px solid var(--border);
        }

        .game-team-label {
            margin-bottom: 10px;
            font-size: .8rem;
            font-weight: 800;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: .07em;
        }

        .game-player-input-wrap {
            position: relative;
        }

        .game-player-input {
            width: 100%;
            height: 44px;
            margin-bottom: 8px;
            padding: 0 12px;
            border: 1px solid var(--border);
            border-radius: 10px;
            outline: none;
            background: var(--surface);
            color: white;
        }

        .game-player-input:focus {
            border-color: var(--accent);
        }

        .game-player-suggestions {
            position: absolute;
            top: 44px;
            left: 0;
            right: 0;
            z-index: 100;
            max-height: 180px;
            overflow-y: auto;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 0 0 10px 10px;
            box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
        }

        .game-player-suggestions.open-up {
            top: auto;
            bottom: calc(100% + 3px);
            border-radius: 10px;
        }

        .game-player-suggestion {
            padding: 10px 12px;
            cursor: pointer;
            color: white;
        }

        .game-player-suggestion:hover,
        .game-player-suggestion.active {
            background: var(--border);
        }

        .game-form-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 14px;
        }

        .game-error {
            margin-top: 12px;
            color: #ff7777;
            font-size: .9rem;
        }

        .hidden {
            display: none !important;
        }

        @media (max-width: 650px) {

            .game-empty {
                align-items: stretch;
                flex-direction: column;
            }

            .game-empty .game-button {
                width: 100%;
            }

            .game-matchup {
                grid-template-columns: 1fr;
                gap: 8px;
            }

            .game-vs {
                order: 2;
            }

            .game-teams {
                grid-template-columns: 1fr;
            }

            .game-actions,
            .game-form-actions {
                flex-direction: column;
            }

            .game-button {
                width: 100%;
            }
        }

        /* ---------------------------------------------------------
           GAME
        --------------------------------------------------------- */

        .game-section {
            margin-bottom: 24px;
            padding: 22px;
            border: 1px solid var(--border);
            border-radius: 22px;
            background: rgba(23,23,26,.88);
            backdrop-filter: blur(10px);
        }

        .game-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 20px;
        }

        .game-subtitle {
            margin: 7px 0 0;
            color: var(--muted);
            font-size: .9rem;
        }

        .active-game-badge {
            flex-shrink: 0;
            padding: 8px 11px;
            border-radius: 999px;
            background: rgba(70,190,110,.12);
            color: #62d889;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: .06em;
        }

        .active-game-badge::first-letter {
            color: #62d889;
        }

        .game-type-buttons {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 20px;
        }

        .game-type-button {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            padding: 16px;
            border: 1px solid var(--border);
            border-radius: 14px;
            background: var(--surface-2);
            color: var(--text);
            cursor: pointer;
            text-align: left;
            transition:
                border-color .15s ease,
                background .15s ease,
                transform .15s ease;
        }

        .game-type-button:hover {
            transform: translateY(-1px);
        }

        .game-type-button.active {
            border-color: var(--accent);
            background: rgba(118,87,255,.14);
        }

        .game-type-button strong {
            font-size: 1.1rem;
        }

        .game-type-button span {
            color: var(--muted);
            font-size: .8rem;
        }

        .teams {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            gap: 16px;
        }

        .team {
            min-width: 0;
        }

        .team-title {
            margin-bottom: 9px;
            color: var(--muted);
            font-size: .8rem;
            font-weight: 750;
            text-transform: uppercase;
            letter-spacing: .08em;
        }

        .player-input {
            width: 100%;
            height: 48px;
            margin-bottom: 9px;
            padding: 0 14px;
            border: 1px solid var(--border);
            border-radius: 12px;
            outline: none;
            background: var(--surface);
            color: white;
        }

        .player-input:focus {
            border-color: var(--accent);
        }

        .vs,
        .active-vs {
            color: var(--muted);
            font-size: .8rem;
            font-weight: 850;
            letter-spacing: .08em;
        }

        .start-game-button {
            width: 100%;
            min-height: 52px;
            margin-top: 8px;
            border-radius: 14px;
            background: var(--accent);
            color: white;
            font-weight: 800;
            cursor: pointer;
            transition:
                background .15s ease,
                transform .15s ease,
                opacity .15s ease;
        }

        .start-game-button:hover:not(:disabled) {
            background: var(--accent-hover);
            transform: translateY(-1px);
        }

        .start-game-button:disabled {
            opacity: .45;
            cursor: not-allowed;
        }

        .game-error {
            margin-top: 12px;
            padding: 12px 14px;
            border-radius: 12px;
            background: rgba(217,75,75,.12);
            color: #ff7777;
            font-size: .9rem;
        }

        .active-game-panel {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
            padding: 18px;
            border-radius: 16px;
            background: var(--surface-2);
            border: 1px solid var(--border);
        }

        .active-game-type {
            margin-bottom: 9px;
            color: var(--muted);
            font-size: .75rem;
            font-weight: 800;
            letter-spacing: .08em;
            text-transform: uppercase;
        }

        .active-teams {
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .active-team {
            display: flex;
            flex-wrap: wrap;
            gap: 7px;
        }

        .player-tag {
            display: inline-flex;
            align-items: center;
            min-height: 30px;
            padding: 5px 10px;
            border-radius: 999px;
            background: rgba(118,87,255,.16);
            color: #ddd6ff;
            font-size: .85rem;
            font-weight: 700;
        }

        .active-game-started {
            margin-top: 8px;
            color: var(--muted);
            font-size: .78rem;
        }

        .end-game-button {
            flex-shrink: 0;
            min-height: 44px;
            padding: 0 18px;
            border-radius: 12px;
            background: rgba(217,75,75,.14);
            color: #ff7777;
            font-weight: 750;
            cursor: pointer;
        }

        .end-game-button:hover {
            background: rgba(217,75,75,.22);
        }

        .hidden {
            display: none !important;
        }


        /* ---------------------------------------------------------
           RECORD
        --------------------------------------------------------- */

        .record-section {
            padding: 22px;
            border: 1px solid var(--border);
            border-radius: 22px;
            background: rgba(23,23,26,.88);
            backdrop-filter: blur(10px);
        }

        .record-buttons {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 12px;
            margin-top: 16px;
        }

        .record-button {
            min-height: 74px;
            padding: 18px 12px;
            border-radius: 16px;
            background: var(--accent);
            color: white;
            font-size: 1.25rem;
            font-weight: 750;
            cursor: pointer;
            transition:
                transform .15s ease,
                background .15s ease,
                opacity .15s ease,
                box-shadow .15s ease;
        }

        .record-button:hover:not(:disabled) {
            background: var(--accent-hover);
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(118,87,255,.22);
        }

        .record-button:active:not(:disabled) {
            transform: scale(.98);
        }

        .record-button:disabled {
            opacity: .35;
            cursor: not-allowed;
        }

        /* ---------------------------------------------------------
           PROCESSING
        --------------------------------------------------------- */

        .processing {
            margin-top: 18px;
            padding: 18px;
            border-radius: 16px;
            background: var(--surface-2);
            border: 1px solid var(--border);
        }

        .processing.hidden {
            display: none;
        }

        .processing-header {
            display: flex;
            justify-content: space-between;
            gap: 16px;
            align-items: center;
            margin-bottom: 12px;
        }

        .processing-title {
            font-weight: 700;
        }

        .processing-percent {
            color: var(--muted);
            font-variant-numeric: tabular-nums;
        }

        .progress-track {
            height: 12px;
            overflow: hidden;
            border-radius: 999px;
            background: #303035;
        }

        .progress-fill {
            height: 100%;
            width: 0%;
            border-radius: inherit;
            background: var(--accent);
            transition: width .25s ease;
        }

        .processing-stage {
            margin-top: 9px;
            color: var(--muted);
            font-size: .9rem;
        }

        /* ---------------------------------------------------------
           LIBRARY
        --------------------------------------------------------- */

        .library {
            margin-top: 42px;
        }

        .library-header {
            display: flex;
            justify-content: space-between;
            align-items: end;
            gap: 20px;
            margin-bottom: 18px;
        }

        .library-header h2 {
            margin: 0;
            font-size: 1.5rem;
        }

        .library-count {
            color: var(--muted);
            font-size: .9rem;
        }

        .tools {
            display: grid;
            grid-template-columns: 1fr auto auto auto;
            gap: 10px;
            margin-bottom: 18px;
        }

        .search {
            min-width: 0;
            height: 46px;
            padding: 0 14px;
            border: 1px solid var(--border);
            border-radius: 12px;
            outline: none;
            background: var(--surface);
            color: white;
        }

        .search:focus {
            border-color: var(--accent);
        }

        .filter {
            height: 46px;
            padding: 0 12px;
            border: 1px solid var(--border);
            border-radius: 12px;
            outline: none;
            background: var(--surface);
            color: white;
        }

        .filter:focus {
            border-color: var(--accent);
        }

        .favorites-toggle {
            min-height: 44px;
            padding: 10px 16px;
            border-radius: 10px;
            background: var(--surface-3);
            color: var(--text);
            cursor: pointer;
            font-weight: 650;
            white-space: nowrap;
            transition: .15s ease;
        }

        .favorites-toggle:hover {
            filter: brightness(1.12);
        }

        .favorites-toggle.active {
            background: var(--accent);
            color: white;
        }

        /* ---------------------------------------------------------
           REPLAY GRID
        --------------------------------------------------------- */

        .replay-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 18px;
        }

        .replay-card {
            overflow: hidden;
            border: 1px solid var(--border);
            border-radius: 18px;
            background: var(--surface);
            transition:
                transform .18s ease,
                border-color .18s ease,
                box-shadow .18s ease;
        }

        .replay-card:hover {
            transform: translateY(-2px);
            border-color: rgba(255,255,255,.12);
            box-shadow: 0 14px 35px rgba(0,0,0,.22);
        }

        .thumbnail-wrap {
            position: relative;
            cursor: pointer;
            background: #090909;
            overflow: hidden;
        }

        .thumbnail-wrap::after {
            content: "▶";
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            width: 54px;
            height: 54px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: rgba(0,0,0,.72);
            color: white;
            font-size: 22px;
            padding-left: 3px;
            opacity: .9;
            pointer-events: none;
            transition:
                transform .15s ease,
                opacity .15s ease;
        }

        .thumbnail-wrap:hover::after {
            transform: translate(-50%,-50%) scale(1.08);
            opacity: 1;
        }

        .thumbnail {
            display: block;
            width: 100%;
            aspect-ratio: 16 / 9;
            object-fit: cover;
        }

        .duration {
            position: absolute;
            right: 10px;
            bottom: 10px;
            padding: 4px 7px;
            border-radius: 7px;
            background: rgba(0,0,0,.75);
            font-size: .8rem;
            font-weight: 700;
        }

        .thumbnail-favorite {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 42px;
            height: 42px;
            min-height: 42px;
            padding: 0;
            border-radius: 50%;
            background: rgba(0,0,0,.65);
            color: white;
            font-size: 1.5rem;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            backdrop-filter: blur(5px);
            transition:
                transform .15s ease,
                background .15s ease;
        }

        .thumbnail-favorite:hover {
            transform: scale(1.08);
            background: rgba(0,0,0,.8);
        }

        .thumbnail-favorite.is-favorite {
            color: #ffd84d;
        }

        /* ---------------------------------------------------------
           REPLAY BODY
        --------------------------------------------------------- */

        .replay-body {
            padding: 15px;
        }

        .replay-title-row {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 10px;
        }

        .replay-title-info {
            min-width: 0;
        }

        .replay-name {
            margin: 0;
            font-size: 1.08rem;
            font-weight: 750;
            word-break: break-word;
        }

        .replay-date {
            margin-top: 5px;
            color: var(--muted);
            font-size: .84rem;
        }

        .replay-game-info {
            margin-top: 8px;
            color: var(--text);
            font-size: .88rem;
            font-weight: 650;
            opacity: .9;
            word-break: break-word;
        }

        .action-delete-small {
            flex: 0 0 auto;
            width: 36px;
            height: 36px;
            min-height: 36px;
            padding: 0;
            border-radius: 9px;
            background: rgba(217,75,75,.14);
            color: #ff7777;
            cursor: pointer;
            font-size: 1.05rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition:
                background .15s ease,
                transform .15s ease;
        }

        .action-delete-small:hover {
            background: rgba(217,75,75,.28);
            transform: scale(1.05);
        }

        .action-delete-small:active {
            transform: scale(.95);
        }

        .replay-actions {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 8px;
            margin-top: 14px;
        }

        .action {
            min-height: 42px;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 650;
            transition:
                transform .15s ease,
                filter .15s ease;
        }

        .action:hover {
            filter: brightness(1.12);
            transform: translateY(-1px);
        }

        .action:active {
            transform: scale(.98);
        }

        .action-play {
            background: var(--accent);
            color: white;
        }

        .action-secondary,
        .action-share {
            background: var(--surface-3);
            color: white;
        }

        .empty {
            grid-column: 1 / -1;
            padding: 45px 20px;
            text-align: center;
            border-radius: 18px;
            border: 1px dashed var(--border);
            color: var(--muted);
        }

        /* ---------------------------------------------------------
           MODALS
        --------------------------------------------------------- */

        .modal-overlay {
            position: fixed;
            inset: 0;
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            background: rgba(0,0,0,.78);
            backdrop-filter: blur(8px);
        }

        .modal {
            width: min(100%, 460px);
            padding: 24px;
            border-radius: 20px;
            background: var(--surface-2);
            border: 1px solid var(--border);
            box-shadow: 0 25px 80px rgba(0,0,0,.55);
        }

        .modal h3 {
            margin: 0 0 8px;
            font-size: 1.35rem;
        }

        .modal-text {
            margin: 0 0 18px;
            color: var(--muted);
            line-height: 1.5;
        }

        .modal-input {
            width: 100%;
            height: 52px;
            padding: 0 14px;
            border: 1px solid #3b3b42;
            border-radius: 12px;
            outline: none;
            background: var(--bg);
            color: white;
        }

        .modal-input:focus {
            border-color: var(--accent);
        }

        .modal-buttons {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-top: 18px;
        }

        .modal-button {
            min-height: 48px;
            border-radius: 12px;
            cursor: pointer;
            font-weight: 700;
        }

        .modal-cancel {
            background: var(--surface-3);
            color: white;
        }

        .modal-confirm {
            background: var(--accent);
            color: white;
        }

        .modal-danger {
            background: var(--danger);
            color: white;
        }

        .player-profile-modal {
            width: min(100%, 560px);
            max-height: calc(100vh - 40px);
            overflow-y: auto;
        }

        .player-profile-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 20px;
        }

        .player-profile-name {
            margin: 0;
            font-size: 1.5rem;
        }

        .player-profile-close {
            width: 40px;
            height: 40px;
            min-height: 40px;
            padding: 0;
            border-radius: 50%;
            background: var(--surface-3);
            color: white;
            cursor: pointer;
            font-size: 20px;
        }

        .player-profile-record {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            margin-bottom: 20px;
        }

        .player-profile-stat {
            padding: 14px;
            border-radius: 12px;
            background: var(--surface-3);
        }

        .player-profile-stat-label {
            display: block;
            margin-bottom: 4px;
            font-size: 12px;
            color: var(--muted);
        }

        .player-profile-stat-value {
            font-size: 1.25rem;
            font-weight: 750;
        }

        .player-profile-section {
            margin-top: 20px;
        }

        .player-profile-section h4 {
            margin: 0 0 10px;
            font-size: 14px;
        }

        .player-profile-types {
            width: 100%;
            border-collapse: collapse;
        }

        .player-profile-types th,
        .player-profile-types td {
            padding: 9px 6px;
            text-align: left;
            border-top: 1px solid rgba(255,255,255,.07);
        }

        .player-profile-types th {
            font-size: 12px;
            opacity: .55;
        }

        .player-profile-player {
            cursor: pointer;
        }

        .player-profile-player:hover {
            text-decoration: underline;
        }

        @media (max-width: 600px) {
            .player-profile-modal {
                width: 100%;
                max-height: calc(100vh - 24px);
            }

            .player-profile-record {
                grid-template-columns: 1fr 1fr;
            }
        }

        .share-url {
            display: flex;
            gap: 8px;
        }

        .share-url .modal-input {
            flex: 1;
            min-width: 0;
        }

        .share-copy {
            flex: 0 0 auto;
            width: 100px;
            min-height: 52px;
            border-radius: 12px;
            background: var(--accent);
            color: white;
            font-weight: 700;
            cursor: pointer;
        }

        .share-copy:hover {
            background: var(--accent-hover);
        }

        /* ---------------------------------------------------------
           VIDEO VIEWER
        --------------------------------------------------------- */

        .viewer {
            width: min(1100px,100%);
            max-height: calc(100vh - 40px);
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

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

        .viewer-title {
            margin: 0;
            font-size: 1.35rem;
            font-weight: 750;
            word-break: break-word;
        }

        .viewer-close {
            flex: 0 0 auto;
            width: 44px;
            height: 44px;
            min-height: 44px;
            padding: 0;
            border-radius: 50%;
            background: var(--surface-3);
            color: white;
            font-size: 1.4rem;
            cursor: pointer;
        }

        .viewer video {
            display: block;
            width: 100%;
            max-height: 68vh;
            border-radius: 14px;
            background: black;
            object-fit: contain;
        }

        .viewer-info {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            color: var(--muted);
            font-size: .9rem;
        }

        .viewer-controls {
            display: grid;
            grid-template-columns: 1fr 1fr auto auto auto;
            gap: 10px;
        }

        .viewer-control {
            min-height: 46px;
            padding: 10px 14px;
            border-radius: 11px;
            background: var(--surface-3);
            color: white;
            font-size: .95rem;
            font-weight: 650;
            cursor: pointer;
        }

        .viewer-control:hover {
            filter: brightness(1.15);
        }

        .viewer-download {
            display: flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
        }

        .viewer-speed {
            min-height: 46px;
            padding: 0 12px;
            border-radius: 11px;
            background: var(--surface-3);
            color: white;
            font-size: .95rem;
        }

        /* ---------------------------------------------------------
           LOGIN
        --------------------------------------------------------- */

        .login-screen {
            position: fixed;
            inset: 0;
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: #0b0d12;
        }

        .login-card {
            width: min(420px,100%);
            padding: 32px;
            border-radius: 20px;
            background: #151922;
            border: 1px solid rgba(255,255,255,.08);
            box-shadow: 0 24px 80px rgba(0,0,0,.45);
        }

        .login-icon {
            font-size: 3rem;
            text-align: center;
            margin-bottom: 8px;
        }

        .login-card h1 {
            margin: 0;
            text-align: center;
        }

        .login-subtitle {
            text-align: center;
            opacity: .65;
            margin: 8px 0 28px;
        }

        .login-card label {
            display: block;
            margin: 14px 0 6px;
            font-size: .9rem;
            opacity: .8;
        }

        .login-card input {
            width: 100%;
            padding: 13px 14px;
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,.12);
            background: #0d1016;
            color: inherit;
            outline: none;
        }

        .login-card input:focus {
            border-color: rgba(255,255,255,.35);
        }

        .login-card button {
            width: 100%;
            margin-top: 22px;
            padding: 13px;
            border-radius: 10px;
            background: white;
            color: #111;
            font-weight: 700;
            cursor: pointer;
        }

        .login-card button:disabled {
            opacity: .6;
            cursor: wait;
        }

        .login-error {
            min-height: 20px;
            margin-top: 12px;
            text-align: center;
            color: #ff7777;
            font-size: .9rem;
        }

        .app-hidden {
            visibility: hidden;
        }

        .app-visible {
            visibility: visible;
        }

        /* ---------------------------------------------------------
           MOBILE
        --------------------------------------------------------- */

        @media (max-width: 700px) {
            main {
                width: min(calc(100% - 20px),520px);
                padding-top: 24px;
            }

            .live-section {
                margin-bottom: 32px;
            }

            .live-header {
                margin-bottom: 12px;
            }

            .live-player {
                border-radius: 12px;
            }

            .record-section {
                padding: 16px;
                border-radius: 18px;
            }

            .record-buttons {
                grid-template-columns: 1fr;
                gap: 10px;
            }

            .record-button {
                min-height: 84px;
                font-size: 1.4rem;
            }

            .replay-grid {
                grid-template-columns: 1fr;
            }

            .library-header {
                align-items: start;
                flex-direction: column;
                gap: 5px;
            }

            .tools {
                grid-template-columns: 1fr 1fr;
                gap: 10px;
            }

            .tools .search {
                grid-column: 1 / -1;
                width: 100%;
            }

            .tools .filter,
            .tools .favorites-toggle {
                width: 100%;
            }

            .viewer {
                width: 100%;
                max-height: calc(100vh - 24px);
                gap: 10px;
            }

            .viewer video {
                max-height: 55vh;
                border-radius: 10px;
            }

            .viewer-title {
                font-size: 1.15rem;
            }

            .viewer-info {
                font-size: .82rem;
            }

            .viewer-controls {
                grid-template-columns: 1fr 1fr;
            }

            .viewer-control,
            .viewer-speed {
                min-height: 48px;
            }

            .share-url {
                flex-direction: column;
            }

            .share-copy {
                width: 100%;
            }
        }
    
        .overall-leaderboard {
            margin-top: 24px;
            padding: 20px;
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.04);
        }

        .overall-leaderboard-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 14px;
        }

        .overall-leaderboard-title h3 {
            margin: 0;
        }

        .overall-leaderboard-table {
            width: 100%;
            border-collapse: collapse;
        }

        .overall-leaderboard-table th,
        .overall-leaderboard-table td {
            padding: 10px 8px;
            text-align: left;
        }

        .overall-leaderboard-table th {
            font-size: 12px;
            opacity: 0.55;
            font-weight: 600;
        }

        .overall-leaderboard-table td {
            border-top: 1px solid rgba(255, 255, 255, 0.07);
        }

        .overall-leaderboard-rank {
            width: 36px;
            opacity: 0.55;
        }

        .overall-leaderboard-player {
            font-weight: 600;
        }

        .overall-leaderboard-record {
            white-space: nowrap;
        }

        .overall-leaderboard-winrate {
            text-align: right !important;
            white-space: nowrap;
        }

        .overall-leaderboard-empty {
            opacity: 0.55;
            padding: 8px 0;
        }

        @media (max-width: 600px) {
            .overall-leaderboard {
                padding: 16px;
            }

            .overall-leaderboard-table th,
            .overall-leaderboard-table td {
                padding: 8px 5px;
            }

            .overall-leaderboard-table th:nth-child(4),
            .overall-leaderboard-table td:nth-child(4) {
                display: none;
            }
        }

        .session-leaderboard {
            margin-top: 24px;
            padding: 20px;
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.04);
        }

        .session-leaderboard-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 14px;
        }

        .session-leaderboard-title h3 {
            margin: 0;
        }

        .session-leaderboard-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .session-leaderboard-session {
            font-size: 12px;
            opacity: 0.55;
        }

        .session-end-button {
            border: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(255, 255, 255, 0.06);
            color: inherit;
            border-radius: 8px;
            padding: 7px 11px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
        }

        .session-end-button:hover {
            background: rgba(255, 255, 255, 0.10);
        }

        .session-end-button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .session-leaderboard-table {
            width: 100%;
            border-collapse: collapse;
        }

        .session-leaderboard-table th,
        .session-leaderboard-table td {
            padding: 10px 8px;
            text-align: left;
        }

        .session-leaderboard-table th {
            font-size: 12px;
            opacity: 0.55;
            font-weight: 600;
        }

        .session-leaderboard-table td {
            border-top: 1px solid rgba(255, 255, 255, 0.07);
        }

        .session-leaderboard-rank {
            width: 36px;
            opacity: 0.55;
        }

        .session-leaderboard-player {
            font-weight: 600;
        }

        .session-leaderboard-record {
            white-space: nowrap;
        }

        .session-leaderboard-winrate {
            text-align: right !important;
            white-space: nowrap;
        }

        .session-leaderboard-empty {
            opacity: 0.55;
            padding: 8px 0;
        }

        @media (max-width: 600px) {
            .session-leaderboard {
                padding: 16px;
            }

            .session-leaderboard-table th,
            .session-leaderboard-table td {
                padding: 8px 5px;
            }

            .session-leaderboard-table th:nth-child(3),
            .session-leaderboard-table td:nth-child(3) {
                display: none;
            }
        }


