/* === Connect 4 Trivia - Buzzer Unit Theme v1.4 === */

/* --- Use the same core variables from the main game --- */
:root {
    /* Core Palette */
    --bg-primary: #0D0F18;
    --bg-secondary: #1A1D2E;
    --accent-primary: #00FFFF;
    --accent-primary-glow: rgba(0, 255, 255, 0.5);
    --accent-secondary: #FF00FF;
    --accent-secondary-glow: rgba(255, 0, 255, 0.5);
    --text-primary: #E0E5F6;
    --text-secondary: #8A94B3;
    --text-on-accent: #0D0F18;
    --surface-glass-bg: rgba(26, 29, 46, 0.6);
    --surface-glass-border: rgba(138, 148, 179, 0.2);
    --danger-primary: #FF4040;
    --danger-glow: rgba(255, 64, 64, 0.4);
    --success-primary: #39FF14;
    --warning-primary: #FFD700;
    --info-primary: #5F9FFF;
    --shop-primary: var(--accent-secondary);
    --disabled-bg: rgba(45, 51, 78, 0.5);
    --disabled-text: #5A6382;
    --disabled-border: rgba(90, 99, 130, 0.5);
    --font-primary: 'Inter', sans-serif;
    --font-mono: 'Roboto Mono', monospace;
    --border-radius-standard: 8px;
    --border-radius-large: 12px;
    --shadow-glow-accent: 0 0 12px var(--accent-primary-glow), 0 0 20px var(--accent-primary-glow);
    --shadow-inset: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* --- Global Resets & Body --- */
html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; }
body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
    touch-action: manipulation;
    background-image:
        linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
}
*, *::before, *::after { box-sizing: border-box; }

/* --- Screen Management --- */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.screen.active { display: flex; }
#main-content {
    width: 100%;
    max-width: 450px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: filter 0.3s ease-in-out;
}

/* --- Login & Team Select --- */
.login-container {
    width: 100%;
    padding: 30px;
    background: var(--surface-glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--surface-glass-border);
    border-radius: var(--border-radius-large);
    text-align: center;
}
.login-container h1 {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    text-shadow: 0 0 8px var(--accent-primary-glow);
    margin: 0 0 30px 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.login-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.9em;
}
input[type="text"], select {
    font-family: var(--font-mono);
    font-size: 1.2em;
    padding: 12px;
    margin-bottom: 25px;
    border: 1px solid var(--surface-glass-border);
    border-radius: var(--border-radius-standard);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-inset);
    transition: all 0.2s ease;
    width: 100%;
    text-align: center;
}
input:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow), var(--shadow-inset);
    outline: none;
}
.primary-button {
    font-family: inherit;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--accent-primary);
    border-radius: var(--border-radius-standard);
    padding: 12px 25px;
    transition: all 0.2s ease;
    background-color: transparent;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.primary-button:hover:enabled {
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-glow-accent);
}
.primary-button:disabled {
    cursor: not-allowed;
    border-color: var(--disabled-border);
    color: var(--disabled-text);
    background-color: transparent;
    opacity: 0.6;
}

/* --- Main Buzzer Screen --- */
#buzzer-screen { justify-content: space-around; }
#team-info-display {
    padding: 15px 20px;
    border-radius: var(--border-radius-standard);
    border: 1px solid; /* Color set by JS */
    border-left-width: 5px; /* Added thick left border */
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    text-align: center;
    display: flex;
    flex-direction: column; /* Stack name and stats line */
    align-items: center; /* Center content horizontally */
    /* background-color set by JS */
}

/* Style for the Team Name (now the top line) */
#team-info-display .team-name {
    font-size: 1.5em; /* Make team name prominent */
    font-weight: 700;
    color: var(--text-primary); /* Primary text color */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5); /* Subtle shadow for readability */
    margin: 0 0 8px 0; /* Space below the name */
    width: 100%;
    text-align: center;
    overflow: hidden; /* Prevent overflow */
    text-overflow: ellipsis; /* Add ellipsis if name is too long */
    white-space: nowrap; /* Keep name on a single line */
}

/* NEW: Container for the stats line */
.buzzer-stats-line {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the stats group */
    width: 100%;
    font-family: var(--font-mono);
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary); /* Primary text color for labels */
    gap: 20px; /* Space between PTS and C4 items */
}

