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

:root {
    --primary: #66ff66;
    --secondary: #ff6644;
    --dark: #1a1a1a;
    --darker: #0f0f0f;
    --accent: #ffdd44;
    --glow: 0 0 15px rgba(102, 255, 102, 0.5);
    --glow-strong: 0 0 30px rgba(102, 255, 102, 0.8);
}

body {
    overflow: hidden;
    background: var(--dark);
    font-family: 'Courier New', monospace;
    color: var(--primary);
    user-select: none;
}

canvas {
    display: block;
    image-rendering: pixelated;
    width: 100vw;
    height: 100vh;
}

video {
    display: none;
}

/* ===== SCREENS ===== */

.screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.98), rgba(25, 25, 50, 0.98));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 1;
    transition: opacity 0.3s;
}

.screen.hidden {
    display: none;
}

.screen.active {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.screen-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

/* ===== SCREEN HEADER ===== */

.screen-header {
    text-align: center;
    margin-bottom: 40px;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title {
    font-size: clamp(2.5rem, 10vw, 5rem);
    font-weight: 900;
    margin-bottom: 10px;
    color: var(--primary);
    text-shadow: 
        0 0 20px var(--primary),
        0 0 40px rgba(102, 255, 102, 0.3),
        0 0 60px rgba(102, 255, 102, 0.1);
    letter-spacing: 3px;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        text-shadow: 
            0 0 20px var(--primary),
            0 0 40px rgba(102, 255, 102, 0.3),
            0 0 60px rgba(102, 255, 102, 0.1);
    }
    50% {
        text-shadow: 
            0 0 30px var(--primary),
            0 0 60px rgba(102, 255, 102, 0.5),
            0 0 90px rgba(102, 255, 102, 0.3);
    }
}

.title.gameover-title {
    color: var(--secondary);
    text-shadow: 
        0 0 20px var(--secondary),
        0 0 40px rgba(255, 102, 68, 0.3);
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--accent);
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.title-accent {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    margin: 20px auto;
    border-radius: 2px;
    box-shadow: var(--glow);
    animation: expand 0.8s ease-out;
}

.title-accent.red {
    background: linear-gradient(90deg, transparent, var(--secondary), transparent);
    box-shadow: 0 0 15px rgba(255, 102, 68, 0.5);
}

@keyframes expand {
    from {
        width: 0;
    }
    to {
        width: 100px;
    }
}

/* ===== SCREEN BODY ===== */

.screen-body {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    animation: slideUp 0.6s ease-out 0.2s both;
    padding: 20px 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== INSTRUCTIONS SECTION ===== */

.instructions-section {
    margin-bottom: 40px;
}

.section-header {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: bold;
    color: var(--primary);
    text-shadow: var(--glow);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    text-align: center;
}

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

.instruction-card {
    background: rgba(102, 255, 102, 0.05);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    animation: fadeInUp 0.6s ease-out backwards;
}

.instruction-card:nth-child(1) { animation-delay: 0.3s; }
.instruction-card:nth-child(2) { animation-delay: 0.4s; }
.instruction-card:nth-child(3) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.instruction-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-strong);
    background: rgba(102, 255, 102, 0.1);
}

.instruction-icon {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 10px;
    display: inline-block;
    animation: float 2s ease-in-out infinite;
}

