/* ===== LUNA DESIGN SYSTEM ===== */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

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

/* ===== DARK THEME (default) ===== */
:root,
.dark {
    --purple: #7c3aed;
    --violet: #8b5cf6;
    --indigo: #6366f1;
    --pink: #ec4899;
    --rose: #f43f5e;
    --gold: #fbbf24;
    --amber: #f59e0b;
    --cyan: #22d3ee;
    --teal: #14b8a6;
    --bg: #0a0612;
    --bg2: #130d24;
    --card: rgba(255, 255, 255, .04);
    --glass: rgba(255, 255, 255, .05);
    --gborder: rgba(255, 255, 255, .08);
    --txt: #f0e6ff;
    --txt2: rgba(240, 230, 255, .7);
    --txt3: rgba(240, 230, 255, .4);
    --glow: 0 0 30px rgba(124, 58, 237, .3);
    --r: 20px;
    --grad1: linear-gradient(135deg, #7c3aed, #ec4899);
    --grad2: linear-gradient(135deg, #6366f1, #22d3ee);
    --grad3: linear-gradient(135deg, #f59e0b, #ec4899);
    --nav-bg: rgba(12, 8, 24, .65);
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --star-opacity: 1;
}

/* ===== LIGHT THEME — нежная розовая ===== */
.light {
    --purple: #7c3aed;
    --violet: #8b5cf6;
    --pink: #ec4899;
    --rose: #f43f5e;
    --gold: #d97706;
    --bg: #fffcfd;
    --bg2: #fdf2f8;
    --card: #ffffff;
    --glass: rgba(124, 58, 237, 0.05);
    --glass-heavy: rgba(124, 58, 237, 0.1);
    --gborder: rgba(124, 58, 237, 0.1);
    --txt: #1e1b4b;
    --txt2: #4338ca;
    --txt3: #6366f1;
    --glow: 0 0 30px rgba(124, 58, 237, 0.1);
    --grad1: linear-gradient(135deg, #7c3aed, #ec4899);
    --grad2: linear-gradient(135deg, #6366f1, #22d3ee);
    --grad3: linear-gradient(135deg, #d97706, #ec4899);
    --nav-bg: rgba(255, 255, 255, 0.85);
    --star-opacity: 0.1;
}

.light .premium-card {
    background: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.1);
}

.light .note-premium {
    background: linear-gradient(to right, rgba(124, 58, 237, 0.03), #fff);
    border-color: rgba(124, 58, 237, 0.05);
}

.light .glass-card {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(124, 58, 237, 0.1);
}

.light body {
    background: url('/img/bg_light.png') center/cover no-repeat fixed, var(--bg);
}

.light .app {
    background: rgba(254, 241, 246, .85);
    backdrop-filter: blur(12px);
}

.light .card::before {
    background: radial-gradient(circle at 50% 0%, rgba(200, 130, 170, .06), transparent 70%)
}

.light .moon-circle {
    box-shadow: 0 0 30px rgba(200, 130, 170, .15), inset 0 0 20px rgba(200, 130, 170, .08)
}

.light .moon-shadow {
    background: var(--bg)
}

.light .tarot-front {
    background: linear-gradient(180deg, #ffffff, #fdf2f8);
}

/* Premium UI Elements */
.premium-card {
    background: var(--card);
    border: 1px solid var(--gborder);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.premium-card:hover {
    transform: translateY(-4px);
    border-color: var(--purple);
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.3);
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.gradient-border-card {
    position: relative;
    background: var(--card);
    border-radius: 20px;
    padding: 1px;
    /* The border width */
}

.gradient-border-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, var(--purple), var(--pink), var(--cyan));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.note-premium {
    padding: 14px;
    border-radius: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(to right, rgba(255, 255, 255, 0.02), transparent);
    transition: all 0.2s ease;
}

.note-type-important {
    border-left: 4px solid var(--rose);
    background: linear-gradient(to right, rgba(244, 63, 94, 0.05), transparent);
}

.note-type-idea {
    border-left: 4px solid var(--gold);
    background: linear-gradient(to right, rgba(251, 191, 36, 0.05), transparent);
}

.note-type-task {
    border-left: 4px solid var(--teal);
    background: linear-gradient(to right, rgba(20, 184, 166, 0.05), transparent);
}

.note-type-note {
    border-left: 4px solid var(--purple);
    background: linear-gradient(to right, rgba(124, 58, 237, 0.05), transparent);
}

.stagger-in>* {
    opacity: 0;
    animation: fadeUp 0.5s ease forwards;
}

.stagger-in>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-in>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-in>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-in>*:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-in>*:nth-child(5) {
    animation-delay: 0.5s;
}

.btn-premium {
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border: none;
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px -4px rgba(124, 58, 237, 0.5);
    transition: all 0.3s ease;
}

.btn-premium:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px -4px rgba(124, 58, 237, 0.4);
}

.nav-premium {
    background: rgba(10, 6, 18, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.light .tarot-back {
    background: linear-gradient(180deg, #f0d0e0, #e8c0d4)
}

.light .tarot-front-label {
    color: var(--txt3)
}

@media(min-width:768px) {
    .light .app {
        background: rgba(254, 241, 246, .88);
        border-color: rgba(200, 130, 170, .2);
        box-shadow: 0 0 80px rgba(200, 130, 170, .12)
    }

    .light body {
        background: url('/img/bg_light.png') center/cover no-repeat fixed,
            radial-gradient(at 30% 20%, rgba(200, 130, 170, .1), transparent 50%),
            radial-gradient(at 70% 80%, rgba(232, 160, 180, .08), transparent 50%), var(--bg)
    }
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--txt);
    display: flex;
    justify-content: center;
    align-items: stretch;
    -webkit-user-select: none;
    user-select: none;
}

#starCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: var(--star-opacity);
    transition: opacity .5s
}

#appCanvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
    border-radius: inherit;
}

/* APP SHELL */
.app {
    width: 100%;
    max-width: 420px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: url('/img/bg_dark.png') center/cover no-repeat fixed, var(--bg);
    z-index: 1;
}

/* PWA standalone — JS задаёт --app-height = screen.height (полная высота экрана)
   html, body растягиваются на полный экран, .app заполняет всё */
html.pwa-standalone,
html.pwa-standalone body {
    height: var(--app-height, 100vh) !important;
    overflow: hidden;
}

.pwa-standalone .app {
    height: var(--app-height, 100vh);
    max-width: none;
    box-sizing: border-box;
}

.pwa-standalone .story-viewer-overlay {
    height: var(--app-height, 100vh) !important;
    background: #000;
    box-sizing: border-box;
}

.pwa-standalone .story-viewer-progress {
    top: calc(env(safe-area-inset-top, 8px) + 8px);
}

.pwa-standalone .story-viewer-header {
    top: calc(env(safe-area-inset-top, 16px) + 16px);
}

.pwa-standalone .story-comments-panel {
    padding-bottom: 34px;
}

.pwa-standalone .story-editor-overlay {
    height: var(--app-height, 100vh) !important;
}

.pwa-standalone .story-editor {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 34px;
}

.pwa-standalone .story-creator-overlay {
    height: var(--app-height, 100vh) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Extend nav background upward in PWA standalone (desktop) mode */
.pwa-standalone .nav {
    height: 90px;
    padding-top: 20px;
    margin-top: -20px;
}

/* Fill safe-area below nav with themed background in PWA */
.pwa-standalone .nav::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: env(safe-area-inset-bottom, 0px);
    background: var(--nav-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    transform: translateY(100%);
    z-index: 100;
}

.light .app {
    background: url('/img/bg_light.png') center/cover no-repeat fixed, var(--bg);
}

/* Desktop: wider, more interesting layout */
@media(min-width:768px) {
    body {
        background: radial-gradient(at 30% 20%, rgba(124, 58, 237, .12), transparent 50%),
            radial-gradient(at 70% 80%, rgba(236, 72, 153, .08), transparent 50%), var(--bg);
    }

    body::before {
        content: '🌙 Luna';
        position: fixed;
        top: 24px;
        left: 32px;
        font-family: var(--font-display);
        font-size: 28px;
        font-weight: 700;
        background: var(--grad1);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        opacity: .5;
        z-index: 0;
    }

    body::after {
        content: '✨ Мистический помощник';
        position: fixed;
        bottom: 24px;
        right: 32px;
        font-family: var(--font-display);
        font-size: 14px;
        color: var(--txt3);
        z-index: 0;
    }

    .app {
        max-width: 480px;
        border-radius: 32px;
        border: 1px solid var(--gborder);
        box-shadow: 0 0 60px rgba(124, 58, 237, .15), 0 0 120px rgba(124, 58, 237, .05);
        height: 92vh;
        max-height: 920px;
        background: url('/img/bg_dark.png') center/cover no-repeat, rgba(10, 6, 18, .85);
        backdrop-filter: blur(24px)
    }

    .light .app {
        background: url('/img/bg_light.png') center/cover no-repeat, rgba(254, 241, 246, .88);
        border-color: rgba(200, 130, 170, .2);
        box-shadow: 0 0 80px rgba(200, 130, 170, .12);
    }

    .light body {
        background: radial-gradient(at 30% 20%, rgba(200, 130, 170, .1), transparent 50%),
            radial-gradient(at 70% 80%, rgba(232, 160, 180, .08), transparent 50%), #fef1f6;
    }
}

/* Larger desktop — even wider */
@media(min-width:1200px) {
    .app {
        max-width: 520px;
    }
}

/* SCREENS */
.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    animation: screenIn .4s ease-out
}

.screen.active {
    display: flex
}

/* Gradient fade overlay at bottom of screen, just above nav */
.screen.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 90px;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
    z-index: 5;
}

@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* HEADER */
.header {
    padding: 16px 20px 8px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
    text-align: center;
    flex-shrink: 0;
    position: relative;
    z-index: 10
}

.header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    background: var(--grad1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.header p {
    font-size: 12px;
    color: var(--txt3);
    margin-top: 2px;
    letter-spacing: 1px;
    text-transform: uppercase
}

/* SCROLLABLE CONTENT */
.scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 58, 237, .3) transparent
}

.scroll::-webkit-scrollbar {
    width: 4px
}

.scroll::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, .3);
    border-radius: 4px
}

/* CARDS */
.card {
    background: var(--card);
    border: 1px solid var(--gborder);
    border-radius: var(--r);
    padding: 20px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(15px);
    transition: transform .3s, box-shadow .3s
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow)
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(124, 58, 237, .08), transparent 70%);
    pointer-events: none
}

