/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: 'Lora', serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 50%, #0a0a1a 100%);
    color: #fff;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ===== STARFIELD ===== */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* ===== COUNTDOWN OVERLAY ===== */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    background: rgba(10, 10, 26, 0.92);
    transition: opacity 1s ease, visibility 1s ease;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.countdown-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.countdown-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.countdown-year {
    font-family: 'Playfair Display', serif;
    font-size: 4.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffd700, #ff6b6b, #ffd700);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
    margin-bottom: 35px;
}

@keyframes shimmer {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.countdown-timer {
    display: flex;
    gap: 16px;
    margin-bottom: 35px;
}

.countdown-unit {
    text-align: center;
    min-width: 80px;
}

.countdown-value {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    line-height: 1;
}

.countdown-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.countdown-sep {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: rgba(255, 215, 0, 0.4);
    margin-top: 5px;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.2;
    }
}

.countdown-msg {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    max-width: 450px;
    line-height: 1.8;
    padding: 0 20px;
}

.countdown-msg .hl {
    color: #ffd700;
    font-weight: 600;
}

.start-btn {
    margin-top: 35px;
    padding: 14px 36px;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    border: none;
    border-radius: 50px;
    color: #1a0a2e;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.3);
    letter-spacing: 1px;
    transition: all 0.3s ease;
    min-height: 48px;
    /* iOS recommended touch target */
    -webkit-appearance: none;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(255, 215, 0, 0.5);
}

.start-btn:active {
    transform: scale(0.97);
}

/* ===== SOLAR SYSTEM ===== */
.solar-system {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    transition: opacity 0.5s ease;
}

.sun {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #fff5c0 0%, #ffd700 30%, #ff8c00 60%, #ff4500 100%);
    border-radius: 50%;
    z-index: 100;
    box-shadow: 0 0 40px rgba(255, 200, 50, 0.9), 0 0 80px rgba(255, 150, 50, 0.6), 0 0 120px rgba(255, 100, 50, 0.4), 0 0 200px rgba(255, 80, 30, 0.2);
    animation: sunPulse 4s ease-in-out infinite;
}

@keyframes sunPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
}

.sun::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(circle, rgba(255, 150, 50, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: corona 3s ease-in-out infinite;
}

@keyframes corona {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.orbit-path {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.orbit-path.earth-orbit {
    border: 2px solid rgba(100, 180, 255, 0.4);
    box-shadow: 0 0 10px rgba(100, 180, 255, 0.2);
}

.planet-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    pointer-events: none;
}

.planet {
    position: absolute;
    border-radius: 50%;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    overflow: hidden;
}

@keyframes orbit {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.earth-orbit-container {
    animation: orbit var(--earth-orbit-duration) linear forwards !important;
}

/* Planets */
.mercury {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 30% 30%, #d0d0d0 0%, #a0a0a0 40%, #606060 80%, #404040 100%);
    box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.4), 0 0 6px rgba(180, 180, 180, 0.4);
}

.venus {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 30% 30%, #fff5d4 0%, #f0d890 25%, #daa520 50%, #b8860b 80%, #8b6914 100%);
    box-shadow: inset -3px -3px 6px rgba(0, 0, 0, 0.3), 0 0 12px rgba(255, 215, 100, 0.5);
}

.earth {
    width: 18px;
    height: 18px;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.5) 0%, transparent 40%), radial-gradient(ellipse at 45% 40%, rgba(34, 139, 34, 0.8) 0%, transparent 25%), radial-gradient(circle at 35% 30%, #87ceeb 0%, #4a90d9 30%, #2e5cb8 60%, #1a3a7a 90%);
    box-shadow: inset -3px -3px 8px rgba(0, 0, 0, 0.4), 0 0 15px rgba(100, 150, 255, 0.9), 0 0 30px rgba(100, 150, 255, 0.6), 0 0 50px rgba(100, 150, 255, 0.3);
    animation: earthGlow 2s ease-in-out infinite;
}

@keyframes earthGlow {

    0%,
    100% {
        box-shadow: inset -3px -3px 8px rgba(0, 0, 0, 0.4), 0 0 15px rgba(100, 150, 255, 0.9), 0 0 30px rgba(100, 150, 255, 0.6);
    }

    50% {
        box-shadow: inset -3px -3px 8px rgba(0, 0, 0, 0.4), 0 0 20px rgba(100, 150, 255, 1), 0 0 40px rgba(100, 150, 255, 0.8);
    }
}

.mars {
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 30% 30%, #ffb088 0%, #cd5c5c 35%, #a52a2a 60%, #6b1a1a 90%);
    box-shadow: inset -2px -2px 5px rgba(0, 0, 0, 0.4), 0 0 10px rgba(205, 92, 92, 0.5);
}

.jupiter {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.3) 0%, transparent 40%), repeating-linear-gradient(180deg, #e8d5b5 0%, #d4a574 4%, #c19660 8%, #b8956a 12%, #a67c52 16%, #d4a574 20%);
    border-radius: 50%;
    box-shadow: inset -5px -5px 15px rgba(0, 0, 0, 0.4), 0 0 20px rgba(212, 165, 116, 0.6);
}

