/* ══════════════════════════════════════════════
   DESIGN SYSTEM — Two Months of Us
   Fonts: Fraunces, Quicksand, Caveat
   Palette: Pink, Cream, Lavender (from v1 & v2)
══════════════════════════════════════════════ */
:root {
    --pink-soft:    #ffeef4;
    --pink-mid:     #f5c6d6;
    --pink-deep:    #ca789b;
    --pink-dark:    #b15e8a;
    --peach:        #fce4d6;
    --cream:        #fffef7;
    --lavender:     #e8daf7;
    --lavender-deep:#c4a6e3;
    --text-dark:    #2c2b3a;
    --text-mid:     #5e4b5a;
    --text-light:   #a0697e;
    --bg:           linear-gradient(145deg, #f9f3e6 0%, #ffe6f0 50%, #f0e0f8 100%);
    --glass-bg:     rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.85);
    --glass-shadow: 0 12px 40px rgba(202, 120, 155, 0.18);
}

/* ══════ AUDIO SECTION ══════ */
.audio-section {
    width: 100%;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(245,198,214,0.4);
    border-radius: 20px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: auto;
}

.audio-song-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.audio-vinyl-mini {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: radial-gradient(circle, #2c2b3a 35%, #1a1a2e 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(44,43,58,0.25);
}
.audio-vinyl-mini.spinning {
    animation: vinylSpin 3s linear infinite;
}

.audio-meta {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
}
.audio-song-title {
    font-family: 'Fraunces', serif;
    font-size: 0.95rem; color: var(--text-dark);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.audio-song-artist {
    font-size: 0.7rem; color: var(--text-light);
    font-style: italic;
}

.audio-mute-btn {
    background: none; border: none;
    font-size: 1.1rem; cursor: pointer;
    opacity: 0.6; transition: opacity 0.2s;
    padding: 0.2rem;
}
.audio-mute-btn:hover { opacity: 1; }

/* Seek bar */
.audio-seek-wrap {
    display: flex; align-items: center; gap: 0.5rem;
}
.audio-time {
    font-size: 0.65rem; color: var(--text-light);
    font-variant-numeric: tabular-nums;
    min-width: 30px; font-weight: 600;
}

/* Custom range sliders */
.audio-seek, .audio-vol {
    -webkit-appearance: none; appearance: none;
    height: 5px; border-radius: 5px; outline: none;
    cursor: pointer;
    background: linear-gradient(to right, var(--pink-deep) 0%, var(--pink-mid) 0%, rgba(202,120,155,0.2) 0%);
    transition: background 0.1s;
}
.audio-seek { flex: 1; }
.audio-seek::-webkit-slider-thumb, .audio-vol::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--pink-deep);
    box-shadow: 0 2px 8px rgba(202,120,155,0.4);
    cursor: pointer;
    transition: transform 0.2s;
}
.audio-seek::-webkit-slider-thumb:hover,
.audio-vol::-webkit-slider-thumb:hover { transform: scale(1.3); }

/* Volume */
.audio-vol-wrap {
    display: flex; align-items: center; gap: 0.5rem;
}
.audio-vol-icon { font-size: 0.9rem; }
.audio-vol { flex: 1; }

/* Play Song Button */
.audio-play-btn {
    width: 100%; padding: 0.7rem;
    background: linear-gradient(135deg, #2c2b3a, #3a2c3a);
    color: rgba(255,255,255,0.9);
    border: none; border-radius: 12px;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem; font-weight: 700;
    cursor: pointer; letter-spacing: 0.5px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(44,43,58,0.2);
    display: flex; align-items: center;
    justify-content: center; gap: 0.5rem;
}
.audio-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(44,43,58,0.3);
}
.audio-play-btn.playing {
    background: linear-gradient(135deg, var(--pink-deep), var(--pink-dark));
    box-shadow: 0 4px 20px rgba(202,120,155,0.4);
}

/* ══════ FLOATING AUDIO PILL (Story Mode) ══════ */
.audio-pill {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(44, 43, 58, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50px;
    padding: 0.6rem 1.2rem;
    display: flex; align-items: center; gap: 0.6rem;
    cursor: pointer; z-index: 35;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    opacity: 0;
    min-width: 160px;
}
.audio-pill.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.audio-pill-icon { font-size: 0.8rem; color: var(--pink-mid); }
.audio-pill-text {
    font-size: 0.75rem; color: rgba(255,255,255,0.8);
    font-family: 'Quicksand', sans-serif; font-weight: 600;
    white-space: nowrap;
}
.audio-pill-bar {
    flex: 1; height: 3px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px; overflow: hidden;
    min-width: 40px;
}
.audio-pill-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--pink-mid), var(--lavender-deep));
    border-radius: 3px; transition: width 0.5s linear;
}


