/* ═══════════════════════════════════════════
   JADE DESIGN SYSTEM — SOFT MIDNIGHT
   Dark · Cottagecore · Whimsical · Spiritual
   ═══════════════════════════════════════════ */

:root {
    /* Midnight Base */
    --bg-deep: #0f1a14;
    --bg-main: #141f18;
    --bg-card: #1e3225;
    --bg-elevated: #253d2d;
    --bg-surface: #2c4735;

    /* Jade Crystal Palette (muted for dark) */
    --jade-deep: #c5e0d2;
    --jade-dark: #a8d0b8;
    --jade-primary: #5a9e7a;
    --jade-medium: #4a8c6a;
    --jade-light: #3a7558;
    --jade-pale: #2d5a3d;
    --jade-mist: #1e3a28;
    --jade-whisper: #182e20;

    /* Text */
    --text-primary: #dde8e0;
    --text-secondary: #8aaa96;
    --text-muted: #5e8570;
    --text-faint: #3d5e4a;

    /* Warm Cottage Accents */
    --cream: #182a1e;
    --cream-dark: #1e3225;
    --parchment: #234030;
    --honey: #c9a45a;
    --honey-light: #a8863f;
    --rose: #c9867e;
    --rose-light: #a06b64;
    --lavender: #9b8ab8;
    --lavender-light: #7a6d96;
    --sky: #6a96b0;

    /* Typography */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Quicksand', 'Segoe UI', sans-serif;
    --font-handwritten: 'Caveat', cursive;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Borders & Shadows */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lifted: 0 8px 32px rgba(0, 0, 0, 0.4);
    --border-subtle: 1px solid rgba(90, 158, 122, 0.12);
    --border-medium: 1px solid rgba(90, 158, 122, 0.2);

    /* Layout */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --nav-height: 72px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; overflow: hidden; background: #0f1a14; }

body {
    font-family: var(--font-body);
    background: var(--bg-main);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══════ JADE CRYSTAL BACKGROUND ═══════ */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('jade-texture.png') center/cover no-repeat;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
    filter: brightness(0.5);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(90, 158, 122, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(90, 158, 122, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ═══════ AUTH SCREEN ═══════ */
#authScreen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
}

#authScreen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('jade-texture.png') center/cover no-repeat;
    opacity: 0.15;
    filter: brightness(0.5);
}

.auth-container {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: var(--space-xl);
    max-width: 360px;
    width: 100%;
}

.auth-logo {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 500;
    letter-spacing: 10px;
    color: var(--jade-dark);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.auth-tagline {
    font-family: var(--font-handwritten);
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: var(--space-2xl);
}

.auth-form { display: flex; flex-direction: column; gap: var(--space-md); }

.auth-input {
    border: var(--border-medium);
    border-radius: var(--radius-md);
    padding: 14px var(--space-md);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-card);
    outline: none;
    transition: border-color 0.2s;
}

.auth-input:focus { border-color: var(--jade-primary); }
.auth-input::placeholder { color: var(--text-faint); }

.auth-btn {
    background: linear-gradient(135deg, var(--jade-primary), var(--jade-pale));
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--radius-xl);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.3s;
    margin-top: var(--space-sm);
}

.auth-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-medium); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-toggle { margin-top: var(--space-lg); font-size: 13px; color: var(--text-muted); }
.auth-toggle a { color: var(--jade-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.auth-error { color: var(--rose); font-size: 13px; min-height: 20px; margin-top: var(--space-xs); }

/* ═══════ APP SHELL ═══════ */
.content-area-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

#app {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app-header {
    padding: calc(var(--safe-top) + var(--space-md)) var(--space-lg) var(--space-md);
    text-align: center;
    flex-shrink: 0;
}

.app-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: 6px;
    color: var(--jade-dark);
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

.app-title::before,
.app-title::after {
    content: '\2726';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--jade-light);
    opacity: 0.7;
}

.app-title::before { left: -24px; }
.app-title::after { right: -24px; }

.app-subtitle {
    font-family: var(--font-handwritten);
    font-size: 15px;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 1px;
}

/* ═══════ CONTENT AREA ═══════ */
.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 var(--space-lg) var(--space-lg);
    -webkit-overflow-scrolling: touch;
}

.content-area::-webkit-scrollbar { width: 4px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--jade-mist); border-radius: 4px; }

@media (max-width: 599px) {
    .content-area::-webkit-scrollbar { display: none; }
    .content-area { -ms-overflow-style: none; scrollbar-width: none; }
}

/* ═══════ PAGES ═══════ */
.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }

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

/* ═══════ AFFIRMATION BANNER ═══════ */
.affirmation-banner {
    background: linear-gradient(135deg, var(--bg-elevated), var(--jade-pale));
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: var(--border-subtle);
}

.affirmation-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(90, 158, 122, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(90, 158, 122, 0.06) 0%, transparent 50%);
}

.affirmation-banner p {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 300;
    font-style: italic;
    line-height: 1.6;
    position: relative;
    z-index: 1;
    color: var(--jade-dark);
}

