/* SnapTrigger - Gamer-themed Reaction Time Game CSS */
:root {
    --primary-color: #ff3e3e;
    --secondary-color: #3e8eff;
    --background-color: #121212;
    --text-color: #ffffff;
    --accent-color: #32cd32;
    --border-color: #444444;
    --neon-glow: 0 0 10px rgba(255, 62, 62, 0.7), 0 0 20px rgba(255, 62, 62, 0.5), 0 0 30px rgba(255, 62, 62, 0.3);
    --blue-glow: 0 0 10px rgba(62, 142, 255, 0.7), 0 0 20px rgba(62, 142, 255, 0.5), 0 0 30px rgba(62, 142, 255, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 62, 62, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(62, 142, 255, 0.1) 0%, transparent 20%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.95));
    overflow: hidden;
}

.game-container {
    width: 90%;
    max-width: 1000px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--neon-glow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    z-index: -1;
    border-radius: 12px;
    opacity: 0.3;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

header h1 {
    font-size: 3.5rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 10px;
    text-shadow: var(--neon-glow);
    font-weight: 900;
    position: relative;
    display: inline-block;
}

header h1::after {
    content: 'SNAPTRIGGER';
    position: absolute;
    top: 53px;
    left: 0px;
    color: rgba(255, 255, 255, 0.1);
    z-index: -1;
    transform: scaleY(-1);
}

.game-menu {
    text-align: center;
    padding: 20px;
}

.game-menu h2 {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.game-btn {
    background-color: var(--primary-color);
    color: var(--button-text);
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    padding: 12px 25px;
    margin: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--button-shadow);
    position: relative;
}

/* Feedback button */
.feedback-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--button-shadow);
    z-index: 1000;
}

.feedback-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

.game-btn:hover:not([disabled]) {
    background-color: #ff6b6b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 62, 62, 0.4);
}

.game-btn:active:not([disabled]) {
    transform: translateY(0);
}

.game-btn[disabled] {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

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

.game-stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.stat {
    text-align: center;
}

.stat span:first-child {
    color: var(--secondary-color);
    margin-right: 5px;
    font-weight: bold;
}

#game-canvas {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    border: 1px solid var(--border-color);
    cursor: crosshair;
    margin: 20px auto;
    box-shadow: var(--blue-glow);
    position: relative;
    display: block;
    background-image: 
        radial-gradient(circle at 30% 40%, rgba(62, 142, 255, 0.05) 0%, transparent 30%),
        radial-gradient(circle at 70% 60%, rgba(255, 62, 62, 0.05) 0%, transparent 30%);
}

.game-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
}

.game-controls button {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.game-controls button:hover {
    background-color: #5aa0ff;
    transform: translateY(-2px);
}

.countdown {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.countdown-number {
    font-size: 10rem;
    color: var(--primary-color);
    animation: pulse 1s infinite;
    text-shadow: var(--neon-glow);
    font-weight: 900;
}

.countdown-number:last-child {
    animation: zoomIn 0.5s forwards;
}

@keyframes zoomIn {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.results {
    text-align: center;
    padding: 20px;
}

.results h2 {
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.result-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.result-stat {
    display: flex;
    justify-content: space-between;
}

.result-stat span:first-child {
    color: var(--secondary-color);
    font-weight: bold;
}

.accuracy-popup {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--accent-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    pointer-events: none;
    animation: fadeOut 1s forwards;
    border: 1px solid rgba(50, 205, 50, 0.3);
    box-shadow: 0 0 10px rgba(50, 205, 50, 0.5);
}

.accuracy-popup.missed {
    color: var(--primary-color);
    font-size: 1.2em;
    text-shadow: 0 0 5px rgba(255, 62, 62, 0.7);
    border: 1px solid rgba(255, 62, 62, 0.3);
    box-shadow: var(--neon-glow);
    animation: shake 0.5s forwards, fadeOut 1s forwards;
}

@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

@keyframes fadeOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* Add particle effects */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    animation: particleFade 1s forwards;
}

@keyframes particleFade {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

/* Stats Board Styles */
.stats-board {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: flex;
    flex-direction: column;
    color: var(--text-color);
    overflow-y: auto; /* Enable vertical scrolling */
    max-height: 100vh; /* Ensure it doesn't exceed viewport height */
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10;
}

.stats-header h2 {
    color: var(--secondary-color);
    margin: 0;
    text-shadow: var(--neon-glow);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
}

.close-btn:hover {
    color: var(--primary-color);
}

.stats-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 60px;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 5;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--secondary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--secondary-color);
    box-shadow: var(--neon-glow);
}

.stats-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto; /* Enable scrolling for content */
}

.tab-content {
    display: none;
    padding: 15px 0;
}

.tab-content.active {
    display: block;
}

/* Stats Summary at the top */
.summary-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin: 20px 0 10px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.summary-card {
    text-align: center;
    padding: 10px 20px;
    flex: 1;
    min-width: 120px;
    max-width: 180px;
}

.summary-value {
    font-size: 32px;
    color: var(--secondary-color);
    margin-bottom: 5px;
    text-shadow: var(--neon-glow);
}

.summary-label {
    font-size: 14px;
    color: var(--text-color);
}

.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(50, 205, 50, 0.5);
}

.chart-container {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
    height: 300px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.metric-card {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    text-align: center;
}

.metric-value {
    font-size: 24px;
    color: var(--secondary-color);
    margin: 10px 0;
    text-shadow: var(--neon-glow);
}

.metric-label {
    font-size: 14px;
    color: var(--text-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
}

.history-date {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.history-stats {
    display: flex;
    justify-content: space-around;
}

.history-stat {
    text-align: center;
}

.history-stat-value {
    font-size: 18px;
    color: var(--accent-color);
}

.history-stat-label {
    font-size: 12px;
    color: var(--text-color);
}

.game-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.game-checkbox {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.game-checkbox input {
    cursor: pointer;
}

.stats-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-bottom: 20px;
}

.stats-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: var(--button-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.stats-actions button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* Make sure body allows scrolling */
body {
    overflow-y: auto;
}
