:root {
    --bg-dark: #0a0a0f;
    --bg-panel: #14141d;
    --text-main: #f0f0f5;
    --text-muted: #8b8b9e;
    
    --color-red: #ff3366;
    --color-red-glow: rgba(255, 51, 102, 0.5);
    
    --color-blue: #00f3ff;
    --color-blue-glow: rgba(0, 243, 255, 0.5);
    
    --color-gold: #ffd700;
    --color-tie: #bdc3c7;
    
    --font-heading: 'Bungee', cursive;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --radius: 8px;
    --transition: 0.3s ease;
}

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

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

.hidden { display: none !important; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(10, 10, 15, 0.9);
    border-bottom: 2px solid #222;
    z-index: 10;
}

.logo {
    display: flex;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
}
.logo-css { color: var(--color-gold); }
.logo-vs { color: var(--text-main); }

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn {
    font-family: var(--font-heading);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: var(--transition);
    font-size: 0.9rem;
    letter-spacing: 1px;
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--text-muted);
    color: var(--text-muted);
}
.btn-outline:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}
.btn-primary { background: var(--color-gold); color: #000; }
.btn-primary:hover { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
.btn-secondary { background: var(--text-main); color: #000; }

/* Toggle Switch */
.mode-toggle { display: flex; align-items: center; gap: 0.75rem; font-family: var(--font-heading); font-size: 0.9rem; color: var(--text-muted); }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .4s; border-radius: 24px; border: 2px solid #555; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: var(--text-main); transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--color-gold); border-color: var(--color-gold); }
input:checked + .slider:before { transform: translateX(20px); background-color: #000; }

.streak-counter {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--text-muted);
}
.highlight { color: var(--color-gold); font-size: 1.2rem; }

/* Arena Layout */
.arena {
    flex: 1;
    display: flex;
    padding: 2rem;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    position: relative;
}

@media (max-width: 900px) {
    .arena { flex-direction: column; gap: 1rem; }
    .vs-center { order: 0; margin-bottom: 1rem; }
    .player { width: 100%; max-width: 500px; }
}

/* Player Panels */
.player {
    flex: 1;
    max-width: 450px;
    background: var(--bg-panel);
    border-radius: var(--radius);
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

.player-header h2 {
    font-family: var(--font-heading);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.player-red { border-top: 4px solid var(--color-red); }
.player-red .player-header h2 { color: var(--color-red); }
.player-red .spec-bar { background: var(--color-red); box-shadow: 0 0 10px var(--color-red-glow); }
.player-red .spec-value { color: var(--color-red); }

.player-blue { border-top: 4px solid var(--color-blue); }
.player-blue .player-header h2 { color: var(--color-blue); }
.player-blue .spec-bar { background: var(--color-blue); box-shadow: 0 0 10px var(--color-blue-glow); }
.player-blue .spec-value { color: var(--color-blue); }

.win-anim-red { animation: winnerRed 1.5s infinite; }
.win-anim-blue { animation: winnerBlue 1.5s infinite; }
.lose-anim { filter: grayscale(1) opacity(0.5); transform: scale(0.95); }

@keyframes winnerRed {
    0%, 100% { box-shadow: 0 0 20px var(--color-red-glow), 0 0 40px var(--color-red-glow); transform: scale(1.02); }
    50% { box-shadow: 0 0 10px var(--color-red-glow); transform: scale(1); }
}
@keyframes winnerBlue {
    0%, 100% { box-shadow: 0 0 20px var(--color-blue-glow), 0 0 40px var(--color-blue-glow); transform: scale(1.02); }
    50% { box-shadow: 0 0 10px var(--color-blue-glow); transform: scale(1); }
}

/* Input Area */
.input-area { margin-bottom: 2rem; }
.selector-input {
    width: 100%;
    background: #000;
    border: 2px solid #333;
    padding: 1rem;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    border-radius: 4px;
    outline: none;
    transition: var(--transition);
    text-align: center;
}
.player-red .selector-input:focus { border-color: var(--color-red); box-shadow: 0 0 10px var(--color-red-glow); }
.player-blue .selector-input:focus { border-color: var(--color-blue); box-shadow: 0 0 10px var(--color-blue-glow); }
.selector-input[disabled] { opacity: 0.7; cursor: not-allowed; }

/* Specificity Breakdown */
.specificity-display {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}
.spec-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
}
.spec-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    height: 80px;
    text-align: left;
}
.spec-bar-bg {
    height: 150px;
    width: 20px;
    background: #222;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.spec-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    border-radius: 10px;
    transition: height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.spec-value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

/* VS Center */
.vs-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    min-width: 150px;
}

.vs-text {
    font-family: var(--font-heading);
    font-size: 4rem;
    color: var(--color-gold);
    text-shadow: 2px 2px 0px #000, 0 0 20px rgba(255,215,0,0.5);
    margin: 0;
    line-height: 1;
}

.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.btn-fight {
    font-family: var(--font-heading);
    font-size: 2rem;
    padding: 1rem 2rem;
    background: linear-gradient(45deg, var(--color-red), var(--color-blue));
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    transition: transform 0.1s, box-shadow 0.1s;
}
.btn-fight:active { transform: translateY(4px); box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.btn-fight:disabled { filter: grayscale(1); opacity: 0.5; cursor: not-allowed; }

.practice-controls h3 {
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 1rem;
}

.guess-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}
.btn-guess {
    width: 100%;
    padding: 0.75rem;
    font-size: 1.2rem;
    background: #222;
    color: var(--text-main);
    border: 2px solid transparent;
}
.btn-guess.red:hover { border-color: var(--color-red); box-shadow: 0 0 10px var(--color-red-glow); }
.btn-guess.blue:hover { border-color: var(--color-blue); box-shadow: 0 0 10px var(--color-blue-glow); }
.btn-guess.draw:hover { border-color: var(--color-tie); box-shadow: 0 0 10px rgba(189,195,199,0.5); }

/* Result Banner */
.result-banner {
    background: #111;
    border-top: 1px solid #333;
    padding: 2rem;
    text-align: center;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#resultTitle {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#resultTitle.show { opacity: 1; transform: translateY(0); }

#resultExplanation {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    opacity: 0;
    transition: opacity 0.5s ease 0.3s;
}
#resultExplanation.show { opacity: 1; }

.winner-red { color: var(--color-red); text-shadow: 0 0 10px var(--color-red-glow); }
.winner-blue { color: var(--color-blue); text-shadow: 0 0 10px var(--color-blue-glow); }
.winner-draw { color: var(--color-tie); text-shadow: 0 0 10px rgba(189,195,199,0.5); }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal.fade { pointer-events: auto; opacity: 1; }

.modal-content {
    background: var(--bg-panel);
    border: 1px solid #333;
    padding: 2.5rem;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}
.modal-content h2 { font-family: var(--font-heading); color: var(--color-gold); margin-bottom: 1rem; }
.modal-content p { color: var(--text-muted); margin-bottom: 1rem; line-height: 1.6; }

.btn-close {
    position: absolute;
    top: 1rem; right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
}
.btn-close:hover { color: var(--text-main); }

.score-list { list-style: none; margin-bottom: 1.5rem; }
.score-list li { margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; color: var(--text-main); font-size: 0.9rem; }
.badge { padding: 0.2rem 0.5rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.8rem; font-weight: bold; background: #222; }
.badge.imp { color: #ff00ff; border: 1px solid #ff00ff; }
.badge.in { color: #00ffcc; border: 1px solid #00ffcc; }
.badge.id { color: #ff9900; border: 1px solid #ff9900; }
.badge.cl { color: #33cc33; border: 1px solid #33cc33; }
.badge.el { color: #cccccc; border: 1px solid #cccccc; }

/* Effects */
@keyframes shakeConfig {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}
.shake { animation: shakeConfig 0.4s cubic-bezier(.36,.07,.19,.97) both; }