.affirmation-banner .source {
    font-family: var(--font-handwritten);
    font-size: 14px;
    opacity: 0.5;
    margin-top: var(--space-sm);
    font-style: normal;
    position: relative;
    z-index: 1;
    color: var(--text-secondary);
}

.affirmation-edit-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(168, 208, 184, 0.15);
    background: rgba(168, 208, 184, 0.08);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.affirmation-edit-btn:hover { background: rgba(168, 208, 184, 0.15); color: var(--text-secondary); }

/* ═══════ ALIGNMENT WIDGET ═══════ */
.alignment-widget {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
    margin-bottom: var(--space-lg);
}

.alignment-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.alignment-widget-header h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 400;
    color: var(--text-primary);
}

.alignment-widget-header span {
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--text-muted);
}

.alignment-scale { display: flex; gap: var(--space-xs); margin-bottom: var(--space-sm); }

.alignment-dot {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.alignment-dot.filled {
    background: linear-gradient(135deg, var(--jade-light), var(--jade-primary));
}

.alignment-dot:hover { transform: scaleY(1.5); }

.alignment-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-faint);
    font-weight: 300;
}

/* Alignment History */
.alignment-history {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: var(--border-subtle);
}

.alignment-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.alignment-history-title {
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--text-muted);
}

.alignment-history-toggle {
    background: none; border: none;
    font-family: var(--font-body);
    font-size: 12px; color: var(--jade-primary);
    cursor: pointer; text-decoration: underline;
    text-underline-offset: 2px;
}

.alignment-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 100px;
    padding: var(--space-sm) 0;
}

.alignment-chart-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.alignment-chart-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.alignment-chart-bar {
    width: 100%;
    max-width: 28px;
    border-radius: 4px 4px 2px 2px;
    background: linear-gradient(to top, var(--jade-pale), var(--jade-primary));
    transition: height 0.4s ease;
    min-height: 2px;
}

.alignment-chart-bar.empty {
    background: var(--bg-surface);
    height: 2px !important;
}

.alignment-chart-bar.today {
    box-shadow: 0 0 8px rgba(90, 158, 122, 0.3);
}

.alignment-chart-label {
    font-size: 10px;
    color: var(--text-faint);
    font-weight: 500;
}

.alignment-chart-label.today {
    color: var(--jade-primary);
}

/* ═══════ FEATURE GRID ═══════ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding-bottom: var(--space-xl);
}

.feature-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all 0.3s;
    border: var(--border-subtle);
    position: relative;
    overflow: hidden;
    display: block;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--jade-light), var(--jade-primary));
    opacity: 0;
    transition: opacity 0.3s;
}

.feature-card:hover,
.feature-card:active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-color: rgba(90, 158, 122, 0.25);
}

.feature-card:hover::before,
.feature-card:active::before { opacity: 1; }

.feature-card-icon { font-size: 28px; margin-bottom: var(--space-sm); display: block; }
.feature-card-title { font-family: var(--font-display); font-size: 17px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.feature-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; font-weight: 300; }
.feature-card.full-width { grid-column: 1 / -1; }

.feature-card[data-accent="rose"]::before { background: linear-gradient(90deg, var(--rose-light), var(--rose)); }
.feature-card[data-accent="lavender"]::before { background: linear-gradient(90deg, var(--lavender-light), var(--lavender)); }
.feature-card[data-accent="honey"]::before { background: linear-gradient(90deg, var(--honey-light), var(--honey)); }
.feature-card[data-accent="sky"]::before { background: linear-gradient(90deg, var(--sky), #5a8699); }

/* ═══════ SECTION HEADERS ═══════ */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding-top: var(--space-md);
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 400;
    color: var(--text-primary);
    flex: 1;
}

.back-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: var(--border-medium); background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--jade-primary); font-size: 18px;
    transition: all 0.2s; flex-shrink: 0;
}

.back-btn:hover { background: var(--bg-elevated); }

.section-action-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: var(--border-medium); background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--jade-primary); font-size: 20px;
    transition: all 0.2s; flex-shrink: 0;
}

.section-action-btn:hover { background: var(--bg-elevated); }

/* ═══════ PLACEHOLDER ═══════ */
.placeholder-content { text-align: center; padding: var(--space-2xl) var(--space-lg); }
.placeholder-icon { font-size: 48px; margin-bottom: var(--space-md); opacity: 0.8; }
.placeholder-content h3 { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--text-primary); margin-bottom: var(--space-sm); }
.placeholder-content p { font-size: 14px; color: var(--text-muted); line-height: 1.6; max-width: 300px; margin: 0 auto; }

.coming-soon-badge {
    display: inline-block;
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--honey);
    background: rgba(201, 164, 90, 0.1);
    padding: 4px 16px;
    border-radius: 20px;
    margin-top: var(--space-md);
}

/* ═══════ JOURNAL ═══════ */
.journal-entries { display: flex; flex-direction: column; gap: var(--space-md); }

.journal-entry-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s;
}

.journal-entry-card:hover { box-shadow: var(--shadow-soft); border-color: rgba(90, 158, 122, 0.2); }

.journal-entry-date { font-family: var(--font-handwritten); font-size: 14px; color: var(--text-muted); margin-bottom: var(--space-xs); }
.journal-entry-title { font-family: var(--font-display); font-size: 19px; font-weight: 500; color: var(--text-primary); margin-bottom: var(--space-xs); }