*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    overflow-x: clip;
    font-family: 'Quicksand', sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    -webkit-tap-highlight-color: transparent;
}

.cursive { font-family: 'Caveat', cursive; }

/* ══════ AMBIENT ══════ */
#particles-canvas {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0;
}
#floating-hearts {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0;
    overflow: hidden;
}
.float-heart {
    position: absolute; bottom: -20px;
    font-size: 1rem; opacity: 0;
    animation: floatUp linear infinite;
}
@keyframes floatUp {
    0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
    10%  { opacity: 0.7; }
    90%  { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(-100vh) rotate(360deg); }
}
.sparkle {
    position: fixed; pointer-events: none;
    font-size: 13px; z-index: 9999;
    animation: sparkleFade 0.8s ease-out forwards;
}
@keyframes sparkleFade {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-22px) scale(0); }
}

/* ══════ PHASE 0.5: MEMORY MOMENT ══════ */
.memory-stars {
    position: absolute; inset: 0;
    pointer-events: none; overflow: hidden;
}
.memory-star {
    position: absolute;
    background: white; border-radius: 50%;
    animation: twinkle ease-in-out infinite alternate;
}
@keyframes twinkle {
    from { opacity: 0.1; transform: scale(0.8); }
    to   { opacity: 0.9; transform: scale(1.2); }
}

.memory-inner {
    position: relative; z-index: 2;
    display: flex; flex-direction: column;
    align-items: center; text-align: center;
    gap: 1.4rem;
    padding: clamp(2rem, 8vw, 4rem) clamp(1.5rem, 6vw, 3rem);
    max-width: 480px; width: 100%;
}

.memory-pill {
    font-size: 0.68rem; letter-spacing: 2.5px;
    text-transform: uppercase; font-weight: 700;
    color: #f5c6d6;
    background: rgba(245, 198, 214, 0.15);
    border: 1px solid rgba(245, 198, 214, 0.35);
    padding: 0.4rem 1.2rem; border-radius: 50px;
}

.memory-date-block {
    display: flex; flex-direction: column;
    align-items: center; gap: 0.2rem;
}
.memory-date-day {
    font-family: 'Fraunces', serif;
    font-size: clamp(3.5rem, 12vw, 5.5rem);
    font-weight: 300; color: white; line-height: 1;
    animation: fadeSlideUp 0.8s ease forwards;
}
.memory-date-year {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem; color: rgba(255,255,255,0.6);
    letter-spacing: 4px; font-weight: 600;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.memory-text-block {
    display: flex; flex-direction: column; gap: 0.5rem;
}
.memory-line {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    color: rgba(255,255,255,0.75); line-height: 1.3;
    opacity: 0; transform: translateY(12px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.memory-line.visible {
    opacity: 1; transform: translateY(0);
}
.memory-line:nth-child(3) {
    color: var(--pink-mid); font-weight: 600;
}

.memory-divider {
    width: 60px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245,198,214,0.6), transparent);
}

.memory-stats-row {
    display: flex; align-items: center;
    gap: 1.2rem; flex-wrap: wrap; justify-content: center;
}
.memory-stat {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.memory-stat-val {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.4rem, 5vw, 2rem);
    color: white; font-weight: 300; line-height: 1;
}
.memory-stat-lbl {
    font-size: 0.62rem; text-transform: uppercase;
    letter-spacing: 1.5px; color: rgba(255,255,255,0.6);
    font-weight: 700;
}
.memory-stat-dot {
    font-size: 1.5rem; color: rgba(255,255,255,0.35);
    line-height: 1;
}

.memory-final {
    font-size: clamp(1.4rem, 4.5vw, 2rem);
    color: #d4b8f0;
    opacity: 0; animation: fadeSlideUp 0.8s ease 2.5s forwards;
}

.memory-continue-btn {
    display: inline-flex; align-items: center; gap: 0.6rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    border-radius: 50px; padding: 0.9rem 2rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.95rem; font-weight: 700;
    cursor: pointer; letter-spacing: 0.5px;
    transition: background 0.3s, transform 0.2s, border-color 0.3s;
    opacity: 0; animation: fadeSlideUp 0.8s ease 3.2s forwards;
    backdrop-filter: blur(10px);
}
.memory-continue-btn:hover {
    background: rgba(245,198,214,0.15);
    border-color: rgba(245,198,214,0.3);
    transform: translateY(-2px);
}
.memory-btn-arrow {
    display: inline-block;
    transition: transform 0.2s;
}
.memory-continue-btn:hover .memory-btn-arrow {
    transform: translateX(4px);
}

/* ══════ PHASES ══════ */

/* Phase-specific backgrounds — defined in CSS so JS style.cssText reset can't wipe them */
#phase-opening {
    background: linear-gradient(145deg, #f9f3e6 0%, #ffe6f0 50%, #f0e0f8 100%);
}
#phase-memory {
    background: linear-gradient(145deg, #1a1228 0%, #2a1a2e 50%, #1a2030 100%);
    flex-direction: column;
    overflow: hidden;
}

.phase {
    position: fixed; inset: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
}
.phase.hidden { display: none; pointer-events: none; }
.phase.active { display: flex; animation: fadeIn 0.6s ease forwards; }
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ══════ SHARED ══════ */
.pill-badge {
    display: inline-block;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    padding: 0.4rem 1.2rem;
    border-radius: 60px;
    font-size: 0.72rem; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--pink-dark);
    border: 1px solid rgba(255, 192, 203, 0.5);
    margin-bottom: 1rem;
}
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: var(--glass-shadow);
}