.card-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px
}

.card-text {
    font-size: 14px;
    color: var(--txt2);
    line-height: 1.6
}

/* GREETING */
.greeting-card {
    text-align: center;
    padding: 20px 16px 16px;
    margin-bottom: 8px
}

.greeting-icon {
    font-size: 48px;
    margin-bottom: 6px;
    animation: float 3s ease-in-out infinite
}

.greeting-text {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600
}

.greeting-sub {
    font-size: 14px;
    color: var(--txt2);
    margin-top: 4px;
    font-style: italic;
    font-family: var(--font-display)
}

/* ZODIAC GRID */
.zodiac-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 8px 0
}

.zodiac-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--gborder);
    cursor: pointer;
    transition: all .3s cubic-bezier(.2, .8, .2, 1);
    position: relative;
    overflow: hidden
}

.zodiac-item:hover,
.zodiac-item.active {
    transform: scale(1.05);
    border-color: var(--purple);
    box-shadow: 0 0 25px rgba(124, 58, 237, .3)
}

.zodiac-item.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(124, 58, 237, .15), transparent);
    animation: pulse2 2s infinite
}

.zodiac-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 6px rgba(124, 58, 237, .5));
    transition: transform .3s
}

.zodiac-item:hover .zodiac-icon {
    transform: scale(1.15) rotate(5deg)
}

.zodiac-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--txt2)
}

