/* ---------- Schriften (lokal, SIL Open Font License) ---------- */
@font-face {
    font-family: "Playfair Display";
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url("fonts/playfair-display-latin-700-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Playfair Display";
    font-weight: 700;
    font-style: italic;
    font-display: swap;
    src: url("fonts/playfair-display-latin-700-italic.woff2") format("woff2");
}
@font-face {
    font-family: "Caveat";
    font-weight: 500;
    font-display: swap;
    src: url("fonts/caveat-latin-500-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Nunito";
    font-weight: 400;
    font-display: swap;
    src: url("fonts/nunito-latin-400-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Nunito";
    font-weight: 700;
    font-display: swap;
    src: url("fonts/nunito-latin-700-normal.woff2") format("woff2");
}

:root {
    --bg: #2e0b1c;
    --bg-2: #5a1834;
    --ink: #fff1f3;
    --muted: #f2bfcb;
    --accent: #ffc2cf;
    --accent-dark: #c2546f;
    --paper: #fffaf5;
    --paper-ink: #4a1d2c;
    --raspberry: #b3264f;
    --rose: #d2587a;
    --plum: #6e2352;
    --coral: #c2453f;
    --radius: 12px;
    --ease: cubic-bezier(.2, .8, .2, 1);

    --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
    --font-ui: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Roségold-Folie für Zahlen */
    --foil: linear-gradient(160deg, #fff6f1 0%, #f8d3c6 30%, #e39a8a 52%, #fde6dc 72%, #d98c7c 100%);
    /* Goldfolie für die letzte Tür */
    --gold: linear-gradient(160deg, #fbe7b5 0%, #d9a94f 38%, #f6dc98 62%, #b07d2c 100%);
    /* feine Papierstruktur */
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 -.18'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg); /* kein weißer Rand beim Überscrollen oder unter Overlays */
}

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font-ui);
    color: var(--ink);
    background:
        radial-gradient(120% 80% at 50% 0%, var(--bg-2), var(--bg) 70%) fixed,
        var(--bg);
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
             max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

body.no-scroll { overflow: hidden; }

/* kein Doppeltipp-Zoom, wenn sie mehrmals schnell für Herzen tippt */
body { touch-action: manipulation; }

/* ---------- Himmel je nach Tageszeit (Klasse daytime-… am body) ---------- */
.sky {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.sky::before,
.sky::after,
.stars {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 4s ease;
}

/* Morgen: warmes Licht von oben */
.sky::before {
    content: "";
    background:
        radial-gradient(90% 50% at 50% -8%, rgba(255, 176, 138, .38), transparent 70%),
        radial-gradient(60% 40% at 85% 0%, rgba(255, 214, 170, .16), transparent 70%);
}

/* Abend und Nacht: dunkler */
.sky::after {
    content: "";
    background: linear-gradient(180deg, rgba(10, 2, 14, .6), rgba(10, 2, 14, .3));
}

.daytime-morning .sky::before { opacity: 1; }
.daytime-evening .sky::after { opacity: .4; }
.daytime-evening .stars { opacity: .35; }
.daytime-night .sky::after,
.daytime-night .stars { opacity: 1; }

.stars span {
    position: absolute;
    left: calc(var(--x) * 1%);
    top: calc(var(--y) * 1%);
    width: calc(var(--s) * 1px);
    height: calc(var(--s) * 1px);
    border-radius: 50%;
    background: #fff8ee;
    box-shadow: 0 0 calc(var(--s) * 2.5px) rgba(255, 248, 238, .8);
    animation: star calc(var(--d) * 1s) ease-in-out calc(var(--w) * -1s) infinite;
}

@keyframes star {
    0%, 100% { opacity: .25; transform: scale(.8); }
    50%      { opacity: 1;   transform: scale(1.1); }
}

/* ---------- aufsteigende Herzen ---------- */
.hearts,
.snow {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.hearts span {
    position: absolute;
    bottom: -40px;
    left: calc(var(--x) * 1%);
    font-size: calc(var(--s) * 1px);
    color: #ff8fab;
    opacity: 0;
    filter: blur(calc(var(--b, 0) * 1px));
    animation: rise calc(var(--d) * 1s) linear calc(var(--w) * -1s) infinite;
}

.hearts span:nth-child(1)  { --x: 4;  --s: 14; --d: 16; --w: 2; }
.hearts span:nth-child(2)  { --x: 12; --s: 30; --d: 26; --w: 9;  --b: 2; }
.hearts span:nth-child(3)  { --x: 21; --s: 12; --d: 14; --w: 5; }
.hearts span:nth-child(4)  { --x: 30; --s: 18; --d: 22; --w: 14; }
.hearts span:nth-child(5)  { --x: 38; --s: 10; --d: 13; --w: 1; }
.hearts span:nth-child(6)  { --x: 47; --s: 34; --d: 28; --w: 11; --b: 3; }
.hearts span:nth-child(7)  { --x: 55; --s: 14; --d: 17; --w: 6; }
.hearts span:nth-child(8)  { --x: 63; --s: 20; --d: 19; --w: 16; }
.hearts span:nth-child(9)  { --x: 71; --s: 11; --d: 15; --w: 3; }
.hearts span:nth-child(10) { --x: 79; --s: 28; --d: 25; --w: 8;  --b: 2; }
.hearts span:nth-child(11) { --x: 86; --s: 13; --d: 16; --w: 12; }
.hearts span:nth-child(12) { --x: 93; --s: 17; --d: 21; --w: 4; }
.hearts span:nth-child(13) { --x: 26; --s: 9;  --d: 12; --w: 10; }
.hearts span:nth-child(14) { --x: 67; --s: 9;  --d: 13; --w: 7; }

@keyframes rise {
    0%   { transform: translate(0, 0) rotate(-10deg); opacity: 0; }
    10%  { opacity: .35; }
    50%  { transform: translate(18px, -55vh) rotate(8deg); }
    90%  { opacity: .25; }
    100% { transform: translate(-10px, -110vh) rotate(-6deg); opacity: 0; }
}

/* ---------- fallender Schnee ---------- */
.snow span {
    position: absolute;
    top: -12px;
    left: calc(var(--x) * 1%);
    width: calc(var(--s) * 1px);
    height: calc(var(--s) * 1px);
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    filter: blur(calc(var(--s) * .15px));
    animation: snow calc(var(--d) * 1s) linear calc(var(--w) * -1s) infinite;
}

.snow span:nth-child(1)  { --x: 3;  --s: 4; --d: 18; --w: 3; }
.snow span:nth-child(2)  { --x: 9;  --s: 2; --d: 14; --w: 9; }
.snow span:nth-child(3)  { --x: 16; --s: 6; --d: 24; --w: 15; }
.snow span:nth-child(4)  { --x: 22; --s: 3; --d: 16; --w: 2; }
.snow span:nth-child(5)  { --x: 29; --s: 2; --d: 13; --w: 7; }
.snow span:nth-child(6)  { --x: 35; --s: 5; --d: 21; --w: 12; }
.snow span:nth-child(7)  { --x: 42; --s: 3; --d: 17; --w: 5; }
.snow span:nth-child(8)  { --x: 49; --s: 2; --d: 12; --w: 10; }
.snow span:nth-child(9)  { --x: 56; --s: 4; --d: 19; --w: 1; }
.snow span:nth-child(10) { --x: 61; --s: 7; --d: 27; --w: 18; }
.snow span:nth-child(11) { --x: 68; --s: 3; --d: 15; --w: 8; }
.snow span:nth-child(12) { --x: 74; --s: 2; --d: 13; --w: 4; }
.snow span:nth-child(13) { --x: 80; --s: 5; --d: 22; --w: 14; }
.snow span:nth-child(14) { --x: 86; --s: 3; --d: 16; --w: 11; }
.snow span:nth-child(15) { --x: 92; --s: 2; --d: 14; --w: 6; }
.snow span:nth-child(16) { --x: 97; --s: 4; --d: 20; --w: 16; }
.snow span:nth-child(17) { --x: 12; --s: 3; --d: 17; --w: 13; }
.snow span:nth-child(18) { --x: 52; --s: 5; --d: 23; --w: 20; }

@keyframes snow {
    0%   { transform: translate(0, 0); opacity: 0; }
    10%  { opacity: .55; }
    50%  { transform: translate(-16px, 55vh); }
    90%  { opacity: .4; }
    100% { transform: translate(12px, 110vh); opacity: 0; }
}

/* ---------- Kopf ---------- */
.header {
    position: relative;
    z-index: 1;
    text-align: center;
    margin: 0 auto 22px;
    padding-top: clamp(26px, 7vw, 38px); /* Platz für die Lichterkette */
}

/* Lichterkette */
/* Lichterkette: über die ganze Breite am oberen Rand aufgehängt */
.garland {
    position: absolute;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: clamp(44px, 10vw, 62px);
    pointer-events: none;
}

.garland-wire {
    fill: none;
    stroke: rgba(248, 211, 198, .45);
    stroke-width: 1.2;
}

.garland rect { fill: #c9a08a; }

.garland-hook circle:first-child { fill: #d9a898; stroke: rgba(80, 20, 40, .5); stroke-width: .8; }

.bulb-glow,
.bulb-glass {
    animation: flicker 3.4s ease-in-out infinite;
    animation-delay: calc(var(--i) * -.53s);
}

.bulb-glass { animation-name: bulb; }

/* noch nicht leuchtende Birnen – mit jeder Tür gehen mehr an */
.bulb.is-off .bulb-glow { display: none; }
.bulb.is-off .bulb-glass { animation: none; opacity: .32; filter: saturate(.35) brightness(.7); }

@keyframes flicker {
    0%, 100% { opacity: .95; }
    50%      { opacity: .3; }
}

@keyframes bulb {
    0%, 100% { opacity: 1; }
    50%      { opacity: .72; }
}

.greeting {
    margin: 0 0 2px;
    font-family: var(--font-hand);
    font-size: clamp(1.35rem, 5.5vw, 1.7rem);
    line-height: 1.2;
    color: #f8d3c6;
    text-shadow: 0 2px 12px rgba(255, 143, 171, .35);
    animation: greeting-in 1.2s var(--ease) .2s backwards;
}

@keyframes greeting-in {
    from { opacity: 0; transform: translateY(6px); }
}

.header h1 {
    margin: 0;
    padding: .05em .15em .12em;
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(2rem, 9vw, 3.4rem);
    line-height: 1.1;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 10px rgba(255, 143, 171, .3));
}

.subtitle {
    margin: 4px 0 0;
    font-family: var(--font-hand);
    font-size: 1.35rem;
    color: var(--muted);
}

.together {
    margin: 8px 0 0;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: rgba(248, 211, 198, .8);
}

.status {
    margin: 14px auto 0;
    max-width: 320px;
}

.progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    overflow: hidden;
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--foil);
    box-shadow: 0 0 10px rgba(255, 194, 207, .6);
    transition: width .8s var(--ease);
}

.status-text {
    margin: 8px 0 0;
    font-size: .8rem;
    letter-spacing: .02em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* Buttons im Kopf: ungelesene Briefe, Erinnerung */
.status-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.status-actions:has(> :not([hidden])) { margin-top: 8px; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid rgba(248, 211, 198, .4);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: var(--ink);
    font: inherit;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    transition: background .2s, transform .15s;
}

.status-pill[hidden] { display: none; }
.status-pill:hover { background: rgba(255, 255, 255, .14); }
.status-pill:active { transform: scale(.97); }
.status-pill:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.status-pill:disabled { opacity: .6; cursor: wait; }

.status-pill--unread {
    border-color: transparent;
    background: linear-gradient(150deg, #e0476f, #9c1c42);
    box-shadow: 0 6px 18px rgba(224, 71, 111, .35);
}

.status-pill--unread:hover { background: linear-gradient(150deg, #e95a80, #a8224b); }

.status-hint {
    margin: 10px 0 0;
    font-size: .8rem;
    line-height: 1.4;
    color: rgba(242, 191, 203, .75);
    text-wrap: balance;
}

.status-hint[hidden] { display: none; }

.countdown {
    margin: 2px 0 0;
    min-height: 1.6em;
    font-family: var(--font-hand);
    font-size: 1.3rem;
    color: #f8d3c6;
    font-variant-numeric: tabular-nums;
}

/* ---------- Türen ---------- */
.grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 780px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .grid { grid-template-columns: repeat(6, 1fr); gap: 14px; }
}

.door {
    position: relative;
    aspect-ratio: 1 / 1.15;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    perspective: 1000px;
    touch-action: manipulation;
    container-type: inline-size;
}

.door:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--radius); }

.door-inside {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 143, 171, .22), transparent 65%),
        #1f0612;
    box-shadow: inset 0 4px 14px rgba(0, 0, 0, .75);
}

.mini-card {
    position: relative;
    width: 58%;
    aspect-ratio: 5 / 7;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: linear-gradient(150deg, #e0476f, #9c1c42);
    outline: 1px solid rgba(255, 214, 223, .6);
    outline-offset: -4px;
    border: 2px solid var(--accent);
    transform: rotate(-4deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .55), 0 0 18px rgba(255, 143, 171, .25);
    transition: opacity .2s;
}

/* Nummer in Roségold-Folie, wie auf dem Umschlag */
.mini-num {
    padding: .1em .08em .16em;
    font-family: var(--font-display);
    font-variant-numeric: lining-nums;
    font-size: clamp(1.1rem, 26cqi, 2rem);
    line-height: 1;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 2px rgba(80, 0, 20, .45));
}

.mini-title { display: none; }

/* Gelesene Briefe: kleiner Zettel mit dem Titel */
.door.is-read .mini-card {
    width: 72%;
    aspect-ratio: 4 / 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3%;
    padding: 8% 7%;
    border: 0;
    border-radius: 4px;
    outline: 1px solid rgba(194, 84, 111, .25);
    outline-offset: -3px;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .25), transparent 55%),
        var(--paper);
    transform: rotate(-3deg);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}

.door.is-read .mini-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-family: var(--font-hand);
    font-size: clamp(.75rem, 15cqi, 1.2rem);
    line-height: 1.05;
    text-align: center;
    color: var(--paper-ink);
    hyphens: auto;
    overflow-wrap: break-word;
}

.door.is-read .mini-num {
    flex: none;
    padding: 0 .08em .06em;
    font-style: italic;
    font-size: clamp(1rem, 20cqi, 1.6rem);
    background: linear-gradient(170deg, #d2587a, #8e173b);
    -webkit-background-clip: text;
    background-clip: text;
    filter: none;
}

.door.is-out .mini-card { opacity: 0; }

/* ihre Reaktion als kleines Abzeichen am Zettel */
.door-reaction {
    position: absolute;
    right: -14%;
    bottom: -10%;
    font-size: clamp(.8rem, 17cqi, 1.25rem);
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
    transform: rotate(8deg);
}

.door-reaction:empty { display: none; }

.door-leaf {
    position: absolute;
    inset: 0;
    z-index: 2;
    transform-style: preserve-3d;
    transform-origin: left center;
    transition: transform .8s var(--ease);
}

.leaf-front,
.leaf-back {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.leaf-front {
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        var(--grain),
        linear-gradient(145deg, rgba(255, 255, 255, .18), rgba(0, 0, 0, .2)),
        var(--leaf, var(--raspberry));
    box-shadow: 0 6px 16px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .12);
}

/* gestrichelter Innenrahmen wie bei einem gestanzten Türchen */
.leaf-front::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1.5px dashed rgba(255, 214, 223, .5);
    border-radius: calc(var(--radius) - 5px);
}

/* Türknauf als kleines Herz */
.leaf-front::after {
    content: "♥";
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    line-height: 1;
    color: #f8d3c6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

/* Innenseite der Tür (sichtbar, wenn sie offen steht) */
.leaf-back {
    transform: rotateY(180deg);
    background:
        var(--grain),
        linear-gradient(-145deg, rgba(255, 255, 255, .25), rgba(0, 0, 0, .1)),
        color-mix(in srgb, var(--leaf, var(--raspberry)) 55%, #ffe4ea);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}

.leaf-emboss {
    position: absolute;
    width: 70%;
    fill: rgba(255, 255, 255, .07);
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .12)) drop-shadow(0 -1px 0 rgba(0, 0, 0, .18));
}

.door--c0 { --leaf: var(--raspberry); }
.door--c1 { --leaf: var(--rose); }
.door--c2 { --leaf: var(--plum); }
.door--c3 { --leaf: var(--coral); }

.door-num {
    padding: .12em .1em .18em;
    font-variant-numeric: lining-nums;
    position: relative;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 7.5vw, 2.3rem);
    line-height: 1;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4));
}

