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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 50%, #CD853F 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(139, 69, 19, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(160, 82, 45, 0.3) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
}


h1 {
    text-align: center;
    color: #FFD700;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.8);
    font-weight: bold;
}

.title-with-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title-text {
    flex: 0 1 auto;
}

.title-icon {
    flex: 0 0 auto;
    font-size: 1.2em;
    line-height: 1;
}

.title-icon-left {
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.title-icon-right {
    height: 1.2em;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.subtitle {
    text-align: center;
    color: #FFE4B5;
    margin-bottom: 30px;
    font-size: 1.2em;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.setup-panel, .game-panel {
    margin-bottom: 30px;
    padding: 25px;
    background: #FFF8DC;
    border-radius: 10px;
    border: 2px solid #D2691E;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #8B4513;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9em;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
}

.btn-primary {
    background: #8B4513;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #A0522D;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-game {
    background: #CD853F;
    color: white;
    font-size: 20px;
    padding: 20px 40px;
    width: 100%;
    margin-top: 20px;
    border: 2px solid #8B4513;
}

.btn-game:hover:not(:disabled) {
    background: #D2691E;
    transform: scale(1.05);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.timer-display {
    text-align: center;
    margin: 30px 0;
}

.timer-value {
    font-size: 4em;
    font-weight: bold;
    color: #8B4513;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.timer-label {
    color: #666;
    margin-top: 10px;
    font-size: 1.1em;
}

.target-info {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #F4A460;
    border-radius: 8px;
    color: #654321;
    font-weight: 600;
    border: 2px solid #8B4513;
}

.result-flash {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
    animation: flashFade 1.5s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.result-flash.success {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #654321;
    border: 3px solid #8B4513;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.result-flash.fail {
    background: linear-gradient(135deg, #D2691E 0%, #8B4513 100%);
    color: #FFE4B5;
    border: 3px solid #654321;
    box-shadow: 0 0 20px rgba(139, 69, 19, 0.5);
}

.result-image {
    font-size: 6em;
    line-height: 1;
    animation: imagePop 0.6s ease-out;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image img {
    max-width: 120px;
    height: auto;
}

@keyframes imagePop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes flashFade {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    20% {
        opacity: 1;
        transform: scale(1);
    }
    80% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

.stats-panel {
    margin-top: 30px;
    padding: 25px;
    background: #FFF8DC;
    border-radius: 10px;
    border: 2px solid #D2691E;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #8B4513;
    margin-bottom: 5px;
}

.stat-value.success {
    color: #FFA500;
}

.stat-value.fail {
    color: #A0522D;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.chart-container {
    margin-top: 30px;
    padding: 25px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em;
    text-align: center;
}

.chart-container {
    position: relative;
    width: 100%;
}
  
#performanceChart {
    width: 100%;
    display: block;
}

/* --- MOBILE ONLY --- */
@media (max-width: 768px) {
    .chart-container {
        height: 240px;        /* give it a real height on mobile */
        max-height: 40vh;
    }

    #performanceChart {
        height: 100% !important;
        width: 100% !important;
    }
}