.zodiac-dates {
    font-size: 9px;
    color: var(--txt3)
}

/* HOROSCOPE */
.horo-display {
    animation: fadeUp .5s ease-out
}

.horo-sign {
    text-align: center;
    margin-bottom: 16px
}

.horo-sign-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 6px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(124, 58, 237, .5))
}

.horo-sign-name {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600
}

.horo-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px
}

.horo-cat {
    display: flex;
    align-items: center;
    gap: 12px
}

.horo-cat-label {
    font-size: 13px;
    color: var(--txt2);
    width: 80px;
    flex-shrink: 0
}

.horo-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, .08);
    border-radius: 3px;
    overflow: hidden
}

.light .horo-bar {
    background: rgba(124, 58, 237, .08)
}

.horo-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(.2, .8, .2, 1);
    background: var(--grad1);
    box-shadow: 0 0 10px rgba(124, 58, 237, .5)
}

.horo-text {
    font-size: 14px;
    color: var(--txt2);
    line-height: 1.7;
    margin-top: 16px;
    font-family: var(--font-display);
    font-size: 16px
}

/* TAROT */
.tarot-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    flex: 1;
    justify-content: center
}

.tarot-card {
    width: 180px;
    height: 300px;
    perspective: 800px;
    cursor: pointer;
    margin: 16px 0
}

.tarot-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform .8s cubic-bezier(.4, .0, .2, 1);
    transform-style: preserve-3d
}

.tarot-card.flipped .tarot-inner {
    transform: rotateY(180deg)
}

.tarot-front,
.tarot-back {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--gborder);
    overflow: hidden
}

.tarot-front {
    background: linear-gradient(180deg, #1a0f30, #0d0520);
    box-shadow: 0 10px 40px rgba(124, 58, 237, .3)
}

.tarot-front-pattern {
    font-size: 40px;
    opacity: .3;
    position: absolute;
    animation: rotate 20s linear infinite
}

.tarot-front-label {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--txt3);
    position: absolute;
    bottom: 20px;
    letter-spacing: 3px
}

.tarot-front .moon-sym {
    font-size: 48px;
    filter: drop-shadow(0 0 15px rgba(124, 58, 237, .6));
    animation: float 3s ease-in-out infinite
}

.tarot-back {
    background: linear-gradient(180deg, #1a0536, #0d0520);
    transform: rotateY(180deg);
    padding: 16px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(236, 72, 153, .2)
}

.tarot-back-icon {
    font-size: 50px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 12px rgba(236, 72, 153, .5))
}

.tarot-back-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px
}

.tarot-back-meaning {
    font-size: 12px;
    color: var(--txt2);
    line-height: 1.5
}

.tarot-back-type {
    font-size: 10px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 8px;
    padding: 3px 12px;
    border: 1px solid rgba(251, 191, 36, .3);
    border-radius: 12px
}

.tarot-hint {
    font-size: 13px;
    color: var(--txt3);
    text-align: center;
    animation: pulse2 2s infinite
}

.tarot-meaning {
    margin-top: 16px;
    text-align: center;
    animation: fadeUp .6s ease-out
}

.tarot-meaning h3 {
    font-family: var(--font-display);
    font-size: 22px;
    margin-bottom: 8px
}

.tarot-meaning p {
    font-size: 14px;
    color: var(--txt2);
    line-height: 1.6;
    max-width: 320px
}

.tarot-btn {
    margin-top: 16px;
    padding: 12px 32px;
    border-radius: 28px;
    background: var(--grad1);
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    box-shadow: 0 8px 25px rgba(124, 58, 237, .4);
    transition: .3s
}

.tarot-btn:hover {
    transform: scale(1.05)
}

/* MOON */
.moon-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0
}

.moon-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: #fff;
    position: relative;
    box-shadow: 0 0 50px rgba(255, 255, 255, .3), inset 0 0 30px rgba(0, 0, 0, .1);
    overflow: hidden
}

.moon-shadow {
    position: absolute;
    inset: 0;
    background: var(--bg);
    transition: transform .5s ease-out
}

.moon-info {
    text-align: center;
    margin-top: 20px
}

.moon-phase {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px
}

.moon-age {
    font-size: 13px;
    color: var(--txt3);
    text-transform: uppercase;
    letter-spacing: 2px
}

.moon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-top: 20px
}

.moon-stat {
    padding: 14px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--gborder);
    text-align: center
}

.moon-stat-val {
    font-size: 15px;
    font-weight: 600;
    color: var(--gold)
}

.moon-stat-label {
    font-size: 10px;
    color: var(--txt3);
    margin-top: 2px;
    text-transform: uppercase
}

/* NAV */
.nav {
    height: 70px;
    background: var(--nav-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--gborder);
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    flex-shrink: 0;
    position: relative;
    z-index: 100
}



.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 12px;
    transition: .3s;
    position: relative
}

.nav-icon-svg {
    width: 24px;
    height: 24px;
    color: var(--txt3);
    transition: .3s
}

.nav-label {
    font-size: 10px;
    color: var(--txt3);
    font-weight: 500
}

.nav-item.active {
    background: rgba(124, 58, 237, .1)
}

.nav-item.active .nav-icon-svg {
    color: var(--purple);
    transform: translateY(-2px);
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, .5))
}

.nav-item.active .nav-label {
    color: var(--purple);
    font-weight: 600
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--grad1);
    border-radius: 1px;
    box-shadow: 0 0 10px var(--purple)
}

/* UTILS */
.premium-tag {
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: var(--grad1);
    padding: 2px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(236, 72, 153, .4)
}

.gold-tag {
    background: var(--grad3);
    box-shadow: 0 2px 8px rgba(245, 158, 11, .4)
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-8px)
    }
}

@keyframes rotate {
    from {
        transform: rotate(0)
    }

    to {
        transform: rotate(360deg)
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes pulse2 {

    0%,
    100% {
        opacity: .8
    }

    50% {
        opacity: .4
    }
}

/* MODAL/POPUP */
.cal-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .3s ease
}

.cal-popup-inner {
    background: var(--bg);
    border: 1px solid var(--gborder);
    border-radius: 28px;
    width: 100%;
    max-width: 340px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
    animation: scaleIn .3s cubic-bezier(.17, .67, .83, .67)
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(.9) translateY(20px)
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0)
    }
}