.door-lock {
    position: absolute;
    left: 10px;
    bottom: 9px;
    width: 12px;
    height: 12px;
    fill: rgba(255, 241, 243, .55);
}

/* Verschlossene Türen treten etwas zurück, damit die offenen leuchten */
.door.is-locked:not(.door--last) .leaf-front { filter: saturate(.7) brightness(.84); }

.door.is-open .door-leaf { transform: rotateY(-104deg); }
.door.is-open { z-index: 2; }

.door.is-today .leaf-front { animation: glow 2.2s ease-in-out infinite; }
.door.is-today.is-open .leaf-front { animation: none; }

/* "Hier!" – nach dem Tippen auf den Hinweis */
.door.is-pointed { animation: point .7s var(--ease) 2; }
.door.is-pointed:not(.is-open) .leaf-front { animation: glow .7s ease-in-out 2; }

@keyframes point {
    50% { transform: scale(1.1); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 6px 16px rgba(0, 0, 0, .35), 0 0 0 2px rgba(255, 194, 207, .55); }
    50%      { box-shadow: 0 6px 16px rgba(0, 0, 0, .35), 0 0 22px 6px rgba(255, 143, 171, .85); }
}

@media (hover: hover) {
    .door:not(.is-open):not(.is-locked):hover .door-leaf { transform: rotateY(-12deg); }
}

.door.shake .door-leaf { animation: shake .45s ease; }

