:root {
    --background: #b4d3ff;
    --card: #70737d;
    --card-shadow: rgba(0, 0, 0, 0.18);
    --card-border: #dfe5f1;
    --highlight: #f8c63d;
    --accent: #ed2d38;
    --text-dark: #172133;
    --light: #ffffff;
    --door-image: url('/assets/images/WinterBackground.webp');
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background: radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0.55) 12px, transparent 18px) 0 0 / 180px 180px,
        radial-gradient(circle at 75% 70%, rgba(255, 255, 255, 0.6) 0, rgba(255, 255, 255, 0.6) 10px, transparent 16px) 0 0 / 200px 200px,
        linear-gradient(180deg, #c9defd 0%, #9fc3fc 100%);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    position: relative;
    overflow-x: hidden;
}

.advent-page {
    position: relative;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 12px 48px;
}

.snow-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.8) 2px, transparent 2px),
        radial-gradient(circle at 30% 80%, rgba(255, 255, 255, 0.9) 2px, transparent 2px),
        radial-gradient(circle at 70% 10%, rgba(255, 255, 255, 0.85) 3px, transparent 3px),
        radial-gradient(circle at 90% 60%, rgba(255, 255, 255, 0.75) 2px, transparent 2px),
        radial-gradient(circle at 45% 40%, rgba(255, 255, 255, 0.8) 2px, transparent 2px);
    background-size: 260px 260px;
    animation: snowfall 18s linear infinite;
    opacity: 0.8;
    z-index: 0;
}

@keyframes snowfall {
    from {
        transform: translateY(-20px);
    }
    to {
        transform: translateY(20px);
    }
}

.advent-wrapper {
    position: relative;
    z-index: 1;
    width: min(1100px, 100%);
    background: rgba(255, 255, 255, 0.75);
    border: 3px solid #dbe7ff;
    border-radius: 16px;
    padding: 24px 18px 28px;
    box-shadow: 0 24px 60px rgba(23, 33, 51, 0.15);
    text-align: center;
    backdrop-filter: blur(4px);
    margin: 0 auto;
}

.eyebrow {
    margin: 0;
    letter-spacing: 3px;
    font-weight: 800;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--highlight);
    text-shadow: 2px 2px 0 #000;
}

.headline {
    margin: 4px 0 12px;
    font-size: clamp(1.8rem, 3.6vw, 2.6rem);
    letter-spacing: 2px;
    font-family: 'Mountains of Christmas', 'Playfair Display', cursive;
    text-shadow: 2px 2px 0 #000;
}

.headline span {
    display: inline-block;
    color: var(--accent);
}

.headline span:nth-child(even) {
    color: var(--light);
}

.subline {
    margin: 0 0 18px;
    font-size: 0.95rem;
    color: #20324f;
}

.calendar-grid {
    display: grid;
    gap: 10px;
    justify-items: stretch;
    padding: 8px 4px;
}

.calendar-grid-mixed {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    grid-auto-rows: 120px;
}

.calendar-door {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 3px solid var(--card-border);
    border-radius: 14px;
    background: var(--card);
    color: var(--light);
    font-size: clamp(1.6rem, 2vw, 2rem);
    font-weight: 700;
    box-shadow: 0 10px 16px var(--card-shadow);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.calendar-door span {
    position: relative;
    z-index: 2;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.35);
}

.calendar-door .door-content {
    position: absolute;
    inset: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 3;
}

.calendar-door .door-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    padding: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.calendar-door::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--card);
    z-index: 1;
    transition: opacity 0.2s ease;
    opacity: 1;
}

.calendar-door:hover:not(.opened) {
    transform: translateY(-2px);
    box-shadow: 0 14px 22px rgba(0, 0, 0, 0.2);
}

.calendar-door:active:not(.opened) {
    transform: translateY(1px);
    filter: brightness(0.96);
}

