/* =========================
   THEME / TOKENS
   ========================= */
:root {
    /* Core colors */
    --text: #2b1b22;
    --ink: #5b1b26; /* main dark (headlines, borders) */
    --ink-soft: #7a2633; /* secondary text */
    --accent: #ff4d8d; /* pink accent */

    /* Surfaces */
    --paper: #fff;
    --paper-soft: #ffffffcc;
    --paper-letter: #fff7fb;
    --paper-sentence: #ffffffaa;

    /* Background */
    --bg-html: #222;
    --bg-grad-1: #fdc8df;
    --bg-grad-2: #ffc9df;
    --bg-spot: rgba(255, 240, 247, 0.6);

    /* Lines */
    --line-peach: #f0b0a8;
    --line-dash: #e9a19a;

    /* Radii */
    --radius-body: 20px;
    --radius-card: 22px;
    --radius-tile: 15px;
    --radius-ui: 16px;
    --radius-small: 12px;
    --radius-thumb: 10px;
    --radius-media: 8px;

    /* Shadows */
    --shadow-body: 0 10px 30px rgba(16, 8, 12, 0.18);
    --shadow-tile: 8px 8px 0px rgba(91, 27, 38, 0.15);
    --shadow-polaroid: 5px 5px 15px rgba(0, 0, 0, 0.1);
    --shadow-modal: 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-media: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-sentence: 2px 4px 10px rgba(0, 0, 0, 0.05);

    /* Fonts */
    --font-hand:
        "Patrick Hand", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-nunito: "Nunito", sans-serif;
}

#no {
    transition:
        left 0.2s ease,
        top 0.2s ease,
        transform 0.2s ease;
    z-index: 10;
}
#yes {
    position: relative;
    z-index: 20;
}
/* =========================
   RESET / BASE
   ========================= */
* {
    box-sizing: border-box;
}

html {
    background: var(--bg-html);
}

body {
    margin: 18px;
    min-height: calc(100svh - 36px);
    display: grid;
    place-items: center;

    width: calc(100% - 36px);
    border-radius: var(--radius-body);

    font-family: var(--font-hand);
    color: var(--text);

    background:
        radial-gradient(
            900px 500px at 88% 92%,
            var(--bg-spot),
            transparent 20%
        ),
        linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 70%);

    box-shadow: var(--shadow-body);

    /* WICHTIG: Scrollen erlauben */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
}

/* =========================
   LAYOUT
   ========================= */
.card {
    width: min(1000px, 95vw);
    padding: 28px 22px;
    position: relative;
    z-index: 1;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
    padding: 10px;
    width: 100%;
}

.row {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.emblem {
    font-size: 34px;
    text-align: center;
    margin-bottom: 10px;
}

/* =========================
   TYPOGRAPHY
   ========================= */
h1 {
    text-align: center;
    font-size: clamp(28px, 5.6vw, 48px);
    font-family: "Patrick Hand", cursive;
    z-index: 2;
}

h1 .prefix {
    display: block;
    font-size: clamp(26px, 6vw, 56px);
    color: #e53b5a; /* kept as-is (unique value) */
    z-index: 2;
}

h1 .headline {
    display: block;
    font-size: clamp(26px, 6vw, 56px);
    color: var(--ink);
    z-index: 2;
}

.sub {
    text-align: center;
    margin: 0 0 18px;
    font-family: var(--font-nunito);
    color: var(--ink-soft);
    font-weight: 700;
}

h1,
.sub,
.row,
.grid {
    position: relative;
    z-index: 5;
}

/* =========================
   BUTTONS
   ========================= */
button {
    position: relative;
    display: inline-block;

    border-radius: 28px;
    padding: 12px 44px;
    font-size: 13px;
    cursor: pointer;

    background: linear-gradient(180deg, #ff9a82);
    color: var(--ink);

    border: 3px solid rgba(131, 14, 34, 0.635);
    transition:
        transform 0.12s cubic-bezier(0.2, 0.9, 0.2, 1),
        filter 0.18s ease;

    min-width: 320px;
    max-width: 48vw;

    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    font-family: var(--font-nunito);
}

button:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

button:active {
    transform: translateY(-1px) scale(0.997);
}

/* Used by modal close button */
.x {
    border: 0;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    min-width: unset;
    padding: 5px;
}

/* =========================
   TILES
   ========================= */
.tile {
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: var(--radius-tile);
    padding: 25px 20px;

    position: relative; /* for sticker positioning */
    box-shadow: var(--shadow-tile);

    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* "thrown on table" rotations */
.tile:nth-child(1) {
    transform: rotate(-1.5deg);
}
.tile:nth-child(2) {
    transform: rotate(1.2deg);
}
.tile:nth-child(3) {
    transform: rotate(-0.8deg);
}

.tile:hover {
    transform: scale(1.03) rotate(0deg);
    z-index: 10;
}

.tile h3 {
    font-family: "Patrick Hand", cursive;
    font-size: 26px;
    color: var(--ink);
    margin: 5px 0;
}

.tile p {
    font-size: 14px;
    color: var(--ink-soft);
    margin-bottom: 20px;
    font-family: var(--font-nunito);
}

/* Buttons inside tiles */
.tile .open {
    width: 100%;
    min-width: unset;
    padding: 10px 15px;
    font-size: 12px;
}

/* Sticker icons */
.decoration {
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 32px;
    filter: drop-shadow(2px 2px 0px rgba(0, 0, 0, 0.1));
    transform: rotate(15deg);
}

/* Letter preview lines */
.line {
    height: 4px;
    background: var(--line-peach);
    margin-bottom: 6px;
    border-radius: 2px;
    width: 100%;
}
.line:first-child {
    margin-top: 40px;
}

.line:last-child {
    width: 60%;
}

.letter-preview {
    width: 60px;
    margin-bottom: 15px;
}

.photo-placeholder {
    font-size: 50px;
    margin-bottom: 10px;
    background: #fdf0f3; /* kept as-is (unique value) */
    width: 80px;
    height: 80px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-thumb);
    border: 2px dashed var(--line-dash);
}

.bouquet {
    height: 120px;
    display: grid;
    place-items: center;
    font-size: 56px;
}

/* =========================
   VIEWS (JS controls visibility)
   ========================= */
.view {
    display: none;
}
.view.active {
    display: block;
}

/* =========================
   MODALS / BACKDROPS (JS toggles .show)
   ========================= */
.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    place-items: center;
    z-index: 1000;
}
.backdrop.show {
    display: grid;
}

.modal {
    width: min(640px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--paper);
    border-radius: var(--radius-card);
    padding: 20px;
    box-shadow: var(--shadow-modal);
}

.letter {
    white-space: pre-wrap;
    background: var(--paper-letter);
    border: 1px dashed var(--accent);
    border-radius: var(--radius-ui);
    padding: 14px;
}

/* =========================
   GALLERY / POLAROIDS
   ========================= */
.polaroid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px;
    width: 100%;
}

