/* ==================== CSS VARIABLES ==================== */
:root {
    /* Background colors */
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-tertiary: #1a1a3a;
    --bg-card: rgba(30, 30, 60, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Billiard specific colors */
    --felt-green: #0a5f2c;
    --felt-dark: #074a23;
    --felt-light: #0d7a38;
    --cushion-brown: #4a2c0a;
    --cushion-dark: #3a2008;
    --wood-light: #8b6914;
    --pocket-dark: #1a1a1a;

    /* Ball colors */
    --ball-red: #dc2626;
    --ball-yellow: #fbbf24;
    --ball-green: #16a34a;
    --ball-brown: #92400e;
    --ball-blue: #2563eb;
    --ball-pink: #ec4899;
    --ball-black: #1f2937;
    --ball-white: #f8fafc;

    /* Accent colors */
    --accent: #16a34a;
    --accent-light: #22c55e;
    --accent-glow: rgba(22, 163, 74, 0.4);
    --gold: #fbbf24;
    --gold-glow: rgba(251, 191, 36, 0.5);

    /* Status colors */
    --success: #00d26a;
    --warning: #ffc048;
    --error: #ff4757;

    /* Shadows and effects */
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at top, rgba(22, 163, 74, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(251, 191, 36, 0.1) 0%, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==================== HOME BUTTON ==================== */
.home-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    z-index: 1000;
}

.home-button:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.home-button svg {
    width: 24px;
    height: 24px;
}

/* ==================== SCREENS ==================== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* ==================== MENU ==================== */
.menu-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.logo {
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 5rem;
    margin-bottom: 16px;
    animation: ballFloat 3s ease-in-out infinite;
}

@keyframes ballFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(10deg);
    }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Player Info */
.player-info {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

.player-info input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.player-info input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--gold);
    font-weight: 600;
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--gold), #f59e0b);
    color: #1a1a1a;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px var(--gold-glow);
}

.btn-tertiary {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-tertiary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    padding: 12px;
}

.btn-back:hover {
    color: var(--text-primary);
}

.btn-copy {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 12px 20px;
    font-size: 0.95rem;
}

.btn-copy:hover {
    background: var(--accent);
}

/* ==================== MODAL CONTAINER ==================== */
.modal-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-container h2 {
    font-size: 1.6rem;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-container input {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.modal-container input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Variant Buttons */
.variant-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.variant-btn {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    color: var(--text-primary);
}

.variant-btn:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.variant-icon {
    font-size: 2rem;
    margin-right: 16px;
    min-width: 50px;
    text-align: center;
}

.variant-details {
    display: flex;
    flex-direction: column;
}

.variant-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.variant-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.difficulty-btn {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    color: var(--text-primary);
}

.difficulty-btn:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.difficulty-icon {
    font-size: 2rem;
    margin-right: 16px;
}

.difficulty-details {
    display: flex;
    flex-direction: column;
}

.difficulty-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.difficulty-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.difficulty-btn.easy:hover {
    border-color: var(--success);
}

.difficulty-btn.medium:hover {
    border-color: var(--warning);
}

.difficulty-btn.hard:hover {
    border-color: var(--error);
}

/* Waiting Screen */
.modal-container.waiting {
    padding: 50px 40px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-glass);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.room-code {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--accent-light);
    background: var(--bg-glass);
    padding: 16px 24px;
    border-radius: var(--border-radius-sm);
    margin: 20px 0;
    font-family: monospace;
}

.queue-position {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ==================== GAME SCREEN ==================== */
.game-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 1600px;
    padding: 20px;
    gap: 16px;
}

/* Players Bar */
.players-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.player.active {
    background: var(--bg-glass);
    box-shadow: var(--shadow-sm);
}

.player-avatar {
    font-size: 2rem;
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-name {
    font-weight: 600;
    font-size: 1rem;
}

.player-score {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
}

.break-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
}

.break-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.break-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.turn-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-glass);
    transition: var(--transition);
}

.turn-indicator.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.game-variant-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.frame-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.frame-display span:first-child {
    font-size: 1.5rem;
    font-weight: 700;
}

.frame-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.balls-remaining {
    display: flex;
    gap: 4px;
}

/* ==================== GAME AREA ==================== */
.game-area {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

/* Table Container */
.table-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
    position: relative;
}