@keyframes shake {
    0%, 100% { transform: rotateY(0); }
    20% { transform: rotateY(-14deg); }
    40% { transform: rotateY(-4deg); }
    60% { transform: rotateY(-10deg); }
    80% { transform: rotateY(-2deg); }
}

/* ---------- letzte Tür: Gold mit Schleife ---------- */
.door--last { --leaf: #c9963f; }

.door--last .leaf-front {
    padding-top: 26%;
    background:
        var(--grain),
        linear-gradient(145deg, rgba(255, 255, 255, .3), rgba(0, 0, 0, .15)),
        var(--gold);
}

.door--last .leaf-front::before { border-color: rgba(255, 248, 228, .75); }
.door--last .leaf-front::after { color: #8a1c3e; text-shadow: 0 1px 0 rgba(255, 240, 205, .6); }
.door--last .leaf-emboss { fill: rgba(255, 255, 255, .14); }

.door--last .door-num {
    background: linear-gradient(170deg, #9c2347, #5a0f28);
    -webkit-background-clip: text;
    background-clip: text;
    filter: drop-shadow(0 1px 0 rgba(255, 244, 214, .8));
}

.door--last .door-lock { fill: rgba(90, 15, 40, .5); }

.door-ribbon {
    position: absolute;
    left: 0;
    right: 0;
    top: 22%;
    height: 9%;
    background: linear-gradient(180deg, #e0476f, #9c1c42);
    box-shadow: 0 1px 3px rgba(60, 0, 20, .4), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.door-bow {
    position: absolute;
    left: 50%;
    top: 10%;
    width: 46%;
    transform: translateX(-50%);
    fill: #c22f59;
    filter: drop-shadow(0 2px 2px rgba(60, 0, 20, .45));
}

.door-bow circle { fill: #e0476f; }

.door-sparkle {
    position: absolute;
    font-size: 11px;
    line-height: 1;
    color: #fff8e6;
    text-shadow: 0 0 6px rgba(255, 240, 200, .9);
    animation: twinkle 2.6s ease-in-out infinite;
}

.door-sparkle--a { left: 16%; bottom: 16%; }
.door-sparkle--b { right: 20%; bottom: 30%; font-size: 8px; animation-delay: -1.3s; }

@keyframes twinkle {
    0%, 100% { opacity: .15; transform: scale(.6) rotate(0); }
    50%      { opacity: 1;   transform: scale(1.1) rotate(20deg); }
}

/* ---------- Umschlag in der Ecke: „Wie geht’s dir?“ ---------- */
.mood-dock {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: calc(100vw - 28px);
    pointer-events: none; /* nur Button und Hinweis sind klickbar */
}

.mood-dock > * { pointer-events: auto; }

/* damit unten nichts vom Button verdeckt bleibt */
body.has-mood-dock { padding-bottom: calc(max(28px, env(safe-area-inset-bottom)) + 104px); }
body.has-mood-dock .toast { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 108px); }

/* Der Button ist ein Briefumschlag aus Briefpapier, mit Wachssiegel und Handschrift */
.mood-button {
    padding: 6px;
    border: 0;
    background: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mood-button:focus-visible { outline: none; }
.mood-button:focus-visible .mood-envelope { outline: 3px solid var(--accent); outline-offset: 5px; }

.mood-envelope {
    position: relative;
    display: block;
    width: 132px;
    aspect-ratio: 10 / 7;
    rotate: -5deg;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)) drop-shadow(0 0 16px rgba(255, 194, 207, .18));
    animation: mood-wiggle 7s ease-in-out infinite;
    transition: rotate .3s var(--ease), translate .3s var(--ease), opacity .2s;
}

.mood-button:hover .mood-envelope { rotate: -1deg; translate: 0 -4px; animation: none; }
.mood-button:active .mood-envelope { translate: 0 1px; scale: .97; }
.mood-envelope.is-out { opacity: 0; }

@keyframes mood-wiggle {
    0%, 84%, 100% { rotate: -5deg; translate: 0 0; }
    88% { rotate: 2deg;  translate: 0 -4px; }
    92% { rotate: -8deg; translate: 0 -2px; }
    96% { rotate: -4deg; translate: 0 0; }
}

.mood-env-back,
.mood-env-front,
.mood-env-flap {
    position: absolute;
    inset: 0;
    border-radius: 7px;
}

/* Innenseite */
.mood-env-back {
    background: linear-gradient(180deg, #e8b9ae, #f3d5cc);
}

/* Briefbogen – schaut in der Pause oben heraus */
.mood-env-letter {
    position: absolute;
    left: 9%;
    right: 9%;
    top: 6%;
    bottom: 10%;
    border-radius: 3px;
    background:
        repeating-linear-gradient(to bottom, transparent 0 7px, rgba(194, 84, 111, .22) 7px 8px) 0 14px / 100% calc(100% - 22px) no-repeat,
        #fffdf9;
    box-shadow: 0 -1px 3px rgba(80, 20, 40, .15);
    transition: translate .5s var(--ease);
}

/* Vorderseite mit Taschenfalz */
.mood-env-front {
    overflow: hidden;
    clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
    background:
        var(--grain),
        radial-gradient(circle at 15% 100%, rgba(255, 143, 171, .18), transparent 55%),
        #fff8f2;
    box-shadow: inset 0 0 0 1.5px rgba(194, 84, 111, .35);
}

.mood-env-front svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mood-env-front path {
    fill: none;
    stroke: rgba(194, 84, 111, .28);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
}

/* Lasche */
.mood-env-flap {
    height: 58%;
    border-radius: 7px 7px 0 0;
    background:
        var(--grain),
        linear-gradient(175deg, #fffaf6, #f6e2da);
    clip-path: polygon(0 0, 100% 0, 50% 90%);
    transition: opacity .3s;
}

/* feine Kante der Lasche */
.mood-env-flap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(194, 84, 111, .3) 50%, transparent calc(50% + 1px)) left / 50% 100% no-repeat,
                linear-gradient(to bottom left, transparent calc(50% - 1px), rgba(194, 84, 111, .3) 50%, transparent calc(50% + 1px)) right / 50% 100% no-repeat;
}

/* Wachssiegel an der Spitze der Lasche */
.mood-env-seal {
    position: absolute;
    left: 50%;
    top: 50%;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 48% 52% 46% 54% / 52% 46% 54% 48%;
    background: radial-gradient(circle at 35% 30%, #e0506b, #93183a 70%);
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .12), inset 0 1px 2px rgba(255, 255, 255, .3), 0 2px 4px rgba(80, 0, 20, .4);
    translate: -50% -50%;
    rotate: -12deg;
    transition: opacity .3s, scale .3s var(--ease);
}

.mood-env-seal svg { width: 52%; fill: #a9203f; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .3)) drop-shadow(0 -1px 0 rgba(0, 0, 0, .3)); }

/* Handschrift auf dem Umschlag */
.mood-env-label {
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: 7%;
    font-family: var(--font-hand);
    font-size: 1.32rem;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    color: var(--raspberry);
}

/* Pause: Umschlag ist offen, der Brief von eben schaut heraus */
.mood-button.is-resting .mood-envelope { animation: none; }
.mood-button.is-resting .mood-env-flap,
.mood-button.is-resting .mood-env-seal { opacity: 0; scale: .6; }
.mood-button.is-resting .mood-env-letter { translate: 0 -42%; }
.mood-button.is-resting .mood-env-label { font-size: 1.12rem; }

/* sehr schmale Handys: etwas kleiner */
@media (max-width: 360px) {
    .mood-envelope { width: 118px; }
    .mood-env-label { font-size: 1.2rem; }
    .mood-button.is-resting .mood-env-label { font-size: 1rem; }
}

/* Erklärung beim ersten Besuch */
.mood-intro {
    position: relative;
    width: min(300px, calc(100vw - 28px));
    padding: 16px 18px 12px;
    border: 2px solid #f8d3c6;
    border-radius: 16px;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .22), transparent 50%),
        var(--paper);
    color: var(--paper-ink);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    animation: intro-pop .5s var(--ease);
}

.mood-intro[hidden] { display: none; }

/* Spitze nach unten zum Button */
.mood-intro::after {
    content: "";
    position: absolute;
    right: 64px;
    bottom: -9px;
    width: 16px;
    height: 16px;
    border-right: 2px solid #f8d3c6;
    border-bottom: 2px solid #f8d3c6;
    background: var(--paper);
    rotate: 45deg;
}

@keyframes intro-pop {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
}

.mood-intro-title {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--raspberry);
}

.mood-intro-text {
    margin: 0;
    font-size: .92rem;
    line-height: 1.45;
}

.mood-intro-ok {
    display: block;
    min-height: 40px;
    margin: 8px 0 0 auto;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--accent-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.mood-intro-ok:hover { background: rgba(194, 84, 111, .08); }
.mood-intro-ok:focus-visible { outline: 3px solid var(--accent); }

/* Auswahl der Stimmung */
.mood-picker {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(30, 5, 16, .78);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .3s ease;
}

.mood-picker { overflow: hidden auto; overscroll-behavior: contain; }
.mood-picker[hidden] { display: none; }
.mood-picker.is-visible { opacity: 1; }

.mood-paper {
    width: min(100%, 400px);
    padding: 26px 22px 14px;
    border: 3px solid #f8d3c6;
    border-radius: 16px;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .22), transparent 45%),
        var(--paper);
    color: var(--paper-ink);
    text-align: center;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
    rotate: 1deg;
    translate: 0 24px;
    transition: translate .4s var(--ease);
}

.mood-picker.is-visible .mood-paper { translate: 0 0; }

.mood-title {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.45rem;
    line-height: 1.2;
    color: var(--raspberry);
}

.mood-sub {
    margin: 4px 0 16px;
    font-family: var(--font-hand);
    font-size: 1.3rem;
    color: var(--accent-dark);
}

.mood-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.mood-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 8px 12px;
    border: 1.5px solid rgba(194, 84, 111, .3);
    border-radius: 14px;
    background: rgba(255, 255, 255, .6);
    color: var(--paper-ink);
    font: inherit;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: left;
    cursor: pointer;
    transition: background .2s, border-color .2s, transform .15s;
    touch-action: manipulation;
}

