/* Grundlayout */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
    background: radial-gradient(circle at top, #1d2a4d 0, #050814 55%, #02030a 100%);
    color: #f7f2e9;
}

/* Sterne / leichter Overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
            radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.18) 0, transparent 40%),
            radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.12) 0, transparent 45%),
            radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0.1) 0, transparent 50%);
    opacity: 0.6;
    pointer-events: none;
    z-index: -1;
}

.app {
    max-width: min(1400px, 95vw);
    margin: 0 auto;
    padding: clamp(24px, 2.5vh, 60px) clamp(16px, 2.5vw, 32px) clamp(32px, 3vh, 48px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: center;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: clamp(18px, 2vh, 32px);
}

.header h1 {
    font-family: "Cinzel", serif;
    font-weight: 700;
    font-size: clamp(2rem, 2vw + 1rem, 3.2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f5e6c5;
    text-shadow: 0 0 14px rgba(246, 212, 130, 0.6);
    margin: clamp(8px, 1vh, 16px) 0;
}

.subtitle {
    font-family: "Cinzel", serif;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-size: clamp(0.9rem, 0.7vw + 0.5rem, 1.3rem);
    color: #f0d9a5;
    margin: clamp(8px, 0.8vh, 12px) 0 clamp(14px, 1.5vh, 32px);
    text-align: center;
}

/* Türenbereich */
.doors-section h2 {
    font-family: "Cinzel", serif;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-size: 1rem;
    color: #f0d9a5;
    margin-bottom: 4px;
    text-align: center;
}

.doors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
    gap: clamp(12px, 1.2vw, 24px);
    margin-top: clamp(10px, 1.2vh, 24px);
}

@media (min-width: 768px) {
    .doors-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

/* Türchen */
.door {
    position: relative;
    padding: clamp(18px, 2vh, 28px) clamp(8px, 0.9vw, 14px);
    border-radius: clamp(8px, 0.9vw, 12px);
    border: 1px solid rgba(255, 215, 128, 0.7);
    background: linear-gradient(145deg, #161b2f, #202a49);
    color: #f7f2e9;
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease,
    background 0.18s ease, border-color 0.18s ease;
    font-family: "Cinzel", serif;
    font-size: clamp(1rem, 0.9vw + 0.5rem, 1.3rem);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.door span.day-number {
    display: block;
    font-size: clamp(1.2rem, 1.4vw + 0.5rem, 2rem);
    margin-bottom: clamp(4px, 0.6vh, 8px);
}

.door span.day-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #d3c6ae;
}

/* Aktives / gelöst / gesperrt Styling */
.door.current {
    border-color: #f6d68d;
    box-shadow: 0 0 18px rgba(246, 214, 141, 0.7);
}

.door.current:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(246, 214, 141, 0.9);
    background: radial-gradient(circle at top, #27335a 0, #1b2340 55%, #11152a 100%);
}

.door.solved {
    background: linear-gradient(145deg, #283655, #3c4d7a);
    border-color: #9fd6a9;
    box-shadow: 0 0 14px rgba(159, 214, 169, 0.65);
}

.door.solved::after {
    content: "✓";
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.9rem;
    color: #9fd6a9;
}

.door.locked {
    background: linear-gradient(145deg, #101322, #161825);
    border-color: rgba(150, 150, 150, 0.4);
    color: #8f8a80;
    cursor: not-allowed;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.65);
}

.door.locked span.day-label {
    color: #75706a;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: clamp(24px, 2.5vh, 48px);
    font-family: "Cinzel", serif;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-size: clamp(0.9rem, 0.7vw + 0.5rem, 1.2rem);
    color: #f0d9a5;
}

/* Schneeflocken Animation */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -50px;
    color: #f6d68d;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 8px rgba(246, 214, 141, 0.9), 0 0 12px rgba(246, 214, 141, 0.6);
    animation: snowfall linear infinite;
    opacity: 0.8;
}

.snowflake.small {
    font-size: 0.8em;
}

.snowflake.medium {
    font-size: 1.2em;
}

.snowflake.large {
    font-size: 1.6em;
}

.snowflake.xlarge {
    font-size: 2em;
}

@keyframes snowfall {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
        opacity: 0.8;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translateX(30px) rotate(180deg);
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(calc(100vh + 50px)) translateX(60px) rotate(360deg);
        opacity: 0;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 4, 12, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    position: relative;
    max-width: 620px;
    width: 100%;
    background: radial-gradient(circle at top, #2b314e 0, #161826 60%, #080811 100%);
    border-radius: 14px;
    border: 1px solid rgba(246, 214, 141, 0.6);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8);
    padding: 18px 20px 20px;
    color: #f7f2e9;
}

.modal-header h2 {
    font-family: "Cinzel", serif;
    font-size: 1.3rem;
    margin: 0;
    color: #f5e1b5;
}

.modal-day {
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #c7b79a;
    margin-top: 4px;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: transparent;
    color: #f2e7d2;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #f9d79a;
}

.modal-body {
    margin-top: 12px;
}

.modal-story {
    font-size: 0.9rem;
    color: #dcd1c2;
    margin-bottom: 10px;
}

.modal-question {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: #f5e6c5;
}

.answer-label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #cfc1ac;
}

#answerInput {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #c2b79e;
    margin-bottom: 10px;
    font-size: 0.95rem;
    background-color: #0f1220;
    color: #f7f2e9;
}

