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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    /* iPhone safe area support for notch */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    margin: 0;
    overflow-x: hidden;
}

.container {
    text-align: center;
}

.game-title {
    font-size: 48px;
    color: #2d5016;
    text-shadow: 3px 3px 0px #fff, 6px 6px 0px rgba(0,0,0,0.2);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 14px;
    color: #444;
    margin-bottom: 20px;
    font-style: italic;
}

#gameArea {
    width: 800px;
    height: 450px;
    background: linear-gradient(180deg, #87CEEB 0%, #87CEEB 70%, #8B7355 70%, #654321 100%);
    border: 8px solid #333;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

/* Timer */
#timer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    background: rgba(0,0,0,0.6);
    padding: 10px 30px;
    border-radius: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    z-index: 100;
}

/* Player */
#player {
    position: absolute;
    bottom: 40px;
    left: 380px; /* Will be controlled by JavaScript */
    width: 40px;
    height: 60px;
    transition: left 0.05s linear;
}

.santa-hat {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 20px solid #ff0000;
    position: absolute;
    top: -18px;
    left: 0;
}

.santa-hat::after {
    content: '';
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 18px;
    left: -6px;
}

.player-body {
    width: 40px;
    height: 40px;
    background: #4169E1;
    border: 3px solid #000;
    position: absolute;
    top: 20px;
}

.player-body::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #000;
    position: absolute;
    top: 12px;
    left: 10px;
    box-shadow: 14px 0 0 #000;
}

/* Chaos Items */
.chaos-item {
    position: absolute;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: bold;
    border: 3px solid #000;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.3);
    animation: fall linear;
}

@keyframes fall {
    from {
        top: -50px;
    }
    to {
        top: 100%;
    }
}

/* Chaos Item Colors by Category */
.chaos-item.urgent {
    background: #ff6b6b;
    color: #fff;
}

.chaos-item.distraction {
    background: #ffd93d;
    color: #333;
}

.chaos-item.meeting {
    background: #6bcfff;
    color: #333;
}

.chaos-item.life {
    background: #c084fc;
    color: #fff;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    transition: opacity 0.3s;
}

.overlay.hidden {
    display: none;
}

/* Start Overlay */
#startOverlay h2 {
    font-size: 32px;
    color: #4ade80;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.start-instructions {
    font-size: 18px;
    color: #ccc;
    margin-bottom: 40px;
    line-height: 1.8;
}

.big-button {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: bold;
    padding: 20px 50px;
    background: #4ade80;
    color: #000;
    border: 4px solid #000;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 6px 6px 0px rgba(0,0,0,0.3);
    transition: all 0.1s;
}

.big-button:hover {
    background: #5ef090;
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0px rgba(0,0,0,0.3);
}

.big-button:active {
    transform: translate(2px, 2px);
    box-shadow: 3px 3px 0px rgba(0,0,0,0.3);
}

/* Hit Overlay */
#hitOverlay {
    background: rgba(0, 0, 0, 0.7);
}

#hitMessage {
    font-size: 24px;
    color: #fff;
    text-align: center;
    padding: 20px;
    max-width: 80%;
}

/* End Overlay */
#endOverlay h2 {
    font-size: 36px;
    color: #4ade80;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#statsMessage {
    font-size: 18px;
    color: #fff;
    margin-bottom: 30px;
    line-height: 1.6;
}

#playAgainBtn {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    padding: 15px 40px;
    background: #4ade80;
    color: #000;
    border: 4px solid #000;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
    transition: all 0.1s;
}

#playAgainBtn:hover {
    background: #5ef090;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px rgba(0,0,0,0.3);
}

#playAgainBtn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.3);
}

.coming-soon {
    font-size: 12px;
    color: #888;
    margin-top: 15px;
    font-style: italic;
}

/* Email Form */
.email-form {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #444;
    max-width: 400px;
}

.form-intro {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 15px;
}

#emailForm {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#emailInput {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 10px 15px;
    border: 3px solid #444;
    border-radius: 4px;
    background: #222;
    color: #fff;
    flex: 1;
    max-width: 250px;
}

#emailInput::placeholder {
    color: #888;
}

#emailForm button {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    padding: 10px 20px;
    background: #6bcfff;
    color: #000;
    border: 3px solid #000;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s;
}

#emailForm button:hover {
    background: #7dd9ff;
    transform: translateY(-2px);
}

#emailForm button:active {
    transform: translateY(0);
}

.form-message {
    font-size: 14px;
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
}

.form-message.success {
    background: #4ade80;
    color: #000;
}

.form-message.error {
    background: #ff6b6b;
    color: #fff;
}

.form-message.hidden {
    display: none;
}