/* ungerade Anzahl: die letzte Stimmung über die ganze Breite */
.mood-option:last-child:nth-child(odd) { grid-column: 1 / -1; justify-content: center; }

.mood-option:hover { background: #fff; border-color: rgba(194, 84, 111, .6); }
.mood-option:active { transform: scale(.97); }
.mood-option:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.mood-option.is-chosen { background: #ffe4ea; border-color: var(--rose); }

.mood-emoji { flex: none; font-size: 1.5rem; line-height: 1; }

/* ---------- Finale ---------- */
.finale {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 40px auto 8px;
    padding: 34px 26px 28px;
    text-align: center;
    border-radius: 18px;
    border: 3px solid #f8d3c6;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .22), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(255, 143, 171, .14), transparent 40%),
        var(--paper);
    color: var(--paper-ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 40px rgba(255, 143, 171, .2);
    animation: finale-in 1s var(--ease);
}

.finale[hidden] { display: none; }

.finale-heart {
    width: 46px;
    fill: var(--raspberry);
    animation: beat 1.6s ease-in-out infinite;
}

.finale-title {
    margin: 6px 0 10px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.8rem;
    line-height: 1.2;
    color: var(--raspberry);
}

.finale-text {
    margin: 0;
    white-space: pre-line;
    text-wrap: pretty;
    font-family: var(--font-hand);
    font-size: 1.6rem;
    line-height: 1.3;
    color: #3d1726;
}

.finale-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

.finale-stats {
    margin: 18px 0 0;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--accent-dark);
    text-wrap: balance;
}

.finale-note {
    margin: 14px 0 0;
    font-size: .88rem;
    color: var(--accent-dark);
}

.finale-note[hidden] { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(150deg, #e0476f, #9c1c42);
    color: #fff4f6;
    font: inherit;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(224, 71, 111, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
    transition: transform .15s ease, box-shadow .2s, opacity .2s;
    touch-action: manipulation;
}

.btn:hover { box-shadow: 0 8px 24px rgba(224, 71, 111, .5), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn:disabled { opacity: .6; cursor: wait; }

.btn--ghost {
    background: transparent;
    color: var(--raspberry);
    box-shadow: inset 0 0 0 1.5px rgba(179, 38, 79, .4);
}

.btn--ghost:hover { background: rgba(179, 38, 79, .06); box-shadow: inset 0 0 0 1.5px rgba(179, 38, 79, .6); }

@keyframes finale-in {
    from { opacity: 0; transform: translateY(30px) scale(.96); }
}

@keyframes beat {
    0%, 60%, 100% { transform: scale(1); }
    15% { transform: scale(1.1); }
    30% { transform: scale(.97); }
    45% { transform: scale(1.06); }
}

.rain {
    position: fixed;
    inset: 0;
    z-index: 70;
    overflow: hidden;
    pointer-events: none;
}

.rain span {
    position: absolute;
    top: -50px;
    left: var(--x);
    font-size: var(--size);
    line-height: 1;
    opacity: 0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    animation: fall var(--dur) linear var(--delay) forwards;
}

@keyframes fall {
    0%   { opacity: 0; transform: translate(0, 0) rotate(0); }
    8%   { opacity: 1; }
    85%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--drift), calc(100vh + 60px)) rotate(var(--rot)); }
}

/* ---------- Umschlag und Brief ---------- */
.stage {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 16px;
}

.stage[hidden] { display: none; }

.stage-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 50%, rgba(224, 71, 111, .25), transparent 60%),
        rgba(30, 5, 16, .82);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity .45s ease;
}

.stage.is-active .stage-backdrop { opacity: 1; }

.stage-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 4;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: var(--ink);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity .3s ease;
}

.stage.is-active .stage-close { opacity: 1; }

.card {
    position: relative;
    z-index: 1;
    width: min(82vw, 480px, calc((100dvh - 170px) * 5 / 7));
    aspect-ratio: 5 / 7;
    perspective: 1400px;
    cursor: pointer;
    outline: none;
    transition: transform .6s var(--ease);
    will-change: transform;
}

.card.is-letter-out { cursor: auto; }

.card-tilt {
    width: 100%;
    height: 100%;
    transition: transform .25s ease-out;
}

.card:focus-visible .scene { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 18px; }

/*
 * Ablauf beim Öffnen (Klassen an .card, nacheinander gesetzt):
 * is-unsealed → Siegel bricht · is-flap-open → Lasche klappt hoch ·
 * is-letter-up → Brief gleitet aus dem Umschlag · is-letter-out → Brief liegt vorne, Umschlag verschwindet
 */
.scene {
    position: relative;
    width: 100%;
    height: 100%;
    scale: var(--scene-s, 1);
    transition: scale .7s var(--ease);
}

.card.is-letter-up  { --scene-s: .62; --env-y: 48%; --letter-y: -50%; }
.card.is-letter-out { --scene-s: 1;   --env-y: 85%; --env-o: 0; --letter-y: 0%; --letter-s: 1; }

.env-back,
.env-front,
.env-flap,
.env-shine,
.letter {
    position: absolute;
    inset: 0;
    border-radius: 16px;
}

.env-back,
.env-front,
.env-flap,
.env-shine {
    translate: 0 var(--env-y, 0%);
    opacity: var(--env-o, 1);
    transition: translate .7s var(--ease), opacity .5s ease;
}

/* Innenseite des Umschlags */
.env-back {
    z-index: 1;
    background: linear-gradient(180deg, #5e0f29, #8a1f43);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 40px rgba(255, 143, 171, .15);
}

/* Vorderseite mit Taschenfalz */
.env-front {
    z-index: 3;
    overflow: hidden;
    clip-path: polygon(0 0, 50% 30%, 100% 0, 100% 100%, 0 100%);
    border: 3px solid #f8d3c6;
    background:
        var(--grain),
        radial-gradient(circle at 50% 80%, rgba(255, 255, 255, .16), transparent 55%),
        linear-gradient(160deg, #e0476f, #8e173b);
}

.env-folds,
.flap-out svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.env-fold-side { fill: rgba(60, 0, 20, .1); }

.env-fold-line,
.flap-out path {
    fill: none;
    stroke: rgba(248, 211, 198, .75);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.flap-out path { stroke-width: 3; }

/* Lichtreflex, folgt der Maus */
.env-front::after,
.letter::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--glare-x, 30%) var(--glare-y, 0%), rgba(255, 255, 255, .14), transparent 55%);
}

.card-corner {
    position: absolute;
    width: 15px;
    fill: #f8d3c6;
    opacity: .9;
}

.card-corner--bl { bottom: 20px; left: 20px; transform: rotate(-150deg); }
.card-corner--br { bottom: 20px; right: 20px; transform: rotate(150deg); }

.card-day {
    position: absolute;
    left: 0;
    right: 0;
    top: 76%;
    padding: .12em .1em .18em;
    text-align: center;
    font-variant-numeric: lining-nums;
    font-family: var(--font-display);
    font-size: clamp(3.4rem, 20vw, 5.5rem);
    line-height: 1;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 3px 6px rgba(80, 0, 20, .45));
    translate: 0 -50%;
}

/* „Öffne mich, wenn …“ auf dem großen Umschlag */
.card-when {
    position: absolute;
    left: 10%;
    right: 10%;
    top: 74%;
    text-align: center;
    font-family: var(--font-hand);
    font-size: clamp(1.5rem, 7vw, 2rem);
    line-height: 1.1;
    color: #fff1f3;
    text-shadow: 0 2px 6px rgba(60, 0, 20, .45);
    translate: 0 -50%;
}

.card-when:empty { display: none; }

.card-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 22px;
    text-align: center;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 241, 243, .8);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: .4; } }

.card.is-unsealed .card-hint { opacity: 0; transition: opacity .2s; animation: none; }

/* Lasche: außen Umschlagpapier, innen gemustertes Futter */
.env-flap {
    z-index: 5;
    perspective: 1100px;
    filter: drop-shadow(0 4px 5px rgba(70, 0, 25, .35));
    transition: translate .7s var(--ease), opacity .5s ease, z-index 0s .28s;
}