/* Style for individual stat items (PTS, C4) */
.buzzer-stats-line .stat-item {
     display: flex; /* Keep flex for label:value */
     align-items: center;
     gap: 4px; /* Space between label and value */
     flex-shrink: 0; /* Prevent shrinking */
}

/* Style for stat values */
.buzzer-stats-line .stat-item .value {
     font-weight: 700; /* Bold value */
     color: var(--warning-primary); /* Amber for values */
     text-shadow: 0 0 5px var(--warning-primary); /* Added subtle glow to values */
}

/* Remove unused/overridden styles */
#team-info-display .team-id-and-stats-line { display: none; } /* Hide the old top line container */
#team-info-display .team-stats-live { display: none; } /* Hide the old stats container */
.buzzer-team-id-small { display: none; } /* Hide the small team ID span */


#buzzer-area {
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 800px;
}
#buzzer-button {
    width: min(80vw, 280px); /* CHANGED: Make it larger */
    height: min(80vw, 280px); /* CHANGED: Make it larger */
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-mono);
    font-size: clamp(1.8em, 6vw, 2.5em);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-on-accent);
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.2s ease;
}
#buzzer-button::before { /* 3D Edge */
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    transform: translateZ(-20px);
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
}
#buzzer-button:active:enabled { transform: translateY(5px) scale(0.95); }

/* States */
#buzzer-button:enabled { /* Ready to Buzz */
    background-color: currentColor; /* Set by JS */
    box-shadow: 0 10px 25px -5px currentColor, inset 0 -8px 15px rgba(0,0,0,0.3);
    animation: pulse-ready 2s infinite ease-in-out;
}
@keyframes pulse-ready {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
#buzzer-button:disabled .buzzer-text { color: var(--disabled-text); }
#buzzer-button:disabled { /* Waiting */
    background-color: var(--disabled-bg);
    box-shadow: inset 0 5px 15px rgba(0,0,0,0.4);
    cursor: not-allowed;
}
#buzzer-button.buzzed-state { /* Buzzed! */
    background-color: var(--info-primary) !important;
    box-shadow: 0 0 25px var(--info-primary), inset 0 0 10px rgba(0,0,0,0.2);
    transform: scale(0.98);
    animation: none;
}
#buzzer-button.buzzed-state .buzzer-text { color: white; }

#status-message-buzzer {
    margin-top: 20px;
    font-size: 1.1em;
    color: var(--text-secondary);
    background-color: var(--surface-glass-bg);
    padding: 10px 20px;
    border-radius: var(--border-radius-standard);
    min-height: 1.5em;
    text-align: center;
    font-weight: 500;
    border: 1px solid var(--surface-glass-border);
    transition: all 0.3s;
}
#status-message-buzzer.error {
    color: var(--danger-primary);
    border-color: var(--danger-primary);
    background-color: rgba(255, 64, 64, 0.1);
    text-shadow: 0 0 5px var(--danger-glow);
}

/* --- Footer --- */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px;
    background: var(--bg-primary);
    border-top: 1px solid var(--surface-glass-border);
    display: flex;
    justify-content: space-around;
    font-size: 0.8em;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
footer strong { color: var(--text-primary); font-weight: 600; }

/* --- Shop Slider --- */
#shop-slider-trigger {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 55px; /* CHANGED: Wider */
    height: 110px; /* CHANGED: Taller */
    background-color: var(--bg-secondary);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-right: none;
    border-radius: var(--border-radius-standard) 0 0 var(--border-radius-standard);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 1001;
    transition: all 0.3s ease;
}
#shop-slider-trigger.hidden { right: -50px; }
#shop-slider-trigger .icon { font-size: 1.8em; }
#shop-slider-trigger span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
}
#shop-slider-trigger.can-shop {
    color: var(--shop-primary);
    border-color: var(--shop-primary);
    animation: pulse-shop-ready 2s infinite;
}
@keyframes pulse-shop-ready {
    0%, 100% { box-shadow: 0 0 8px var(--shop-glow); }
    50% { box-shadow: 0 0 20px var(--shop-glow); }
}
#shop-slider-trigger.disabled-trigger {
    color: var(--disabled-text);
    border-color: var(--disabled-border);
    cursor: not-allowed;
    animation: none;
}

