* {
    box-sizing: border-box;
}

:root {
    --night: #080104;
    --wine: #2a0612;
    --crimson: #d1123f;
    --blush: #ffd3db;
    --gold: #f6d3a1;
    --ink: #3b0a17;
    --seal: #9b0f30;
    --paper: #fbf1ea;

    /* Güllerin içine ne kadar yukarıdan baktığımız */
    --tilt: -26deg;
    /* Fare konumu, -1 … 1 (script.js ayarlıyor) */
    --px: 0;
    --py: 0;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background:
        radial-gradient(120% 80% at 50% 26%, #3d0a1b 0%, #1d040d 42%, var(--night) 100%);
    color: var(--blush);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ========================================================
   Gökyüzü, sahne, sis
   ======================================================== */
.sky-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(38% 30% at 50% 30%, rgba(255, 40, 90, 0.20), transparent 70%),
        radial-gradient(60% 40% at 50% 100%, rgba(120, 10, 40, 0.35), transparent 70%);
    animation: sky-breathe 8s ease-in-out infinite alternate;
}

@keyframes sky-breathe {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

.scene {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 3vh;
    z-index: 2;
    pointer-events: none;
}

.ground {
    position: relative;
    flex: none;
    width: min(100vw, 150vh);
    aspect-ratio: 1.6;
    transform-origin: 50% 34%;
    translate: calc(var(--px) * -8px) calc(var(--py) * -5px);
    transition: translate 1.6s cubic-bezier(.2, .7, .2, 1);
    animation: garden-reveal 6s cubic-bezier(.6, 0, .3, 1) 2.8s both;
}

@keyframes garden-reveal {
    from { transform: scale(1.85); }
    to   { transform: scale(1); }
}

/* Dik tutulan telefonlar: güller büyük kalsın diye bahçe yanlardan taşar */
@media (max-aspect-ratio: 1/1) {
    .ground {
        width: 200vw;
    }
    .scene {
        padding-bottom: 22vh;
    }
}

.mist {
    position: absolute;
    inset: auto 0 0 0;
    height: 42vh;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(to top,
            rgba(14, 2, 7, 1) 0%,
            rgba(18, 3, 9, 0.88) 30%,
            rgba(30, 5, 14, 0.45) 62%,
            transparent 100%);
}

.mist::before,
.mist::after {
    content: "";
    position: absolute;
    inset: 10% -30% 0;
    background:
        radial-gradient(30% 45% at 25% 60%, rgba(120, 30, 55, 0.22), transparent 70%),
        radial-gradient(28% 40% at 70% 55%, rgba(90, 20, 45, 0.25), transparent 70%);
    animation: mist-drift 26s ease-in-out infinite alternate;
}

.mist::after {
    animation-duration: 34s;
    animation-direction: alternate-reverse;
    opacity: 0.7;
}

@keyframes mist-drift {
    from { transform: translateX(-8%); }
    to   { transform: translateX(8%); }
}

/* ========================================================
   Bir gül (sap + 3D baş). İçerideki tüm ölçüler cqi cinsinden,
   yani sapın 1 SVG birimi = gülün genişliğinin %1'i.
   ======================================================== */
.rose {
    position: absolute;
    left: calc(var(--hx) * 1%);
    top: calc(var(--hy) * 1%);
    width: calc(var(--w) * 1%);
    container-type: inline-size;
    pointer-events: none;
}

.rose.layer-back  { z-index: 1; filter: brightness(0.58) saturate(0.85); }
.rose.layer-mid   { z-index: 2; filter: brightness(0.8); }
.rose.layer-hero  { z-index: 3; }
.rose.layer-front { z-index: 6; filter: blur(3px) brightness(0.5) saturate(0.9); }

.rose-sway {
    position: absolute;
    inset: 0;
    transform-origin: 50% 100%;
    animation: sway var(--sd, 7s) ease-in-out var(--sdelay, 0s) infinite alternate;
}

@keyframes sway {
    from { rotate: calc(var(--amp, 1.5deg) * -1); }
    to   { rotate: var(--amp, 1.5deg); }
}

.stem {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.stem-main {
    fill: none;
    stroke: #163a22;
    stroke-width: 3.2;
    stroke-linecap: round;
}

.stem-hi {
    fill: none;
    stroke: #4d8f57;
    stroke-width: 0.9;
    stroke-linecap: round;
    opacity: 0.75;
}

.stem-rim {
    fill: none;
    stroke: #ff2d5f;
    stroke-width: 0.6;
    stroke-linecap: round;
    opacity: 0.35;
}

.petiole {
    fill: none;
    stroke: #1d4a2a;
    stroke-width: 0.9;
    stroke-linecap: round;
}

.leaflet {
    fill: url(#leafGrad);
    stroke: #5a9a62;
    stroke-width: 0.25;
    stroke-opacity: 0.6;
}

.rib {
    fill: none;
    stroke: rgba(190, 235, 190, 0.35);
    stroke-width: 0.3;
}

.thorn {
    fill: #5a1a24;
}

.hip {
    fill: url(#hipGrad);
}

/* script.js tarafından büyütülür */
.leaf-grow,
.thorn-grow,
.hip-grow {
    transform: scale(0);
}

/* ---------- Gül başı ---------- */
.head-anchor {
    position: absolute;
    left: 50cqi;
    top: 60cqi;
    width: 0;
    height: 0;
    perspective: 240cqi;
}

.head-glow {
    position: absolute;
    width: 170cqi;
    height: 170cqi;
    left: -85cqi;
    top: -110cqi;
    border-radius: 50%;
    background: radial-gradient(closest-side,
            hsla(var(--hue), 100%, 58%, 0.42),
            hsla(var(--hue), 100%, 45%, 0.12) 55%,
            transparent);
    opacity: 0;
    pointer-events: none;
    animation: glow-breathe 4.5s ease-in-out infinite alternate;
}

@keyframes glow-breathe {
    from { transform: scale(0.9); }
    to   { transform: scale(1.12); }
}

.head-hit {
    position: absolute;
    width: 90cqi;
    height: 80cqi;
    left: -45cqi;
    top: -60cqi;
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
}

.head-tilt {
    position: absolute;
    left: 0;
    top: 0;
    transform-style: preserve-3d;
    transform:
        rotateX(calc(var(--tilt) + var(--py) * 9deg))
        rotateY(calc(var(--px) * 16deg));
    transition: transform 1.6s cubic-bezier(.2, .7, .2, 1);
}

.head-idle {
    transform-style: preserve-3d;
    animation: head-idle 11s ease-in-out var(--sdelay, 0s) infinite alternate;
}

@keyframes head-idle {
    from { transform: rotateY(-12deg) rotateZ(-2deg); }
    to   { transform: rotateY(12deg) rotateZ(2deg); }
}

.head-bloom {
    transform-style: preserve-3d;
    transform: scale(0);
}

/* Her taç yaprak iki parça: çanak gibi alt kısım ve dışa kıvrılan uç */
.petal {
    position: absolute;
    bottom: 0;
    left: calc(var(--pw) * -0.5);
    width: var(--pw);
    height: var(--ph);
    transform-origin: 50% 100%;
    transform-style: preserve-3d;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
    outline: 1px solid transparent; /* Chrome'da daha yumuşak 3D kenarlar */
    box-shadow: 0 0 0.8cqi rgba(90, 0, 25, 0.55);
    backface-visibility: visible;
}

.lip {
    position: absolute;
    left: 0;
    bottom: calc(100% - 0.3cqi);
    width: 100%;
    height: var(--lh);
    transform-origin: 50% 100%;
    border-radius: 50% 50% 8% 8% / 100% 100% 8% 8%;
    box-shadow:
        inset 0 0.5cqi 0.9cqi rgba(255, 190, 200, 0.28),
        0 -0.3cqi 0.9cqi rgba(90, 0, 25, 0.45);
    outline: 1px solid transparent;
}

.sepal {
    position: absolute;
    bottom: 0;
    left: -3.5cqi;
    width: 7cqi;
    height: 21cqi;
    transform-origin: 50% 100%;
    border-radius: 50% 50% 50% 50% / 92% 92% 8% 8%;
    background: linear-gradient(to top, #12301c, #3a7a47);
}

/* ========================================================
   Canvas (yaprak ve kalp katmanı)
   ======================================================== */
#petals-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* ========================================================
   Alt butonlar
   ======================================================== */
.dock {
    position: fixed;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    translate: -50% 0;
    z-index: 10;
    display: flex;
    gap: 4px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(32, 4, 13, 0.55);
    border: 1px solid rgba(255, 150, 170, 0.16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    animation: dock-in 1s cubic-bezier(.2, .8, .2, 1) 8.5s both;
}

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

.dock-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px 0 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--blush);
    font: 500 14px/1 'Plus Jakarta Sans', system-ui, sans-serif;
    letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.dock-btn:hover {
    background: rgba(255, 140, 165, 0.12);
}

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


.btn-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 420px) {
    .dock-btn {
        padding: 0 14px 0 11px;
        font-size: 13px;
    }
}

/* ========================================================
   Aşk mektubu
   ======================================================== */
.letter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(8, 1, 4, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fade-in 0.4s ease both;
}

.letter-backdrop[hidden] {
    display: none;
}

@keyframes fade-in {
    from { opacity: 0; }
}

.letter {
    position: relative;
    width: min(520px, 100%);
    padding: 52px 44px 40px;
    border-radius: 3px;
    color: var(--ink);
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.7), transparent 60%),
        radial-gradient(90% 70% at 100% 100%, rgba(214, 170, 150, 0.35), transparent 70%),
        var(--paper);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 30px 80px rgba(0, 0, 0, 0.6);
    font-family: 'Cormorant Garamond', Georgia, serif;
    animation: letter-in 0.8s cubic-bezier(.2, .9, .25, 1) both;
}

@keyframes letter-in {
    from { opacity: 0; transform: translateY(30px) rotate(-2deg) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

.letter h2 {
    margin: 0 0 14px;
    font-family: 'Great Vibes', cursive;
    font-weight: 400;
    font-size: 46px;
    line-height: 1.1;
    color: var(--seal);
}

#typewriter-text {
    margin: 0;
    min-height: 7.5em;
    font-size: 21px;
    font-style: italic;
    line-height: 1.65;
}

#typewriter-text.typing::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -0.12em;
    background: currentColor;
    animation: caret 0.9s steps(1) infinite;
}

@keyframes caret {
    50% { opacity: 0; }
}

.letter-sign {
    margin: 22px 0 0;
    text-align: right;
    font-family: 'Great Vibes', cursive;
    font-size: 32px;
    color: var(--seal);
}

.letter-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.letter-close:hover {
    background: rgba(59, 10, 23, 0.08);
}

.letter-close:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}

.seal {
    position: absolute;
    top: -30px;
    left: 50%;
    translate: -50% 0;
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border-radius: 47% 53% 50% 50% / 52% 48% 52% 48%;
    background: radial-gradient(circle at 35% 30%, #e5375f, #9b0f30 55%, #5c0619);
    box-shadow:
        inset 0 0 0 5px rgba(0, 0, 0, 0.12),
        inset 0 0 0 6px rgba(255, 160, 175, 0.25),
        0 6px 16px rgba(80, 0, 20, 0.45);
}

.seal svg {
    width: 26px;
    height: 26px;
    fill: rgba(255, 210, 218, 0.55);
}

@media (max-width: 480px) {
    .letter {
        padding: 48px 26px 30px;
    }
    #typewriter-text {
        font-size: 19px;
    }
}

/* ========================================================
   Hareket azaltma açıksa: bahçe açılmış hâlde gelsin
   ======================================================== */
@media (prefers-reduced-motion: reduce) {
    .ground,
    .rose-sway,
    .head-idle,
    .head-glow,
    .sky-glow,
    .mist::before,
    .mist::after,
    .dock,
    .letter,
    .letter-backdrop {
        animation: none !important;
    }
    .head-tilt,
    .ground {
        transition: none;
    }
}
