:root {
    --primary-color: #8a5cf6;
    --primary-color-dunkel: #6d3fd6;
    --gold: #d4af37;
    --gold-hell: #f0d78c;
    --background-color: #120c1e;
    --background-color-tief: #0a0714;
    --card-color: #1e1530;
    --card-border: rgba(212, 175, 55, 0.35);
    --text-color: #e8e0f5;
    --text-color-gedaempft: #b5a9cf;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    --schrift-serif: Georgia, 'Times New Roman', serif;
    --schrift-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
    font-family: var(--schrift-sans);
    background-color: var(--background-color);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(138, 92, 246, 0.18), transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(212, 175, 55, 0.12), transparent 35%),
        radial-gradient(circle at 50% 90%, rgba(138, 92, 246, 0.12), transparent 45%);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.6;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--gold-hell);
    margin-bottom: 6px;
    font-size: 2.5rem;
    font-family: var(--schrift-serif);
    text-shadow: 0 0 18px rgba(212, 175, 55, 0.35);
}

.untertitel {
    color: var(--text-color-gedaempft);
    font-style: italic;
}

main {
    flex: 1;
}

.tageskarte {
    background-color: var(--card-color);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 25px;
    text-align: center;
}

.tageskarte h2 {
    color: var(--gold);
    font-family: var(--schrift-serif);
    font-size: 1.1rem;
    margin-bottom: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tageskarte figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tageskarte-bild {
    width: 90px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--card-border);
    box-shadow: var(--shadow);
}

#tageskarte-name {
    color: var(--text-color-gedaempft);
    font-family: var(--schrift-serif);
    font-style: italic;
}

.problem-input-container {
    background-color: var(--card-color);
    border: 1px solid var(--card-border);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--gold-hell);
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--card-border);
    border-radius: 5px;
    resize: vertical;
    font-size: 1rem;
    background-color: var(--background-color-tief);
    color: var(--text-color);
    font-family: var(--schrift-sans);
}

textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.hinweis {
    margin-top: 10px;
    color: var(--gold-hell);
    background-color: rgba(212, 175, 55, 0.12);
    border: 1px solid var(--card-border);
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 0.95rem;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 15px;
    transition: background-color 0.3s ease, transform 0.15s ease;
}

button:hover {
    background-color: var(--primary-color-dunkel);
}

button:active {
    transform: scale(0.98);
}

button:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.hidden {
    display: none;
}

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

.cards-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin: 30px 0;
    list-style: none;
}

.card {
    width: 120px;
    height: 200px;
    background: linear-gradient(160deg, var(--primary-color), var(--primary-color-dunkel));
    border-radius: 10px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.card::before {
    content: '✦';
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: rgba(212, 175, 55, 0.5);
}

.card-bild {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
}

.card figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.7rem;
    line-height: 1.2;
    padding: 4px;
    /* Fast deckend: die Karten tragen ihren Titel selbst im Bild, ein
       durchscheinender Streifen liesse beide Beschriftungen ineinanderlaufen. */
    background: rgba(10, 7, 20, 0.93);
    color: var(--gold-hell);
    display: none;
}

.card.aufgedeckt {
    animation: aufdecken 0.5s ease forwards;
}

.card.aufgedeckt::before {
    display: none;
}

.card.aufgedeckt .card-bild,
.card.aufgedeckt figcaption {
    display: block;
}

.card.aufgedeckt.umgekehrt .card-bild {
    transform: rotate(180deg);
}

@keyframes aufdecken {
    0% {
        transform: rotateY(90deg);
        box-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }
    60% {
        box-shadow: 0 0 24px rgba(212, 175, 55, 0.55);
    }
    100% {
        transform: rotateY(0deg);
        box-shadow: var(--shadow);
    }
}

.analyzing-container {
    margin: 30px 0;
}

.analyzing-text {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--gold-hell);
    font-family: var(--schrift-serif);
    font-style: italic;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(138, 92, 246, 0.25);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.solution-container {
    background-color: var(--card-color);
    border: 1px solid var(--card-border);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-top: 30px;
    text-align: left;
}

h2 {
    color: var(--gold-hell);
    margin-bottom: 15px;
    font-size: 1.6rem;
    font-family: var(--schrift-serif);
}

h3 {
    color: var(--gold-hell);
    font-family: var(--schrift-serif);
    font-size: 1.15rem;
    margin-bottom: 10px;
}

#solution-text {
    font-size: 1.2rem;
    margin-bottom: 15px;
    line-height: 1.7;
    font-family: var(--schrift-serif);
}

.solution-advice {
    color: var(--text-color-gedaempft);
    margin-bottom: 20px;
    font-style: italic;
}

.zertifikat {
    background-color: var(--background-color-tief);
    border: 1px dashed var(--card-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.zertifikat dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 14px;
    font-size: 0.95rem;
}

.zertifikat dt {
    color: var(--text-color-gedaempft);
}

.zertifikat dd {
    color: var(--text-color);
    font-weight: bold;
}

#kopier-button {
    background-color: var(--gold);
    color: var(--background-color-tief);
}

#kopier-button:hover {
    background-color: var(--gold-hell);
}

#new-reading-button {
    background-color: var(--primary-color-dunkel);
}

#new-reading-button:hover {
    background-color: var(--primary-color);
}

footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-color-gedaempft);
}

/* Bewegungsreduktion respektieren */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Media queries for responsiveness */
@media (max-width: 600px) {
    .cards-container {
        gap: 10px;
    }

    .card {
        width: 100px;
        height: 160px;
    }

    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 400px) {
    .card {
        width: 78px;
        height: 130px;
    }

    .zertifikat dl {
        grid-template-columns: 1fr;
    }

    .app-container {
        padding: 12px;
    }
}