#buzzer-shop-slider-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(90vw, 350px);
    height: 100vh;
    background: var(--surface-glass-bg);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--surface-glass-border);
    color: var(--text-primary);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}
#buzzer-shop-slider-panel.open { right: 0; }
body.shop-slider-open-body #main-content { filter: blur(5px); }

#buzzer-shop-slider-panel h2 {
    color: var(--shop-primary);
    text-shadow: 0 0 8px var(--shop-glow);
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 1.6em;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--shop-primary);
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
#buzzer-shop-slider-panel .current-score-display {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-secondary);
}
#buzzer-shop-slider-panel .current-score-display strong {
    color: var(--warning-primary);
    font-weight: 700;
    font-size: 1.2em;
}
#buzzer-shop-slider-panel hr { border-color: var(--surface-glass-border); margin: 15px 0; }
.buzzer-shop-item-slider {
    border: 1px solid var(--surface-glass-border);
    background-color: var(--bg-secondary);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: var(--border-radius-standard);
}
.buzzer-shop-item-slider h3 {
    font-size: 1.1em;
    margin: 0 0 8px 0;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.buzzer-shop-item-slider .icon { color: var(--accent-primary); }
.buzzer-shop-item-slider p { font-size: 0.9em; margin-bottom: 10px; color: var(--text-secondary); }
.buy-item-btn-slider {
    background-color: var(--success-primary);
    color: var(--text-on-accent);
    border: none;
    width: 100%;
    padding: 12px;
    font-size: 1.05em;
    margin-top: 10px;
    border-radius: var(--border-radius-standard);
    font-weight: 600;
    transition: all 0.2s ease;
}
.buy-item-btn-slider:hover:enabled { filter: brightness(1.2); }
.buy-item-btn-slider:disabled {
    background-color: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
}
#close-buzzer-shop-slider-btn {
    background-color: var(--disabled-bg);
    color: var(--disabled-text);
    border: none;
    margin-top: auto;
    padding: 12px 20px;
    width: 100%;
    font-size: 1.05em;
    border-radius: var(--border-radius-standard);
    font-weight: 600;
}

/* --- Challenge Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1010;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(13, 15, 24, 0.85);
    backdrop-filter: blur(4px);
    z-index: 1010; /* Ensure it's above shop slider */
    align-items: center;
    justify-content: center;
    padding: 15px;
}
.modal-overlay.hidden { display: none; }
.modal-overlay:not(.hidden) { display: flex; }

.modal-content {
    background: var(--surface-glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--danger-primary);
    box-shadow: 0 0 25px var(--danger-glow);
    border-radius: var(--border-radius-large);
    padding: 25px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.modal-content h2 {
    color: var(--danger-primary);
    text-shadow: 0 0 8px var(--danger-glow);
    margin: 0 0 15px 0;
    font-size: 1.6em;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.modal-content p { color: var(--text-secondary); }
.modal-content p strong { color: var(--text-primary); font-weight: 600; }
.modal-content hr { border-color: var(--surface-glass-border); margin: 20px 0; }
#buzzer-challenge-category-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 20px 0;
}
#buzzer-challenge-category-options button {
    background-color: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 15px 10px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: var(--border-radius-standard);
    transition: all 0.2s ease;
}
#buzzer-challenge-category-options button:hover:enabled {
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-glow-accent);
}
#buzzer-challenge-setup-status { font-style: italic; margin-top:15px; font-size: 0.9em; }

/* In buzzer_style.css, add to the end */
#connection-status {
    transition: color 0.3s ease;
}
#connection-status.disconnected {
    color: var(--danger-primary);
    text-shadow: 0 0 5px var(--danger-glow);
}
#connection-status.connected {
    color: var(--success-primary);
    text-shadow: 0 0 5px var(--success-primary);
}

/* --- NEW: Connection Lost Overlay --- */
#connection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 15, 24, 0.9);
    backdrop-filter: blur(5px);
    z-index: 2000; /* Sit on top of everything */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#connection-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.connection-modal {
    text-align: center;
    color: var(--text-primary);
}

.connection-modal h1 {
    color: var(--danger-primary);
    text-shadow: 0 0 8px var(--danger-glow);
    font-family: var(--font-mono);
    text-transform: uppercase;
    margin-bottom: 15px;
}