#answerInput:focus {
    outline: none;
    border-color: #f6d68d;
    box-shadow: 0 0 0 1px rgba(246, 214, 141, 0.5);
}

.btn-primary {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #f6d68d, #dca34e);
    color: #251b0b;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* Sicherstellen, dass Button in Modal volle Breite hat */
.modal-body .btn-primary {
    width: 100% !important;
    display: block !important;
}

.btn-primary:hover {
    box-shadow: 0 0 14px rgba(246, 214, 141, 0.8);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

/* Feedback & Nachricht */
.feedback {
    min-height: 18px;
    margin-top: 6px;
    font-size: 0.86rem;
}

.feedback.error {
    color: #ff9a9a;
}

.feedback.success {
    color: #f6d68d;
    text-shadow: 0 0 8px rgba(246, 214, 141, 0.8), 0 0 12px rgba(246, 214, 141, 0.6);
    animation: pulse-gold 2s ease-in-out infinite;
}

@keyframes pulse-gold {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 8px rgba(246, 214, 141, 0.8), 0 0 12px rgba(246, 214, 141, 0.6), 0 0 16px rgba(246, 214, 141, 0.4);
    }
    50% {
        opacity: 0.9;
        text-shadow: 0 0 12px rgba(246, 214, 141, 1), 0 0 16px rgba(246, 214, 141, 0.8), 0 0 20px rgba(246, 214, 141, 0.6);
    }
}

.modal-continuation {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(246, 214, 141, 0.3);
    font-size: 0.9rem;
    color: #dcd1c2;
    white-space: pre-line;
}

.modal-continuation.hidden {
    display: none;
}

.modal-message {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(246, 214, 141, 0.2);
    font-size: 0.9rem;
    color: #e4d7c3;
    font-style: italic;
    white-space: pre-line;
}

.modal-message.hidden {
    display: none;
}
.modal {
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    padding-right: 8px;
}

.modal-story,
.modal-question,
.modal-continuation {
    white-space: pre-line;
}

/* Flackernde Buchstaben wie in einem Kamin */
.flicker-letter {
    display: inline-block;
    color: #f6d68d;
    text-shadow: 0 0 8px rgba(246, 214, 141, 0.8), 0 0 12px rgba(246, 214, 141, 0.6);
    animation: flicker 2s infinite;
    animation-timing-function: ease-in-out;
}

@keyframes flicker {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 8px rgba(246, 214, 141, 0.8), 0 0 12px rgba(246, 214, 141, 0.6), 0 0 16px rgba(246, 214, 141, 0.4);
    }
    25% {
        opacity: 0.7;
        text-shadow: 0 0 6px rgba(246, 214, 141, 0.6), 0 0 10px rgba(246, 214, 141, 0.4);
    }
    50% {
        opacity: 0.9;
        text-shadow: 0 0 10px rgba(246, 214, 141, 0.9), 0 0 14px rgba(246, 214, 141, 0.7), 0 0 18px rgba(246, 214, 141, 0.5);
    }
    75% {
        opacity: 0.8;
        text-shadow: 0 0 7px rgba(246, 214, 141, 0.7), 0 0 11px rgba(246, 214, 141, 0.5);
    }
}

/* Grössere Pfoten im Footer */
.flicker-letter.paws {
    font-size: 1.5em;
    display: inline-block;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 620px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    position: relative;
}

.login-card {
    position: relative;
    max-width: 620px;
    width: 100%;
    max-height: 80vh;
    background: radial-gradient(circle at top, #2b314e 0, #161826 60%, #080811 100%);
    border-radius: 14px;
    border: 1px solid rgba(246, 214, 141, 0.6);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8);
    padding: 18px 20px 20px;
    color: #f7f2e9;
    animation: cardAppear 0.6s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.login-header {
    flex-shrink: 0;
}

.login-title {
    font-family: "Cinzel", serif;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f5e1b5;
    text-shadow: 0 0 14px rgba(246, 212, 130, 0.6);
    margin: 0;
    text-align: center;
}

.login-body {
    margin-top: 12px;
    overflow-y: auto;
    padding-right: 8px;
}

.login-story {
    font-size: 0.9rem;
    color: #dcd1c2;
    margin-bottom: 10px;
    white-space: pre-line;
}

.login-question {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: #f5e6c5;
    white-space: pre-line;
}

.login-body .answer-label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #cfc1ac;
}

.login-body #pinInput {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #c2b79e;
    margin-bottom: 10px;
    font-size: 0.95rem;
    background-color: #0f1220;
    color: #f7f2e9;
}

.login-body #pinInput:focus {
    outline: none;
    border-color: #f6d68d;
    box-shadow: 0 0 0 1px rgba(246, 214, 141, 0.5);
}

.login-body .btn-primary {
    width: 100%;
    margin-bottom: 0;
}

.login-body .feedback {
    min-height: 18px;
    margin-top: 6px;
    font-size: 0.86rem;
}

.login-body .feedback.error {
    color: #ff9a9a;
}

.login-body .feedback.hidden {
    display: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Login Page - Schneeflocken z-index anpassen */
.login-page .snowflakes {
    z-index: 1;
}

.login-page .login-container {
    z-index: 10;
}

/* Responsive für Login */
@media (max-width: 768px) {
    .pin-input {
        width: 140px;
        height: 55px;
        font-size: 1.4rem;
        letter-spacing: 0.2em;
    }
    
    .login-card {
        padding: 20px 18px;
    }
}