/* geschlossen an den runden Ecken abschneiden, damit die Kantenlinien nicht überstehen */
.env-flap { clip-path: inset(0 round 16px); }

.card.is-flap-open .env-flap { z-index: 0; clip-path: none; }

.flap-face {
    position: absolute;
    inset: 0;
    border-radius: 16px 16px 0 0;
    clip-path: polygon(0 0, 100% 0, 50% 52%);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-origin: 50% 0;
    transition: transform .55s cubic-bezier(.4, .1, .3, 1);
}

.flap-out {
    background:
        var(--grain),
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .2), transparent 60%),
        linear-gradient(170deg, #ea5c80, #b02a52);
}

.flap-in {
    transform: rotateX(0deg) rotateY(180deg);
    background:
        radial-gradient(circle, rgba(224, 71, 111, .35) 1.5px, transparent 2px) 0 0 / 14px 14px,
        radial-gradient(circle, rgba(224, 71, 111, .2) 1.5px, transparent 2px) 7px 7px / 14px 14px,
        #fde9e4;
}

.card.is-flap-open .flap-out { transform: rotateX(180deg); }
.card.is-flap-open .flap-in  { transform: rotateX(180deg) rotateY(180deg); }

.env-shine {
    z-index: 7;
    overflow: hidden;
    pointer-events: none;
}

.card.is-unsealed .env-shine { --env-o: 0; }

/* Glanz, der über den Umschlag läuft */
.env-shine::before {
    content: "";
    position: absolute;
    top: -20%;
    bottom: -20%;
    left: 0;
    width: 35%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
    transform: translateX(-150%) skewX(-18deg);
    animation: sheen 5s ease-in-out 1s infinite;
}

@keyframes sheen {
    0%       { transform: translateX(-150%) skewX(-18deg); }
    35%, 100% { transform: translateX(400%) skewX(-18deg); }
}

/* ---------- Tür 24: goldener Umschlag ---------- */
.card.is-golden .env-back {
    background: linear-gradient(180deg, #7a5418, #a8782c);
    animation: golden-glow 2.4s ease-in-out infinite;
}

@keyframes golden-glow {
    0%, 100% { box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 30px rgba(246, 220, 152, .25); }
    50%      { box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 70px 10px rgba(246, 220, 152, .55); }
}

.card.is-golden .env-front {
    border-color: #fbe7b5;
    background:
        var(--grain),
        radial-gradient(circle at 50% 80%, rgba(255, 255, 255, .3), transparent 55%),
        var(--gold);
}

.card.is-golden .flap-out {
    background:
        var(--grain),
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .35), transparent 60%),
        linear-gradient(170deg, #f6dc98, #c99640);
}

.card.is-golden .env-fold-line,
.card.is-golden .flap-out path { stroke: rgba(255, 248, 228, .9); }
.card.is-golden .env-fold-side { fill: rgba(120, 80, 20, .12); }
.card.is-golden .card-corner { fill: #9c2347; }
.card.is-golden .card-hint { color: rgba(90, 15, 40, .75); }

.card.is-golden .card-day {
    background: linear-gradient(170deg, #9c2347, #5a0f28);
    -webkit-background-clip: text;
    background-clip: text;
    filter: drop-shadow(0 1px 0 rgba(255, 244, 214, .8));
}

.card.is-golden .env-shine::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
    animation-duration: 3s;
}

.card.is-golden .letter {
    border-color: #e9c77b;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(246, 220, 152, .4), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(255, 143, 171, .16), transparent 40%),
        var(--paper);
}

.card.is-golden.is-letter-out .letter { box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 50px rgba(246, 220, 152, .4); }

/* Wachssiegel (auf dem Umschlag und unten auf dem Brief) */
.seal {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 48% 52% 46% 54% / 52% 46% 54% 48%;
    background: radial-gradient(circle at 35% 30%, #e0506b, #93183a 70%);
    box-shadow:
        inset 0 0 0 5px rgba(0, 0, 0, .12),
        inset 0 2px 3px rgba(255, 255, 255, .3),
        0 3px 6px rgba(80, 0, 20, .35);
    transform: rotate(-14deg);
}

.seal svg {
    width: 50%;
    fill: #a9203f;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .3)) drop-shadow(0 -1px 0 rgba(0, 0, 0, .35));
}

.env-seal {
    position: absolute;
    z-index: 6;
    left: 50%;
    top: 52%;
    width: 22%;
    height: auto;
    aspect-ratio: 1;
    margin: -11% 0 0 -11%;
    animation: seal-wobble 2.4s ease-in-out infinite;
}

.card.is-unsealed .env-seal { animation: seal-break .45s ease-in forwards; }
.card.is-sealing .env-seal { animation: seal-stamp .55s var(--ease); }
.card.is-sealing .card-hint { opacity: 0; animation: none; }

@keyframes seal-stamp {
    0%   { transform: rotate(-34deg) scale(1.9); opacity: 0; }
    55%  { transform: rotate(-10deg) scale(.9); opacity: 1; }
    100% { transform: rotate(-14deg) scale(1); }
}

@keyframes seal-wobble {
    0%, 70%, 100% { transform: rotate(-14deg) scale(1); }
    80% { transform: rotate(-8deg) scale(1.06); }
    90% { transform: rotate(-18deg) scale(1.02); }
}

@keyframes seal-break {
    0%   { transform: rotate(-14deg) scale(1); opacity: 1; }
    35%  { transform: rotate(-4deg) scale(1.18); opacity: 1; }
    100% { transform: rotate(28deg) scale(.4) translateY(70%); opacity: 0; }
}

/* Der Brief selbst: Briefpapier */
.letter {
    z-index: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 26px 24px 18px;
    border: 3px solid #f8d3c6;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .22), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(255, 143, 171, .14), transparent 40%),
        var(--paper);
    color: var(--paper-ink);
    box-shadow: 0 -2px 10px rgba(80, 0, 20, .2);
    translate: 0 var(--letter-y, 0%);
    scale: var(--letter-s, .9);
    transition: translate .7s var(--ease), scale .7s var(--ease), box-shadow .5s ease;
}

.card.is-letter-out .letter {
    z-index: 8;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 40px rgba(255, 143, 171, .15);
}

.card-title {
    margin: 0 0 8px;
    padding-bottom: 10px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--raspberry);
    border-bottom: 1px solid rgba(194, 84, 111, .35);
}

.card-text {
    --fs: 1.6rem;
    --line: calc(var(--fs) * 1.25);
    flex: 1;
    min-height: 0;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(194, 84, 111, .35) transparent;
    white-space: pre-line;
    font-family: var(--font-hand);
    font-size: var(--fs);
    line-height: var(--line);
    color: #3d1726;
    /* Linien scrollen mit dem Text mit */
    background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--line) - 1px), rgba(194, 84, 111, .18) calc(var(--line) - 1px) var(--line));
    background-attachment: local;
    -webkit-overflow-scrolling: touch;
}

/* unten ausblenden, solange noch mehr Text kommt */
.card-text.has-more {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), transparent);
}

/* Text erscheint Wort für Wort, wie gerade geschrieben */
.card-text .word { display: inline-block; }

.card-text.will-write .word,
.card-text.will-write .polaroid { opacity: 0; }

.card-text.will-write.is-writing .word { animation: write .5s ease-out forwards; }
.card-text.will-write.is-writing .polaroid { animation: photo-in .7s var(--ease) .1s forwards; }

@keyframes write {
    from { opacity: 0; clip-path: inset(-.3em 100% -.3em -.3em); transform: translateY(2px); }
    to   { opacity: 1; clip-path: inset(-.3em -.3em -.3em -.3em); transform: none; }
}

@keyframes photo-in {
    from { opacity: 0; transform: translateY(-14px) scale(.9); }
    to   { opacity: 1; transform: none; }
}

/* eingeklebtes Polaroid */
.polaroid {
    position: relative;
    float: right;
    width: 46%;
    margin: 10px 4px 8px 12px;
    padding: 6px 6px 20px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(60, 10, 25, .28);
    rotate: 4deg;
    cursor: zoom-in;
}

/* Auf schmalen Handys etwas kleiner, damit lange Wörter noch neben das Foto passen */
@media (max-width: 480px) {
    .polaroid { width: 38%; margin-left: 8px; }
}

.polaroid::before {
    content: "";
    position: absolute;
    top: -9px;
    left: 50%;
    width: 52px;
    height: 18px;
    translate: -50% 0;
    rotate: -5deg;
    background: rgba(255, 214, 223, .75);
    box-shadow: 0 1px 2px rgba(60, 10, 25, .15);
}

.polaroid img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #f3e6e9;
}