.connection-modal p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Spinner Animation */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--surface-glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#reconnect-button {
    border-color: var(--warning-primary);
    color: var(--warning-primary);
}
#reconnect-button:hover:enabled {
    background-color: var(--warning-primary);
    color: var(--text-on-accent);
    box-shadow: 0 0 12px var(--warning-primary);
}

/* === TARGET SELECTION INTERFACE v4 (Modern Card Design) === */

#target-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 15, 24, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1500;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    padding: 20px;
    box-sizing: border-box;
}

#target-selection-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.target-selection-container {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--surface-glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--surface-glass-border);
    border-radius: var(--border-radius-large);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    overflow: hidden;
}

/* Header Section */
.selection-header {
    padding: 25px 30px 20px 30px;
    border-bottom: 1px solid var(--surface-glass-border);
    text-align: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--surface-glass-bg) 100%);
}

#selection-title {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    text-shadow: 0 0 8px var(--accent-primary-glow);
    font-size: 1.6em;
    margin: 0 0 10px 0;
}

.selection-instruction {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 0;
    line-height: 1.4;
}

/* Phase Management */
.selection-phase {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.selection-phase.active {
    display: flex;
}

/* Content Area */
.selection-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar */
.selection-content::-webkit-scrollbar {
    width: 6px;
}
.selection-content::-webkit-scrollbar-track {
    background: transparent;
}
.selection-content::-webkit-scrollbar-thumb {
    background-color: var(--accent-primary);
    border-radius: 3px;
    opacity: 0.7;
}

/* Card Grid Layout */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    width: 100%;
}

/* Individual Selection Cards */
.selection-card {
    background: var(--bg-secondary);
    border: 2px solid var(--surface-glass-border);
    border-radius: var(--border-radius-standard);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.selection-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, var(--accent-primary-glow), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.selection-card:hover::before {
    opacity: 0.1;
}

.selection-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.3),
        0 0 20px var(--accent-primary-glow);
}

.selection-card.selected {
    border-color: var(--accent-primary);
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 
        0 0 20px var(--accent-primary-glow),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.selection-card.selected::before {
    opacity: 0.2;
}

/* Card Content */
.card-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.card-title {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.card-subtitle {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    font-family: var(--font-mono);
}

.card-details {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
}

.card-value {
    color: var(--warning-primary);
    font-weight: 600;
    text-shadow: 0 0 5px var(--warning-glow);
}

.card-owner {
    color: inherit;
    font-weight: 500;
}

/* Single Item Layout */
.selection-grid.single-item {
    grid-template-columns: 1fr;
    max-width: 300px;
    margin: 0 auto;
}

.selection-grid.single-item .selection-card {
    min-height: 140px;
    border-color: var(--accent-primary);
    background: rgba(0, 255, 255, 0.05);
}

/* Controls Section */
.selection-controls {
    padding: 20px 30px;
    border-top: 1px solid var(--surface-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: var(--bg-primary);
}

.selection-controls button {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    border-radius: var(--border-radius-standard);
    transition: all 0.2s ease;
    min-width: 100px;
}

#back-to-category-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
}

#back-to-category-btn:hover:enabled {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

#confirm-selection-btn {
    background: var(--accent-primary);
    color: var(--text-on-accent);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-primary-glow);
}

#confirm-selection-btn:hover:enabled {
    background: rgba(0, 255, 255, 0.9);
    box-shadow: 0 0 25px var(--accent-primary-glow);
    transform: translateY(-2px);
}

#confirm-selection-btn:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    border-color: var(--disabled-border);
    box-shadow: none;
    cursor: not-allowed;
}

#cancel-selection-btn {
    background: transparent;
    color: var(--danger-primary);
    border: 1px solid var(--danger-primary);
}

#cancel-selection-btn:hover:enabled {
    background: var(--danger-primary);
    color: var(--text-on-accent);
    box-shadow: 0 0 15px var(--danger-glow);
}