/* Instructions */
.instructions {
    margin-top: 20px;
    font-size: 14px;
    color: #333;
}

.instructions p {
    margin: 5px 0;
}

/* Responsive adjustments */
@media (max-width: 850px) {
    #gameArea {
        width: 600px;
        height: 400px;
    }

    .game-title {
        font-size: 36px;
    }
}

@media (max-width: 650px) {
    body {
        padding: 0;
        /* iPhone safe area support for notch */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        align-items: flex-start;
    }

    .container {
        width: 100%;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .game-title {
        font-size: 24px;
        margin: 10px 0 5px 0;
        text-shadow: 2px 2px 0px #fff, 4px 4px 0px rgba(0,0,0,0.2);
    }

    .subtitle {
        font-size: 11px;
        margin-bottom: 8px;
    }

    #gameArea {
        width: 100vw;
        height: calc(100vh - 80px);
        max-height: none;
        border-left: none;
        border-right: none;
        border-width: 4px 0;
        margin: 0;
        flex: 1;
    }

    #timer {
        font-size: 20px;
        padding: 6px 16px;
        top: 10px;
    }

    #player {
        width: 35px;
        height: 52px;
    }

    .santa-hat {
        border-left: 17px solid transparent;
        border-right: 17px solid transparent;
        border-bottom: 17px solid #ff0000;
        top: -15px;
    }

    .santa-hat::after {
        width: 10px;
        height: 10px;
        top: 15px;
        left: -5px;
    }

    .player-body {
        width: 35px;
        height: 35px;
        top: 17px;
    }

    .player-body::after {
        width: 7px;
        height: 7px;
        top: 10px;
        left: 8px;
        box-shadow: 12px 0 0 #000;
    }

    .chaos-item {
        font-size: 10px;
        padding: 6px 10px;
        border-width: 2px;
    }

    /* Make buttons easier to tap on mobile */
    .big-button, #playAgainBtn {
        font-size: 18px;
        padding: 16px 36px;
        min-width: 180px;
    }

    /* Adjust email form for mobile */
    #emailForm {
        flex-direction: column;
        gap: 12px;
    }

    #emailInput {
        max-width: 100%;
        width: 100%;
        font-size: 16px;
    }

    #emailForm button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }

    /* Adjust overlays for mobile */
    .overlay h2, #endOverlay h2, #startOverlay h2 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .start-instructions {
        font-size: 14px;
        margin-bottom: 25px;
    }

    #statsMessage {
        font-size: 14px;
    }

    #hitMessage {
        font-size: 18px;
        padding: 15px;
    }

    .email-form {
        padding-top: 20px;
        margin-top: 20px;
    }

    .form-intro {
        font-size: 14px;
    }

    .coming-soon {
        font-size: 11px;
        margin-top: 10px;
    }
}

/* Mobile/Touch Device Controls */
.mobile-controls {
    display: none;
}

.desktop-controls {
    display: inline;
}

/* Show mobile controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    .mobile-controls {
        display: inline;
    }

    .desktop-controls {
        display: none;
    }

    /* Instant player response on mobile - no transition delay */
    #player {
        transition: none;
    }

    /* Add subtle touch hints on game area */
    #gameArea {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        touch-action: none; /* Prevent browser gestures */
    }

    /* Prevent text selection during gameplay */
    body {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        touch-action: manipulation; /* Faster tap response */
    }
}

/* Landscape mobile optimization */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        padding: 0;
        /* iPhone safe area support for notch in landscape */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .container {
        width: 100%;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .game-title {
        font-size: 18px;
        margin: 5px 0 2px 0;
    }

    .subtitle {
        font-size: 10px;
        margin-bottom: 5px;
    }

    #gameArea {
        width: 100vw;
        height: calc(100vh - 50px);
        border: none;
        flex: 1;
    }

    #timer {
        font-size: 18px;
        padding: 5px 12px;
        top: 8px;
    }

    #player {
        width: 30px;
        height: 45px;
    }

    .santa-hat {
        border-left: 15px solid transparent;
        border-right: 15px solid transparent;
        border-bottom: 15px solid #ff0000;
        top: -13px;
    }

    .player-body {
        width: 30px;
        height: 30px;
        top: 15px;
    }

    .chaos-item {
        font-size: 9px;
        padding: 5px 8px;
    }
}

/* Very small phones (320px width) */
@media (max-width: 400px) {
    .game-title {
        font-size: 20px;
    }

    .subtitle {
        font-size: 10px;
    }

    #timer {
        font-size: 18px;
        padding: 5px 14px;
    }

    .chaos-item {
        font-size: 9px;
        padding: 5px 8px;
    }

    .big-button, #playAgainBtn {
        font-size: 16px;
        padding: 14px 30px;
    }
}
