* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Georgia', serif;
    background: #1a1a2e;
    color: #fff;
}

/* ───── Pages ───── */
.page {
    display: none;
    min-height: 100svh; /* svh = safe viewport height, fixes iPhone bottom bar */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    text-align: center;
    animation: fadeIn 0.8s ease;
}

.page.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ───── Page 1 – Apology ───── */
#page1 {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.apology-icon {
    font-size: 56px;
    margin-bottom: 1.25rem;
    animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.1); }
}

.apology-title {
    font-size: clamp(18px, 5vw, 28px);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #e0c4f4;
    line-height: 1.3;
}

.letter-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 620px;
    text-align: left;
    line-height: 1.9;
    font-size: clamp(13px, 3.5vw, 15px);
    color: #ddd;
    margin-bottom: 1.5rem;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    max-height: 55svh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

.letter-box p {
    margin-bottom: 1rem;
}

.letter-box p:last-child {
    margin-bottom: 0;
}

.letter-signature {
    text-align: right;
    font-style: italic;
    color: #b39ddb;
    margin-top: 1.5rem;
    font-size: 13px;
}

.btn-next {
    background: #6c48c5;
    color: #fff;
    border: none;
    padding: 14px 36px;
    border-radius: 50px;
    font-size: clamp(14px, 4vw, 16px);
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    /* Prevent double-tap zoom on iOS */
    touch-action: manipulation;
    -webkit-appearance: none;
    min-width: 180px;
}

.btn-next:active {
    transform: scale(0.97);
    background: #7c5cbf;
}

/* ───── Page 2 – Forgiveness ───── */
#page2 {
    background: linear-gradient(135deg, #2d1b69 0%, #11998e 100%);
}

.question-icon {
    font-size: 64px;
    margin-bottom: 1.25rem;
    animation: wobble 1.5s ease-in-out infinite;
}

@keyframes wobble {
    0%, 100% { transform: rotate(-5deg); }
    50%       { transform: rotate(5deg); }
}

.question-title {
    font-size: clamp(18px, 5vw, 26px);
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: #fff;
}

.question-sub {
    font-size: clamp(12px, 3vw, 14px);
    color: rgba(255,255,255,0.6);
    margin-bottom: 2rem;
    padding: 0 1rem;
}

/* btn-area must be big enough so No has room to escape */
.btn-area {
    position: relative;
    width: min(420px, 92vw);
    height: 220px;
    margin: 0 auto;
}

.btn-yes {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: #27ae60;
    color: #fff;
    border: none;
    padding: 14px 36px;
    border-radius: 50px;
    font-size: clamp(15px, 4vw, 18px);
    cursor: pointer;
    font-weight: 600;
    touch-action: manipulation;
    -webkit-appearance: none;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.btn-yes:active {
    background: #2ecc71;
    transform: translateY(-50%) scale(0.96);
}

.btn-no {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 14px 36px;
    border-radius: 50px;
    font-size: clamp(15px, 4vw, 18px);
    cursor: pointer;
    font-weight: 600;
    touch-action: manipulation;
    -webkit-appearance: none;
    transition: background 0.2s;
    white-space: nowrap;
}

.no-counter {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    margin-top: 140px;
    font-style: italic;
    min-height: 20px;
    width: 100%;
    text-align: center;
}

/* ───── Page 3 – Happy Birthday ───── */
#page3 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #fda085 100%);
    position: relative;
    overflow: hidden;
}

.confetti-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    animation: confettiFall linear infinite;
}

@keyframes confettiFall {
    0%   { transform: translateY(-10px) rotate(0deg);   opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.cake-icon {
    font-size: 72px;
    z-index: 1;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-12px); }
}

.birthday-title {
    font-size: clamp(24px, 7vw, 40px);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.2);
    margin: 0.75rem 0 0.4rem;
    z-index: 1;
    line-height: 1.2;
}

.birthday-subtitle {
    font-size: clamp(13px, 3.5vw, 18px);
    color: rgba(255,255,255,0.85);
    margin-bottom: 1.5rem;
    z-index: 1;
    padding: 0 0.5rem;
}

.birthday-msg {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    width: 100%;
    max-width: 560px;
    font-size: clamp(13px, 3.5vw, 16px);
    line-height: 1.8;
    color: #fff;
    margin-bottom: 1.5rem;
    z-index: 1;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    max-height: 45svh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ───── Music toggle ───── */
.music-note {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom));
    right: 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    touch-action: manipulation;
    /* Keeps it above iPhone home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}