.selection-controls .hidden {
    visibility: hidden;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .target-selection-container {
        max-width: 95%;
        margin: 10px;
    }
    
    .selection-header {
        padding: 20px 20px 15px 20px;
    }
    
    #selection-title {
        font-size: 1.4em;
    }
    
    .selection-content {
        padding: 15px;
    }
    
    .selection-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .selection-card {
        min-height: 100px;
        padding: 15px;
    }
    
    .selection-controls {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .selection-controls button {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .target-selection-container {
        max-height: 95vh;
    }
    
    .selection-header {
        padding: 15px;
    }
    
    #selection-title {
        font-size: 1.2em;
    }
    
    .selection-instruction {
        font-size: 0.85em;
    }
    
    .selection-content {
        padding: 12px;
    }
    
    .selection-card {
        min-height: 90px;
        padding: 12px;
    }
    
    .card-title {
        font-size: 1.1em;
    }
    
    .card-subtitle {
        font-size: 0.85em;
    }
}

/* Loading State */
.selection-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

.selection-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--surface-glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== GAME-THEMED SELECTION OVERLAY STYLES ===== */

/* ===== BLUE/CYAN GAME-THEMED SELECTION OVERLAY STYLES ===== */

/* Main Overlay - Foundation */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none;
}

/* Backdrop */
.selection-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

/* Main Container with Neon Border */
.selection-container {
    position: relative;
    background: linear-gradient(145deg, #0f172a, #1e293b);
    border: 3px solid #00d4ff;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(0, 212, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: neonPulse 3s ease-in-out infinite alternate;
}

@keyframes neonPulse {
    0% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.7),
            0 0 20px rgba(0, 212, 255, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
    100% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.7),
            0 0 40px rgba(0, 212, 255, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
}

/* Phase Management */
.selection-phase {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    transition: all 0.3s ease;
}

.selection-phase.active {
    display: flex;
}

/* Header - Blue/Cyan Style */
.selection-header {
    padding: 20px;
    background: linear-gradient(135deg, #0c4a6e, #075985);
    color: white;
    text-align: center;
    position: relative;
    border-bottom: 2px solid #0369a1;
}

.selection-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00d4ff, transparent);
}

.selection-header h3 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.selection-instruction {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    color: #bae6fd;
}

/* Search Section */
.search-section {
    padding: 15px;
    background: #020617;
    border-bottom: 1px solid #1e293b;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #334155;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    background: #0f172a;
    color: #e2e8f0;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #00d4ff;
    background: #1e293b;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.search-input::placeholder {
    color: #64748b;
}

/* Horizontal Categories Container */
.horizontal-scroll-container {
    padding: 15px 0;
    overflow-x: auto;
    overflow-y: hidden;
    background: #020617;
    scrollbar-width: none;
}

.horizontal-scroll-container::-webkit-scrollbar {
    display: none;
}

.horizontal-selector {
    display: flex;
    gap: 12px;
    padding: 0 15px;
    min-height: 100px;
}