/* Großansicht: das Foto als großes Polaroid über dem Brief */
.lightbox {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(30, 5, 16, .72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    cursor: zoom-out;
    outline: none;
    opacity: 0;
    transition: opacity .3s ease;
}

.lightbox[hidden] { display: none; }
.lightbox.is-visible { opacity: 1; }

.lightbox-photo {
    position: relative;
    margin: 0;
    padding: 12px 12px 0;
    background: #fff;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
    rotate: -2deg;
    scale: .7;
    translate: 0 30px;
    transition: scale .45s var(--ease), translate .45s var(--ease), rotate .45s var(--ease);
}

.lightbox.is-visible .lightbox-photo { scale: 1; translate: 0 0; }

/* Klebestreifen */
.lightbox-photo::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 50%;
    width: 90px;
    height: 26px;
    translate: -50% 0;
    rotate: 4deg;
    background: rgba(255, 214, 223, .8);
    box-shadow: 0 1px 3px rgba(60, 10, 25, .2);
}

.lightbox-photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100vw - 80px, 520px);
    max-height: calc(100dvh - 150px);
    background: #f3e6e9;
}

.lightbox-caption {
    padding: 8px 6px 12px;
    min-height: 54px;
    text-align: center;
    font-family: var(--font-hand);
    font-size: 1.7rem;
    line-height: 1.1;
    color: var(--paper-ink);
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-family: var(--font-hand);
    font-size: 1.25rem;
    color: var(--accent-dark);
}

.card.is-error .card-title { color: var(--paper-ink); }

/* ---------- Reaktionen und Antwort unter dem Brief ---------- */
.reply {
    position: absolute;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100vw - 24px);
    padding: 5px;
    border: 1px solid rgba(248, 211, 198, .3);
    border-radius: 999px;
    background: rgba(255, 250, 245, .12);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    translate: -50% 0;
    animation: reply-in .5s var(--ease);
}

.reply[hidden] { display: none; }

@keyframes reply-in {
    from { opacity: 0; translate: -50% 16px; }
}

.reactions { display: flex; }

.reaction {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .25s var(--ease), background .2s, box-shadow .2s;
}

.reaction:hover { background: rgba(255, 255, 255, .14); }
.reaction:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

.reaction[aria-pressed="true"] {
    background: rgba(255, 250, 245, .92);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    transform: scale(1.1);
}

.reaction.is-popping { animation: reaction-pop .45s var(--ease); }

@keyframes reaction-pop {
    40% { transform: scale(1.5) rotate(-10deg); }
}

.stage[data-mode="door"] .reply-send,
.stage[data-mode="write"] .reactions,
.stage[data-mode="write"] .reply-button { display: none; }

/* ihr Brief: Schreiben direkt auf dem Briefpapier */
.card-text.is-compose {
    overflow: hidden;
    background: none;
}

.letter-input,
.note-text {
    --line: 1.85rem;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    resize: none;
    font-family: var(--font-hand);
    font-size: 1.45rem; /* ≥ 16px, sonst zoomt iOS beim Tippen hinein */
    line-height: var(--line);
    color: #3d1726;
    background: transparent repeating-linear-gradient(to bottom, transparent 0 calc(var(--line) - 1px), rgba(194, 84, 111, .22) calc(var(--line) - 1px) var(--line));
    background-attachment: local;
    scrollbar-width: thin;
    scrollbar-color: rgba(194, 84, 111, .35) transparent;
}

.letter-input { height: 100%; }
.note-text { height: calc(var(--line) * 7); }

.letter-input::placeholder,
.note-text::placeholder { color: rgba(74, 29, 44, .4); }

/* Zettel für die Antwort auf einen Brief */
.note {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 16px;
    background: rgba(30, 5, 16, .72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .3s ease;
}

.note[hidden] { display: none; }
.note.is-visible { opacity: 1; }

.note-paper {
    width: min(100%, 420px);
    padding: 22px 22px 14px;
    border: 3px solid #f8d3c6;
    border-radius: 16px;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .22), transparent 45%),
        var(--paper);
    color: var(--paper-ink);
    box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
    rotate: -1deg;
    translate: 0 24px;
    transition: translate .4s var(--ease);
}

.note.is-visible .note-paper { translate: 0 0; }

.note-title {
    display: block;
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(194, 84, 111, .35);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.25rem;
    line-height: 1.25;
    color: var(--raspberry);
}

.note-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}

.note-cancel {
    min-height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--accent-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.note-cancel:hover { background: rgba(194, 84, 111, .08); }
.note-cancel:focus-visible { outline: 3px solid var(--accent); }

/* ---------- Herzchen-Explosion ---------- */
.burst {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    pointer-events: none;
}

.burst span {
    position: absolute;
    left: 0;
    top: 0;
    font-size: var(--size);
    line-height: 1;
    opacity: 0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    animation: pop 1.2s cubic-bezier(.15, .7, .3, 1) var(--delay) forwards;
}

@keyframes pop {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(.2); }
    65%  { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty) + 40px)) rotate(var(--rot)) scale(1); }
}

/* ---------- Einführung beim ersten Öffnen ---------- */
.tour {
    position: fixed;
    inset: 0;
    z-index: 65;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    overflow: hidden auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 50% 40%, rgba(224, 71, 111, .25), transparent 60%),
        rgba(30, 5, 16, .86);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .35s ease;
    touch-action: pan-y;
}

.tour[hidden] { display: none; }
.tour.is-visible { opacity: 1; }

.tour-card {
    position: relative;
    width: min(100%, 380px);
    padding: 26px 22px 16px;
    border: 3px solid #f8d3c6;
    border-radius: 18px;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .22), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(255, 143, 171, .14), transparent 40%),
        var(--paper);
    color: var(--paper-ink);
    text-align: center;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
    translate: 0 24px;
    transition: translate .45s var(--ease);
}

.tour.is-visible .tour-card { translate: 0 0; }

.tour-skip {
    position: absolute;
    top: 8px;
    right: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: rgba(194, 84, 111, .85);
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.tour-skip:hover { background: rgba(194, 84, 111, .08); }
.tour-skip:focus-visible { outline: 3px solid var(--accent); }

.tour-step { display: none; }
.tour-step.is-current { display: block; animation: tour-in .4s var(--ease); }

@keyframes tour-in {
    from { opacity: 0; transform: translateX(14px); }
}

/* je nachdem, ob die Erinnerung schon eingeschaltet ist */
.tour-push-on,
.tour.push-on .tour-push-off { display: none; }
.tour.push-on .tour-push-on { display: block; }

.tour-art {
    display: grid;
    place-items: center;
    height: 112px;
    margin: 10px 0 12px;
}

.tour-title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--raspberry);
}

.tour-text {
    min-height: 7.8em; /* gleich hoch, damit die Karte zwischen den Schritten nicht springt */
    margin: 0;
    font-size: .98rem;
    line-height: 1.55;
    text-wrap: pretty;
}