.journal-entry-preview {
    font-size: 13px; color: var(--text-muted); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.journal-entry-author { font-size: 11px; color: var(--text-faint); margin-top: var(--space-sm); font-weight: 500; }

.journal-editor { display: none; }
.journal-editor.active { display: block; }

.journal-editor-title {
    width: 100%; border: none; outline: none;
    font-family: var(--font-display);
    font-size: 24px; font-weight: 500;
    color: var(--text-primary); background: transparent;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: var(--border-subtle);
}

.journal-editor-title::placeholder { color: var(--text-muted); }

.journal-editor-body {
    width: 100%; border: none; outline: none;
    font-family: var(--font-body);
    font-size: 15px; line-height: 1.8;
    color: var(--text-primary); background: transparent;
    resize: none; min-height: 300px;
}

.journal-editor-body::placeholder { color: var(--text-muted); }

.journal-editor-actions {
    display: flex; gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: var(--border-subtle);
}

.empty-state { text-align: center; padding: var(--space-2xl) var(--space-lg); color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: var(--space-md); opacity: 0.5; }
.empty-state p { font-size: 14px; line-height: 1.6; max-width: 260px; margin: 0 auto; }

/* ═══════ MESSENGER ═══════ */
.messenger-container {
    display: flex; flex-direction: column;
    height: calc(100vh - 180px);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-subtle);
    overflow: hidden;
}

.messenger-messages {
    flex: 1; overflow-y: auto; padding: var(--space-md);
    display: flex; flex-direction: column; gap: var(--space-sm);
}

.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
}

.msg-row.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-row.received {
    align-self: flex-start;
}

.msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.msg-avatar-initial {
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.msg {
    max-width: 100%; padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg); font-size: 14px; line-height: 1.5;
    word-wrap: break-word;
}

.msg.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--jade-primary), var(--jade-pale));
    color: white;
    border-bottom-right-radius: 4px;
}

.msg.received {
    align-self: flex-start;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.msg-time { display: none; }
.msg-sender { display: none; }

.messenger-input-area {
    display: flex; gap: var(--space-sm);
    padding: var(--space-md);
    border-top: var(--border-subtle);
    background: var(--bg-elevated);
}

.messenger-input {
    flex: 1; border: var(--border-medium);
    border-radius: var(--radius-xl); padding: 12px var(--space-md);
    font-family: var(--font-body); font-size: 15px;
    outline: none; background: var(--bg-card); color: var(--text-primary);
    min-height: 44px;
}

.messenger-input::placeholder { color: var(--text-faint); }
.messenger-input:focus { border-color: var(--jade-primary); }

.messenger-send {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--jade-primary), var(--jade-pale));
    border: none; color: white; font-size: 16px;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}

.messenger-send:hover { transform: scale(1.05); }

.msg:active { opacity: 0.7; transition: opacity 0.1s; }

/* ═══════ MODAL ═══════ */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 100; align-items: flex-end; justify-content: center;
}

.modal-overlay.visible { display: flex; }

.modal-content {
    background: var(--bg-main);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%; max-width: 540px; max-height: 80vh;
    display: flex; flex-direction: column;
    animation: slideUp 0.3s ease;
    border-top: var(--border-medium);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    border-bottom: var(--border-subtle); flex-shrink: 0;
}

.modal-header h3 { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--text-primary); }

.modal-close {
    width: 36px; height: 36px; border-radius: 50%;
    border: var(--border-medium); background: var(--bg-card);
    color: var(--jade-primary); font-size: 20px;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
}

.modal-close:hover { background: var(--bg-elevated); }
.modal-body { padding: var(--space-lg); overflow-y: auto; flex: 1; }
.modal-description { font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-lg); line-height: 1.5; }

.affirmation-list-item {
    display: flex; align-items: flex-start; gap: var(--space-sm);
    padding: var(--space-md); background: var(--bg-card);
    border-radius: var(--radius-md); border: var(--border-subtle);
    margin-bottom: var(--space-sm);
}

.affirmation-list-item .affirmation-text {
    flex: 1; font-family: var(--font-display);
    font-size: 15px; font-style: italic; color: var(--text-primary);
    line-height: 1.5; border: none; background: none;
    resize: none; width: 100%; outline: none;
}

.affirmation-delete-btn {
    width: 28px; height: 28px; border-radius: 50%;
    border: 1px solid var(--rose-light); background: none;
    color: var(--rose); font-size: 14px; cursor: pointer;
    flex-shrink: 0; display: flex;
    align-items: center; justify-content: center;
    opacity: 0.5; transition: all 0.2s;
}

.affirmation-delete-btn:hover { opacity: 1; background: rgba(201, 134, 126, 0.1); }

.affirmation-add { margin-top: var(--space-md); display: flex; gap: var(--space-sm); align-items: flex-end; }

.affirmation-input {
    flex: 1; border: var(--border-medium);
    border-radius: var(--radius-md); padding: var(--space-md);
    font-family: var(--font-display); font-size: 15px;
    font-style: italic; color: var(--text-primary);
    background: var(--bg-card); resize: none; outline: none;
}