/* Category Cards - Blue/Cyan Style */
.category-card {
    min-width: 130px;
    height: 100px;
    background: linear-gradient(145deg, #1e293b, #334155);
    border: 2px solid #475569;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    color: #e2e8f0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00d4ff, #0284c7);
    border-radius: 12px 12px 0 0;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.category-card:hover {
    border-color: #00d4ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.category-card:hover::before {
    transform: scaleX(1);
}

.category-card.selected {
    background: linear-gradient(145deg, #0284c7, #0369a1);
    color: white;
    border-color: #00d4ff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}

.category-card.selected::before {
    transform: scaleX(1);
    background: linear-gradient(90deg, #bae6fd, #7dd3fc);
}

.category-name {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    line-height: 1.2;
}

.category-count {
    font-size: 12px;
    opacity: 0.8;
    color: #7dd3fc;
}

.category-card.selected .category-count {
    color: #bae6fd;
}

/* Vertical Cells Container */
.vertical-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 15px;
    background: #020617;
    scrollbar-width: thin;
    scrollbar-color: #334155 #0f172a;
}

.vertical-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.vertical-scroll-container::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 3px;
}

.vertical-scroll-container::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.vertical-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 15px;
    padding-top: 10px;
}

/* Cell Items - Blue/Cyan Style */
.cell-item {
    background: linear-gradient(145deg, #1e293b, #334155);
    border: 2px solid #475569;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #e2e8f0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.cell-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #00d4ff, #0284c7);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.cell-item:hover {
    border-color: #00d4ff;
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.cell-item:hover::before {
    transform: scaleY(1);
}

.cell-item.selected {
    background: linear-gradient(145deg, #0284c7, #0369a1);
    color: white;
    border-color: #00d4ff;
    transform: translateX(6px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3);
}

.cell-item.selected::before {
    transform: scaleY(1);
    background: rgba(255,255,255,0.3);
}

.cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cell-position {
    font-weight: bold;
    font-size: 16px;
}

.cell-value {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.cell-item.selected .cell-value {
    background: rgba(255,255,255,0.2);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

.cell-details {
    font-size: 14px;
    opacity: 0.8;
    line-height: 1.3;
}

/* Phase Header (for cell selection phase) */
.phase-header {
    padding: 12px 15px;
    background: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
}

.back-button {
    background: linear-gradient(145deg, #374151, #4b5563);
    border: 2px solid #6b7280;
    color: #e5e7eb;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: linear-gradient(145deg, #4b5563, #6b7280);
    color: white;
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.selected-category-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-label {
    font-size: 14px;
    color: #9ca3af;
    font-weight: 500;
}

.category-name {
    font-size: 16px;
    font-weight: bold;
    color: #00d4ff;
}

/* Selection Preview */
.selection-preview {
    margin: 15px;
    background: linear-gradient(145deg, #1e3a5f, #1e40af);
    border: 2px solid #0284c7;
    border-radius: 10px;
    padding: 15px;
    display: none;
    color: #bae6fd;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.selection-preview.show {
    display: block;
    animation: expandIn 0.3s ease-out;
}

@keyframes expandIn {
    0% {
        opacity: 0;
        transform: scaleY(0.5);
    }
    100% {
        opacity: 1;
        transform: scaleY(1);
    }
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    color: #7dd3fc;
}

.preview-content {
    font-size: 14px;
    line-height: 1.4;
}

.preview-content div {
    margin-bottom: 4px;
}

/* Action Buttons */
.selection-buttons {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: #0f172a;
    border-top: 1px solid #334155;
}

.selection-buttons button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-cancel {
    background: linear-gradient(145deg, #dc2626, #b91c1c);
    color: white;
    border: 2px solid #ef4444;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-cancel:hover {
    background: linear-gradient(145deg, #b91c1c, #991b1b);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.btn-confirm {
    background: linear-gradient(145deg, #00d4ff, #0284c7);
    color: white;
    border: 2px solid #38bdf8;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.btn-confirm:hover:not(:disabled) {
    background: linear-gradient(145deg, #0284c7, #0369a1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 212, 255, 0.4);
}

.btn-confirm:disabled {
    background: linear-gradient(145deg, #4b5563, #374151);
    border-color: #6b7280;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Selection Hint */
.selection-hint {
    padding: 10px 15px;
    text-align: center;
    color: #475569;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #020617;
}

.hint-icon {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-4px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .selection-container {
        max-width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }
    
    .category-card {
        min-width: 110px;
        height: 90px;
    }
    
    .selection-header {
        padding: 15px;
    }
    
    .selection-header h3 {
        font-size: 18px;
    }
    
    .horizontal-selector {
        padding: 0 10px;
    }
    
    .vertical-scroll-container {
        padding: 0 10px;
    }
    
    .selection-buttons {
        padding: 12px;
    }
}

/* Team color preview styling */
.cell-item.team-preview {
    animation: teamColorPulse 1.5s ease-in-out infinite alternate;
    position: relative;
    overflow: visible;
}

.cell-item.team-preview::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 12px;
    background: inherit;
    z-index: -1;
    opacity: 0.3;
    animation: teamGlow 2s ease-in-out infinite alternate;
}

@keyframes teamColorPulse {
    0% {
        transform: translateX(6px) scale(1.02);
    }
    100% {
        transform: translateX(8px) scale(1.04);
    }
}

@keyframes teamGlow {
    0% {
        opacity: 0.2;
    }
    100% {
        opacity: 0.4;
    }
}

/* Enhanced selection preview with team colors */
.selection-preview .preview-content div:last-child {
    animation: previewHighlight 1s ease-in-out infinite alternate;
}

@keyframes previewHighlight {
    0% {
        opacity: 0.9;
    }
    100% {
        opacity: 1;
    }
}