:root {
    --castle-color: #4a4a4a;
    --door-color: #8b4513;
    --gold-color: #ffd700;
}

/* Schriftarten */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Open+Sans:wght@400;600&display=swap');

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1c20 0%, #2b2f38 100%);
    font-family: 'Open Sans', sans-serif; /* Lesbarere Standardschrift */
    color: var(--gold-color);
}

h1, h2, .door-number {
    font-family: 'Cinzel', fantasy; /* Dekorative Schrift für Überschriften */
}

.castle {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-image: url('../assets/castle_background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 900px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    position: relative;
}

h1 {
    text-align: center;
    font-size: 3em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 40px;
}

.calendar-container {
    position: relative;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    margin: 0 auto;
    width: 95%;
    aspect-ratio: 1;
}

.door {
    position: absolute;
    cursor: pointer;
    perspective: 1000px;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%);
}

.door-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--door-color);
    border: 2px solid var(--gold-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        2px 2px 5px rgba(0,0,0,0.3),
        inset 0 0 15px rgba(255,215,0,0.3);
    background-image: 
        linear-gradient(45deg, 
            rgba(139, 69, 19, 0.7) 25%, 
            rgba(160, 82, 45, 0.7) 25%, 
            rgba(160, 82, 45, 0.7) 50%, 
            rgba(139, 69, 19, 0.7) 50%, 
            rgba(139, 69, 19, 0.7) 75%, 
            rgba(160, 82, 45, 0.7) 75%, 
            rgba(160, 82, 45, 0.7));
    background-size: 20px 20px;
    will-change: transform;
}

.door-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(139, 69, 19, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    transform-origin: left;
}

.door.opened .door-front {
    transform: rotateY(-105deg);
    pointer-events: none;
}

/* Türnummer styling - Basisstil */
.door-number {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--gold-color);
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Spezielle Größen für zweistellige Zahlen */
.door[data-day="10"] .door-number,
.door[data-day="11"] .door-number,
.door[data-day="12"] .door-number,
.door[data-day="13"] .door-number,
.door[data-day="14"] .door-number,
.door[data-day="15"] .door-number,
.door[data-day="16"] .door-number,
.door[data-day="17"] .door-number,
.door[data-day="18"] .door-number,
.door[data-day="19"] .door-number,
.door[data-day="20"] .door-number,
.door[data-day="21"] .door-number,
.door[data-day="22"] .door-number,
.door[data-day="23"] .door-number {
    font-size: 1em; /* Kleinere Schrift für zweistellige Zahlen */
}

/* Spezielle Größe für Tür 24 */
.door[data-day="24"] .door-number {
    font-size: 2em;
}

/* Türgriff */
.door-handle {
    position: absolute;
    right: 10px;
    top: 50%;
    width: 8px;
    height: 15px;
    background: var(--gold-color);
    border-radius: 4px;
    transform: translateY(-50%);
    box-shadow: 0 0 5px rgba(255,215,0,0.5);
}

/* Gesperrte Tür */
.door.locked .door-front {
    opacity: 0.7;
    cursor: not-allowed;
}

.door.locked .door-handle {
    background: #666;
    box-shadow: none;
}

/* Hover Effekt */
.door:not(.opened):not(.locked):hover .door-front {
    transform: rotateY(-15deg);
    box-shadow:
        3px 3px 8px rgba(0,0,0,0.4),
        inset 0 0 20px rgba(255,215,0,0.4);
}

/* Keyboard Focus Effekt */
.door:focus {
    outline: 3px solid var(--gold-color);
    outline-offset: 4px;
    z-index: 10;
}

.door:not(.opened):not(.locked):focus .door-front {
    transform: rotateY(-15deg);
    box-shadow:
        3px 3px 8px rgba(0,0,0,0.4),
        inset 0 0 20px rgba(255,215,0,0.4);
}

/* Letztes Türchen (24) speziell gestalten */
.door:last-child {
    /* Keine feste Größe hier, wird durch JavaScript gesetzt */
}

.door:last-child .door-front {
    background-image: 
        linear-gradient(45deg, 
            rgba(139, 69, 19, 0.8) 25%, 
            rgba(178, 34, 34, 0.8) 25%, 
            rgba(178, 34, 34, 0.8) 50%, 
            rgba(139, 69, 19, 0.8) 50%, 
            rgba(139, 69, 19, 0.8) 75%, 
            rgba(178, 34, 34, 0.8) 75%, 
            rgba(178, 34, 34, 0.8));
    background-size: 30px 30px;
    border-width: 3px;
}