.cycle-input {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--gborder);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--txt);
    font-family: inherit;
    font-size: 15px;
    margin-bottom: 12px;
    outline: none;
    transition: .3s
}

.cycle-input:focus {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .05)
}

.cycle-label {
    display: block;
    font-size: 11px;
    color: var(--txt3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    margin-left: 4px
}

/* HOME COMPONENTS */
.home-section-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--txt3);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 24px 0 12px;
    display: flex;
    align-items: center;
    gap: 10px
}

.home-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--gborder), transparent)
}

.quick-actions-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: none
}

.quick-actions-row::-webkit-scrollbar {
    display: none
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 64px;
    transition: transform .2s;
}

.quick-action:hover {
    transform: translateY(-3px);
}

.quick-action:active {
    transform: scale(.92);
}

.quick-action-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 1.5px solid var(--gborder);
    transition: all .3s;
    position: relative;
    overflow: hidden;
}

.quick-action:hover .quick-action-circle {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .1);
    box-shadow: 0 0 15px rgba(124, 58, 237, .2);
}

.quick-action-label {
    font-size: 10px;
    color: var(--txt2);
    font-weight: 500;
    text-align: center;
    white-space: nowrap
}

/* FORUM CARDS */
.forum-card {
    padding: 16px;
    cursor: pointer
}

.forum-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px
}

.forum-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 1px solid var(--gborder)
}

.forum-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--txt)
}

.forum-time {
    font-size: 10px;
    color: var(--txt3);
    margin-left: auto
}

.forum-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--txt);
    line-height: 1.3;
    margin-bottom: 6px
}

.forum-card-body {
    font-size: 13px;
    color: var(--txt2);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.forum-card-footer {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--gborder)
}

.forum-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--txt3)
}

.forum-stat svg {
    width: 14px;
    height: 14px
}

/* CHAT COMPONENTS */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    padding-bottom: 100px
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeUp .3s ease-out
}

.message.ai {
    background: var(--card);
    border: 1px solid var(--gborder);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--txt)
}

.message.user {
    background: var(--grad1);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(124, 58, 237, .2)
}

.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px 24px;
    background: linear-gradient(to top, var(--bg) 60%, transparent);
    display: flex;
    gap: 10px;
    align-items: center
}

.chat-input {
    flex: 1;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--gborder);
    border-radius: 24px;
    padding: 12px 20px;
    color: var(--txt);
    outline: none;
    font-size: 14px;
    transition: .3s
}

.chat-input:focus {
    border-color: var(--purple);
    box-shadow: var(--glow)
}

.chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--grad1);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(236, 72, 153, .3);
    transition: .2s
}

.chat-send:active {
    transform: scale(.9)
}

.typing-indicator {
    padding: 10px 16px;
    background: var(--glass);
    border-radius: 16px;
    display: flex;
    gap: 4px;
    width: fit-content;
    margin-bottom: 20px
}

.dot {
    width: 4px;
    height: 4px;
    background: var(--purple);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out
}

.dot:nth-child(2) {
    animation-delay: .2s
}

.dot:nth-child(3) {
    animation-delay: .4s
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0)
    }

    40% {
        transform: scale(1)
    }
}

/* CHAT BUBBLE & CONTAINER (used by chat.js) */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeUp .3s ease-out;
    word-wrap: break-word;
}

.chat-bubble.bot {
    background: var(--card);
    border: 1px solid var(--gborder);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--txt);
}

.chat-bubble.user {
    background: var(--grad1);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(124, 58, 237, .2);
}

.chat-bubble .time {
    font-size: 10px;
    color: var(--txt3);
    margin-top: 4px;
    opacity: 0.7;
}

.chat-bubble.user .time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-input-wrap {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(to top, var(--bg) 60%, transparent);
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 100;
}

.chat-quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
}

.chat-quick-prompts::-webkit-scrollbar {
    display: none;
}

/* MOOD TRACKER */
.mood-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 12px 0
}

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 4px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--gborder);
    cursor: pointer;
    transition: .3s
}

.mood-btn i {
    font-size: 24px;
    transition: transform .3s
}

.mood-btn span {
    font-size: 10px;
    color: var(--txt3);
    font-weight: 600;
    text-transform: uppercase
}

.mood-btn.active {
    border-color: var(--pink);
    background: rgba(236, 72, 153, .12);
    box-shadow: 0 0 15px rgba(236, 72, 153, .2)
}

.mood-btn.active i {
    transform: scale(1.2)
}

.mood-btn.active span {
    color: var(--pink)
}

/* CALENDAR */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 12px
}

.cal-day-label {
    text-align: center;
    font-size: 10px;
    color: var(--txt3);
    font-weight: 700;
    padding-bottom: 8px
}

.cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--gborder);
    font-size: 13px;
    position: relative;
    cursor: pointer;
    transition: .2s
}

.cal-cell.other {
    opacity: .2
}

.cal-cell.today {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .1);
    font-weight: 700
}

.cal-cell.period {
    background: var(--grad1);
    border: none;
    color: #fff
}

.cal-cell.ovulation {
    border-color: var(--cyan);
    box-shadow: inset 0 0 10px rgba(34, 211, 238, .3)
}

.cal-cell.fertile {
    border-color: rgba(34, 211, 238, .4)
}

.cal-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--purple);
    position: absolute;
    bottom: 4px
}

.cal-cell.period .cal-dot {
    background: #fff
}

/* FORUM CATEGORIES */
.chat-quick-prompt {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 18px;
    background: var(--glass);
    border: 1px solid var(--gborder);
    color: var(--txt2);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: .3s;
    margin: 2px
}

.chat-quick-prompt:hover,
.chat-quick-prompt.active {
    border-color: var(--purple);
    color: var(--purple);
    background: rgba(124, 58, 237, .05)
}

