:root {
    --bg-dark: #090710;
    --bg-card: #130f1e;
    --bg-card-hover: #191427;
    --bg-input: #0c0915;
    --border-color: #2e2440;
    --border-glow: #7042a6;
    
    --purple-light: #c084fc;
    --purple-main: #9333ea;
    --purple-deep: #581c87;
    --crimson: #e11d48;
    --crimson-glow: rgba(225, 29, 72, 0.35);
    --amber-candle: #fbbf24;
    --ghost-green: #34d399;
    
    --text-primary: #f3f0f9;
    --text-secondary: #ad9ebf;
    --text-muted: #796c8d;
    --accent-gold: #fcd34d;
    
    --font-heading: 'Cinzel', serif;
    --font-creep: 'Creepster', cursive;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-serif: 'Crimson Pro', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Basics */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    min-height: 100vh;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(ellipse at 50% -10%, rgba(147, 51, 234, 0.18) 0%, transparent 60%),
        radial-gradient(circle at 10% 40%, rgba(225, 29, 72, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 70%, rgba(88, 28, 135, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 110%, rgba(147, 51, 234, 0.1) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.65;
    position: relative;
    overflow-x: hidden;
}

/* Particle Canvas for Eerie Fog / Embers */
.ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.65;
}

/* Candlelight Flicker Mode Overlay */
.candlelight-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    background: radial-gradient(circle at center, rgba(251, 191, 36, 0.12) 0%, rgba(20, 10, 5, 0.45) 80%);
    mix-blend-mode: color-dodge;
    animation: candleFlicker 3s infinite ease-in-out alternate;
}

@keyframes candleFlicker {
    0% { opacity: 0.7; transform: scale(1); filter: brightness(1); }
    25% { opacity: 0.85; transform: scale(1.01); filter: brightness(1.08); }
    50% { opacity: 0.65; transform: scale(0.995); filter: brightness(0.95); }
    75% { opacity: 0.9; transform: scale(1.015); filter: brightness(1.12); }
    100% { opacity: 0.75; transform: scale(1); filter: brightness(1); }
}

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   AMBIENT SOUNDSCAPE CONTROLLER (TOP DOCK)
   ========================================================================== */
.soundscape-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 11, 24, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(147, 51, 234, 0.22);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    transition: var(--transition);
}

.soundscape-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.sound-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sound-toggle-btn {
    background: rgba(46, 36, 64, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.sound-toggle-btn:hover {
    border-color: var(--purple-light);
    background: rgba(147, 51, 234, 0.25);
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.3);
}

.sound-toggle-btn.active {
    background: rgba(147, 51, 234, 0.4);
    border-color: var(--purple-light);
    color: #fff;
    box-shadow: 0 0 15px rgba(192, 132, 252, 0.4);
}

.visualizer-canvas {
    border-radius: 4px;
    background: rgba(10, 7, 16, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sound-presets {
    display: flex;
    align-items: center;
    gap: 6px;
}

.preset-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 5px 11px;
    border-radius: 16px;
    font-size: 0.76rem;
    cursor: pointer;
    transition: var(--transition);
}

.preset-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-glow);
    background: rgba(255, 255, 255, 0.04);
}

.preset-btn.active {
    background: rgba(147, 51, 234, 0.2);
    border-color: var(--purple-light);
    color: var(--purple-light);
    font-weight: 600;
}

.volume-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-icon {
    font-size: 0.85rem;
    opacity: 0.8;
}

input[type="range"]#ambientVolume,
input[type="range"]#pitchSlider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #251d34;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--purple-light);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(192, 132, 252, 0.8);
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.navbar {
    width: min(1120px, 92%);
    margin: 16px auto 0;
    padding: 12px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.35rem;
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.logo:hover {
    text-shadow: 0 0 16px rgba(192, 132, 252, 0.6);
}

.ghost-emoji {
    font-size: 1.6rem;
    animation: floatGhost 3s ease-in-out infinite alternate;
}

@keyframes floatGhost {
    from { transform: translateY(0) rotate(0deg); }
    to { transform: translateY(-4px) rotate(4deg); }
}

.logo-accent {
    color: var(--purple-light);
    font-weight: 900;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-btn {
    background: rgba(30, 22, 45, 0.7);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.nav-btn:hover {
    border-color: var(--purple-light);
    background: rgba(88, 28, 135, 0.4);
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.35);
}

.spirit-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.status-orb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ghost-green);
    box-shadow: 0 0 10px var(--ghost-green);
    animation: pulseOrb 2s infinite ease-in-out;
}