/* ══════ PHASE 0: OPENING ══════ */
.opening-inner {
    text-align: center;
    padding: 2rem 1.5rem;
    z-index: 11;
    max-width: 480px; width: 100%;
}
.album-title-big {
    font-family: 'Fraunces', serif;
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 400;
    color: var(--text-dark);
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}
.album-subtitle {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    color: var(--pink-dark);
    margin-bottom: 2.5rem;
}

/* Vinyl */
.vinyl-wrapper {
    width: clamp(180px, 45vw, 220px);
    margin: 0 auto 2.5rem;
    position: relative;
    cursor: pointer;
}
.vinyl-record {
    width: 100%; aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #2c2b3a 30%, #1a1a2e 60%, #2c2b3a 100%);
    box-shadow: 0 20px 50px rgba(44,43,58,0.35), 0 0 0 3px rgba(255,255,255,0.05);
    position: relative;
    animation: vinylSpin 4s linear infinite;
    transform-origin: center;
}
.vinyl-record:hover { animation-play-state: paused; }
@keyframes vinylSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.vinyl-grooves {
    position: absolute; inset: 10%;
    border-radius: 50%;
    background: repeating-radial-gradient(circle at 50%,
        rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 1px,
        transparent 1px, transparent 6px);
}
.vinyl-label {
    position: absolute;
    inset: 28%; border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-soft), var(--lavender));
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px; z-index: 2;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
}
.vinyl-label-title {
    font-family: 'Fraunces', serif;
    font-size: 0.5rem; font-weight: 500;
    color: var(--text-dark); letter-spacing: 0.5px;
    text-align: center;
}
.vinyl-label-sub {
    font-family: 'Caveat', cursive;
    font-size: 0.7rem; color: var(--pink-deep);
}
.vinyl-hole {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--bg); margin-top: 4px;
}
.vinyl-reflection {
    position: absolute; top: 10%; left: 15%;
    width: 25%; height: 45%;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
    border-radius: 50%; transform: rotate(-30deg);
    pointer-events: none;
}

/* Play Button */
.play-btn {
    display: inline-flex; align-items: center; gap: 0.6rem;
    background: linear-gradient(135deg, var(--pink-mid), var(--pink-deep));
    color: white; border: none; border-radius: 60px;
    padding: 0.9rem 2.2rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem; font-weight: 700;
    cursor: pointer; letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(202, 120, 155, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
.play-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(202,120,155,0.5); }
.play-btn:active { transform: translateY(-1px); }
.play-icon { font-size: 1.1rem; }
.opening-hint {
    margin-top: 1.2rem;
    font-size: 0.75rem; color: var(--text-light);
    letter-spacing: 1px; font-family: 'Caveat', cursive;
    font-size: 1rem;
}

/* ══════ PHASE 1: PLAYER LAYOUT ══════ */
.player-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    width: 100%; max-width: 1100px;
    height: 100vh; max-height: 780px;
    padding: 1.5rem;
    z-index: 11;
    align-items: stretch;
}