/* SPLASH SCREEN */
#splashScreen {
    background: var(--bg);
}

/* LUNA SPLASH */
#luna-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #0a0612;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

.splash-moon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 24px;
    animation: moonFloat 4s ease-in-out infinite;
}

.splash-text {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 12px;
    color: #fff;
    background: linear-gradient(135deg, #fff, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    animation: textAppear 2s ease forwards 0.5s;
}

.splash-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    bottom: -10px;
    background: #fff;
    border-radius: 50%;
    opacity: 0.3;
    animation: pFloat var(--d) linear infinite;
}

@keyframes moonFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes textAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
        letter-spacing: 20px;
    }

    to {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: 12px;
    }
}

@keyframes pFloat {
    to {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

/* PROFILE STYLES */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform .2s
}

.theme-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    border: 2px solid var(--gborder);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: .3s
}

.theme-option.active .theme-preview {
    border-color: var(--purple);
    box-shadow: var(--glow)
}

.theme-preview-dot {
    width: 20%;
    height: 20%;
    border-radius: 50%
}

.theme-option span {
    font-size: 11px;
    font-weight: 600;
    color: var(--txt2)
}

.profile-menu {
    border-radius: var(--r);
    background: var(--card);
    border: 1px solid var(--gborder);
    overflow: hidden;
    margin-bottom: 20px
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--gborder);
    font-size: 14px;
    color: var(--txt2);
    transition: .2s
}

.profile-menu-item:last-child {
    border-bottom: none
}

.profile-menu-item:active {
    background: rgba(124, 58, 237, .05)
}

.section-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--txt3);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 16px 0 10px;
    text-align: left
}

/* MODAL FORUM */
.forum-cat-btn {
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 11px;
    background: var(--glass);
    border: 1px solid var(--gborder)
}

.forum-cat-btn.active {
    background: var(--grad1);
    color: #fff;
    border: none
}

.post-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--gborder);
    cursor: pointer;
    transition: .2s
}

.post-action:active {
    transform: scale(.9)
}

/* TOGGLE SWITCH */
.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--gborder);
    border-radius: 10px;
    position: relative;
    transition: .3s
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: .3s
}

.toggle-switch.on {
    background: var(--teal)
}

.toggle-switch.on::after {
    left: 18px
}

/* ONBOARDING */
.ob-wrap {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    text-align: center;
    background: radial-gradient(circle at 50% 30%, rgba(124, 58, 237, .15), transparent 70%)
}

.ob-icon {
    font-size: 80px;
    margin-bottom: 24px;
    animation: float 4s ease-in-out infinite
}

.ob-title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--grad1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent
}

.ob-text {
    font-size: 16px;
    color: var(--txt2);
    line-height: 1.6;
    margin-bottom: 40px
}

/* DIARY PREMIUM */
.mood-btn.premium {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    border: 1px solid var(--gborder);
    transition: .3s cubic-bezier(.17, .67, .83, .67);
    cursor: pointer
}

.mood-btn.premium:hover {
    transform: scale(1.1) translateY(-2px);
    border-color: var(--purple)
}

.mood-btn.premium.selected {
    background: var(--grad1);
    color: #fff;
    transform: scale(1.25);
    border: none;
    box-shadow: 0 5px 20px rgba(236, 72, 153, .4)
}

/* AI MAGIC CARD */
.ai-magic-card {
    padding: 1px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.5), rgba(236, 72, 153, 0.5), rgba(34, 211, 238, 0.5));
    border-radius: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden
}

.ai-magic-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    opacity: 0.1;
    z-index: 0;
    animation: rotate 10s linear infinite
}

.ai-magic-card-inner {
    background: var(--bg2);
    border-radius: 19px;
    padding: 24px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(20px);
}

.purple-grad-text {
    background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700
}

/* ADMIN STYLES */
.admin-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 16px;
    scrollbar-width: none
}

.admin-tab {
    padding: 8px 16px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--gborder);
    color: var(--txt2);
    font-size: 13px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: .3s
}

.admin-tab.active {
    background: var(--grad1);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .3)
}

.admin-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--gborder);
    border-radius: 16px;
    margin-bottom: 8px
}

.admin-action-btn {
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
    background: var(--glass);
    border: 1px solid var(--gborder);
    color: var(--txt);
    cursor: pointer
}

.admin-action-btn.del {
    color: var(--rose);
    border-color: rgba(244, 63, 94, .3)
}

/* ===== OFFLINE BANNER ===== */
.offline-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: linear-gradient(135deg, rgba(124, 58, 237, .9), rgba(236, 72, 153, .9));
    color: white;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    padding: 6px 16px;
    letter-spacing: 0.3px;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity .4s, transform .4s cubic-bezier(.2, .8, .2, 1);
    backdrop-filter: blur(10px);
}

.offline-banner.visible {
    opacity: 1;
    transform: translateY(0);
}

.light .offline-banner {
    background: linear-gradient(135deg, rgba(124, 58, 237, .85), rgba(236, 72, 153, .85));
}

/* ===== TAROT SUB-BUTTONS ===== */
.tarot-sub-btn {
    padding: 10px 16px;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--gborder);
    color: var(--txt);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all .3s ease;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.tarot-sub-btn:hover {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, .2);
}

.tarot-sub-btn:active {
    transform: scale(.95);
}

.light .tarot-sub-btn {
    background: rgba(255, 255, 255, .7);
    border-color: rgba(124, 58, 237, .15);
    color: var(--txt);
}

.light .tarot-sub-btn:hover {
    background: rgba(124, 58, 237, .1);
}

/* ===== CALENDAR HEADER & WEEKDAYS ===== */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cal-month-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--txt);
}

.cal-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--gborder);
    background: var(--glass);
    color: var(--txt);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}