.door:last-child .door-handle {
    width: 12px;
    height: 20px;
    right: 15px;
}

@media (max-width: 768px) {
    .door {
        width: 80% !important;
        height: 80% !important;
    }
    
    .door:last-child {
        width: 160% !important;
        height: 160% !important;
    }
    
    .door-front {
        font-size: 1em;
    }
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
}

.modal-content {
    background-color: #2b2f38;
    margin: 2% auto;
    padding: 20px;
    border: 2px solid var(--gold-color);
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 30px;
    cursor: pointer;
    color: var(--gold-color);
}

.story-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow-y: auto;
    max-height: calc(90vh - 40px);
    padding-right: 10px;
}

.story-content::-webkit-scrollbar {
    width: 8px;
}

.story-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.story-content::-webkit-scrollbar-thumb {
    background: var(--gold-color);
    border-radius: 4px;
}

#storyImage {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: 40vh;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 15px;
}

#storyTitle {
    font-family: 'Cinzel', fantasy;
    margin: 10px 0 5px 0;
    font-size: 1.8em;
    text-align: center;
    color: var(--gold-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#storyText {
    font-family: 'Open Sans', sans-serif;
    margin: 20px 0;
    line-height: 1.8;
    text-align: left;
    padding: 0 20px;
    font-size: 1.1em;
    color: #fff;
    letter-spacing: 0.02em;
}

.story-paragraph {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 15px;
    border-left: 3px solid var(--gold-color);
}

#playButton {
    background: var(--gold-color);
    color: #2b2f38;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin: 5px 0 20px 0;
    transition: transform 0.2s ease;
}

#playButton:hover {
    transform: scale(1.05);
}

#storyImage {
    margin-top: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calendar-container {
        min-height: auto;
        padding: 5px;
        margin: 0;
        width: 100vw;
        max-width: none;
    }
    
    h1 {
        font-size: 1.8em;
        margin: 15px 0;
    }

    .castle {
        min-height: auto;
        padding: 5px;
        width: 100%;
        margin: 0;
    }

    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
    }
}

/* Türchen Dekorationen */
.door::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 7px;
}

/* Schloss-Elemente */
.castle::before {
    display: none;
}

/* Am Ende der Datei hinzufügen */
.admin-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    display: none;
}

body.admin-mode .admin-indicator {
    display: block;
}

#musicControl {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--gold-color);
    border: 2px solid var(--gold-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2em;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

#musicControl:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

#musicControl i {
    color: var(--gold-color);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* Am Ende der Datei hinzufügen */
.story-part {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border-left: 3px solid var(--gold-color);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.story-part p {
    text-align: left;
    line-height: 1.8;
    margin: 15px 0;
    width: 100%;
}

/* Responsives Grid */
@media (orientation: landscape) {
    .calendar-container {
        grid-template-columns: repeat(8, 1fr); /* 8x8 für Querformat */
    }
}

@media (orientation: portrait) {
    .calendar-container {
        grid-template-columns: repeat(5, 1fr); /* 5x12 für Hochformat */
    }
}

/* Am Ende der CSS-Datei hinzufügen */
.site-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--gold-color);
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 215, 0, 0.2);
}

