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

body {
    font-family: 'Press Start 2P', monospace;
    background: #2a5a1e;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
    -webkit-user-select: none;
}

#game-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ── Canvas ── */

#game-canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#game-canvas.shooting {
    cursor: crosshair;
}

/* ── Score Popup ── */

#score-popup {
    position: fixed;
    z-index: 9;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #ffd700;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.6), 2px 2px 0 #000;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
}

#score-popup.show {
    animation: scorePop 0.8s ease-out forwards;
}

@keyframes scorePop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.8);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -60%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -120%) scale(1);
    }
}

/* ── Screens (overlays) ── */

.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 30, 10, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.screen.active {
    display: flex;
}

.screen-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

/* ── Menu Screen ── */

.game-title {
    font-size: 2.5rem;
    line-height: 1.3;
    color: #ff6600;
    text-shadow: 3px 3px 0 #8B2500, 0 0 20px rgba(255, 102, 0, 0.3);
    margin-bottom: 0.5rem;
}

.menu-subtitle {
    font-size: 0.65rem;
    color: #88cc88;
    letter-spacing: 0.3em;
    margin-bottom: 1.5rem;
}

.menu-highscore {
    font-size: 0.7rem;
    color: #aaccaa;
    margin-bottom: 2rem;
}

.menu-highscore span {
    color: #ffd700;
}

/* ── Mode Selector ── */

.mode-selector {
    margin-bottom: 1rem;
}

.mode-label {
    font-size: 0.45rem;
    color: #88aa88;
    letter-spacing: 0.15em;
    margin-bottom: 0.4rem;
}

.mode-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.mode-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    padding: 0.4rem 0.6rem;
    border: 2px solid #4a8a3a;
    border-radius: 3px;
    background: rgba(30, 60, 20, 0.6);
    color: #88aa88;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-btn:hover {
    border-color: #6ab84a;
    background: rgba(40, 80, 30, 0.8);
}

.mode-btn.selected {
    border-color: #ff6600;
    color: #ff6600;
    background: rgba(255, 102, 0, 0.15);
}

/* ── HUD Mode Badge ── */

.hud-mode-badge {
    font-size: 0.4rem;
    padding: 1px 4px;
    border-radius: 2px;
    background: #cc4444;
    color: #ffffff;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* ── Buttons ── */

.btn {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 0.6rem auto;
    padding: 0.8rem 1.5rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    border: 2px solid #4a8a3a;
    border-radius: 4px;
    background: rgba(30, 60, 20, 0.8);
    color: #88cc88;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.05em;
}

.btn:hover {
    border-color: #6ab84a;
    background: rgba(40, 80, 30, 0.9);
}

.btn:active {
    transform: scale(0.97);
}

.btn.primary {
    border-color: #ff6600;
    color: #ff6600;
    background: rgba(255, 102, 0, 0.1);
}

.btn.primary:hover {
    background: rgba(255, 102, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.2);
}

.btn i {
    margin-right: 0.4rem;
}

/* ── How To Play ── */

.howto-steps {
    text-align: left;
    margin: 1.5rem 0 2rem;
    line-height: 2.8;
}

.howto-steps p {
    font-size: 0.6rem;
}

.howto-steps i {
    width: 24px;
    text-align: center;
    color: #ff6600;
    margin-right: 0.5rem;
}

.howto-modes {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    text-align: left;
}

.howto-modes h3 {
    font-size: 0.55rem;
    color: #ff6600;
    margin-bottom: 0.5rem;
}

.howto-modes p {
    font-size: 0.5rem;
    color: #88cc88;
    line-height: 2.2;
}

.howto-modes strong {
    color: #ffffff;
}

/* ── HUD ── */

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
    pointer-events: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 0.45rem;
    color: #88aa88;
    letter-spacing: 0.15em;
}

.hud-value {
    font-size: 0.8rem;
    color: #ffffff;
}

/* ── Shot Icons ── */

.shot-icon {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: #ff6600;
    border-radius: 2px 2px 0 0;
    margin: 0 2px;
    transition: opacity 0.2s;
}

.shot-icon.used {
    opacity: 0.2;
}

/* ── Duck Tracker ── */

.duck-tracker {
    display: flex;
    justify-content: center;
    padding: 6px 0;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.tracker-duck {
    display: inline-block;
    width: 16px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tracker-pending {
    background: rgba(255, 255, 255, 0.15);
}

.tracker-active {
    background: rgba(255, 255, 255, 0.4);
    border-color: #ffffff;
}

.tracker-hit {
    background: #44cc44;
    border-color: #44cc44;
}

.tracker-miss {
    background: #cc4444;
    border-color: #cc4444;
}

/* ── Round Result ── */

.tally {
    margin: 1.2rem 0;
    text-align: left;
}

.tally-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.6rem;
}

.tally-set {
    color: #88aa88;
}

.tally-hit {
    color: #44cc44;
}

.tally-miss {
    color: #cc4444;
}

.tally-bonus {
    text-align: center;
    font-size: 0.65rem;
    color: #ffd700;
    margin-top: 0.8rem;
    animation: pulse 0.6s ease-in-out infinite;
}

.result-total {
    font-size: 0.75rem;
    color: #ffd700;
    margin: 1rem 0 1.5rem;
    padding-top: 0.5rem;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
}

/* ── Game Over ── */

.final-stats {
    margin: 1.5rem 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.6rem;
}

.stat-label {
    color: #88aa88;
}

.stat-value {
    color: #ffffff;
}

.new-highscore {
    font-size: 0.8rem;
    color: #ffd700;
    margin: 1rem 0;
    animation: pulse 0.6s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Landscape Prompt ── */

#landscape-prompt {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #1a3a10;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 2rem;
}

#landscape-prompt i {
    font-size: 2.5rem;
    color: #ff6600;
}

#landscape-prompt p {
    font-size: 0.65rem;
    color: #88cc88;
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
    #landscape-prompt {
        display: flex;
    }
}

/* ── Responsive ── */

@media (max-width: 480px) {
    .game-title {
        font-size: 1.8rem;
    }

    .hud-top {
        padding: 4px 8px;
    }

    .hud-value {
        font-size: 0.65rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.6rem;
    }

    #score-popup {
        font-size: 11px;
    }
}

@media (max-height: 400px) {
    .game-title {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }

    .menu-subtitle {
        margin-bottom: 0.5rem;
    }

    .mode-selector {
        margin-bottom: 0.5rem;
    }

    .mode-btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.4rem;
    }

    .menu-highscore {
        margin-bottom: 0.8rem;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        margin: 0.3rem auto;
    }

    .howto-steps {
        line-height: 2.2;
    }
}