.cal-nav-btn:hover {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .1);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.cal-weekdays span {
    text-align: center;
    font-size: 10px;
    color: var(--txt3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0;
}

/* ===== CYCLE SETUP FORM ===== */
.cycle-setup {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px;
    text-align: center;
}

.cycle-label {
    font-size: 12px;
    color: var(--txt2);
    font-weight: 500;
    align-self: flex-start;
    width: 100%;
    text-align: left;
    margin-bottom: 4px;
}

.cycle-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--gborder);
    background: var(--glass);
    color: var(--txt);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: border-color .2s;
}

.cycle-input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .1);
}

/* ===== CYCLE STAT CARDS ===== */
.cycle-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.cycle-stat-card {
    background: var(--glass);
    border: 1px solid var(--gborder);
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
    backdrop-filter: blur(8px);
}

.cycle-stat-val {
    font-size: 28px;
    font-weight: 800;
    background: var(--grad1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.cycle-stat-label {
    font-size: 11px;
    color: var(--txt2);
    margin-top: 4px;
    line-height: 1.3;
}

/* ===== CYCLE MAIN LAYOUT ===== */
.cycle-main {
    padding: 8px 0;
}

/* ===== CALENDAR LEGEND ===== */
.cal-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 12px;
    padding: 8px 0;
}

.cal-leg-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--txt3);
}

.cal-leg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.cal-leg-dot.period {
    background: var(--grad1);
}

.cal-leg-dot.fertile {
    background: var(--cyan);
}

.cal-leg-dot.pms {
    background: var(--rose);
}

.cal-day-num {
    font-size: 13px;
    font-weight: 500;
}

.cal-marker {
    font-size: 8px;
    position: absolute;
    bottom: 2px;
}

.cal-multi-check {
    position: absolute;
    top: 1px;
    right: 3px;
    font-size: 8px;
    color: var(--pink);
    font-weight: 700;
}

.cal-cell.multi-selected {
    border-color: var(--pink);
    background: rgba(236, 72, 153, .1);
}

.cal-cell.pms {
    border-color: rgba(244, 63, 94, .3);
    background: rgba(244, 63, 94, .06);
}

/* ===== SECTION TITLES ===== */
.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--txt2);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 16px 0 8px;
    padding-left: 4px;
}

/* ===== GENERIC STYLED BUTTONS (reset, etc.) ===== */
.btn-danger {
    padding: 10px 20px;
    border-radius: 14px;
    background: rgba(244, 63, 94, .1);
    border: 1px solid rgba(244, 63, 94, .3);
    color: var(--rose);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all .2s;
}

.btn-danger:hover {
    background: rgba(244, 63, 94, .2);
    border-color: var(--rose);
}

.btn-secondary {
    padding: 10px 20px;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--gborder);
    color: var(--txt2);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all .2s;
}

.btn-secondary:hover {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .1);
}

/* ===== CALENDAR POPUP BUTTONS ===== */
.cal-popup-btn {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 14px;
    border: 1px solid var(--gborder);
    background: var(--glass);
    color: var(--txt);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all .2s;
    text-align: left;
}

.cal-popup-btn:hover {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .1);
}

.cal-popup-btn:last-child {
    margin-bottom: 0;
    text-align: center;
    color: var(--txt3);
    font-size: 12px;
}

/* ===== CYCLE RESET BUTTON ===== */
.cycle-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(244, 63, 94, .06);
    border: 1px solid rgba(244, 63, 94, .2);
    color: var(--rose);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all .2s;
}

.cycle-reset-btn:hover {
    background: rgba(244, 63, 94, .15);
    border-color: var(--rose);
}

/* ===== FORUM VOTE / BOOKMARK BUTTONS ===== */
.vote-btn {
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--gborder);
    background: var(--glass);
    color: var(--txt2);
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
    font-family: var(--font-body);
}

.vote-btn:hover {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .1);
    color: var(--txt);
}

.forum-bookmark-btn {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--gborder);
    background: var(--glass);
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}

.forum-bookmark-btn:hover {
    border-color: var(--gold);
    background: rgba(251, 191, 36, .1);
}

/* ===== FORUM CARDS ===== */
.forum-post-card {
    background: var(--glass);
    border: 1px solid var(--gborder);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all .2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.forum-post-card:hover,
.forum-post-card:active {
    border-color: rgba(124, 58, 237, .3);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(124, 58, 237, .1);
}

.forum-post-card.full {
    cursor: default;
}

.forum-post-card.full:hover {
    transform: none;
    box-shadow: none;
}

.forum-post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.forum-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--glass-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.forum-post-meta {
    flex: 1;
    min-width: 0;
}

.forum-author {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    gap: 6px;
}

.forum-anon-badge {
    font-size: 10px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--purple);
    padding: 1px 6px;
    border-radius: 6px;
    font-style: italic;
    font-weight: 400;
}

.forum-time {
    font-size: 10px;
    color: var(--txt3);
}

.forum-post-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}

.forum-post-body {
    font-size: 13px;
    color: var(--txt2);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.forum-post-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.forum-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--txt3);
}

.forum-score {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--txt3);
    background: var(--glass-heavy);
    padding: 4px 10px;
    border-radius: 10px;
}

.forum-score.positive {
    color: #10b981;
}

.forum-score.negative {
    color: #ef4444;
}

.forum-back-btn {
    background: none;
    border: none;
    color: var(--purple);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-body);
}

.forum-back-btn:hover {
    opacity: .8;
}

/* Forum reply compose */
.forum-reply-compose {
    background: var(--glass);
    border: 1px solid var(--gborder);
    border-radius: 16px;
    padding: 12px;
    margin: 12px 0;
}

.forum-reply-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--gborder);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--txt);
    font-family: var(--font-body);
    resize: none;
    outline: none;
    transition: border-color .2s;
}

.forum-reply-input:focus {
    border-color: var(--purple);
}

.forum-reply-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.forum-voice-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--gborder);
    background: var(--glass);
    color: var(--txt2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
}

.forum-voice-btn:hover {
    border-color: var(--purple);
    color: var(--purple);
}

.forum-voice-btn.recording {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, .1);
    animation: voicePulse 1s ease-in-out infinite;
}

.forum-voice-status {
    font-size: 11px;
    color: var(--txt3);
}