.affirmation-input::placeholder { color: var(--text-faint); }
.affirmation-input:focus { border-color: var(--jade-primary); }

/* ═══════ BUTTONS ═══════ */
.btn-primary {
    background: linear-gradient(135deg, var(--jade-primary), var(--jade-pale));
    color: white; border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-xl);
    font-family: var(--font-body); font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.3s;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-medium); }

.btn-secondary {
    background: var(--bg-card); color: var(--jade-primary);
    border: var(--border-medium);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-xl);
    font-family: var(--font-body); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
}

.btn-secondary:hover { background: var(--bg-elevated); }
.btn-sm { padding: var(--space-sm) var(--space-lg); font-size: 13px; }

.btn-danger {
    background: var(--rose); color: white; border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-xl);
    font-family: var(--font-body); font-size: 13px;
    cursor: pointer; transition: all 0.2s;
}

.btn-danger:hover { opacity: 0.9; }

/* ═══════ BOTTOM NAV ═══════ */
.bottom-nav {
    flex-shrink: 0; background: var(--bg-deep);
    border-top: var(--border-subtle);
    padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + var(--safe-bottom));
    display: flex; justify-content: space-around; align-items: center;
    height: calc(var(--nav-height) + var(--safe-bottom));
    position: relative;
}

.bottom-nav::before {
    content: ''; position: absolute; top: -20px; left: 0; right: 0; height: 20px;
    background: linear-gradient(to top, var(--bg-main), transparent);
    pointer-events: none;
}

.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    cursor: pointer; padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md); border: none; background: none;
    color: var(--text-faint); position: relative;
    -webkit-tap-highlight-color: transparent; transition: all 0.2s;
}

.nav-item.active { color: var(--jade-primary); }

.nav-item.active::after {
    content: ''; position: absolute; top: -9px; left: 50%;
    transform: translateX(-50%); width: 20px; height: 3px;
    background: var(--jade-primary); border-radius: 0 0 3px 3px;
}

.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.5px; }

/* ═══════ SETTINGS ═══════ */
.settings-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
    margin-bottom: var(--space-md);
}

.settings-section h3 {
    font-family: var(--font-display);
    font-size: 18px; font-weight: 500; color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: var(--border-subtle);
}

.settings-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--jade-pale);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.settings-avatar span {
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--text-muted);
    font-weight: 500;
}

.settings-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-avatar-btn {
    cursor: pointer;
    text-align: center;
    display: inline-block;
}

.settings-avatar-hint {
    font-size: 12px;
    color: var(--text-faint);
    font-family: var(--font-handwritten);
}

.settings-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-sm) 0;
}

.settings-label { font-size: 14px; color: var(--text-primary); }
.settings-value { font-size: 13px; color: var(--text-muted); }

/* ═══════ PERSONAS ═══════ */
.personas-list { display: flex; flex-direction: column; gap: var(--space-md); }

.persona-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.persona-card:hover { box-shadow: var(--shadow-soft); border-color: rgba(90, 158, 122, 0.2); }

.persona-card-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--jade-pale);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.persona-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

.persona-card-avatar span {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--text-muted);
    font-weight: 500;
}

.persona-card-info { flex: 1; min-width: 0; }

.persona-card-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
}

.persona-card-age {
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 1px;
}

.persona-card-preview {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.persona-card-arrow {
    font-size: 24px;
    color: var(--text-faint);
    flex-shrink: 0;
}

/* Detail View */
.persona-detail { animation: fadeIn 0.3s ease; }

.persona-detail-hero {
    text-align: center;
    padding: var(--space-lg) 0 var(--space-xl);
}

.persona-detail-avatar {
    width: 96px; height: 96px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 3px solid var(--jade-pale);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
}

.persona-detail-avatar img { width: 100%; height: 100%; object-fit: cover; }

.persona-detail-avatar span {
    font-family: var(--font-display);
    font-size: 36px;
    color: var(--text-muted);
    font-weight: 500;
}

.persona-detail-name {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    color: var(--text-primary);
}

.persona-detail-age {
    font-family: var(--font-handwritten);
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 2px;
}

.persona-detail-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-md);
}

.persona-detail-fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding-bottom: var(--space-xl);
}

.persona-detail-field {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
}

.persona-detail-field-label {
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--jade-primary);
    margin-bottom: var(--space-sm);
    letter-spacing: 0.5px;
}

.persona-detail-field-value {
    font-family: var(--font-display);
    font-size: 16px;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
}

/* Editor */
.persona-editor { animation: fadeIn 0.3s ease; padding-bottom: var(--space-xl); }

.persona-editor-avatar-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.persona-editor-avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--jade-pale);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.persona-editor-avatar img { width: 100%; height: 100%; object-fit: cover; }

.persona-editor-avatar span {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--text-muted);
    font-weight: 500;
}

.persona-field-input {
    width: 100%;
    margin-bottom: var(--space-sm);
    resize: none;
}

.persona-extras-section {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: var(--border-subtle);
}

.persona-extras-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.persona-extras-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.persona-extra-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: var(--border-subtle);
}