/* kleine Bilder zu den Schritten */
.tour-seal {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 48% 52% 46% 54% / 52% 46% 54% 48%;
    background: radial-gradient(circle at 35% 30%, #e0506b, #93183a 70%);
    box-shadow: inset 0 0 0 6px rgba(0, 0, 0, .12), inset 0 2px 3px rgba(255, 255, 255, .3), 0 6px 14px rgba(80, 0, 20, .35);
    rotate: -12deg;
    animation: beat 1.6s ease-in-out infinite;
}

.tour-seal svg { width: 50%; fill: #a9203f; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .3)) drop-shadow(0 -1px 0 rgba(0, 0, 0, .35)); }

.tour-seal--small {
    position: absolute;
    left: 50%;
    top: 58%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .12), 0 2px 4px rgba(80, 0, 20, .4);
    animation: none;
}

.tour-door {
    display: grid;
    place-items: center;
    width: 82px;
    height: 94px;
    border-radius: var(--radius);
    background:
        var(--grain),
        linear-gradient(145deg, rgba(255, 255, 255, .18), rgba(0, 0, 0, .2)),
        var(--raspberry);
    animation: glow 2.2s ease-in-out infinite;
}

.tour-door span {
    padding: .1em .1em .16em;
    font-family: var(--font-display);
    font-size: 2.6rem;
    line-height: 1;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.tour-envelope {
    position: relative;
    width: 116px;
    height: 82px;
    border: 2px solid #f8d3c6;
    border-radius: 8px;
    background:
        var(--grain),
        radial-gradient(circle at 50% 85%, rgba(255, 255, 255, .16), transparent 60%),
        linear-gradient(160deg, #e0476f, #8e173b);
    rotate: -4deg;
    box-shadow: 0 8px 18px rgba(80, 0, 20, .3);
}

.tour-envelope-flap {
    position: absolute;
    inset: 0 0 auto;
    height: 58%;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(170deg, #ea5c80, #b02a52);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.tour-emoji {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, rgba(255, 194, 207, .55), rgba(255, 194, 207, .15));
    font-size: 2.8rem;
    line-height: 1;
}

.tour-mood { width: 128px; filter: drop-shadow(0 8px 14px rgba(80, 0, 20, .3)); }

/* Navigation */
.tour-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
}

.tour-back {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(194, 84, 111, .08);
    color: var(--accent-dark);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.tour-back:focus-visible { outline: 3px solid var(--accent); }

.tour-dots { display: flex; gap: 6px; }

.tour-dots span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(194, 84, 111, .28);
    transition: width .3s var(--ease), background .3s;
}

.tour-dots span.is-current { width: 20px; background: var(--rose); }

.tour-next { min-width: 112px; }

/* Link ganz unten: Einführung nochmal ansehen */
.page-foot {
    position: relative;
    z-index: 1;
    margin: 34px auto 0;
    text-align: center;
}

.link-button {
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: rgba(242, 191, 203, .75);
    font: inherit;
    font-size: .88rem;
    text-decoration: underline;
    text-decoration-color: rgba(242, 191, 203, .35);
    text-underline-offset: 4px;
    cursor: pointer;
}

.link-button:hover { color: var(--ink); }
.link-button:focus-visible { outline: 3px solid var(--accent); }

/* ---------- Herzen beim Tippen ---------- */
.tap-hearts {
    position: fixed;
    inset: 0;
    z-index: 40;
    overflow: hidden;
    pointer-events: none;
}

.tap-hearts span {
    position: absolute;
    font-size: var(--size);
    line-height: 1;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    opacity: 0;
    animation: tap-heart var(--dur) cubic-bezier(.2, .7, .3, 1) var(--delay) forwards;
}

@keyframes tap-heart {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(.8); }
}

/* ---------- Hinweis ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 60;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(255, 250, 245, .97);
    color: var(--paper-ink);
    font-size: .95rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .3s var(--ease);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
    .hearts, .snow { display: none; }
    .stars span { animation: none; opacity: .7; }
    .sky::before, .sky::after, .stars { transition: none; }
    .card-hint, .env-shine::before, .env-seal, .finale, .finale-heart,
    .bulb-glow, .bulb-glass, .door-sparkle, .door.is-today .leaf-front,
    .door.is-pointed, .door.is-pointed .leaf-front, .greeting, .card.is-golden .env-back, .mood-envelope, .mood-intro,
    .tour-step.is-current, .tour-seal, .tour-door,
    .reply, .reaction.is-popping, .card.is-sealing .env-seal { animation: none; }
    .card.is-unsealed .env-seal { animation: none; opacity: 0; }
    .door-leaf, .card, .card-tilt, .scene, .letter, .flap-face, .progress span,
    .env-back, .env-front, .env-flap, .env-shine, .lightbox, .lightbox-photo,
    .note, .note-paper, .mood-picker, .mood-paper, .tour, .tour-card { transition-duration: .01s; transition-delay: 0s; }
}

/* ---------- Einleitung mit Passwort ---------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

body.intro {
    display: grid;
    place-items: center;
    overflow: hidden;
}

.intro-box {
    position: relative;
    z-index: 1;
    width: min(100%, 380px);
    text-align: center;
}

.intro-lock {
    display: block;
    width: 132px;
    margin: 0 auto 6px;
    overflow: visible;
    filter: drop-shadow(0 8px 24px rgba(224, 71, 111, .45));
    animation: intro-beat 1.6s ease-in-out infinite;
}

.intro-lock-hole { fill: #7a1733; transform-origin: 12px 12.5px; transition: transform .5s var(--ease), opacity .5s; }

@keyframes intro-beat {
    0%, 60%, 100% { transform: scale(1); }
    15% { transform: scale(1.07); }
    30% { transform: scale(.97); }
    45% { transform: scale(1.04); }
}

.intro-title {
    margin: 0;
    padding: .05em .15em .12em;
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(2.2rem, 10vw, 3rem);
    line-height: 1.1;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 10px rgba(255, 143, 171, .3));
}

.intro-text {
    margin: 6px 0 24px;
    white-space: pre-line;
    text-wrap: balance;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    line-height: 1.3;
    color: var(--muted);
}

.intro-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.intro-input {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid rgba(248, 211, 198, .45);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: var(--ink);
    font: inherit;
    font-size: 1.05rem; /* ≥ 16px, sonst zoomt iOS beim Tippen hinein */
    text-align: center;
    letter-spacing: .08em;
    outline: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.intro-input::placeholder { color: rgba(242, 191, 203, .6); letter-spacing: .02em; }

.intro-input:focus {
    border-color: #f8d3c6;
    background: rgba(255, 255, 255, .12);
    box-shadow: 0 0 0 4px rgba(255, 143, 171, .2);
}

.intro-button {
    padding: 14px 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(150deg, #e0476f, #9c1c42);
    color: #fff4f6;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .03em;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(224, 71, 111, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
    transition: transform .15s ease, box-shadow .2s;
    touch-action: manipulation;
}

.intro-button:hover { box-shadow: 0 10px 28px rgba(224, 71, 111, .5), inset 0 1px 0 rgba(255, 255, 255, .25); }
.intro-button:active { transform: scale(.97); }
.intro-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.intro-error {
    margin: 14px 0 0;
    font-size: .95rem;
    color: #ffb3c1;
}

.intro-hint {
    margin: 18px 0 0;
    font-size: .85rem;
    color: rgba(242, 191, 203, .7);
}

.intro-hint a { color: var(--accent); }

.is-error .intro-form { animation: intro-shake .45s ease; }
.is-error .intro-input { border-color: #ff8fab; }

@keyframes intro-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(3px); }
}

/* Richtig: Schlüsselloch verschwindet, Herz schwillt an */
.is-success .intro-lock { animation: intro-unlock 1.9s var(--ease) forwards; }
.is-success .intro-lock-hole { transform: scale(0); opacity: 0; transition-delay: .2s; }
.is-success .intro-title,
.is-success .intro-text,
.is-success .intro-hint { animation: intro-fade 1.9s ease forwards; }

@keyframes intro-unlock {
    0%   { transform: scale(1); }
    20%  { transform: scale(1.2); }
    35%  { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(9); opacity: 0; }
}

@keyframes intro-fade {
    0%, 55% { opacity: 1; }
    100%    { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .intro-lock, .is-error .intro-form { animation: none; }
}

/* ---------- Erinnerungsbuch ---------- */
.book-nav {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto 24px;
}

.book .btn--ghost {
    color: var(--ink);
    box-shadow: inset 0 0 0 1.5px rgba(248, 211, 198, .45);
}

.book .btn--ghost:hover { background: rgba(255, 255, 255, .08); }

.book-pages {
    display: grid;
    gap: 22px;
    max-width: 560px;
    margin: 0 auto;
}

.book-page {
    padding: 30px 28px 26px;
    border: 3px solid #f8d3c6;
    border-radius: 16px;
    background:
        var(--grain),
        radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .2), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(255, 143, 171, .12), transparent 40%),
        var(--paper);
    color: var(--paper-ink);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
}

.book-cover {
    display: grid;
    justify-items: center;
    align-content: center;
    min-height: 340px;
    text-align: center;
}

.book-cover-heart { width: 54px; fill: var(--raspberry); }

.book-cover-title {
    margin: 8px 0 4px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(2rem, 8vw, 2.6rem);
    line-height: 1.15;
    color: var(--raspberry);
}

.book-cover-sub,
.book-cover-dates {
    margin: 0;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    color: var(--accent-dark);
}

.book-cover-dates { margin-top: 18px; font-size: 1.2rem; }

.book-cover-label {
    margin: 22px 0 0;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .4em;
    text-transform: uppercase;
    color: var(--rose);
}

.book-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(194, 84, 111, .35);
}

.book-num {
    flex: none;
    min-width: 1.4em;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 2.6rem;
    line-height: 1;
    text-align: center;
    color: var(--rose);
}

.book-num-heart { flex: none; width: 36px; fill: var(--rose); }

.book-title {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.45rem;
    line-height: 1.2;
    color: var(--raspberry);
}

.book-date {
    margin: 2px 0 0;
    font-family: var(--font-hand);
    font-size: 1.15rem;
    color: var(--accent-dark);
}

.book-text {
    margin: 0;
    white-space: pre-line;
    text-wrap: pretty;
    font-family: var(--font-hand);
    font-size: 1.5rem;
    line-height: 1.3;
    color: #3d1726;
}

.book-photo { cursor: auto; }

.book-answer {
    clear: both;
    margin-top: 18px;
    padding: 12px 16px;
    border-left: 3px solid var(--rose);
    border-radius: 0 10px 10px 0;
    background: rgba(255, 194, 207, .22);
}

.book-answer-label {
    margin: 0;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent-dark);
}

.book-answer-text {
    margin: 4px 0 0;
    white-space: pre-line;
    font-family: var(--font-hand);
    font-size: 1.35rem;
    line-height: 1.3;
    color: #3d1726;
}

.book-letter--hers { border-color: var(--rose); }

/* Inhaltsverzeichnis */
.book-toc-title {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.8rem;
    text-align: center;
    color: var(--raspberry);
}

.book-toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.book-toc-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px dotted rgba(194, 84, 111, .35);
}

.book-toc-num {
    flex: none;
    min-width: 1.8em;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--rose);
}

.book-toc-name {
    flex: 1;
    font-family: var(--font-hand);
    font-size: 1.35rem;
    line-height: 1.15;
    color: #3d1726;
}

.book-toc-date {
    flex: none;
    font-family: var(--font-hand);
    font-size: 1.1rem;
    color: var(--accent-dark);
}