/* Player Card (left) */
.player-card {
    display: flex; flex-direction: column;
    align-items: center; gap: 1.2rem;
    padding: 2rem 1.8rem;
    height: 100%;
}

/* Album Art */
.album-art-wrap { width: 100%; }
.album-art {
    width: 100%; aspect-ratio: 1;
    border-radius: 22px;
    background: linear-gradient(135deg, #2c2b3a 0%, #1a1a2e 50%, #3a2c3a 100%);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    box-shadow: 0 15px 40px rgba(44,43,58,0.3);
}
.waveform-container {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: 0.4;
}
.waveform {
    display: flex; align-items: center; gap: 3px;
    height: 60%;
}
.waveform-bar {
    width: 4px; border-radius: 4px;
    background: linear-gradient(to top, var(--pink-deep), var(--lavender-deep));
    animation: waveAnim 1.2s ease-in-out infinite alternate;
}
@keyframes waveAnim {
    from { transform: scaleY(0.3); }
    to   { transform: scaleY(1); }
}
.album-art-text {
    z-index: 2; text-align: center;
}
.art-title {
    display: block;
    font-family: 'Fraunces', serif;
    font-size: 1.6rem; font-weight: 400;
    color: rgba(255,255,255,0.92);
}
.art-sub {
    display: block;
    font-family: 'Caveat', cursive;
    font-size: 1.2rem; color: var(--pink-mid);
}

/* Now Playing Info */
.now-playing-info { text-align: center; width: 100%; }
.now-playing-label {
    font-size: 0.65rem; letter-spacing: 2px;
    text-transform: uppercase; color: var(--text-light);
    font-weight: 700; margin-bottom: 0.3rem;
}
.now-playing-title {
    font-family: 'Fraunces', serif;
    font-size: 1.4rem; font-weight: 400;
    color: var(--text-dark); margin-bottom: 0.3rem;
}
.now-playing-artist { font-size: 1rem; color: var(--pink-deep); }

/* Progress bar */
.player-progress-wrap { width: 100%; }
.progress-track {
    width: 100%; height: 6px;
    background: rgba(202,120,155,0.15);
    border-radius: 6px; overflow: hidden; margin-bottom: 0.5rem;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--pink-mid), var(--pink-deep));
    border-radius: 6px;
    transition: width 0.3s ease;
}
.progress-times {
    display: flex; justify-content: space-between;
    font-size: 0.7rem; color: var(--text-light);
    font-weight: 600; letter-spacing: 0.5px;
}