.persona-extra-item-header {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-sm);
}

.persona-extra-label {
    flex: 1;
    font-family: var(--font-handwritten) !important;
    font-size: 15px !important;
}

.persona-extra-value {
    width: 100%;
    resize: none;
}

/* ═══════ CONNECTIONS ═══════ */
.connections-filters {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.connections-filters::-webkit-scrollbar { display: none; }

.connections-filter {
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    border: var(--border-medium);
    background: var(--bg-card);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.connections-filter.active {
    background: var(--bg-elevated);
    color: var(--jade-primary);
    border-color: var(--jade-primary);
}

.connections-filter:hover:not(.active) { color: var(--text-secondary); }

/* Connection type picker in editor */
.connection-type-picker {
    margin-bottom: var(--space-sm);
}

.connection-type-label {
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--text-muted);
    display: block;
    margin-bottom: var(--space-sm);
}

.connection-type-options {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.connection-type-btn {
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    border: var(--border-medium);
    background: var(--bg-card);
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.connection-type-btn.active {
    background: var(--bg-elevated);
    border-color: var(--jade-primary);
    color: var(--jade-primary);
}

.connection-type-btn:hover:not(.active) { color: var(--text-secondary); }

/* Connection type tag on detail view */
.connection-tag {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 14px;
    border-radius: var(--radius-xl);
    margin-top: var(--space-sm);
    text-transform: capitalize;
}

.connection-tag-love-interest {
    background: rgba(155, 138, 184, 0.15);
    color: var(--lavender);
}

.connection-tag-friends {
    background: rgba(201, 164, 90, 0.15);
    color: var(--honey);
}

.connection-tag-kin {
    background: rgba(201, 134, 126, 0.15);
    color: var(--rose);
}

.connection-tag-pets {
    background: rgba(90, 158, 122, 0.15);
    color: var(--jade-primary);
}

/* ═══════ WORLD / LOCATIONS ═══════ */
.world-card-avatar {
    border-radius: var(--radius-md) !important;
    background: var(--bg-surface);
}

.world-card-avatar span {
    font-size: 24px !important;
    font-family: initial !important;
}

.world-detail-hero {
    text-align: center;
    padding: var(--space-lg) 0 var(--space-xl);
}

.world-detail-photo {
    width: 100%; max-width: 320px; height: 180px;
    border-radius: var(--radius-lg); background: var(--bg-surface);
    border: var(--border-subtle); overflow: hidden;
    margin: 0 auto var(--space-lg); position: relative;
}

.world-detail-photo img { width: 100%; height: 100%; object-fit: cover; }

.world-detail-photo-placeholder {
    width: 100%; height: 100%; display: flex;
    align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 80%, rgba(90, 158, 122, 0.08) 0%, transparent 60%), var(--bg-surface);
}

.world-detail-photo-placeholder span { font-size: 48px; opacity: 0.6; }

.world-editor-photo-row {
    display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-lg);
}

.world-editor-photo {
    width: 80px; height: 56px; border-radius: var(--radius-md);
    background: var(--bg-surface); border: 2px solid var(--jade-pale);
    overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.world-editor-photo img { width: 100%; height: 100%; object-fit: cover; }
.world-editor-photo span { font-size: 24px; }

/* ═══════ OUR SPACE — PHOTO GALLERY ═══════ */
.space-albums-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding-bottom: var(--space-xl);
}

.space-album-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-subtle);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.space-album-card:hover {
    box-shadow: var(--shadow-soft);
    border-color: rgba(90, 158, 122, 0.2);
}

.space-album-cover {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-surface);
}

.space-album-cover-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.space-album-card:hover .space-album-cover-img {
    transform: scale(1.03);
}

.space-album-cover-empty {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 60%, rgba(90, 158, 122, 0.06) 0%, transparent 70%), var(--bg-surface);
}

.space-album-cover-empty span {
    font-size: 36px;
    opacity: 0.4;
}

.space-album-info {
    padding: var(--space-sm) var(--space-md) var(--space-md);
}

.space-album-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.space-album-meta {
    font-family: var(--font-handwritten);
    font-size: 13px;
    color: var(--text-faint);
    margin-top: 1px;
}

.space-album-delete {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    width: 24px; height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: var(--rose);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.space-album-card:hover .space-album-delete { opacity: 1; }

/* Always show delete on touch devices */
@media (hover: none) {
    .space-album-delete { opacity: 0.7; }
}

/* Album header */
.space-album-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    gap: var(--space-sm);
}

.space-album-header-info { flex: 1; }

.space-album-count {
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--text-muted);
}

.space-album-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* Photo Grid */
.space-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding-bottom: var(--space-xl);
}

.space-photo-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    background: var(--bg-surface);
}

.space-photo-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.space-photo-thumb:hover img { transform: scale(1.05); }

.space-photo-thumb-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    font-size: 10px;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
}

.space-photo-thumb:hover .space-photo-thumb-caption { opacity: 1; }

@media (hover: none) {
    .space-photo-thumb-caption { opacity: 1; }
}

/* Photo Detail */
.space-photo-detail {
    text-align: center;
    padding-bottom: var(--space-xl);
}