.polaroid {
    background: var(--paper);
    padding: 10px 10px 15px 10px;
    border: 1px solid #ddd;
    box-shadow: var(--shadow-polaroid);
    transform: rotate(var(--rot, -2deg));
    cursor: pointer;
    transition: transform 0.3s ease;
}

.polaroid:nth-child(even) {
    --rot: 3deg;
}

.polaroid:hover {
    transform: scale(1.1) rotate(0deg);
    z-index: 5;
}

/* Landscape polaroids */
.polaroid.landscape {
    grid-column: span 2;
    max-width: 400px;
}

.polaroid.landscape .photo-frame {
    aspect-ratio: 16 / 9;
}

/* Video overlay icon */
.polaroid.video::after {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -110%);
    font-size: 40px;
    color: rgb(255, 255, 255);
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
    opacity: 0.9;
    pointer-events: none;
}

.photo-frame {
    width: 100%;
    aspect-ratio: 3/4;
    background: #eee;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.caption {
    font-family: "Patrick Hand", cursive;
    text-align: center;
    margin-top: 10px;
    font-size: 18px;
    color: var(--ink);
}

/* Large view media (JS toggles display) */
.polaroid-large img,
.polaroid-large video {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 65svh;
    display: none; /* JS sets block */
    margin: 0 auto 15px;
    border-radius: var(--radius-media);
    box-shadow: var(--shadow-media);
    object-fit: contain;
    background: transparent;
}

/* =========================
   FLOWER PAGE
   ========================= */
.flower-container {
    text-align: center;
    padding: 20px;
}

.flower-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
}

.main-bouquet {
    width: 80%;
    max-width: 350px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
    transition: transform 0.5s ease;
}

.main-bouquet:hover {
    transform: scale(1.05) rotate(2deg);
}

.sentence {
    font-family: "Patrick Hand", cursive;
    font-size: clamp(16px, 4vw, 22px);
    color: var(--ink);
    background: var(--paper-sentence);
    padding: 8px 15px;
    border-radius: var(--radius-small);
    max-width: 250px;
    box-shadow: var(--shadow-sentence);
}

/* Grundstyling für alle Sticker */
.sticker {
    position: absolute;
    /* clamp(Minimalgröße, Relative Größe, Maximalgröße) */
    width: clamp(50px, 12vw, 120px);
    height: auto;
    pointer-events: none; /* Man kann durch sie hindurchklicken */

    /* WICHTIG: z-index auf -1 oder 0 schiebt sie hinter den Text */
    z-index: 0;

    filter: drop-shadow(3px 3px 2px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
    opacity: 0.8; /* Leicht transparent, damit Text lesbar bleibt */
}

/* Positionen */
.stitch-top-left {
    top: 5px;
    left: 5px;
    transform: rotate(-15deg);
}

.stitch-bottom-right {
    bottom: 5px;
    right: 5px;
    transform: rotate(10deg);
}
.stitch-right {
    bottom: 30px;
    right: 30px;
    transform: rotate(10deg);
}
/* Container für das Bild über dem Text */
.header-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.header-image {
    width: 180px; /* Standardgröße auf dem Laptop */
    height: auto;
    max-width: 60vw; /* Damit es auf dem Handy nicht über den Rand geht */
    filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.1)); /* Sanfter Schatten */
}