/* Controls */
.player-controls {
    display: flex; align-items: center; justify-content: center;
    gap: 1.5rem;
}
.ctrl-btn {
    background: rgba(255,255,255,0.6); border: none;
    border-radius: 50%; cursor: pointer;
    font-size: 1rem; color: var(--text-dark);
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.ctrl-btn:hover { background: white; transform: scale(1.08); }
.ctrl-main {
    width: 64px; height: 64px; font-size: 1.3rem;
    background: linear-gradient(135deg, var(--pink-mid), var(--pink-deep));
    color: white;
    box-shadow: 0 8px 25px rgba(202,120,155,0.4);
}
.ctrl-main:hover { background: linear-gradient(135deg, var(--pink-deep), var(--pink-dark)); transform: scale(1.08); }

/* Tracklist (right) */
.tracklist-card {
    display: flex; flex-direction: column;
    padding: 1.8rem;
    overflow: hidden; height: 100%;
}
.tracklist-header { margin-bottom: 1.2rem; }
.tracklist-title {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem; font-weight: 400;
    color: var(--text-dark);
}
.tracklist-sub { font-size: 1.1rem; color: var(--pink-deep); }
.tracklist {
    list-style: none;
    display: flex; flex-direction: column; gap: 0.5rem;
    overflow-y: auto; flex: 1;
    padding-right: 4px;
}
.tracklist::-webkit-scrollbar { width: 5px; }
.tracklist::-webkit-scrollbar-thumb {
    background: var(--pink-mid); border-radius: 10px;
}
.track-item {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    align-items: center; gap: 1rem;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    border: 1px solid transparent;
}
.track-item:hover {
    background: rgba(255,255,255,0.7);
    border-color: rgba(245, 198, 214, 0.4);
    transform: translateX(4px);
}
.track-item.active {
    background: linear-gradient(135deg, rgba(245,198,214,0.35), rgba(232,218,247,0.35));
    border-color: var(--pink-mid);
}
.track-item.active .track-name { color: var(--pink-dark); font-weight: 700; }
.track-num {
    font-family: 'Fraunces', serif;
    font-size: 1rem; color: var(--text-light); font-weight: 400;
}
.track-item.active .track-num { color: var(--pink-deep); }
.track-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.track-name {
    font-size: 0.95rem; font-weight: 700;
    color: var(--text-dark); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.track-desc {
    font-size: 0.72rem; color: var(--text-light);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-duration {
    font-size: 0.8rem; color: var(--text-light);
    font-variant-numeric: tabular-nums;
}
.track-play-btn {
    font-size: 0.75rem; color: var(--pink-deep);
    opacity: 0; transition: opacity 0.2s;
    width: 28px; text-align: center;
}
.track-item:hover .track-play-btn { opacity: 1; }

/* ══════ PHASE 2: STORY MODE ══════ */
#phase-story {
    flex-direction: column;
    background: #1a1a2e;
    z-index: 20;
}

/* Story Progress Bars */
.story-progress-container {
    position: absolute; top: 16px; left: 16px; right: 16px;
    display: flex; gap: 6px; z-index: 30;
}
.story-prog-bar {
    flex: 1; height: 3px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px; overflow: hidden;
}
.story-prog-fill {
    height: 100%; width: 0%;
    background: white; border-radius: 3px;
    transition: width linear;
}
.story-prog-fill.done { width: 100%; transition: none; }

/* Back button */
.story-back-btn {
    position: absolute; top: 40px; right: 16px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
    border-radius: 30px; padding: 0.4rem 1rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.75rem; font-weight: 600;
    cursor: pointer; z-index: 30;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}
.story-back-btn:hover { background: rgba(255,255,255,0.25); }

.story-track-label {
    position: absolute; top: 36px; left: 16px;
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    color: rgba(255,255,255,0.6); z-index: 30;
    font-family: 'Quicksand', sans-serif;
}

/* Slides */
.story-slides {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
.story-slide {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: clamp(2rem, 8vw, 5rem) clamp(1.5rem, 6vw, 4rem);
    text-align: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.5s ease;
}
.story-slide.active {
    opacity: 1; pointer-events: auto;
}

/* Story slide themes */
.slide-theme-dark  { background: linear-gradient(145deg, #1a1a2e, #2c1a3a); }
.slide-theme-pink  { background: linear-gradient(145deg, #3a1a2a, #2a1a3a); }
.slide-theme-light { background: linear-gradient(145deg, #2c2240, #1a2040); }
.slide-theme-warm  { background: linear-gradient(145deg, #2a1818, #3a1a2a); }
.slide-theme-final { background: linear-gradient(145deg, #1a2a1a, #2a2040); }

/* Story Text Styles */
.story-eyebrow {
    font-size: 0.7rem; letter-spacing: 3px;
    text-transform: uppercase; font-weight: 700;
    color: var(--pink-mid); margin-bottom: 1.5rem;
    font-family: 'Quicksand', sans-serif;
}
.story-big-number {
    font-family: 'Fraunces', serif;
    font-size: clamp(3.5rem, 14vw, 7rem);
    font-weight: 300; color: white;
    line-height: 1; margin-bottom: 0.5rem;
    animation: countUp 0.8s ease-out;
}
@keyframes countUp {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.story-heading {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.8rem, 6vw, 3.5rem);
    font-weight: 300; color: white;
    line-height: 1.2; margin-bottom: 1rem;
}
.story-heading em { font-style: italic; color: var(--pink-mid); }
.story-body {
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    color: rgba(255,255,255,0.65); line-height: 1.7;
    max-width: 480px; font-family: 'Quicksand', sans-serif;
    font-weight: 500;
}
.story-cursive {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.6rem, 5vw, 2.8rem);
    color: var(--lavender-deep); margin-top: 1.2rem;
    display: block;
}
.story-quote {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.3rem, 4vw, 2rem);
    color: var(--pink-mid); font-style: italic;
    line-height: 1.4; margin: 1rem 0;
    padding: 1.2rem 1.5rem;
    border-left: 3px solid var(--pink-deep);
    text-align: left;
    background: rgba(255,255,255,0.04);
    border-radius: 0 12px 12px 0;
    max-width: 420px;
}

/* Chat Bubbles in story */
.story-chat-wrap {
    display: flex; flex-direction: column; gap: 0.7rem;
    width: 100%; max-width: 340px; margin-top: 1rem;
}
.story-bubble {
    padding: 0.7rem 1.1rem;
    border-radius: 18px; font-size: 0.9rem;
    line-height: 1.5; color: white;
    max-width: 90%; text-align: left;
    opacity: 0; transform: translateY(10px);
    animation: bubblePop 0.4s ease forwards;
}
.story-bubble.me {
    background: rgba(59, 74, 107, 0.7);
    align-self: flex-end; border-bottom-right-radius: 5px;
}
.story-bubble.her {
    background: linear-gradient(135deg, rgba(202,120,155,0.5), rgba(196,166,227,0.4));
    align-self: flex-start; border-bottom-left-radius: 5px;
}
@keyframes bubblePop {
    to { opacity: 1; transform: translateY(0); }
}

/* Stat Chips */
.story-stats-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.8rem; margin-top: 1.5rem; width: 100%; max-width: 380px;
}
.story-stat-chip {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px; padding: 1rem;
    text-align: center;
}
.story-stat-chip-val {
    font-family: 'Fraunces', serif;
    font-size: 1.8rem; color: white; font-weight: 400;
    display: block; margin-bottom: 0.2rem;
}
.story-stat-chip-label {
    font-size: 0.65rem; color: rgba(255,255,255,0.5);
    text-transform: uppercase; letter-spacing: 1px;
    font-weight: 700;
}

/* Timer in story */
.story-timer-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem; margin-top: 1.5rem; width: 100%; max-width: 400px;
}
.story-timer-chip {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px; padding: 1rem 0.5rem; text-align: center;
}
.story-timer-chip .val {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.5rem, 5vw, 2.2rem); color: white; font-weight: 400;
    display: block; margin-bottom: 0.2rem;
}
.story-timer-chip .lbl {
    font-size: 0.6rem; color: rgba(255,255,255,0.45);
    text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}

/* Tap zones */
.story-tap-prev, .story-tap-next {
    position: absolute; top: 0; bottom: 0;
    width: 40%; z-index: 25; cursor: pointer;
}
.story-tap-prev { left: 0; }
.story-tap-next { right: 0; }

/* Confetti */
.confetti-piece {
    position: fixed; top: -10px;
    width: 10px; height: 14px;
    border-radius: 3px;
    pointer-events: none; z-index: 999;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ══════ RESPONSIVE: TABLET & MOBILE ══════ */
@media (max-width: 900px) {

    /* ---- Core fix: pull player phase OUT of fixed positioning when active ---- */
    /* Handled via JS inline styles in showPhase() — CSS only sets fallback layout */
    #phase-player {
        min-height: 100dvh;
    }
    body:has(#phase-player.active),
    html:has(#phase-player.active) {
        overflow-y: auto;
        height: auto;
    }

    /* ---- Player Layout ---- */
    .player-layout {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        padding-bottom: 2.5rem;
        width: 100%;
        height: auto;
        max-height: none;
    }

    /* ---- Player Card ---- */
    .player-card {
        padding: 1.2rem;
        gap: 0.75rem;
        flex-direction: column;
        align-items: center;
    }

    /* ---- Album Art: much smaller so controls are visible ---- */
    .album-art-wrap {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    .album-art {
        width: 140px !important;
        height: 140px !important;
        aspect-ratio: unset;
        max-width: 140px;
        border-radius: 16px;
    }
    .art-title { font-size: 1rem; }
    .art-sub { font-size: 0.85rem; }
    .waveform-bar { width: 3px; }

    /* ---- Info & Controls ---- */
    .now-playing-info { text-align: center; }
    .now-playing-title { font-size: 1.1rem; }
    .now-playing-artist { font-size: 0.85rem; }
    .ctrl-btn { width: 38px; height: 38px; }
    .ctrl-main { width: 52px; height: 52px; font-size: 1.1rem; }

    /* ---- Tracklist: no inner scroll, show everything ---- */
    .tracklist-card {
        max-height: none;
        padding: 1.2rem;
    }
    .tracklist {
        overflow-y: visible;
        max-height: none;
    }
    .track-item {
        padding: 0.75rem 0.8rem;
        gap: 0.7rem;
    }

    /* ---- Audio Section ---- */
    .audio-section { margin-top: 0; }
}

@media (max-width: 480px) {
    .player-layout { padding: 0.75rem; padding-bottom: 2rem; }
    .story-stats-grid { grid-template-columns: 1fr 1fr; }
    .story-timer-grid { grid-template-columns: repeat(3, 1fr); }
    .story-back-btn { top: 38px; right: 12px; padding: 0.35rem 0.75rem; }
    .story-track-label { top: 34px; left: 12px; }
}