.space-photo-detail img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}

.space-photo-detail-caption {
    font-family: var(--font-display);
    font-size: 17px;
    font-style: italic;
    color: var(--text-secondary);
    margin-top: var(--space-md);
    line-height: 1.6;
}

.space-photo-detail-meta {
    font-family: var(--font-handwritten);
    font-size: 13px;
    color: var(--text-faint);
    margin-top: var(--space-xs);
}

.space-photo-detail-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

/* Generate Preview */
.space-gen-preview {
    margin-top: var(--space-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: var(--border-subtle);
}

.space-gen-preview img {
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
    background: var(--bg-surface);
    display: block;
}

.space-gen-preview-actions {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    justify-content: center;
    background: var(--bg-card);
}

/* Generate Loading */
.space-gen-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl) 0;
}

.space-gen-loading p {
    font-family: var(--font-handwritten);
    font-size: 15px;
    color: var(--text-muted);
}

.space-gen-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--bg-surface);
    border-top-color: var(--jade-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Move Photo List */
.space-move-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.space-move-item {
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: var(--border-subtle);
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.space-move-item:hover { background: var(--bg-elevated); }
.space-move-item.current { opacity: 0.5; cursor: default; }

/* ═══════ SENSORY ANCHORS ═══════ */
.anchors-intro {
    font-family: var(--font-handwritten);
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

.anchors-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 4px;
    border: var(--border-subtle);
}

.anchors-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.anchors-tab.active {
    background: var(--bg-elevated);
    color: var(--jade-primary);
}

.anchors-tab:hover:not(.active) { color: var(--text-secondary); }

.anchors-panel { display: none; }
.anchors-panel.active { display: block; animation: fadeIn 0.3s ease; }

.anchors-add-area {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
    margin-bottom: var(--space-lg);
}

.anchors-list { display: flex; flex-direction: column; gap: var(--space-md); padding-bottom: var(--space-xl); }

.anchor-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
    transition: all 0.2s;
}

.anchor-card:hover { border-color: rgba(90, 158, 122, 0.2); }

.anchor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.anchor-card-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.anchor-card-meta {
    font-family: var(--font-handwritten);
    font-size: 13px;
    color: var(--text-faint);
    margin-top: 2px;
}

/* Playlist embed */
.playlist-embed {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.playlist-embed iframe {
    border-radius: var(--radius-md);
    display: block;
}

/* Palette swatches */
.palette-swatches {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 72px;
}

.palette-swatch {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.palette-swatch:hover { transform: scaleY(1.08); transform-origin: bottom; }

.palette-swatch-hex {
    font-family: var(--font-body);
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
}

.palette-swatch:hover .palette-swatch-hex { opacity: 1; }

/* Palette builder */
.palette-builder {
    margin-top: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.palette-builder-colours {
    display: flex;
    gap: 4px;
    min-height: 40px;
    flex-wrap: wrap;
}

.palette-builder-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.palette-builder-swatch:hover { border-color: rgba(255, 255, 255, 0.3); transform: scale(1.1); }

.palette-swatch-x {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
}

.palette-builder-swatch:hover .palette-swatch-x { opacity: 1; }

.palette-builder-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.palette-colour-input {
    width: 40px;
    height: 36px;
    border: var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    cursor: pointer;
    padding: 2px;
}

.palette-colour-input::-webkit-color-swatch-wrapper { padding: 2px; }
.palette-colour-input::-webkit-color-swatch { border: none; border-radius: 4px; }

/* Scent cards */
.scent-body {
    font-family: var(--font-display);
    font-size: 15px;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ═══════ PERSISTENT MINI PLAYER ═══════ */
.mini-player {
    flex-shrink: 0;
    background: var(--bg-deep);
    border-top: var(--border-subtle);
    position: relative;
    z-index: 50;
    overflow: hidden;
    transition: all 0.3s ease;
}

.mini-player-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
}

.mini-player-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.mini-player-name {
    flex: 1;
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-controls {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    display: flex;
    gap: 4px;
    z-index: 2;
}

.mini-player-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: var(--border-medium);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mini-player-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.mini-player-embed {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mini-player-embed iframe {
    display: block;
    width: 100%;
    border: none;
}

.mini-player.expanded .mini-player-embed {
    max-height: 160px;
}

.mini-player.expanded #miniPlayerExpand {
    transform: rotate(180deg);
}

/* Adjust content area when mini player is visible */
body.mini-player-active .content-area {
    padding-bottom: var(--space-sm);
}

/* ═══════ SCENE BUILDER ═══════ */
.scene-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.scene-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-subtle);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.scene-card:hover { box-shadow: var(--shadow-soft); border-color: rgba(90, 158, 122, 0.2); }

.scene-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-elevated);
}

.scene-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scene-card-body {
    padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.scene-card-mood {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--honey);
    margin-bottom: var(--space-xs);
    font-family: var(--font-body);
}

.scene-card-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.scene-card-preview {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scene-card-meta {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: var(--space-sm);
    font-family: var(--font-handwritten);
    font-weight: 500;
}

/* Scene Detail */
.scene-detail-image {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.scene-detail-image img {
    width: 100%;
    display: block;
}

.scene-detail-mood {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--honey);
    margin-bottom: var(--space-sm);
}

.scene-detail-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.3;
}

.scene-detail-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
    margin-bottom: var(--space-lg);
}

.scene-detail-meta {
    font-size: 12px;
    color: var(--text-faint);
    font-family: var(--font-handwritten);
    font-weight: 500;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: var(--border-subtle);
}

.scene-detail-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Scene Editor */
.scene-editor-image-area {
    margin-bottom: var(--space-lg);
}

.scene-editor-image-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-elevated);
    border: var(--border-medium);
    border-style: dashed;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.scene-editor-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scene-editor-image-placeholder {
    text-align: center;
    color: var(--text-faint);
}