.site-footer a {
    color: var(--gold-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Bildstil für alle Geschichten einheitlich */
#storyImage,
.story-part img {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: 40vh;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 15px;
}

/* Spezielle Anpassung für Tag 24 Bilder */
.story-part img {
    max-width: 300px; /* Kleinere maximale Breite für die Tag-24-Bilder */
    max-height: 30vh; /* Kleinere maximale Höhe für die Tag-24-Bilder */
}

/* Story-Part Container für Tag 24 */
.story-part {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border-left: 3px solid var(--gold-color);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .story-part img {
        max-width: 250px;
        max-height: 25vh;
    }
}

/* Magischer Alert Dialog */
#magicAlert {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.magic-alert-content {
    background: linear-gradient(135deg, #2b2f38 0%, #1a1c20 100%);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid var(--gold-color);
    text-align: center;
    max-width: 400px;
    position: relative;
    animation: magicAppear 0.5s ease-out;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

.magic-alert-content h3 {
    color: var(--gold-color);
    font-family: 'Cinzel', fantasy;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.magic-alert-content p {
    color: #fff;
    margin: 10px 0;
    line-height: 1.6;
}

.magic-alert-content button {
    background: var(--gold-color);
    color: #2b2f38;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    margin-top: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.magic-alert-content button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.magic-snowflake {
    position: absolute;
    color: white;
    font-size: 20px;
    pointer-events: none;
    animation: snowfall linear infinite;
    opacity: 0.6;
}

@keyframes magicAppear {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes snowfall {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 0;
    }
    20% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(400px) rotate(360deg);
        opacity: 0;
    }
}

/* Video-Styling */
.story-media {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: 40vh;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

/* Responsive Anpassungen für mobile Geräte */
@media (max-width: 768px) {
    .calendar-container {
        min-height: auto;
        padding: 10px;
        margin: 10px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.8em;
        margin: 15px 0;
    }

    .castle {
        min-height: auto;
        padding: 10px;
    }
}

/* Spezifische Anpassungen für verschiedene Bildschirmformate */
@media (orientation: portrait) {
    .calendar-container {
        aspect-ratio: 5/8;
        width: 100% !important;
        max-width: none !important;
        padding: 10px;
        margin: 0;
    }

    .castle {
        padding: 5px;
    }

    /* Türchen-Größe für Portrait-Modus */
    .door {
        width: 16% !important;
        height: 6.25% !important;
    }

    /* Größeres Türchen 24 für Portrait-Modus */
    .door[data-day="24"] {
        width: 32% !important;
        height: 12.5% !important;
    }

    /* Spezifische Regel für Türchen 23 */
    .door[data-day="23"] {
        width: 16% !important;
        height: 6.25% !important;
    }

    /* Anpassung der Schriftgrößen für mobile Ansicht */
    .door-number {
        font-size: 0.9em;
    }

    .door[data-day="24"] .door-number {
        font-size: 1.4em;
    }
}

@media (orientation: landscape) {
    .calendar-container {
        aspect-ratio: 8/5;
        max-width: 800px;
        width: 95%;
        margin: 0 auto;
    }

    /* Türchen-Größe für Landscape-Modus */
    .door {
        width: 10% !important;
        height: 10% !important;
    }

    /* Größeres Türchen 24 für Landscape-Modus */
    .door[data-day="24"] {
        width: 20% !important;
        height: 20% !important;
    }

    /* Spezifische Regel für Türchen 23 */
    .door[data-day="23"] {
        width: 10% !important;
        height: 10% !important;
    }
}

/* Sehr kleine Bildschirme */
@media (max-width: 480px) {
    .door-number {
        font-size: 0.9em;
    }

    .door[data-day="24"] .door-number {
        font-size: 1.4em;
    }

    /* Modal Anpassungen */
    .modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 15px;
    }

    #storyTitle {
        font-size: 1.4em;
    }

    #storyText {
        font-size: 1em;
        padding: 0 10px;
    }

    .story-paragraph {
        padding: 10px;
        margin-bottom: 10px;
    }
}

/* Mittlere Bildschirme */
@media (min-width: 481px) and (max-width: 768px) {
    .door-number {
        font-size: 1em;
    }

    .door[data-day="24"] .door-number {
        font-size: 1.6em;
    }
}

/* Gemeinsame mobile Anpassungen */
@media (max-width: 768px) {
    .story-media {
        max-width: 90%;
    }

    #playButton {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    #musicControl {
        width: 40px;
        height: 40px;
        font-size: 1em;
    }

    .site-footer {
        padding: 15px;
        font-size: 0.8em;
    }
}

/* Basis Container-Styles */
.castle {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-image: url('../assets/castle_background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 900px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    position: relative;
}

/* Mobile Anpassungen */
@media screen and (max-width: 768px) {
    .castle {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 10px;
        min-height: auto;
        border-radius: 0;
    }

    .calendar-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 5px !important;
    }

    body {
        margin: 0;
        padding: 0;
    }

    h1 {
        font-size: 1.8em;
        margin: 15px 0;
        padding: 0 10px;
    }
}

/* Spezifische Anpassungen für sehr schmale Bildschirme */
@media screen and (max-width: 480px) {
    .castle {
        padding: 5px;
    }

    .calendar-container {
        padding: 2px !important;
    }
}
  