.calendar-door.opened {
    color: var(--light);
    border-color: #ffffff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
    background-image: var(--door-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    text-shadow: 2px 3px 6px rgba(0, 0, 0, 0.45);
}

.calendar-door.opened span {
    opacity: 0;
}

.calendar-door.opened .door-content,
.calendar-door.claimed .door-content {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.calendar-door.opened.claimed {
    /* Add specific style for claimed doors if needed, e.g. opacity or overlay */
    cursor: default;
}

.calendar-door.opened::after {
    opacity: 0;
}

.advent-sunday {
    border-color: var(--card-border);
    background: var(--card);
    box-shadow: 0 10px 16px var(--card-shadow);
}

.advent-sunday span {
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.advent-sunday::before,
.advent-sunday::after {
    content: none;
}

/* Test Day Styling - Visually distinct for testing */
.calendar-door.test-day {
    border: 4px solid #ff6b35;
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    box-shadow: 0 10px 20px rgba(255, 107, 53, 0.4), 
                0 0 0 2px rgba(255, 255, 255, 0.3),
                inset 0 0 20px rgba(255, 255, 255, 0.2);
    position: relative;
    animation: testDayPulse 2s ease-in-out infinite;
}

.calendar-door.test-day::before {
    content: "TEST";
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #ff6b35;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.calendar-door.test-day span {
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 800;
}

.calendar-door.test-day:hover:not(.opened) {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px rgba(255, 107, 53, 0.5),
                0 0 0 2px rgba(255, 255, 255, 0.4),
                inset 0 0 25px rgba(255, 255, 255, 0.3);
}

.calendar-door.test-day.opened {
    border-color: #ff6b35;
    box-shadow: 0 10px 20px rgba(255, 107, 53, 0.3);
}

@keyframes testDayPulse {
    0%, 100% {
        box-shadow: 0 10px 20px rgba(255, 107, 53, 0.4), 
                    0 0 0 2px rgba(255, 255, 255, 0.3),
                    inset 0 0 20px rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 10px 25px rgba(255, 107, 53, 0.6), 
                    0 0 0 3px rgba(255, 255, 255, 0.4),
                    inset 0 0 25px rgba(255, 255, 255, 0.3);
    }
}

.hint {
    margin-top: 14px;
    color: #374a6b;
    font-size: 0.95rem;
}

code {
    background: #f0f4ff;
    padding: 4px 6px;
    border-radius: 6px;
}

@media (max-width: 720px) {
    .calendar-grid-mixed {
        grid-template-columns: repeat(4, minmax(80px, 1fr));
        grid-auto-rows: 90px;
    }
}

@media (max-width: 540px) {
    .calendar-grid-mixed {
        grid-template-columns: repeat(2, minmax(80px, 1fr));
        grid-auto-rows: 85px;
    }
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.4); 
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 0; /* Padding entfernt, damit Bild bis an den Rand geht */
    border: 1px solid #888;
    width: 80%; 
    max-width: 400px;
    border-radius: 10px;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    overflow: hidden; /* Damit das Bild die abgerundeten Ecken respektiert */
}

.modal-header {
    padding: 15px 20px;
    background-color: #f0f4ff;
    border-bottom: 1px solid #dfe5f1;
}

.modal-header h2 {
    margin: 0;
    color: var(--accent);
    font-size: 1.5rem;
}

.modal-image {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 0; /* Margin entfernt */
    object-fit: cover;
    max-height: 200px;
}

.modal-body {
    padding: 10px 20px 20px; /* Weniger Padding oben */
}

.modal-body p {
    margin-top: 5px;
    margin-bottom: 5px;
}

.close-modal {
    color: #333;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 10px;
    cursor: pointer;
    z-index: 10; /* Damit es über dem Bild liegt */
    background: rgba(255, 255, 255, 0.7); /* Halbtransparenter Hintergrund für bessere Lesbarkeit */
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 50%;
    text-align: center;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#kau-input {
    width: 100%;
    padding: 10px;
    margin: 15px 0 10px; /* Mehr Abstand nach oben zum Text */
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

#submit-kau {
    background-color: var(--accent, #ed2d38);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

#submit-kau:hover {
    background-color: #c9222c;
}