.scene-editor-image-placeholder span {
    font-size: 32px;
    display: block;
    margin-bottom: var(--space-xs);
}

.scene-editor-image-placeholder p {
    font-size: 13px;
}

.scene-editor-image-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Mood & Category Picker (shared) */
.scene-mood-picker {
    margin-bottom: var(--space-md);
}

.scene-mood-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    display: block;
    margin-bottom: var(--space-sm);
}

.scene-mood-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.scene-mood-btn {
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    border: var(--border-medium);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
}

.scene-mood-btn:hover { background: var(--bg-elevated); }

.scene-mood-btn.active {
    background: var(--jade-pale);
    border-color: var(--jade-primary);
    color: var(--text-primary);
}

/* ═══════ TIMELINE ═══════ */
.timeline-list {
    position: relative;
    padding-left: 24px;
}

.timeline-list::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--jade-pale), var(--jade-light), transparent);
    border-radius: 1px;
}

.timeline-year-marker {
    position: relative;
    font-family: var(--font-handwritten);
    font-size: 18px;
    font-weight: 600;
    color: var(--jade-primary);
    margin-bottom: var(--space-md);
    margin-top: var(--space-lg);
    padding-left: var(--space-md);
}

.timeline-year-marker::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--jade-primary);
    box-shadow: 0 0 8px rgba(90, 158, 122, 0.4);
}

.timeline-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: var(--border-subtle);
    margin-bottom: var(--space-md);
    cursor: pointer;
    transition: all 0.2s;
}

.timeline-card:hover { box-shadow: var(--shadow-soft); border-color: rgba(90, 158, 122, 0.2); }

.timeline-card::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 22px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--jade-light);
}

.timeline-card-date {
    font-family: var(--font-handwritten);
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.timeline-card-cat {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--lavender);
    margin-bottom: var(--space-xs);
    font-family: var(--font-body);
}

.timeline-card-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.timeline-card-preview {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-card-author {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: var(--space-sm);
    font-weight: 500;
}

.timeline-editor {
    display: none;
}

.timeline-editor[style*="display: block"],
.timeline-editor[style*="display:block"] {
    display: block;
}

/* Category colours */
.timeline-card-cat[data-cat="milestone"] { color: var(--honey); }
.timeline-card-cat[data-cat="love"] { color: var(--rose); }
.timeline-card-cat[data-cat="adventure"] { color: var(--sky); }
.timeline-card-cat[data-cat="home"] { color: var(--jade-primary); }
.timeline-card-cat[data-cat="memory"] { color: var(--lavender); }
.timeline-card-cat[data-cat="everyday"] { color: var(--text-muted); }

.scene-card-mood[data-mood="serene"] { color: var(--jade-primary); }
.scene-card-mood[data-mood="golden"] { color: var(--honey); }
.scene-card-mood[data-mood="cosy"] { color: var(--rose); }
.scene-card-mood[data-mood="romantic"] { color: var(--rose); }
.scene-card-mood[data-mood="adventure"] { color: var(--sky); }
.scene-card-mood[data-mood="misty"] { color: var(--lavender); }

/* ═══════ DECORATIVE ═══════ */
.botanical-accent {
    text-align: center; font-size: 20px; opacity: 0.2;
    letter-spacing: 12px; margin: var(--space-lg) 0; color: var(--text-muted);
}

@keyframes floatLeaf {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-6px) rotate(3deg); }
    66% { transform: translateY(-3px) rotate(-2deg); }
}

.float-gentle { animation: floatLeaf 6s ease-in-out infinite; }

/* ═══════ NOTIFICATION PREFERENCES ═══════ */
.notif-pref-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: var(--border-subtle);
    cursor: pointer;
}

.notif-pref-row:last-child { border-bottom: none; }

.notif-pref-label {
    font-size: 14px;
    color: var(--text-primary);
}

.notif-pref-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--bg-surface);
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.notif-pref-row input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s;
}

.notif-pref-row input[type="checkbox"]:checked {
    background: var(--jade-primary);
}

.notif-pref-row input[type="checkbox"]:checked::after {
    left: 22px;
    background: white;
}

/* ═══════ RESPONSIVE — DESKTOP ═══════ */