/* Übersicht „Für schwere Momente“ */
.book-moods-intro {
    margin: 0 0 16px;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    line-height: 1.3;
    color: #3d1726;
}

.book-moods-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.book-moods-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dotted rgba(194, 84, 111, .35);
}

.book-moods-emoji { flex: none; width: 1.6em; font-size: 1.4rem; text-align: center; }

.book-moods-name {
    flex: 1;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--raspberry);
}

.book-moods-status {
    flex: none;
    max-width: 55%;
    font-family: var(--font-hand);
    font-size: 1.2rem;
    line-height: 1.1;
    text-align: right;
    color: var(--accent-dark);
}

.book-moods-list li.is-complete .book-moods-status { color: var(--rose); }

.book-foot {
    margin-top: 18px;
    text-align: center;
    font-family: var(--font-hand);
    font-size: 1.1rem;
    letter-spacing: .2em;
    color: rgba(194, 84, 111, .7);
}

/* Kapitelseite einer Stimmung (book.php) */
.book-chapter {
    display: grid;
    justify-items: center;
    align-content: center;
    min-height: 340px;
    text-align: center;
}

.book-chapter-emoji { font-size: 3rem; line-height: 1; }

.book-chapter-count {
    margin: 0;
    font-family: var(--font-hand);
    font-size: 1.3rem;
    color: var(--accent-dark);
}

/* Titel als SVG für den Druck (siehe assets/book-print.js) – am Bildschirm unsichtbar */
.book-foil {
    position: absolute;
    width: 0;
    height: 0;
    visibility: hidden;
    overflow: visible;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: 100px;
}

/* Unsichtbares Messfeld für die Druckgröße der Briefe (siehe assets/book-print.js) */
.book-print-probe {
    position: absolute;
    top: 0;
    left: -9999px;
    line-height: 1.38;
    visibility: hidden;
    pointer-events: none;
}

/* ---------- Erinnerungsbuch gedruckt / als PDF: A4, jede Seite ein Blatt ---------- */
@media print {
    @page { size: A4; margin: 0; }

    html, body.book {
        margin: 0;
        padding: 0;
        background: none;
    }

    /* Papierfarbe auch für Folgeseiten, falls ein langer Brief über eine Seite hinausgeht */
    body.book {
        background: #fffaf5;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .book-nav { display: none; }

    .book-pages {
        display: block;
        max-width: none;
        margin: 0;
    }

    .book-page {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 210mm;
        min-height: 296.5mm;
        margin: 0;
        padding: 30mm 28mm 32mm;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background:
            radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .18), transparent 38%),
            radial-gradient(circle at 0% 100%, rgba(255, 143, 171, .12), transparent 34%),
            #fffaf5;
        break-after: page;
        box-decoration-break: clone;
        -webkit-box-decoration-break: clone;
    }

    .book-page:last-child { break-after: auto; }

    /* Zierrahmen: doppelte feine Linie */
    .book-page::before {
        content: "";
        position: absolute;
        inset: 11mm;
        border: .5mm solid rgba(194, 84, 111, .45);
        border-radius: 3mm;
        outline: .25mm solid rgba(194, 84, 111, .3);
        outline-offset: -2.4mm;
        pointer-events: none;
    }

    /* Titel- und Schlussseite: dunkel mit Roségold, wie der Kalender */
    .book-cover {
        height: 296.5mm;
        min-height: 0;
        overflow: hidden;
        align-items: center;
        text-align: center;
        background:
            radial-gradient(120% 75% at 50% 0%, #5a1834, #2e0b1c 72%),
            #2e0b1c;
    }

    .book-cover::before { border-color: rgba(248, 211, 198, .55); outline-color: rgba(248, 211, 198, .3); }

    /* Titel: der scharfe SVG-Text ersetzt den als Bild gedruckten CSS-Verlauf */
    .book-cover .book-cover-title:has(.book-foil) {
        font-size: 0;
        line-height: 0;
        background: none;
    }

    .book-cover .book-foil {
        position: static;
        display: block;
        visibility: visible;
        width: auto;
        max-width: 154mm;
        height: 20mm;
        margin: 0 auto;
    }

    /* Dunkle Farbe ein paar Millimeter über den Rand hinaus, damit am Blattrand kein weißer Streifen bleibt */
    .book-cover { box-shadow: 0 0 0 4mm #2e0b1c; }

    .book-cover-heart {
        width: 26mm;
        fill: #e39a8a;
    }

    .book-cover-title {
        margin: 8mm 0 3mm;
        padding: 0 .1em .12em;
        font-size: 42pt;
        background: var(--foil);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .book-cover-sub { font-size: 24pt; color: #f2bfcb; }
    .book-cover-dates { margin-top: 4mm; font-size: 16pt; color: #f8d3c6; }
    .book-cover-label { margin-top: 16mm; font-size: 10pt; letter-spacing: .45em; color: #e39a8a; }
    .book-end .book-text { max-width: 140mm; font-size: 24pt; color: #f8d3c6; text-align: center; }

    /* Inhaltsverzeichnis */
    .book-toc { justify-content: flex-start; padding: 26mm 30mm 24mm; }
    .book-toc-title { margin-bottom: 6mm; font-size: 28pt; }
    .book-toc-list li { padding: .8mm 0; }
    .book-toc-num { font-size: 12pt; }
    .book-toc-name { font-size: 15pt; line-height: 1.1; }
    .book-toc-date { font-size: 12pt; }

    /* Briefseite */
    .book-head {
        flex-direction: column;
        gap: 1.5mm;
        margin: 0 0 10mm;
        padding: 0;
        border: 0;
        text-align: center;
    }

    /* Trennlinie unter dem Titel */
    .book-head::after {
        content: "♥";
        display: block;
        width: 70mm;
        margin: 4mm auto 0;
        font-size: 10pt;
        line-height: 1;
        color: var(--rose);
        background: linear-gradient(90deg, transparent, rgba(194, 84, 111, .5) 30%, transparent 44%, transparent 56%, rgba(194, 84, 111, .5) 70%, transparent) center / 100% .3mm no-repeat;
    }

    .book-num { font-size: 56pt; }
    .book-num-heart { width: 18mm; }
    .book-title { font-size: 28pt; }
    .book-date { font-size: 17pt; }

    .book-text {
        font-size: var(--print-fs, 25pt);
        line-height: 1.38;
        orphans: 3;
        widows: 3;
    }

    .book-photo {
        float: none;
        align-self: center;
        width: 72mm;
        margin: 0 0 9mm;
        padding: 3mm 3mm 11mm;
        rotate: -2deg;
        box-shadow: 0 1mm 4mm rgba(60, 10, 25, .25);
        break-inside: avoid;
    }

    .book-answer {
        margin-top: 12mm;
        padding: 4mm 6mm;
        break-inside: avoid;
    }

    .book-answer-label { font-size: 9pt; }
    .book-answer-text { font-size: 20pt; }

    .book-foot {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 16mm;
        margin: 0;
        font-size: 13pt;
    }

    .book-moods { justify-content: flex-start; padding-top: 34mm; }
    .book-moods-intro { margin: 0 0 9mm; font-size: 20pt; }
    .book-moods-list li { gap: 5mm; padding: 4mm 0; }
    .book-moods-emoji { font-size: 20pt; }
    .book-moods-name { font-size: 17pt; }
    .book-moods-status { font-size: 18pt; }

    .book-letter--hers { background: radial-gradient(circle at 50% 0%, rgba(255, 143, 171, .22), transparent 50%), #fff4f3; }

    /*
     * Sehr lange Briefe laufen über mehrere Seiten. Papier und Zierrahmen kommen dann von
     * festen Ebenen, die der Browser auf jede gedruckte Seite zeichnet – so hat auch die
     * Folgeseite einen vollständigen Rahmen. Die Seitenzahl steht am Ende des Textes.
     */
    body.book::before,
    body.book::after {
        content: "";
        position: fixed;
        z-index: -1;
        pointer-events: none;
    }

    body.book::before {
        inset: 0;
        background:
            radial-gradient(circle at 100% 0%, rgba(255, 143, 171, .18), transparent 38%),
            radial-gradient(circle at 0% 100%, rgba(255, 143, 171, .12), transparent 34%),
            #fffaf5;
    }

    body.book::after {
        inset: 11mm;
        border: .5mm solid rgba(194, 84, 111, .45);
        border-radius: 3mm;
        outline: .25mm solid rgba(194, 84, 111, .3);
        outline-offset: -2.4mm;
    }

    .book-letter.is-long {
        display: block;
        background: none;
    }

    .book-chapter { align-items: center; text-align: center; }
    .book-chapter-emoji { font-size: 54pt; }
    .book-chapter .book-cover-title { margin: 8mm 0 3mm; font-size: 40pt; background: none; color: var(--raspberry); }
    .book-chapter-count { font-size: 18pt; }

    .book-letter.is-long::before { display: none; }
    .book-letter.is-long .book-photo { display: block; margin: 0 auto 9mm; }
    .book-letter.is-long .book-foot { position: static; margin-top: 10mm; }
}