/* Anpassung für mobile Geräte */
@media (max-width: 480px) {
    .header-image {
        width: 140px; /* Etwas kleiner auf dem Handy */
    }
}

/* =========================
   RESPONSIVE
   ========================= */
@media (min-width: 600px) {
    .flower-wrap {
        gap: 5px;
    }
    .s1 {
        transform: translateX(-80px) rotate(-3deg);
    }
    .s2 {
        transform: translateX(80px) rotate(2deg);
    }
    .s3 {
        transform: translateX(-60px) rotate(1deg);
    }
    .s4 {
        transform: translateX(70px) rotate(-2deg);
    }
    .s5 {
        font-size: 26px;
        font-weight: bold;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .polaroid.landscape {
        grid-column: span 1;
    }
}

@media (max-width: 520px) {
    .grid {
        grid-template-columns: 1fr;
    }
    button {
        min-width: 220px;
    }
}

/* Für größere Bildschirme (Laptop) die Sticker etwas größer machen */
@media (min-width: 768px) {
    .sticker {
        width: 120px;
    }
}

/* Extra-Schutz für sehr kleine Handys */
@media (max-width: 400px) {
    .sticker {
        width: 45px; /* Wird automatisch kleiner */
        opacity: 0.6; /* Wird noch blasser, falls er Text berührt */
    }

    /* Erhöht den Abstand im Header, damit der Hase nicht auf dem Text klebt */
    .header-image-container {
        margin-bottom: 25px;
    }
}





/* Container, der Bilder und Text nebeneinander hält */
.no-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

/* Styling für die beiden Bilder */
.no-side-img {
    width: clamp(60px, 15vw, 120px); /* Skaliert zwischen Handy und Laptop */
    height: auto;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.1));
}

/* Der Textbereich in der Mitte */
.no-text-center {
    flex: 1;
    max-width: 400px;
    text-align: center;
}

/* Für schmale Handys: Alles untereinander stapeln */
@media (max-width: 500px) {
    .no-content-wrapper {
        flex-direction: column; /* Bilder über/unter dem Text */
        gap: 10px;
    }
    
    .no-side-img {
        width: 80px; /* Feste Größe auf kleinen Handys */
    }
}

/* Container für das Briefpapier */
.letter-container {
    position: relative;
    background: var(--paper-letter); /* Deine Brieffarbe */
    border-radius: var(--radius-ui);
    padding: 10px;
}

/* Der Sticker im Brief */
.letter-sticker {
    position: absolute;
    width: clamp(60px, 20vw, 100px); /* Skaliert auf dem Handy */
    height: auto;
    z-index: 10; /* Vor dem Papier, aber wir achten auf den Text */
    
    /* Position: Oben rechts "ankleben" */
    top: -20px;
    right: -10px;
    transform: rotate(15deg);
    
    pointer-events: none; /* Man kann durch ihn hindurch den Text markieren */
}

/* Sicherstellen, dass der Text lesbar bleibt */
.letter {
    position: relative;
    z-index: 5;
    line-height: 1.6; /* Mehr Zeilenabstand für bessere Lesbarkeit */
}





.quiz-container {
    margin: 20px 0;
    width: 100%;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.quiz-opt-btn {
    width: 100%;
    max-width: 400px;
    background: var(--paper);
    border: 2px solid var(--ink);
    padding: 12px;
    border-radius: var(--radius-small);
    font-family: var(--font-nunito);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-opt-btn:hover {
    background: var(--bg-grad-1);
    transform: scale(1.02);
}

.quiz-opt-btn:active {
    transform: scale(0.98);
}

/* Die Wackel-Animation */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* Diese Klasse wird per JS hinzugefügt */
.shake-effect {
    animation: shake 0.4s ease-in-out;
    border-color: #ff4d4d !important; /* Optional: Rand wird kurz rot */
}

/* In style.css hinzufügen */
.quiz-opt-btn:focus {
    background-color: var(--bg-grad-1);
    outline: none;
}

/* Optional: Wenn du willst, dass der "Abbrechen"-Button im Quiz 
   dezenter aussieht als die Antwort-Buttons */
#backToGiftsFromQuiz {
    background: transparent;
    border: 2px solid var(--ink-soft);
    min-width: 200px;
    margin-top: 30px;
    opacity: 0.8;
}

/* Verhindert, dass Elemente der Siegseite untereinander kleben */
#quiz-win-view {
    display: none; /* Wird durch .active zu block */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
}

#quiz-win-view.active {
    display: flex;
}