.saturn {
    width: 32px;
    height: 32px;
    background: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.3) 0%, transparent 40%), repeating-linear-gradient(180deg, #f7e8c8 0%, #e8d4a8 8%, #d9c088 16%, #cdb07a 24%);
    border-radius: 50%;
    box-shadow: inset -4px -4px 12px rgba(0, 0, 0, 0.35), 0 0 15px rgba(240, 218, 176, 0.5);
}

.saturn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 16px;
    background: linear-gradient(to right, transparent 0%, rgba(210, 190, 150, 0.6) 25%, rgba(200, 180, 140, 0.5) 68%, transparent 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotateX(70deg);
}

.uranus {
    width: 22px;
    height: 22px;
    background: radial-gradient(circle at 35% 35%, #c8ffff 0%, #7dd4d4 30%, #5ab8b8 55%, #3a9090 80%);
    border-radius: 50%;
    box-shadow: inset -3px -3px 8px rgba(0, 0, 0, 0.3), 0 0 12px rgba(125, 212, 212, 0.6);
}

.neptune {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 35% 35%, #6495ed 0%, #4169e1 30%, #2850a8 55%, #1a3c80 80%);
    border-radius: 50%;
    box-shadow: inset -3px -3px 8px rgba(0, 0, 0, 0.4), 0 0 12px rgba(65, 105, 225, 0.7);
}

/* ===== PROGRESS ===== */
.orbit-progress {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.orbit-progress.hidden {
    opacity: 0;
    pointer-events: none;
}

.progress-label {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.progress-count {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 600;
    background: linear-gradient(135deg, #ffd700, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-days {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}

.earth-label {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    z-index: 10;
    transition: opacity 0.5s ease;
    width: 90%;
    text-align: center;
}

.earth-label.hidden {
    opacity: 0;
}

/* ===== CELEBRATION ===== */
.celebration {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease;
    width: 90%;
}

.celebration.visible {
    opacity: 1;
}

.celebration h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    margin-bottom: 10px;
}

.celebration p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
}

/* ===== LETTER ===== */
.letter-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    perspective: 1500px;
}

.letter-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.letter {
    position: relative;
    width: 90%;
    max-width: 650px;
    height: 80vh;
    max-height: 700px;
    background: linear-gradient(145deg, #fffef5 0%, #f5f0e0 100%);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(139, 119, 101, 0.2), inset 0 0 100px rgba(139, 119, 101, 0.05);
    transform: translateY(-100vh) rotate(-5deg);
    transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.letter-container.visible .letter {
    transform: translateY(0) rotate(0deg);
}

.letter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: 8px;
}

.letter-header {
    padding: 20px 40px;
    border-bottom: 1px solid rgba(139, 119, 101, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.letter-date {
    font-size: 0.9rem;
    color: #8b7765;
}

.letter-close {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #8b7765;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
}

.letter-close:hover {
    color: #5a4a3a;
}

.letter-pages {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.letter-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 30px 40px 40px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: all 0.5s ease;
    overflow-y: auto;
    pointer-events: none;
    -webkit-overflow-scrolling: touch;
}

.letter-page.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

.letter-page.exit-left {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    pointer-events: none;
}

.page-greeting {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #3a3025;
    margin-bottom: 25px;
}

.page-content {
    font-size: 1.1rem;
    line-height: 1.9;
    color: #4a4035;
}

.page-content p {
    margin-bottom: 1.2em;
}

.page-signature {
    margin-top: 30px;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.3rem;
    color: #5a4a3a;
    white-space: pre-line;
}

.letter-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to top, rgba(245, 240, 224, 1) 0%, rgba(245, 240, 224, 0) 100%);
}

.nav-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #c9a050 0%, #8b7040 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-family: 'Lora', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    min-height: 44px;
    -webkit-appearance: none;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.page-indicator {
    font-size: 0.9rem;
    color: #8b7765;
}

/* ===== SKIP & PARTICLES ===== */
.skip-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 25px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Lora', serif;
    font-size: 0.95rem;
    cursor: pointer;
    z-index: 50;
    transition: all 0.3s ease;
    min-height: 44px;
    -webkit-appearance: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.skip-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.skip-btn:active {
    transform: scale(0.95);
}

.skip-btn.hidden {
    display: none;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: float-up 3s ease-out forwards;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(0.5);
    }
}

/* Fireworks canvas */
.fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
}

/* ============================================
   RESPONSIVE — iPhone Optimized
   ============================================ */

/* Tablets & small laptops */
@media (max-width: 768px) {
    .sun {
        width: 50px;
        height: 50px;
    }

    .sun::before {
        top: -12px;
        left: -12px;
        right: -12px;
        bottom: -12px;
    }

    .planet {
        transform: translateX(-50%) translateY(-50%) scale(0.7);
    }

    .progress-count {
        font-size: 2.5rem;
    }

    .letter {
        height: 85vh;
        max-height: none;
    }

    .letter-header {
        padding: 15px 20px;
    }

    .letter-page {
        padding: 20px 20px 30px 20px;
    }

    .page-greeting {
        font-size: 1.5rem;
        margin-bottom: 18px;
    }

    .page-content {
        font-size: 1rem;
        line-height: 1.8;
    }

    .page-signature {
        font-size: 1.15rem;
    }

    .countdown-year {
        font-size: 3rem;
        margin-bottom: 25px;
    }

    .countdown-value {
        font-size: 2.2rem;
    }

    .countdown-unit {
        min-width: 60px;
    }

    .countdown-timer {
        gap: 10px;
    }

    .countdown-title {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }

    .earth-label {
        font-size: 1.2rem;
        padding: 0 15px;
        top: calc(20px + env(safe-area-inset-top));
    }

    .celebration h1 {
        font-size: 2rem;
    }

    .celebration p {
        font-size: 1rem;
        padding: 0 10px;
    }

    .orbit-progress {
        bottom: calc(40px + env(safe-area-inset-bottom));
    }

    .skip-btn {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right: calc(20px + env(safe-area-inset-right));
    }
}

/* iPhone Pro Max / Plus (430px) */
@media (max-width: 430px) {
    .solar-system {
        transform: translate(-50%, -50%) scale(0.55);
    }

    .countdown-year {
        font-size: 2.6rem;
        margin-bottom: 20px;
    }

    .countdown-value {
        font-size: 2rem;
    }

    .countdown-sep {
        font-size: 1.8rem;
    }

    .countdown-unit {
        min-width: 55px;
    }

    .countdown-timer {
        gap: 8px;
        margin-bottom: 25px;
    }

    .countdown-title {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .countdown-msg {
        font-size: 0.95rem;
        line-height: 1.7;
        padding: 0 16px;
    }

    .start-btn {
        font-size: 0.95rem;
        padding: 14px 32px;
    }

    .letter {
        width: 95%;
        height: 88vh;
        max-height: none;
        border-radius: 12px;
    }

    .letter-header {
        padding: 14px 18px;
    }

    .letter-page {
        padding: 18px 18px 28px 18px;
    }

    .page-greeting {
        font-size: 1.35rem;
        margin-bottom: 16px;
    }

    .page-content {
        font-size: 0.95rem;
        line-height: 1.75;
    }

    .page-signature {
        font-size: 1.05rem;
        margin-top: 20px;
    }

    .celebration h1 {
        font-size: 1.7rem;
        padding: 0 10px;
    }

    .celebration p {
        font-size: 0.9rem;
    }

    .progress-label {
        font-size: 1rem;
    }

    .progress-count {
        font-size: 2rem;
    }

    .progress-days {
        font-size: 0.85rem;
    }

    .nav-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
}

/* iPhone 15/14/13/12 (390px), iPhone 15 Pro (393px) */
@media (max-width: 393px) {
    .solar-system {
        transform: translate(-50%, -50%) scale(0.48);
    }

    .countdown-year {
        font-size: 2.3rem;
    }

    .countdown-value {
        font-size: 1.8rem;
    }

    .countdown-sep {
        font-size: 1.6rem;
    }

    .countdown-unit {
        min-width: 50px;
    }

    .countdown-timer {
        gap: 6px;
    }

    .countdown-msg {
        font-size: 0.9rem;
    }

    .letter {
        width: 96%;
        height: 90vh;
        max-height: none;
    }

    .letter-page {
        padding: 16px 16px 26px 16px;
    }

    .page-greeting {
        font-size: 1.25rem;
    }

    .page-content {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .page-signature {
        font-size: 1rem;
    }

    .earth-label {
        font-size: 1rem;
    }
}

/* iPhone SE / iPhone mini (375px) */
@media (max-width: 375px) {
    .solar-system {
        transform: translate(-50%, -50%) scale(0.42);
    }

    .countdown-year {
        font-size: 2rem;
        margin-bottom: 16px;
    }

    .countdown-value {
        font-size: 1.6rem;
    }

    .countdown-sep {
        font-size: 1.4rem;
    }

    .countdown-unit {
        min-width: 45px;
    }

    .countdown-timer {
        gap: 4px;
        margin-bottom: 20px;
    }

    .countdown-title {
        font-size: 0.9rem;
        letter-spacing: 1.5px;
    }

    .countdown-msg {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .start-btn {
        font-size: 0.9rem;
        padding: 12px 28px;
    }

    .letter {
        width: 97%;
        height: 92vh;
        max-height: none;
    }

    .letter-header {
        padding: 12px 14px;
    }

    .letter-page {
        padding: 14px 14px 24px 14px;
    }

    .page-greeting {
        font-size: 1.15rem;
        margin-bottom: 14px;
    }

    .page-content {
        font-size: 0.85rem;
        line-height: 1.65;
    }

    .page-signature {
        font-size: 0.95rem;
        margin-top: 16px;
    }

    .celebration h1 {
        font-size: 1.5rem;
    }

    .celebration p {
        font-size: 0.85rem;
    }

    .earth-label {
        font-size: 0.9rem;
    }
}

/* iPhone SE 1st gen / very small screens (320px) */
@media (max-width: 320px) {
    .solar-system {
        transform: translate(-50%, -50%) scale(0.35);
    }

    .countdown-year {
        font-size: 1.7rem;
    }

    .countdown-value {
        font-size: 1.4rem;
    }

    .countdown-unit {
        min-width: 40px;
    }

    .countdown-title {
        font-size: 0.8rem;
    }

    .countdown-msg {
        font-size: 0.8rem;
    }

    .start-btn {
        padding: 11px 24px;
        font-size: 0.85rem;
    }

    .celebration h1 {
        font-size: 1.3rem;
    }

    .page-greeting {
        font-size: 1.05rem;
    }

    .page-content {
        font-size: 0.82rem;
    }

}

/* ===== iPhone landscape mode ===== */
@media (max-height: 450px) and (orientation: landscape) {
    .countdown-year {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .countdown-timer {
        margin-bottom: 10px;
    }

    .countdown-value {
        font-size: 1.6rem;
    }

    .countdown-title {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }

    .countdown-msg {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .start-btn {
        margin-top: 12px;
        padding: 10px 24px;
    }

    .solar-system {
        transform: translate(-50%, -50%) scale(0.45);
    }

    .letter {
        height: 95vh;
        width: 80%;
    }

    .letter-page {
        padding: 10px 20px 40px 20px;
    }

    .page-greeting {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .page-content {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .celebration h1 {
        font-size: 1.5rem;
    }

    .celebration {
        top: 5%;
    }

    .earth-label {
        font-size: 0.9rem;
    }

    .orbit-progress {
        bottom: 15px;
    }
}

/* ===== iOS performance: prefer reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .star {
        animation: none;
        opacity: 0.6;
    }

    .sun {
        animation: none;
    }

    .sun::before {
        animation: none;
    }

    .earth {
        animation: none;
    }

    .countdown-sep {
        animation: none;
        opacity: 0.5;
    }

    .letter {
        transition-duration: 0.5s;
    }

    .particle {
        animation-duration: 1.5s;
    }
}