.forum-voice-status.active {
    color: #ef4444;
}

.forum-send-btn {
    padding: 8px 16px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--purple), #a855f7);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    transition: all .2s;
}

.forum-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, .3);
}

@keyframes voicePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, .3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

/* Forum voice player */
.forum-voice-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--glass-heavy);
    border-radius: 12px;
    margin-top: 8px;
}

.forum-voice-player button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

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

.forum-voice-player .voice-progress-fill {
    height: 100%;
    background: var(--purple);
    border-radius: 2px;
    transition: width .1s;
}

.forum-voice-player .voice-time {
    font-size: 10px;
    color: var(--txt3);
    min-width: 35px;
}

.forum-voice-player .voice-speed {
    font-size: 10px;
    color: var(--purple);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(124, 58, 237, .1);
    border: none;
    font-weight: 600;
}


.tarot-btn {
    padding: 12px 24px;
    border-radius: 16px;
    border: none;
    background: var(--purple-grad);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all .3s;
    letter-spacing: 0.3px;
}

.tarot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, .3);
}

.tarot-btn:active {
    transform: scale(.97);
}

/* ===== AUTH TABS ===== */
.auth-tabs {
    display: flex;
    position: relative;
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--gborder);
    border-radius: 14px;
    padding: 3px;
    margin-bottom: 16px;
}

.auth-tab-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: var(--purple-grad);
    border-radius: 12px;
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    z-index: 0;
    box-shadow: 0 2px 8px rgba(124, 58, 237, .25);
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--txt2);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color .3s;
    border-radius: 12px;
}

.auth-tab.active {
    color: white;
}

.auth-tab-content {
    width: 100%;
    min-height: 140px;
}

.auth-form-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== AUTH SOCIAL ICON BUTTONS ===== */
.auth-social-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.auth-social-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--gborder);
    background: var(--glass);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
}

.auth-social-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.auth-social-icon-btn.vk {
    background: linear-gradient(135deg, #4a76a8, #5d8bb8);
    border-color: transparent;
}

.auth-social-icon-btn.yandex {
    background: linear-gradient(135deg, #fc3f1d, #ff5533);
    border-color: transparent;
}

.auth-social-icon-btn.google {
    background: white;
    border-color: rgba(0, 0, 0, .1);
}

.auth-social-icon-btn.apple {
    background: linear-gradient(135deg, #333, #1a1a1a);
    border-color: transparent;
}

.dark .auth-social-icon-btn.google {
    background: rgba(255, 255, 255, .1);
    border-color: var(--gborder);
}

/* ===== AUTH THEME BUTTON ===== */
.auth-theme-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--gborder);
    background: var(--glass);
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s;
    z-index: 10;
}

.auth-theme-btn:hover {
    transform: scale(1.1);
    border-color: var(--purple);
}

.auth-theme-icon {
    font-size: 18px;
    line-height: 1;
}

/* ===== PIN CODE ===== */
.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--gborder);
    background: transparent;
    transition: all .2s ease;
}

.pin-dot.filled {
    background: var(--purple);
    border-color: var(--purple);
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(124, 58, 237, .4);
}

.pin-keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
}

.pin-key {
    width: 64px;
    height: 52px;
    border-radius: 16px;
    border: 1px solid var(--gborder);
    background: var(--glass);
    color: var(--txt);
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s ease;
    margin: 0 auto;
    -webkit-tap-highlight-color: transparent;
}

.pin-key:active {
    transform: scale(.92);
    background: var(--purple);
    color: white;
    border-color: var(--purple);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

/* ===== STORIES ===== */
.stories-bar {
    margin: 4px -16px 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
}

.stories-scroll {
    display: flex;
    gap: 12px;
    padding: 0 16px;
    overflow-x: auto;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.story-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #7c3aed, #ec4899, #fbbf24, #ec4899, #7c3aed);
    background-size: 300% 300%;
    animation: ringShimmer 4s ease infinite;
    box-shadow: 0 0 12px rgba(124, 58, 237, .3);
    transition: transform .2s ease, box-shadow .2s ease;
}

.story-ring:active {
    transform: scale(0.92);
    box-shadow: 0 0 20px rgba(124, 58, 237, .5);
}

@keyframes ringShimmer {

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

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

.story-ring.viewed {
    background: var(--gborder);
    animation: none;
    box-shadow: none;
}

.story-ring.add {
    background: var(--glass-heavy);
    border: 2px dashed var(--purple);
    animation: none;
    box-shadow: none;
}

.story-ring.processing {
    background: conic-gradient(#7c3aed calc(var(--progress, 0) * 1%),
            rgba(124, 58, 237, .2) calc(var(--progress, 0) * 1%));
    animation: processingPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 16px rgba(124, 58, 237, .4);
}

.story-ring.processing .story-avatar-wrap {
    opacity: .6;
}

@keyframes processingPulse {

    0%,
    100% {
        box-shadow: 0 0 12px rgba(124, 58, 237, .3);
    }

    50% {
        box-shadow: 0 0 24px rgba(124, 58, 237, .6);
    }
}

.story-avatar-wrap {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--txt2);
    overflow: hidden;
}

.story-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.story-name {
    font-size: 10px;
    color: var(--txt3);
    max-width: 60px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Story frosted dropdown menu */
.story-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: transparent;
}

.story-dropdown {
    position: fixed;
    top: calc(env(safe-area-inset-top, 8px) + 66px);
    right: 14px;
    z-index: 10011;
    min-width: 210px;
    background: rgba(255, 255, 255, .1);
    backdrop-filter: blur(60px) saturate(200%) brightness(1.1);
    -webkit-backdrop-filter: blur(60px) saturate(200%) brightness(1.1);
    border-radius: 24px;
    border: 0.5px solid rgba(255, 255, 255, .25);
    padding: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .15);
    opacity: 0;
    transform: scale(0.7);
    transform-origin: top right;
    transition: opacity .2s ease, transform .2s cubic-bezier(.32, .72, 0, 1);
    pointer-events: none;
}