.instruction-card:nth-child(1) .instruction-icon { animation-delay: 0s; }
.instruction-card:nth-child(2) .instruction-icon { animation-delay: 0.3s; }
.instruction-card:nth-child(3) .instruction-icon { animation-delay: 0.6s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.instruction-text {
    font-size: clamp(0.85rem, 2vw, 1rem);
    line-height: 1.6;
    color: #fff;
}

/* ===== INFO SECTION ===== */

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

.duck-types {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.duck-type-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    background: rgba(102, 255, 102, 0.08);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    transition: all 0.3s;
}

.duck-type-item:hover {
    background: rgba(102, 255, 102, 0.15);
    transform: translateX(10px);
}

.duck-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.duck-color.blue {
    background: linear-gradient(135deg, #4169e1, #1e90ff);
}

.duck-color.green {
    background: linear-gradient(135deg, #32cd32, #00ff00);
}

.duck-color.red {
    background: linear-gradient(135deg, #ff6644, #ff4422);
}

.duck-text {
    color: #fff;
}

/* ===== FEATURES SECTION ===== */

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

.feature-item {
    padding: 15px;
    background: rgba(255, 221, 68, 0.05);
    border: 1px solid rgba(255, 221, 68, 0.3);
    border-radius: 8px;
    text-align: center;
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: all 0.3s;
}

.feature-item:hover {
    background: rgba(255, 221, 68, 0.1);
    border-color: rgba(255, 221, 68, 0.6);
    transform: scale(1.05);
}

/* ===== GAME OVER SPECIFIC ===== */

.gameover-body {
    max-height: 70vh;
    overflow-y: auto;
}

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

.stat-card {
    background: linear-gradient(135deg, rgba(102, 255, 102, 0.1), rgba(102, 255, 102, 0.05));
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    animation: scaleIn 0.6s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-icon {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 10px;
}

.stat-label {
    font-size: clamp(0.75rem, 1.5vw, 0.9rem);
    color: var(--primary);
    opacity: 0.8;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: bold;
    color: var(--primary);
    text-shadow: var(--glow);
}

/* ===== GRADE CONTAINER ===== */

.grade-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.grade-card {
    background: linear-gradient(135deg, rgba(255, 221, 68, 0.1), rgba(255, 102, 68, 0.1));
    border: 3px solid var(--secondary);
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
    animation: popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.grade-icon {
    font-size: clamp(3rem, 8vw, 5rem);
    margin-bottom: 15px;
    display: inline-block;
    animation: bounce 0.6s ease-out;
}

@keyframes bounce {
    0% { transform: translateY(-30px); }
    70% { transform: translateY(10px); }
    100% { transform: translateY(0); }
}

.grade-text {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 900;
    color: var(--secondary);
    text-shadow: 0 0 20px var(--secondary);
    margin-bottom: 10px;
}

.grade-message {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--accent);
}

/* ===== SUMMARY SECTION ===== */

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

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: rgba(102, 102, 102, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(102, 102, 102, 0.3);
}

.summary-label {
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    color: #aaa;
    margin-bottom: 5px;
}

.summary-value {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: bold;
    color: var(--accent);
}

/* ===== SCREEN FOOTER ===== */

.screen-footer {
    width: 100%;
    text-align: center;
    animation: slideUp 0.6s ease-out 0.4s both;
}

.btn-start,
.btn-restart,
.btn-secondary {
    position: relative;
    padding: clamp(12px, 3vw, 18px) clamp(40px, 8vw, 60px);
    margin: 15px 10px;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.btn-start,
.btn-restart {
    background: linear-gradient(135deg, var(--secondary), #ff4422);
    color: white;
    border: 2px solid #ffaa88;
}

.btn-start:hover,
.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(255, 102, 68, 0.6), 0 12px 25px rgba(0, 0, 0, 0.4);
}

.btn-start:active,
.btn-restart:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(102, 255, 102, 0.2);
}

.btn-secondary:hover {
    background: rgba(102, 255, 102, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(102, 255, 102, 0.5), 0 12px 25px rgba(0, 0, 0, 0.4);
}

.btn-text {
    position: relative;
    z-index: 2;
}

.btn-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: translateX(-100%);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.disclaimer {
    font-size: clamp(0.75rem, 1.5vw, 0.9rem);
    color: #999;
    margin-top: 15px;
    font-style: italic;
}

/* ===== CRT EFFECT ===== */

#crt {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.03),
        rgba(255, 255, 255, 0.03) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    mix-blend-mode: overlay;
    z-index: 50;
}

/* ===== SCROLLBAR ===== */

.screen-body::-webkit-scrollbar {
    width: 10px;
}

.screen-body::-webkit-scrollbar-track {
    background: rgba(102, 255, 102, 0.05);
}

.screen-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

.screen-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .screen-content {
        padding: 15px;
    }

    .instructions-grid {
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }

    .grade-card {
        padding: 30px 40px;
    }

    .screen-body {
        max-height: 65vh;
    }
}

@media (max-width: 480px) {
    .screen-header {
        margin-bottom: 25px;
    }

    .instructions-grid {
        grid-template-columns: 1fr;
    }

    .screen-body {
        max-height: 60vh;
    }

    .btn-start,
    .btn-restart,
    .btn-secondary {
        width: 100%;
        margin: 10px 0;
    }
}

/* ===== ACCESSIBILITY ===== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}