.target-ball-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    width: fit-content;
}

.target-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.target-ball {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ball-red);
    box-shadow: inset -3px -3px 6px rgba(0, 0, 0, 0.3),
        inset 3px 3px 6px rgba(255, 255, 255, 0.2);
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

/* Spin Control */
.spin-control {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.spin-ball {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, #e0e0e0);
    box-shadow: inset -4px -4px 10px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    cursor: pointer;
}

.spin-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--ball-red);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.spin-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.spin-labels span {
    position: absolute;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.spin-top {
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
}

.spin-bottom {
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
}

.spin-left {
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
}

.spin-right {
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
}

/* Power Gauge */
.power-gauge-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: var(--transition);
}

.power-gauge-container.active {
    opacity: 1;
}

.power-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.power-bar {
    width: 20px;
    height: 150px;
    background: var(--bg-glass);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.power-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(to top, var(--success), var(--warning), var(--error));
    border-radius: 10px;
    transition: height 0.05s linear;
}

.power-marker {
    position: absolute;
    left: -4px;
    right: -4px;
    height: 4px;
    background: white;
    border-radius: 2px;
    bottom: 0;
    transition: bottom 0.05s linear;
}

.power-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
}

/* Shot Info */
.shot-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
}

.shot-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.shot-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gold);
}

/* ==================== SIDE PANEL ==================== */
.side-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 14px 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.tab-btn:hover:not(.active) {
    color: var(--text-secondary);
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.tab-content.active {
    display: flex;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
}

/* Ball Status */
.ball-status {
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    padding: 12px;
}

.ball-status h4 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.ball-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ball-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.ball-indicator.potted {
    opacity: 0.3;
    transform: scale(0.8);
}

.ball-indicator.red {
    background: var(--ball-red);
}

.ball-indicator.yellow {
    background: var(--ball-yellow);
}

.ball-indicator.green {
    background: var(--ball-green);
}

.ball-indicator.brown {
    background: var(--ball-brown);
}

.ball-indicator.blue {
    background: var(--ball-blue);
}

.ball-indicator.pink {
    background: var(--ball-pink);
}

.ball-indicator.black {
    background: var(--ball-black);
}

.ball-indicator.white {
    background: var(--ball-white);
}

/* Chat */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    padding: 8px 12px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
}

.chat-message .author {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.85rem;
}

.chat-message .text {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.chat-message.system {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-send {
    padding: 10px 16px;
    background: var(--accent);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.btn-send:hover {
    background: var(--accent-light);
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    padding: 10px 14px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-player {
    font-weight: 600;
    font-size: 0.85rem;
}

.history-action {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.history-points {
    font-weight: 700;
    color: var(--gold);
}

.history-points.foul {
    color: var(--error);
}

/* ==================== MODALS ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h2 {
    font-size: 1.6rem;
    margin-bottom: 16px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Foul Modal */
.modal-content.foul .foul-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.foul-points {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px;
}

.foul-label {
    color: var(--text-secondary);
}

.foul-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--error);
}

/* Free Ball Modal */
.modal-content.free-ball .free-ball-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* Game Over Modal */
.modal-content.game-over .result-icon {
    font-size: 5rem;
    margin-bottom: 16px;
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.final-stat {
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
}

.final-stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.final-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
}

.rating-change {
    margin-bottom: 24px;
    font-size: 1.1rem;
}

.rating-change.positive {
    color: var(--success);
}

.rating-change.negative {
    color: var(--error);
}

.game-over-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.rematch-status {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Respot Modal */
.modal-content.respot .respot-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .game-area {
        grid-template-columns: 1fr;
    }

    .side-panel {
        max-height: 250px;
    }
}

@media (max-width: 768px) {
    .players-bar {
        flex-direction: column;
        gap: 16px;
    }

    .player {
        width: 100%;
        justify-content: center;
    }

    .break-display {
        display: none;
    }

    .spin-control {
        bottom: 10px;
        left: 10px;
        padding: 10px;
    }

    .spin-ball {
        width: 60px;
        height: 60px;
    }

    .power-gauge-container {
        bottom: 10px;
        right: 10px;
        padding: 10px;
    }

    .power-bar {
        height: 100px;
    }

    .final-stats {
        grid-template-columns: 1fr;
    }
}