/* Tablet & small desktop (768px+) */
@media (min-width: 768px) {
    /* App shell: side nav + centered content */
    #app {
        flex-direction: row;
        height: 100vh;
    }

    .app-header {
        padding: var(--space-xl) var(--space-lg) var(--space-md);
    }

    /* Move bottom nav to left sidebar */
    .bottom-nav {
        flex-direction: column;
        width: 80px;
        height: 100vh;
        border-top: none;
        border-right: var(--border-subtle);
        padding: var(--space-xl) var(--space-sm);
        gap: var(--space-sm);
        justify-content: flex-start;
        order: -1;
        flex-shrink: 0;
        position: relative;
    }

    .bottom-nav::before {
        display: none;
    }

    .nav-item {
        width: 100%;
        padding: var(--space-sm) var(--space-xs);
        border-radius: var(--radius-md);
    }

    .nav-item.active::after {
        top: 50%;
        left: -9px;
        right: auto;
        transform: translateY(-50%);
        width: 3px;
        height: 20px;
        border-radius: 0 3px 3px 0;
    }

    .nav-icon { font-size: 20px; }
    .nav-label { font-size: 9px; }

    /* Main content wrapper */
    .content-area-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        overflow: hidden;
    }

    /* Wider content */
    .content-area {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        padding: 0 var(--space-xl) var(--space-xl);
    }

    .app-header {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }

    /* Feature grid: 3 columns */
    .feature-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }

    .feature-card.full-width {
        grid-column: auto;
    }

    .feature-card {
        padding: var(--space-xl);
    }

    .feature-card-icon { font-size: 32px; }
    .feature-card-title { font-size: 18px; }
    .feature-card-desc { font-size: 13px; }

    /* Affirmation banner wider */
    .affirmation-banner {
        padding: var(--space-xl) var(--space-2xl);
    }

    .affirmation-banner p {
        font-size: 20px;
    }

    /* Alignment widget */
    .alignment-widget {
        padding: var(--space-xl);
    }

    /* Journal cards */
    .journal-entries {
        gap: var(--space-lg);
    }

    .journal-entry-card {
        padding: var(--space-xl);
    }

    .journal-entry-title { font-size: 21px; }

    .journal-editor-title { font-size: 28px; }
    .journal-editor-body { font-size: 16px; min-height: 400px; }

    /* Messenger: taller on desktop */
    .messenger-container {
        height: calc(100vh - 200px);
        max-height: 700px;
    }

    .messenger-messages {
        padding: var(--space-lg);
        gap: var(--space-md);
    }

    .msg { font-size: 15px; }
    .msg-row { max-width: 65%; }

    /* Persona cards */
    .persona-card { padding: var(--space-xl); }
    .persona-card-name { font-size: 22px; }
    .persona-detail-name { font-size: 32px; }
    .persona-detail-avatar { width: 120px; height: 120px; }
    .persona-detail-avatar span { font-size: 44px; }

    /* Connections */
    .connections-filters {
        gap: var(--space-sm);
    }

    /* World detail */
    .world-detail-photo {
        max-width: 480px;
        height: 260px;
    }

    /* Space albums: 3 columns */
    .space-albums-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }

    /* Photo grid: 4 columns */
    .space-photo-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    /* Scene cards */
    .scene-card-body { padding: var(--space-lg) var(--space-xl) var(--space-xl); }
    .scene-card-title { font-size: 21px; }

    /* Scene detail */
    .scene-detail-title { font-size: 30px; }
    .scene-detail-text { font-size: 16px; }

    /* Timeline */
    .timeline-card { padding: var(--space-xl); }
    .timeline-card-title { font-size: 20px; }

    /* Settings */
    .settings-section { padding: var(--space-xl); }

    /* Anchors */
    .anchors-tabs {
        max-width: 400px;
    }

    .palette-swatches { height: 88px; }

    /* Section headers */
    .section-header h2 { font-size: 30px; }

    /* Modals center on desktop */
    .modal-overlay {
        align-items: center;
    }

    .modal-content {
        border-radius: var(--radius-xl);
        max-width: 500px;
        max-height: 70vh;
    }

    /* Empty states */
    .empty-state { padding: var(--space-2xl) var(--space-xl); }
    .empty-state-icon { font-size: 48px; }
    .empty-state p { font-size: 15px; max-width: 360px; }

    /* Mini player */
    .mini-player {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Large desktop (1080px+) */
@media (min-width: 1080px) {
    .bottom-nav {
        width: 100px;
        padding: var(--space-xl) var(--space-md);
    }

    .nav-icon { font-size: 22px; }
    .nav-label { font-size: 10px; }

    .content-area,
    .app-header {
        max-width: 860px;
    }

    .mini-player {
        max-width: 860px;
    }

    .feature-card {
        padding: var(--space-xl) var(--space-xl);
    }

    .feature-card-title { font-size: 19px; }

    /* Messenger wider bubbles */
    .msg-row { max-width: 55%; }

    /* Space: 4 album columns */
    .space-albums-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Photo grid: 5 columns */
    .space-photo-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    /* Scene list: 2-column */
    .scene-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }

    /* Timeline cards wider */
    .timeline-card-title { font-size: 22px; }
}

/* Extra wide (1400px+) */
@media (min-width: 1400px) {
    .content-area,
    .app-header {
        max-width: 1000px;
    }

    .mini-player {
        max-width: 1000px;
    }

    .space-photo-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}
