:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f29;
    --bg-tertiary: #232936;
    --bg-hover: #2a3441;
    --border-color: #394046;
    --border-accent: #9263e8;
    --text-primary: #ffffff;
    --text-secondary: #b8c5d6;
    --text-muted: #7d8590;
    --accent-purple: #8e5bea;
    --accent-light: #c9a4f1;
    --accent-orange: #f5a97f;
    --accent-red: #ed8796;
    --accent-mauve: #aa76e8;
    --success: #00d9a5;
    --warning: #f5a97f;
    --danger: #ed8796;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --border-radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========== SELECTION / LAUNCHER PAGE ========== */
.wrapped-launcher {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.wrapped-launcher::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(142, 91, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 217, 165, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(245, 169, 127, 0.08) 0%, transparent 50%);
    animation: launcherGlow 8s ease-in-out infinite alternate;
}

@keyframes launcherGlow {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
}

.launcher-content {
    position: relative;
    z-index: 1;
    max-width: 560px;
    width: 100%;
    text-align: center;
}

.launcher-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-light), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShimmer 3s ease-in-out infinite;
    background-size: 200% 200%;
}

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

.launcher-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

.launcher-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.launcher-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-light), var(--accent-mauve));
}

.launcher-field {
    margin-bottom: 1.5rem;
    text-align: left;
}

.launcher-field label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.user-search-container {
    position: relative;
}

.user-search-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.user-search-input:focus {
    border-color: var(--accent-purple);
}

.user-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.user-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--shadow-lg);
}

.user-search-dropdown.show { display: block; }

.user-search-option {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: background 0.15s;
    font-size: 0.9rem;
}

.user-search-option:hover { background: var(--bg-hover); }

.user-search-option img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-search-option .option-name {
    font-weight: 500;
}

.user-search-option .option-username {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

/* Selected user preview */
.selected-user-preview {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.selected-user-preview.show { display: flex; }

.selected-user-preview img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent-purple);
}

.selected-user-preview .preview-info {
    flex: 1;
    text-align: left;
}

.selected-user-preview .preview-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.selected-user-preview .preview-role {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.selected-user-preview .preview-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    transition: color 0.2s;
}

.selected-user-preview .preview-clear:hover {
    color: var(--accent-red);
}

/* Period selector */
.period-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.period-btn {
    flex: 1;
    min-width: 60px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.55rem 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.period-btn:hover {
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.period-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

/* Launch button */
.launch-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-mauve));
    color: white;
    box-shadow: 0 4px 20px rgba(142, 91, 234, 0.4);
}

.launch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(142, 91, 234, 0.5);
}

.launch-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.launch-btn i {
    font-size: 1.2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 1.5rem;
    transition: color 0.2s;
}

.back-link:hover { color: var(--text-primary); }