@keyframes pulseOrb {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* ==========================================================================
   CONTAINER & HERO
   ========================================================================== */
.container {
    width: min(840px, 92%);
    margin: 0 auto;
    position: relative;
    z-index: 10;
    padding-bottom: 60px;
}

.hero {
    text-align: center;
    padding: 56px 0 36px;
}

.eyebrow {
    color: var(--purple-light);
    font-size: 0.76rem;
    letter-spacing: 3px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.3rem, 6.5vw, 4.2rem);
    line-height: 1.12;
    letter-spacing: -0.5px;
    margin-bottom: 18px;
}

.blood-text {
    font-family: var(--font-creep);
    color: var(--crimson);
    letter-spacing: 1px;
    text-shadow: 0 0 20px var(--crimson-glow);
}

.hero-text {
    max-width: 580px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
}

/* ==========================================================================
   GENERATOR CARD & FORM
   ========================================================================== */
.generator, .result {
    background: linear-gradient(160deg, rgba(23, 17, 36, 0.95), rgba(14, 10, 22, 0.98));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(147, 51, 234, 0.12);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.generator::before, .result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--purple-light), var(--crimson), transparent);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.small-label {
    color: var(--purple-light);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.section-heading h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.moon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.moon {
    font-size: 2.4rem;
    color: var(--purple-light);
    transform: rotate(-15deg);
    filter: drop-shadow(0 0 12px rgba(192, 132, 252, 0.5));
}

/* Prompt Chips */
.prompts-suggestion {
    margin-bottom: 22px;
    background: rgba(10, 7, 16, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.prompt-chip-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.prompt-chip {
    background: rgba(33, 26, 48, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 5px 11px;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.prompt-chip:hover {
    color: var(--text-primary);
    border-color: var(--purple-light);
    background: rgba(88, 28, 135, 0.4);
    transform: translateY(-1px);
}

/* Form Fields */
.field {
    margin-bottom: 22px;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

textarea, select, input[type="text"], input[type="url"], input[type="password"], input[type="search"] {
    width: 100%;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

textarea {
    min-height: 130px;
    resize: vertical;
    line-height: 1.6;
}

textarea::placeholder, input::placeholder {
    color: var(--text-muted);
}

textarea:focus, select:focus, input:focus {
    border-color: var(--purple-light);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.2);
    background: #100b1a;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

.field-row .field {
    margin-bottom: 0;
}

.field-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle-pwd-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toggle-pwd-btn:hover {
    opacity: 1;
}

/* AI Provider Card */
.ai-provider-card {
    background: rgba(14, 10, 22, 0.75);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 26px;
}

.provider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.provider-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--purple-light);
    letter-spacing: 0.5px;
}

.provider-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.provider-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.provider-radio input[type="radio"] {
    accent-color: var(--purple-main);
}

.provider-radio:has(input:checked) {
    color: var(--text-primary);
    font-weight: 600;
}

.provider-config {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ollama-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
}

.connection-status-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Summon Button */
.generate-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(100deg, #7e22ce, #9333ea, #c084fc);
    background-size: 200% auto;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    box-shadow: 0 6px 28px rgba(147, 51, 234, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: var(--transition);
}

.generate-btn:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 10px 35px rgba(192, 132, 252, 0.55);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.btn-sigil {
    font-size: 1.2rem;
}

.privacy-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 18px;
}

/* ==========================================================================
   STORY READER SECTION
   ========================================================================== */
.hidden {
    display: none !important;
}

.result {
    margin-top: 36px;
    animation: fadeIn 0.6s ease forwards;
}

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

.result-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.badge {
    background: rgba(147, 51, 234, 0.18);
    border: 1px solid rgba(192, 132, 252, 0.3);
    color: var(--purple-light);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dread-badge {
    background: rgba(225, 29, 72, 0.2);
    border-color: rgba(225, 29, 72, 0.4);
    color: #fda4af;
}

.story-title {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    line-height: 1.2;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    color: #fff;
    text-shadow: 0 0 15px rgba(192, 132, 252, 0.3);
}

.story-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.result-sigil {
    font-size: 2.4rem;
    opacity: 0.7;
}

/* Reader Toolbar */
.reader-toolbar {
    background: rgba(10, 7, 16, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 22px 0 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-btn {
    background: rgba(30, 22, 45, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.toolbar-btn:hover:not(:disabled) {
    border-color: var(--purple-light);
    background: rgba(147, 51, 234, 0.3);
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.narration-btn.speaking {
    background: rgba(225, 29, 72, 0.3);
    border-color: var(--crimson);
    color: #fda4af;
    animation: speakingPulse 1.5s infinite alternate;
}

@keyframes speakingPulse {
    0% { box-shadow: 0 0 6px var(--crimson); }
    100% { box-shadow: 0 0 16px var(--crimson); }
}

.pitch-label {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.toolbar-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
}

/* Story Typography & Content */
.story-content {
    line-height: 1.95;
    font-size: 1.12rem;
    color: #e5def0;
    transition: var(--transition);
    padding: 10px 4px;
}

/* Typography styles */
.story-content.font-gothic {
    font-family: var(--font-heading);
    letter-spacing: 0.2px;
}

.story-content.font-serif {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 2;
}

.story-content.font-sans {
    font-family: var(--font-body);
}

.story-content.font-mono {
    font-family: var(--font-mono);
    font-size: 0.98rem;
}

.story-content p {
    margin-bottom: 22px;
    text-align: justify;
    text-justify: inter-word;
    position: relative;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* First paragraph drop cap */
.story-content p:first-of-type::first-letter {
    font-family: var(--font-heading);
    font-size: 3.2rem;
    float: left;
    line-height: 0.8;
    margin-right: 12px;
    color: var(--purple-light);
    text-shadow: 0 0 12px rgba(192, 132, 252, 0.4);
}

/* Active reading paragraph highlight */
.story-content p.reading-active {
    background: rgba(147, 51, 234, 0.18);
    border-left: 3px solid var(--purple-light);
    color: #ffffff;
    text-shadow: 0 0 8px rgba(192, 132, 252, 0.3);
}

/* Result Action Buttons */
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.action-btn, .secondary-btn {
    background: rgba(30, 22, 45, 0.9);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.action-btn:hover, .secondary-btn:hover {
    background: rgba(88, 28, 135, 0.4);
    border-color: var(--purple-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.25);
}

.action-btn.highlight-btn {
    background: linear-gradient(120deg, #7e22ce, #9333ea);
    border-color: var(--purple-light);
    color: #fff;
    margin-left: auto;
}

.action-btn.highlight-btn:hover {
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.5);
}

.action-message {
    color: var(--purple-light);
    font-size: 0.85rem;
    margin-top: 14px;
    font-style: italic;
}

/* ==========================================================================
   FEATURE CARDS
   ========================================================================== */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin: 50px 0 20px;
}

.feature-card {
    background: rgba(19, 14, 30, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px 18px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--border-glow);
    background: rgba(28, 20, 44, 0.9);
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.feature-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.feature-card h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 8px;
    color: #fff;
}

.feature-card p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ==========================================================================
   GRIMOIRE VAULT MODAL
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(4, 3, 8, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.vault-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: min(800px, 100%);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(147, 51, 234, 0.2);
    overflow: hidden;
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: #fff;
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal-btn:hover {
    color: #fff;
    border-color: var(--crimson);
    background: rgba(225, 29, 72, 0.2);
}

.vault-controls {
    padding: 16px 28px;
    background: rgba(10, 7, 16, 0.5);
    border-bottom: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

.vault-list {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vault-item {
    background: rgba(14, 10, 22, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    transition: var(--transition);
}

.vault-item:hover {
    border-color: var(--purple-light);
    background: rgba(24, 18, 38, 0.95);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.vault-item-info h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: #fff;
    margin-bottom: 4px;
}

.vault-item-meta {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.vault-item-excerpt {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vault-item-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vault-item-actions button {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(30, 22, 45, 0.8);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.vault-item-actions button:hover {
    border-color: var(--purple-light);
    background: rgba(147, 51, 234, 0.3);
}

.vault-item-actions .delete-vault-btn:hover {
    border-color: var(--crimson);
    background: rgba(225, 29, 72, 0.25);
    color: #fda4af;
}

.vault-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.vault-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

.modal-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border-color);
    background: rgba(10, 7, 16, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.danger-btn {
    border-color: rgba(225, 29, 72, 0.4);
    color: #fda4af;
}

.danger-btn:hover {
    background: rgba(225, 29, 72, 0.25) !important;
    border-color: var(--crimson) !important;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    background: rgba(19, 14, 30, 0.95);
    border: 1px solid var(--purple-light);
    color: #fff;
    padding: 14px 22px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(192, 132, 252, 0.3);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 48px 20px 36px;
    text-align: center;
    position: relative;
    z-index: 10;
    background: rgba(6, 4, 11, 0.8);
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-brand {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.footer-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.footer-quote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--purple-light);
    margin-bottom: 16px;
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 860px) {
    .features {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .soundscape-inner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sound-presets {
        overflow-x: auto;
        padding-bottom: 4px;
    }
}

@media (max-width: 640px) {
    .field-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .generator, .result {
        padding: 22px 18px;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions button {
        width: 100%;
    }

    .action-btn.highlight-btn {
        margin-left: 0;
    }

    .vault-controls {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .ambient-canvas {
        display: none;
    }
}