.story-dropdown.open {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.light .story-dropdown {
    background: rgba(255, 255, 255, .55);
    border-color: rgba(255, 255, 255, .6);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .1), inset 0 1px 0 rgba(255, 255, 255, .5);
}

.story-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 18px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: rgba(255, 255, 255, .9);
    font-size: 15px;
    font-family: var(--font);
    cursor: pointer;
    transition: background .15s ease;
}

.story-dropdown-btn:active {
    background: rgba(255, 255, 255, .1);
}

.story-dropdown-btn.destructive {
    color: #FF453A;
}

.light .story-dropdown-btn {
    color: var(--txt);
}

.light .story-dropdown-btn:active {
    background: rgba(0, 0, 0, .05);
}

.light .story-dropdown-btn.destructive {
    color: #FF3B30;
}

/* Story creator overlay */
.story-creator-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-end;
    opacity: 0;
    transition: opacity .3s ease;
}

.story-creator-overlay.active {
    opacity: 1;
}

.story-creator {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    padding: 20px 20px calc(env(safe-area-inset-bottom, 20px) + 12px);
    transform: translateY(100%);
    transition: transform .3s ease;
    max-height: 85vh;
    overflow-y: auto;
}

.story-creator-overlay.active .story-creator {
    transform: translateY(0);
}

.story-creator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.story-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.story-creator-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.story-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--gborder);
    cursor: pointer;
    transition: all .2s;
    font-size: 12px;
    color: var(--txt2);
}

.story-option:hover {
    border-color: var(--purple);
    transform: translateY(-2px);
}

.story-option-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(124, 58, 237, .1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple);
}

/* Story preview */
.story-preview {
    margin-top: 16px;
}

.story-media-preview {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
}

.story-caption-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--gborder);
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
    color: var(--txt);
    margin-top: 8px;
    resize: none;
    font-family: var(--font-body);
    outline: none;
}

.story-caption-input:focus {
    border-color: var(--purple);
}

/* Text story creator */
.story-text-creator {
    border-radius: 16px;
    padding: 40px 20px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.story-text-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    resize: none;
    outline: none;
    font-family: var(--font-display);
    min-height: 100px;
}

.story-text-input::placeholder {
    color: rgba(255, 255, 255, .5);
}

.story-text-actions {
    display: flex;
    align-items: center;
    margin-top: 16px;
}

/* Story viewer */
.story-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: #000;
    opacity: 0;
    transition: opacity .3s ease;
}

.story-viewer-overlay.active {
    opacity: 1;
}

.story-viewer {
    width: 100%;
    height: 100%;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.story-viewer-progress {
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: rgba(255, 255, 255, .2);
    border-radius: 1px;
    z-index: 2;
}

.story-progress-fill {
    height: 100%;
    background: white;
    border-radius: 1px;
    width: 0%;
}

.story-viewer-header {
    position: absolute;
    top: 16px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.story-viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.story-viewer-content.text {
    border-radius: 0;
}

.story-viewer-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-viewer-text {
    font-size: 24px;
    font-weight: 600;
    color: white;
    text-align: center;
    padding: 40px;
    line-height: 1.5;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.story-viewer-caption {
    position: absolute;
    bottom: 40px;
    left: 16px;
    right: 16px;
    color: white;
    font-size: 14px;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

.story-viewer-nav {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 1;
}

.story-nav-prev,
.story-nav-next {
    flex: 1;
    cursor: pointer;
}

/* ===== STORY EDITOR ===== */
.story-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: #000;
    opacity: 0;
    transition: opacity .3s ease;
}

.story-editor-overlay.active {
    opacity: 1;
}

.story-editor {
    width: 100%;
    height: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}

.story-editor-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    flex-shrink: 0;
}

.story-editor-frame {
    aspect-ratio: 9 / 16;
    max-width: calc(100% - 24px);
    height: 55vh;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 2px solid rgba(124, 58, 237, .4);
    background: #111;
    touch-action: none;
    cursor: grab;
    flex-shrink: 0;
}

.story-editor-frame:active {
    cursor: grabbing;
}

.story-editor-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
}

.story-editor-media img,
.story-editor-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Grid lines */
.story-editor-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .2;
}

.story-grid-line {
    position: absolute;
    background: white;
}

.story-grid-line.h1 {
    left: 0;
    right: 0;
    top: 33.33%;
    height: 1px;
}

.story-grid-line.h2 {
    left: 0;
    right: 0;
    top: 66.66%;
    height: 1px;
}

.story-grid-line.v1 {
    top: 0;
    bottom: 0;
    left: 33.33%;
    width: 1px;
}

.story-grid-line.v2 {
    top: 0;
    bottom: 0;
    left: 66.66%;
    width: 1px;
}

/* Controls */
.story-editor-controls {
    flex-shrink: 0;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.story-editor-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.story-ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .08);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
}

.story-ctrl-btn:active {
    transform: scale(.9);
    background: rgba(124, 58, 237, .3);
    border-color: var(--purple);
}

.story-ctrl-btn.reset {
    background: rgba(124, 58, 237, .15);
    border-color: rgba(124, 58, 237, .3);
}

.story-publish-btn {
    padding: 14px 24px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, var(--purple), #a855f7);
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .2s;
}

.story-publish-btn:active {
    transform: scale(.97);
}

/* ===== STORY COMMENTS PANEL ===== */
.story-comments-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 60vh;
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform .3s ease;
    z-index: 10;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .3);
}

.story-comments-panel.open {
    transform: translateY(0);
}

.story-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--gborder);
    color: var(--txt);
    flex-shrink: 0;
}

.story-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    max-height: 35vh;
}

.story-comment {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
}

.story-comment-compose {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    border-top: 1px solid var(--gborder);
    flex-shrink: 0;
}

.story-comment-input {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--gborder);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--txt);
    font-family: var(--font-body);
    outline: none;
}

.story-comment-input:focus {
    border-color: var(--purple);
}

.story-comment-send {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--purple), #a855f7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.story-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.story-comment-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pink);
    color: white;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}