/* ========== STORY CONTAINER ========== */
.story-container {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.story-container.active {
    display: block;
}

/* Progress bars */
.story-progress-bar {
    display: flex;
    gap: 4px;
    padding: 12px 16px 8px;
    z-index: 10;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.progress-segment {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-segment-fill {
    height: 100%;
    width: 0%;
    background: white;
    border-radius: 2px;
    transition: none;
}

.progress-segment.completed .progress-segment-fill {
    width: 100%;
}

.progress-segment.active .progress-segment-fill {
    /* width is animated via JS */
}

/* Story close / back */
.story-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 12px;
    z-index: 10;
    position: absolute;
    top: 35px;
    left: 0;
    right: 0;
    gap: 8px;
}

.story-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.story-user-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
}

.story-user-info .story-username {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.story-user-info .story-period-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.story-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.8;
    transition: opacity 0.2s;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    z-index: 11;
}

.story-close-btn:hover { opacity: 1; }

/* ========== NOW PLAYING INDICATOR ========== */
.now-playing {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.now-playing.show {
    opacity: 1;
}

.np-icon {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.np-title {
    font-size: 0.6rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.np-artist {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Slides */
.story-slides-wrapper {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.story-slide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.story-slide.active {
    opacity: 1;
    pointer-events: auto;
}

/* Slide backgrounds */
.slide-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    animation: bgPan 12s ease-in-out infinite alternate;
}

@keyframes bgPan {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

.slide-bg-1 {
    background: linear-gradient(135deg, #1a0533 0%, #2d1b69 25%, #0f1419 50%, #1a3a2a 75%, #0f1419 100%);
    background-size: 300% 300%;
}
.slide-bg-2 {
    background: linear-gradient(135deg, #0f1419 0%, #3b1f7a 30%, #1a0533 60%, #0f1419 100%);
    background-size: 300% 300%;
}
.slide-bg-3 {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 30%, #2c5364 60%, #0f1419 100%);
    background-size: 300% 300%;
}
.slide-bg-4 {
    background: linear-gradient(135deg, #1a0533 0%, #4a1942 30%, #0f1419 60%, #2d1b69 100%);
    background-size: 300% 300%;
}
.slide-bg-5 {
    background: linear-gradient(135deg, #0f1419 0%, #1a3a2a 30%, #0f2b1a 60%, #0f1419 100%);
    background-size: 300% 300%;
}
.slide-bg-6 {
    background: linear-gradient(135deg, #2d1b69 0%, #0f1419 30%, #1a3a4a 50%, #0f1419 100%);
    background-size: 300% 300%;
}
.slide-bg-7 {
    background: linear-gradient(135deg, #3a1c0a 0%, #1a0533 30%, #0f1419 60%, #2d1b10 100%);
    background-size: 300% 300%;
}
.slide-bg-8 {
    background: linear-gradient(135deg, #0f1419 0%, #1f1a3d 30%, #3a1c3a 60%, #0f1419 100%);
    background-size: 300% 300%;
}
.slide-bg-9 {
    background: linear-gradient(135deg, #2d1b69 0%, #1a0533 30%, #3b1f7a 50%, #0f1419 100%);
    background-size: 300% 300%;
}
.slide-bg-restaurant {
    background: linear-gradient(135deg, #0f1419 0%, #1a2a3a 25%, #2a1a3a 50%, #1a3a2a 75%, #0f1419 100%);
    background-size: 300% 300%;
}

.slide-bg-zero {
    background: linear-gradient(135deg, #0f9b0f 0%, #065535 40%, #0a2f0a 100%);
}

.zero-price {
    font-size: 4rem;
    font-weight: 900;
    color: #00ff88;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.5), 0 0 60px rgba(0, 255, 136, 0.2);
    margin: 0.5rem 0;
    letter-spacing: 2px;
}

.slide-bg-10 {
    background: linear-gradient(135deg, #1a0533 0%, #2d1b69 20%, #0f2b1a 40%, #3a1c0a 60%, #0f1419 80%, #1a3a4a 100%);
    background-size: 400% 400%;
    animation: bgPan 16s ease-in-out infinite alternate;
}

/* Slide content */
.slide-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 600px;
    width: 100%;
}

/* Animation: fade up */
.anim-fade-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.story-slide.active .anim-fade-up {
    opacity: 1;
    transform: translateY(0);
}

.anim-delay-1 { transition-delay: 0.15s !important; }
.anim-delay-2 { transition-delay: 0.35s !important; }
.anim-delay-3 { transition-delay: 0.55s !important; }
.anim-delay-4 { transition-delay: 0.75s !important; }
.anim-delay-5 { transition-delay: 0.95s !important; }

/* Animation: scale in */
.anim-scale-in {
    opacity: 0;
    transform: scale(0.3);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.story-slide.active .anim-scale-in {
    opacity: 1;
    transform: scale(1);
}

/* Animation: slam in */
.anim-slam {
    opacity: 0;
    transform: scale(3) rotate(-12deg);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.story-slide.active .anim-slam {
    opacity: 1;
    transform: scale(1) rotate(-3deg);
}

/* Animation: slide from left */
.anim-slide-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.story-slide.active .anim-slide-left {
    opacity: 1;
    transform: translateX(0);
}

/* Animation: slide from right */
.anim-slide-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.story-slide.active .anim-slide-right {
    opacity: 1;
    transform: translateX(0);
}

/* Slide typography */
.slide-emoji {
    font-size: clamp(3rem, 8vw, 5rem);
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.slide-icon {
    font-size: clamp(2.5rem, 7vw, 4rem);
    margin-bottom: 1rem;
    color: var(--accent-purple);
    filter: drop-shadow(0 4px 16px rgba(142, 91, 234, 0.5));
}

.slide-icon.green { color: var(--success); filter: drop-shadow(0 4px 16px rgba(0, 217, 165, 0.5)); }
.slide-icon.orange { color: var(--accent-orange); filter: drop-shadow(0 4px 16px rgba(245, 169, 127, 0.5)); }
.slide-icon.red { color: var(--accent-red); filter: drop-shadow(0 4px 16px rgba(237, 135, 150, 0.5)); }

.slide-label {
    font-size: clamp(0.8rem, 2vw, 1rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.slide-big-number {
    font-size: clamp(3.5rem, 12vw, 7rem);
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(142, 91, 234, 0.3));
}

.slide-big-number.green {
    background: linear-gradient(135deg, #fff 0%, var(--success) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(0, 217, 165, 0.3));
}

.slide-big-number.orange {
    background: linear-gradient(135deg, #fff 0%, var(--accent-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(245, 169, 127, 0.3));
}

.slide-headline {
    font-size: clamp(1.3rem, 4vw, 2.2rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slide-subtext {
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    max-width: 400px;
}

.slide-subtext strong {
    color: var(--accent-light);
}

/* Intro slide avatar */
.intro-avatar {
    width: clamp(100px, 25vw, 140px);
    height: clamp(100px, 25vw, 140px);
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-purple);
    box-shadow: 0 0 0 0 rgba(142, 91, 234, 0.5);
    margin-bottom: 1.5rem;
    animation: avatarPulseRing 2s ease-in-out infinite;
}

@keyframes avatarPulseRing {
    0%, 100% { box-shadow: 0 0 0 0 rgba(142, 91, 234, 0.5), 0 0 30px rgba(142, 91, 234, 0.2); }
    50% { box-shadow: 0 0 0 12px rgba(142, 91, 234, 0), 0 0 50px rgba(142, 91, 234, 0.3); }
}

/* Rank / percentile bar */
.percentile-bar-container {
    width: 100%;
    max-width: 350px;
    margin-top: 1.5rem;
}

.percentile-bar-bg {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.percentile-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-light));
    width: 0%;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0.6s;
}

.story-slide.active .percentile-bar-fill {
    /* width set by JS */
}

.percentile-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Mini bar chart (weekday / monthly) */
.mini-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    width: 100%;
    max-width: 380px;
    margin-top: 1.5rem;
    padding: 0;
}

.mini-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.mini-bar {
    width: 100%;
    min-height: 4px;
    border-radius: 4px 4px 0 0;
    background: rgba(142, 91, 234, 0.6);
    transition: height 1s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

.mini-bar.highlight {
    background: linear-gradient(180deg, var(--accent-light), var(--accent-purple));
    box-shadow: 0 0 12px rgba(142, 91, 234, 0.4);
}

.mini-bar-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    white-space: nowrap;
}

.mini-bar-value {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

/* Monthly sparkline chart */
.monthly-chart-container {
    width: 100%;
    max-width: 420px;
    margin-top: 1.5rem;
}

.monthly-chart-container canvas {
    width: 100% !important;
    height: 150px !important;
}

/* Restaurant donut (personal vs shared) */
.restaurant-donut-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0 1rem;
}

.restaurant-donut {
    position: relative;
    width: clamp(130px, 30vw, 160px);
    height: clamp(130px, 30vw, 160px);
    --personal-pct: 50;
}

.restaurant-donut svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.restaurant-donut .donut-bg {
    fill: none;
    stroke: rgba(237, 135, 150, 0.25);
    stroke-width: 14;
}

.restaurant-donut .donut-personal {
    fill: none;
    stroke: var(--accent-purple);
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 314.16;
    stroke-dashoffset: 314.16;
    transition: stroke-dashoffset 1.4s cubic-bezier(0.22, 1, 0.36, 1);
    filter: drop-shadow(0 0 8px rgba(142, 91, 234, 0.5));
}

.restaurant-donut.animate .donut-personal {
    stroke-dashoffset: calc(314.16 - (314.16 * var(--personal-pct) / 100));
}

.donut-center-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-pct {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: 800;
    color: white;
    line-height: 1;
}

.donut-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.restaurant-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.personal {
    background: var(--accent-purple);
    box-shadow: 0 0 6px rgba(142, 91, 234, 0.5);
}

.legend-dot.shared {
    background: rgba(237, 135, 150, 0.5);
}

.legend-text strong {
    color: var(--accent-light);
}

/* Intro start button */
.intro-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 50px;
    font-size: 1.15rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-mauve));
    box-shadow: 0 4px 24px rgba(142, 91, 234, 0.5);
    transition: all 0.3s ease;
    position: relative;
    z-index: 20;
    animation: startBtnPulse 2s ease-in-out infinite;
}

.intro-start-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 32px rgba(142, 91, 234, 0.7);
}

.intro-start-btn:active {
    transform: translateY(0) scale(0.98);
}

.intro-start-btn i {
    font-size: 1rem;
}

.intro-start-btn.started {
    pointer-events: none !important;
    opacity: 0 !important;
    transform: scale(0.8) !important;
    transition: all 0.4s ease !important;
}

.intro-sound-hint {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.intro-sound-hint i {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

@keyframes startBtnPulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(142, 91, 234, 0.5); }
    50% { box-shadow: 0 4px 32px rgba(142, 91, 234, 0.8), 0 0 0 8px rgba(142, 91, 234, 0.1); }
}

/* Streak fire */
.streak-fire {
    position: relative;
    display: inline-block;
}

.streak-fire .fire-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(245, 169, 127, 0.3) 0%, transparent 70%);
    animation: fireGlow 1.5s ease-in-out infinite alternate;
    border-radius: 50%;
}

@keyframes fireGlow {
    0% { opacity: 0.5; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.1); }
}

/* Fun comparison slide */
.comparison-icon {
    font-size: clamp(3rem, 8vw, 5rem);
    margin-bottom: 1rem;
    animation: compareBounce 2s ease-in-out infinite;
}

@keyframes compareBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Personality stamp */
.personality-stamp {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: 3px solid var(--accent-purple);
    border-radius: 12px;
    font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-light);
    margin-bottom: 1rem;
    position: relative;
}

.personality-stamp::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 1px solid rgba(142, 91, 234, 0.3);
    border-radius: 16px;
}

/* Outro summary card */
.outro-card {
    background: rgba(26, 31, 41, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(142, 91, 234, 0.3);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.outro-card .outro-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.outro-card .outro-row:last-child {
    border-bottom: none;
}

.outro-card .outro-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.outro-card .outro-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-light);
}

.outro-cta {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* ========== CONFETTI ========== */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    opacity: 0;
}

.confetti-piece.active {
    animation: confettiFall var(--duration) ease-in forwards;
    animation-delay: var(--delay);
    opacity: 1;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(calc(100vh + 40px)) rotate(var(--rotation)) scale(0.5);
        opacity: 0;
    }
}

/* Count-up number shimmer */
.count-up-shimmer {
    position: relative;
    overflow: hidden;
}

.count-up-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: shimmerSlide 2s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes shimmerSlide {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Touch/click zones (invisible) */
.story-nav-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 5;
}

.story-nav-zone.left {
    left: 0;
    width: 25%;
}

.story-nav-zone.right {
    right: 0;
    width: 75%;
}

/* Paused indicator */
.story-paused-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.201);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.507);
    font-size: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 15;
}

.story-paused-indicator.show {
    opacity: 1;
}

/* Loading spinner for wrapped */
.wrapped-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    min-height: 100vh;
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
}

.wrapped-loading.show { display: flex; }

.wrapped-loading .loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.wrapped-loading .loading-text {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ========== API KEY MODAL (reused) ========== */
.api-key-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem;
}

.api-key-modal.hidden { display: none; }

.api-key-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.api-key-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-light), var(--accent-mauve));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.api-key-header { margin-bottom: 1.5rem; }

.api-key-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.api-key-header h2 i { color: var(--accent-purple); }
.api-key-header p { color: var(--text-muted); font-size: 0.9rem; }

.api-key-form { margin-bottom: 1rem; }
.api-key-input-group { margin-bottom: 1rem; }

.api-key-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.api-key-input-group input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    outline: none;
    transition: border-color 0.2s ease;
}

.api-key-input-group input:focus { border-color: var(--accent-purple); }
.api-key-input-group input::placeholder { color: var(--text-muted); font-family: 'Inter', sans-serif; }

.api-key-error {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: none;
}

.api-key-error.show { display: block; }

.api-key-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.api-key-btn {
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.api-key-btn-primary {
    background: var(--accent-purple);
    color: white;
}

.api-key-btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.api-key-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.api-key-info {
    background: rgba(142, 91, 234, 0.1);
    border: 1px solid rgba(142, 91, 234, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.api-key-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.api-key-info i {
    color: var(--accent-purple);
    margin-right: 0.5rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .wrapped-launcher { padding: 1rem; }
    .launcher-card { padding: 1.25rem; }
    .period-selector { gap: 0.35rem; }
    .period-btn { padding: 0.45rem 0.3rem; font-size: 0.72rem; min-width: auto; }
    .slide-content { padding: 0 0.5rem; }
    .outro-card { padding: 1.25rem; }
    .mini-bars { height: 90px; gap: 4px; }
    .story-progress-bar { padding: 8px 10px 6px; gap: 3px; }
    .intro-avatar { width: 90px; height: 90px; }
}
