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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #e0e0e0;
}

.container {
    max-width: 600px;
    width: 90%;
    padding: 40px;
    background: rgba(20, 20, 40, 0.9);
    border: 2px solid #4a4a6a;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(100, 100, 200, 0.2);
}

.container.center {
    text-align: center;
}

.container.victory {
    text-align: center;
    border: 2px solid #22c55e;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.3);
    animation: fadeIn 1s ease;
}

h1 {
    text-align: center;
    color: #a855f7;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
    margin-bottom: 10px;
    letter-spacing: 3px;
}

/* Puzzle Pages */
.puzzle-question {
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.puzzle-main-question {
    font-size: 1.4rem;
    margin-bottom: 25px;
    color: #e0e0e0;
    text-align: center;
    font-weight: bold;
}

.hint {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Buttons */
button {
    padding: 12px 25px;
    background: linear-gradient(135deg, #6b21a8 0%, #4c1d95 100%);
    border: none;
    border-radius: 5px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(168, 85, 247, 0.4);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #374151, #1f2937);
}

/* Large button for index page */
.btn-large {
    padding: 15px 50px;
    font-size: 1.1rem;
}

/* Keypad */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.keypad button {
    padding: 15px;
    font-size: 1.2rem;
}

.code-display {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #4a4a6a;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 10px;
    margin-bottom: 15px;
    min-height: 50px;
}

/* 7-digit code display for puzzle5 */
.code-display-7 {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #4a4a6a;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    font-size: 1.2rem;
    letter-spacing: 5px;
    margin-bottom: 15px;
    min-height: 50px;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #4a4a6a;
    border-radius: 5px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

/* Sequence Buttons */
.sequence-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.sequence-btn {
    width: 70px;
    height: 70px;
    font-size: 2rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f1f33 100%);
    border: 2px solid #3b82f6;
}

.sequence-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

/* Feedback */
.feedback {
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
    display: none;
}

.feedback.success {
    display: block;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    color: #22c55e;
    animation: pulse 0.5s ease;
}

.feedback.error {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
    animation: shake 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

/* Victory Page */
.victory {
    text-align: center;
    padding: 20px;
}

.victory h2 {
    color: #22c55e;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.victory p {
    font-size: 1.2rem;
    color: #9ca3af;
    margin-bottom: 10px;
}

.restart-btn {
    margin-top: 30px;
    padding: 15px 40px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 5px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(34, 197, 94, 0.5);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Index Page (Landing) */
.intro-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #9ca3af;
    margin-bottom: 30px;
}

.initial-countdown {
    padding: 30px;
}

.initial-timer {
    font-size: 2rem;
    color: #f59e0b;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
    font-weight: bold;
    white-space: nowrap;
}

.initial-label {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.main-content {
    display: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.main-content.revealed {
    display: block;
    opacity: 1;
}

/* Bottom Countdown (all pages) */
.countdown {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #4a4a6a;
    border-radius: 5px;
    margin-top: 20px;
}

.countdown-label {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.countdown-timer {
    font-size: 1.3rem;
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    font-weight: bold;
}

/* Progress Dots - 9 dots */
.progress-9 {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    max-width: 90px;
}

.progress-dot-9 {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4a4a6a;
    transition: background 0.3s;
}

.progress-dot-9.completed {
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.progress-dot-9.current {
    background: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* Toggle Switches */
.switches-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.switch {
    text-align: center;
}

.toggle {
    width: 60px;
    height: 100px;
    background: #2a2a3a;
    border: 3px solid #4a4a6a;
    border-radius: 30px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle.on {
    background: #22c55e;
    border-color: #22c55e;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.toggle-handle {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6b21a8, #4c1d95);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: top 0.3s;
    top: 5px;
}

.toggle.on .toggle-handle {
    top: 40px;
}

/* Radial Dials */
.dials-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 30px 0;
}

.dial {
    text-align: center;
}

.dial-outer {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #2a2a3a 0%, #1a1a2a 100%);
    border: 4px solid #4a4a6a;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.dial-outer.unlocked {
    border-color: #22c55e;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.dial-marker {
    position: absolute;
    width: 3px;
    height: 10px;
    background: #4a4a6a;
    left: 50%;
    top: 5px;
    transform: translateX(-50%);
}

.dial-pointer {
    position: absolute;
    width: 4px;
    height: 35px;
    background: linear-gradient(to bottom, #f59e0b, #6b21a8);
    left: 50%;
    top: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) translateY(-100%) rotate(0deg);
    border-radius: 2px;
    transition: transform 0.3s ease;
}

.dial-pointer.unlocked {
    background: linear-gradient(to bottom, #22c55e, #16a34a);
}

.dial-value {
    margin-top: 15px;
    font-size: 1.5rem;
    color: #f59e0b;
    font-weight: bold;
}

/* Image Display */
.image-display {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.image-display img {
    max-width: 216px;
    max-height: 216px;
    border-radius: 10px;
    border: 2px solid #4a4a6a;
}

/* Emoji Display for song puzzles */
.emoji-display {
    font-size: 2.5rem;
    text-align: center;
    padding: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    margin: 20px 0;
}

/* Puzzle Position */
.puzzle-position {
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
    margin-top: 10px;
    letter-spacing: 1px;
}

/* Puzzle Lockout Overlay */
.puzzle-lockout {
    text-align: center;
    padding: 40px 30px;
}

.lockout-content {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #4a4a6a;
    border-radius: 10px;
    padding: 40px 30px;
}

.lockout-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.lockout-message {
    color: #9ca3af;
    font-size: 1rem;
    margin-bottom: 15px;
}

.lockout-date {
    font-size: 1.5rem;
    color: #a855f7;
    font-weight: bold;
    margin-bottom: 25px;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.lockout-timer {
    font-size: 2rem;
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    font-weight: bold;
    letter-spacing: 0;
    word-break: break-all;
}

/* Puzzle content wrapper */
.puzzle-content {
    animation: fadeIn 0.5s ease;
}

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 480px) {
    /* Container adjustments */
    .container {
        width: 95%;
        padding: 20px 15px;
    }

    /* Typography */
    h1 {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .intro-text {
        font-size: 0.95rem;
    }

    /* Initial countdown - prevent overflow */
    .initial-timer {
        font-size: 1.3rem;
        white-space: normal;
        word-break: break-word;
    }

    .initial-countdown {
        padding: 15px;
    }

    /* Puzzle text */
    .puzzle-question {
        font-size: 1rem;
    }

    .puzzle-main-question {
        font-size: 1.1rem;
    }

    /* Buttons */
    button {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .btn-large {
        padding: 12px 30px;
        font-size: 1rem;
    }

    /* Code display - reduce letter-spacing */
    .code-display {
        font-size: 1.2rem;
        letter-spacing: 5px;
        padding: 10px;
    }

    .code-display-7 {
        font-size: 1rem;
        letter-spacing: 3px;
        padding: 10px;
    }

    /* Keypad */
    .keypad {
        gap: 8px;
    }

    .keypad button {
        padding: 12px;
        font-size: 1.1rem;
    }

    /* Sequence buttons - smaller */
    .sequence-buttons {
        gap: 10px;
    }

    .sequence-btn {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }

    /* Input */
    input[type="text"] {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    /* Input group - stack on very small screens */
    .input-group {
        gap: 8px;
    }

    /* Countdown */
    .countdown {
        padding: 10px;
        margin-top: 15px;
    }

    .countdown-timer {
        font-size: 1.1rem;
    }

    /* Progress dots */
    .progress-9 {
        gap: 4px;
        max-width: 80px;
    }

    .progress-dot-9 {
        width: 8px;
        height: 8px;
    }

    /* Toggle switches - smaller */
    .switches-container {
        gap: 15px;
        margin: 20px 0;
    }

    .toggle {
        width: 50px;
        height: 85px;
    }

    .toggle-handle {
        width: 40px;
        height: 40px;
    }

    .toggle.on .toggle-handle {
        top: 35px;
    }

    /* Radial dials - smaller */
    .dials-container {
        gap: 15px;
        margin: 20px 0;
    }

    .dial-outer {
        width: 80px;
        height: 80px;
    }

    .dial-pointer {
        height: 28px;
    }

    .dial-value {
        font-size: 1.2rem;
        margin-top: 10px;
    }

    /* Image display - smaller */
    .image-display {
        gap: 10px;
    }

    .image-display img {
        max-width: 100px;
        max-height: 100px;
    }

    /* Emoji display */
    .emoji-display {
        font-size: 2rem;
        padding: 20px;
    }

    /* Victory page */
    .victory h2 {
        font-size: 1.8rem;
    }

    .victory p {
        font-size: 1rem;
    }

    .restart-btn {
        padding: 12px 30px;
    }

    /* Feedback */
    .feedback {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .container {
        padding: 15px 10px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .sequence-btn {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }

    .toggle {
        width: 45px;
        height: 75px;
    }

    .toggle-handle {
        width: 36px;
        height: 36px;
    }

    .toggle.on .toggle-handle {
        top: 30px;
    }

    .dial-outer {
        width: 70px;
        height: 70px;
    }

    .code-display {
        font-size: 1rem;
        letter-spacing: 3px;
    }

    .code-display-7 {
        font-size: 0.9rem;
        letter-spacing: 2px;
    }

    /* Lockout overlay */
    .puzzle-lockout {
        text-align: center;
        padding: 30px 20px;
    }

    .lockout-content {
        background: rgba(0, 0, 0, 0.3);
        border: 2px solid #4a4a6a;
        border-radius: 10px;
        padding: 30px 20px;
    }

    .lockout-icon {
        font-size: 3rem;
        margin-bottom: 15px;
    }

    .lockout-message {
        color: #9ca3af;
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .lockout-date {
        font-size: 1.3rem;
        color: #a855f7;
        font-weight: bold;
        margin-bottom: 20px;
        text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
    }

    .lockout-timer {
        font-size: 1.5rem;
        color: #f59e0b;
        text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
        font-weight: bold;
        letter-spacing: 3px;
    }

    /* Puzzle content wrapper */
    .puzzle-content {
        animation: fadeIn 0.5s ease;
    }
}
