* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: #102015;
    color: #26351f;
    overflow-x: hidden;
}

body {
    font-family: "Cormorant Garamond", Georgia, serif;
}

button {
    font-family: "Cormorant Garamond", Georgia, serif;
}

.garden-page {
    min-height: 100svh;
    background: linear-gradient(rgba(6, 18, 10, 0.22), rgba(6, 18, 10, 0.38)), url("images/garden-bg.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

    .garden-page::before {
        content: "";
        position: fixed;
        inset: 0;
        background: radial-gradient(circle at 50% 18%, rgba(255, 248, 215, 0.24), transparent 30%), linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.28));
        pointer-events: none;
    }

.app-shell {
    width: 100%;
    max-width: 430px;
    min-height: 100svh;
    margin: 0 auto;
    padding: calc(10px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.top-area {
    position: relative;
    text-align: center;
    padding-top: 44px;
    flex-shrink: 0;
}

.restart-button {
    position: absolute;
    top: 4px;
    right: 0;
    width: auto;
    min-height: 36px;
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    color: #fff6da;
    background: rgba(72, 88, 39, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    font-size: 0.9rem;
    font-weight: 700;
}

.tiny-label {
    margin: 0;
    font-family: system-ui, sans-serif;
    color: #fff8da;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.18rem;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0,0,0,0.45);
}

h1 {
    margin: 7px 0 18px;
    font-family: "Parisienne", cursive;
    color: #fff7d8;
    font-size: 3.45rem;
    line-height: 0.92;
    font-weight: 400;
    text-shadow: 0 4px 14px rgba(0,0,0,0.48);
}

.progress-card {
    margin: 0 auto 12px;
    padding: 13px 16px;
    width: 100%;
    border-radius: 22px;
    background: rgba(52, 68, 34, 0.58);
    border: 1px solid rgba(255, 255, 225, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.17);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #fff8df;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.progress-track {
    width: 100%;
    height: 11px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,230,0.38);
}

#progressFill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #9fbf54, #f5eaa0, #fffdf0);
    transition: width 0.45s ease;
}

.screen {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 25px;
    padding: 18px 17px;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 250, 226, 0.86), rgba(252, 246, 218, 0.78));
    border: 1px solid rgba(255, 255, 245, 0.62);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 18px 44px rgba(0,0,0,0.24), inset 0 0 30px rgba(255,255,255,0.25);
    animation: screenIn 0.35s ease both;
}

@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hidden {
    display: none !important;
}

.flower-icon {
    margin: 0 0 4px;
    color: #e5b73f;
    font-size: 1.55rem;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(83, 94, 36, 0.35);
}

h2 {
    margin: 2px 0 10px;
    color: #4b6937;
    font-size: 2.25rem;
    line-height: 0.98;
    font-weight: 700;
}

.letter-card {
    margin: 10px auto 14px;
    max-width: 360px;
}

    .letter-card p,
    .message-box p,
    .final-lines p {
        color: #26351f;
        font-size: 1rem;
        line-height: 1.34;
        margin: 0 0 8px;
    }

.script-line {
    padding-top: 4px;
    color: #4b6937 !important;
    font-family: "Parisienne", cursive;
    font-size: 1.65rem !important;
    line-height: 1.05 !important;
}

.subtitle {
    margin: 0 auto 8px;
    max-width: 340px;
    color: #52693f;
    font-size: 0.92rem;
    line-height: 1.28;
}

.message-box {
    margin: 8px auto 0;
    max-width: 350px;
}

    .message-box p {
        opacity: 0;
        animation: lineReveal 0.5s ease forwards;
    }

@keyframes lineReveal {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.button-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.primary-button,
.secondary-button {
    width: 100%;
    min-height: 43px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
}

.primary-button {
    color: #fff8df;
    background: rgba(72, 88, 39, 0.82);
    border: 1px solid rgba(255,255,225,0.18);
    box-shadow: 0 10px 22px rgba(0,0,0,0.18);
}

.secondary-button {
    color: #4b6937;
    background: rgba(255, 255, 245, 0.52);
    border: 1px solid rgba(75, 105, 55, 0.25);
}

    .primary-button:active,
    .secondary-button:active,
    .restart-button:active {
        transform: scale(0.97);
    }

.final-lines {
    margin: 10px auto 12px;
    max-width: 350px;
}

    .final-lines p {
        animation: finalFade 0.65s ease both;
    }

        .final-lines p:last-child {
            color: #4b6937;
            font-family: "Parisienne", cursive;
            font-size: 1.55rem;
            line-height: 1.1;
        }

@keyframes finalFade {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contract-frame {
    margin: 10px auto 12px;
    width: 100%;
    max-width: 350px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(255, 255, 245, 0.62);
    border: 1px solid rgba(75, 105, 55, 0.22);
}

    .contract-frame img {
        display: block;
        width: 100%;
        height: auto;
        max-height: 58svh;
        object-fit: contain;
        border-radius: 11px;
        background: white;
    }

@media (max-height: 760px) {
    .top-area {
        padding-top: 36px;
    }

    h1 {
        font-size: 3rem;
        margin-bottom: 12px;
    }

    .progress-card {
        padding: 10px 13px;
        margin-bottom: 9px;
    }

    .screen {
        padding: 14px 14px;
        border-radius: 22px;
    }

    h2 {
        font-size: 1.85rem;
    }

    .letter-card p,
    .message-box p,
    .final-lines p {
        font-size: 0.9rem;
        line-height: 1.25;
        margin-bottom: 6px;
    }

    .script-line {
        font-size: 1.35rem !important;
    }

    .primary-button,
    .secondary-button {
        min-height: 39px;
        font-size: 0.9rem;
    }

    .flower-icon {
        font-size: 1.25rem;
    }
}

@media (max-width: 375px) {
    h1 {
        font-size: 2.75rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .letter-card p,
    .message-box p,
    .final-lines p {
        font-size: 0.88rem;
    }
}
