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

:root {
    --ember: #D4763A;
    --ember-glow: #E8934F;
    --deep-night: #0A0A12;
    --midnight: #12121F;
    --dusk: #1C1C2E;
    --mist: #2A2A42;
    --soft-light: #E8DDD3;
    --faded: #9B8F85;
    --gold: #C9A96E;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    background: var(--deep-night);
    color: var(--soft-light);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Ember particles */
.embers {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ember-particle {
    position: absolute;
    width: 3px; height: 3px;
    background: var(--ember);
    border-radius: 50%;
    opacity: 0;
    animation: float-up linear infinite;
    box-shadow: 0 0 6px var(--ember), 0 0 12px rgba(212, 118, 58, 0.3);
}

.ember-particle:nth-child(1) { left: 10%; animation-duration: 8s; animation-delay: 0s; }
.ember-particle:nth-child(2) { left: 25%; animation-duration: 12s; animation-delay: 2s; width: 2px; height: 2px; }
.ember-particle:nth-child(3) { left: 45%; animation-duration: 10s; animation-delay: 4s; }
.ember-particle:nth-child(4) { left: 60%; animation-duration: 14s; animation-delay: 1s; width: 2px; height: 2px; }
.ember-particle:nth-child(5) { left: 75%; animation-duration: 9s; animation-delay: 3s; }
.ember-particle:nth-child(6) { left: 88%; animation-duration: 11s; animation-delay: 5s; width: 4px; height: 4px; }
.ember-particle:nth-child(7) { left: 35%; animation-duration: 13s; animation-delay: 6s; width: 2px; height: 2px; }
.ember-particle:nth-child(8) { left: 55%; animation-duration: 7s; animation-delay: 2.5s; }

@keyframes float-up {
    0% { transform: translateY(100vh) translateX(0); opacity: 0; }
    10% { opacity: 0.8; }
    50% { opacity: 0.4; }
    90% { opacity: 0.1; }
    100% { transform: translateY(-20vh) translateX(40px); opacity: 0; }
}

/* Nav */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(10, 10, 18, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 118, 58, 0.1);
}

.nav-logo {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--ember);
    text-decoration: none;
    letter-spacing: 0.15em;
}

.nav-link {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--faded);
    text-decoration: none;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: color 0.3s;
}

.nav-link:hover, .nav-link.active {
    color: var(--ember);
}

/* Phases */
.phase {
    display: none;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.phase.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.8s ease;
}

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

/* Phase 1: Intention */
.intention-container {
    max-width: 600px;
    text-align: center;
    padding: 6rem 2rem 2rem;
}

.phase-symbol {
    font-size: 3rem;
    color: var(--ember);
    opacity: 0.6;
    margin-bottom: 1.5rem;
}

.intention-container h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--soft-light) 0%, var(--gold) 50%, var(--ember) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ember), transparent);
    margin: 1.5rem auto;
}

.intention-text {
    font-size: 1.15rem;
    color: var(--faded);
    font-weight: 300;
    font-style: italic;
    line-height: 1.9;
    margin-bottom: 2.5rem;
}

/* Spread selector */
.spread-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.spread-btn {
    background: rgba(28, 28, 46, 0.6);
    border: 1px solid rgba(212, 118, 58, 0.15);
    border-radius: 4px;
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    flex: 1;
    max-width: 220px;
}

.spread-btn:hover {
    border-color: rgba(212, 118, 58, 0.4);
    transform: translateY(-2px);
}

.spread-btn.active {
    border-color: var(--ember);
    box-shadow: 0 0 20px rgba(212, 118, 58, 0.15);
    background: rgba(212, 118, 58, 0.08);
}

.spread-icon {
    display: block;
    font-size: 1.4rem;
    color: var(--ember);
    margin-bottom: 0.5rem;
    letter-spacing: 0.3rem;
}

.spread-name {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--gold);
    letter-spacing: 0.1em;
    margin-bottom: 0.3rem;
}

.spread-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--faded);
}

/* Intention input */
.intention-input-wrap {
    margin-bottom: 2rem;
    text-align: left;
}

.intention-input-wrap label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 0.5rem;
    text-align: center;
}

#intention {
    width: 100%;
    background: rgba(28, 28, 46, 0.6);
    border: 1px solid rgba(212, 118, 58, 0.15);
    border-radius: 4px;
    color: var(--soft-light);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    padding: 1rem;
    resize: vertical;
    line-height: 1.7;
    transition: border-color 0.3s;
}

#intention:focus {
    outline: none;
    border-color: rgba(212, 118, 58, 0.4);
    box-shadow: 0 0 20px rgba(212, 118, 58, 0.08);
}

#intention::placeholder {
    color: var(--faded);
    opacity: 0.6;
    font-style: italic;
}

/* Buttons */
.btn-ember {
    position: relative;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--soft-light);
    background: linear-gradient(135deg, rgba(212, 118, 58, 0.3), rgba(201, 169, 110, 0.2));
    border: 1px solid rgba(212, 118, 58, 0.4);
    padding: 1rem 2.5rem;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s;
    border-radius: 2px;
}

.btn-ember:hover {
    background: linear-gradient(135deg, rgba(212, 118, 58, 0.5), rgba(201, 169, 110, 0.3));
    border-color: var(--ember);
    transform: translateY(-2px);
    box-shadow: 0 4px 30px rgba(212, 118, 58, 0.2);
}

.btn-ember.btn-small {
    padding: 0.7rem 1.5rem;
    font-size: 0.8rem;
}

.btn-ghost {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--faded);
    background: transparent;
    border: 1px solid rgba(155, 143, 133, 0.3);
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 2px;
}

.btn-ghost:hover {
    color: var(--soft-light);
    border-color: var(--faded);
}

/* Phase 2: Card Selection */
.selection-container {
    width: 100%;
    max-width: 1200px;
    padding: 5rem 2rem 2rem;
    text-align: center;
    margin: 0 auto;
}

.selection-container h2 {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 400;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.selection-subtitle {
    font-size: 1.1rem;
    color: var(--faded);
    font-weight: 300;
    margin-bottom: 2rem;
}

/* Card fan - the spread of face-down cards */
.card-fan {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
    margin-bottom: 2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.tarot-card-back {
    width: 65px;
    height: 105px;
    background: linear-gradient(145deg, var(--dusk), var(--midnight));
    border: 1px solid rgba(212, 118, 58, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.tarot-card-back::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(201, 169, 110, 0.15);
    border-radius: 2px;
}

.tarot-card-back::after {
    content: '\2726';
    font-size: 1.2rem;
    color: var(--ember);
    opacity: 0.4;
}

.tarot-card-back:hover {
    transform: translateY(-12px) scale(1.05);
    border-color: var(--ember);
    box-shadow: 0 8px 30px rgba(212, 118, 58, 0.25);
}

.tarot-card-back:hover::after {
    opacity: 0.8;
}

.tarot-card-back.selected {
    transform: translateY(-20px) scale(1.08);
    border-color: var(--gold);
    box-shadow: 0 12px 40px rgba(201, 169, 110, 0.3);
    pointer-events: none;
}

.tarot-card-back.selected::after {
    content: '\2713';
    color: var(--gold);
    opacity: 1;
}

.tarot-card-back.disabled {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.95);
}

/* Selected positions indicator */
.selected-positions {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.position-slot {
    text-align: center;
    min-width: 120px;
}

.position-slot-label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ember);
    margin-bottom: 0.3rem;
}

.position-slot-name {
    font-size: 0.85rem;
    color: var(--faded);
    font-style: italic;
    min-height: 1.5em;
}

.position-slot-name.filled {
    color: var(--gold);
    font-style: normal;
}

/* Phase 3: Reading */
.reading-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 5rem 2rem 4rem;
    text-align: center;
}

.reading-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 400;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--soft-light) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.reading-spread-name {
    font-size: 0.9rem;
    color: var(--ember);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

/* Revealed cards */
.revealed-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0 3rem;
}

.revealed-card {
    width: 100%;
    max-width: 320px;
    text-align: left;
    animation: cardReveal 0.8s ease forwards;
    opacity: 0;
}

.revealed-card:nth-child(1) { animation-delay: 0.2s; }
.revealed-card:nth-child(2) { animation-delay: 0.6s; }
.revealed-card:nth-child(3) { animation-delay: 1.0s; }

@keyframes cardReveal {
    from { opacity: 0; transform: translateY(30px) rotateY(90deg); }
    50% { transform: translateY(0) rotateY(0deg); }
    to { opacity: 1; transform: translateY(0) rotateY(0deg); }
}

.card-visual {
    background: linear-gradient(145deg, var(--dusk), var(--midnight));
    border: 1px solid rgba(212, 118, 58, 0.25);
    border-radius: 4px;
    padding: 2rem 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card-visual::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(201, 169, 110, 0.1);
    border-radius: 2px;
    pointer-events: none;
}

.card-number {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--faded);
    margin-bottom: 0.5rem;
}

.card-symbol {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
    filter: drop-shadow(0 0 8px rgba(212, 118, 58, 0.4));
}

.card-name {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}

.card-traditional {
    font-size: 0.8rem;
    color: var(--faded);
    font-style: italic;
    opacity: 0.7;
}

.card-reversed-badge {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ember);
    border: 1px solid rgba(212, 118, 58, 0.3);
    padding: 0.2rem 0.6rem;
    margin-top: 0.5rem;
    border-radius: 2px;
}

.card-position-label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ember);
    margin-bottom: 0.3rem;
}

.card-keyword {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.card-meaning {
    font-size: 0.95rem;
    color: var(--faded);
    font-weight: 300;
    line-height: 1.8;
}

.card-imagery {
    font-size: 0.85rem;
    color: var(--faded);
    font-style: italic;
    opacity: 0.6;
    margin-top: 0.75rem;
    line-height: 1.6;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(212, 118, 58, 0.1);
}

/* AI Interpretation */
.ai-interpretation {
    background: rgba(28, 28, 46, 0.6);
    border: 1px solid rgba(212, 118, 58, 0.15);
    border-radius: 4px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: left;
}

.interpretation-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.interpretation-icon {
    font-size: 1.5rem;
    color: var(--ember);
}

.interpretation-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 0.1em;
}

.interpretation-text {
    font-size: 1.05rem;
    color: var(--soft-light);
    font-weight: 300;
    line-height: 2;
}

.interpretation-text p {
    margin-bottom: 1rem;
}

.interpretation-text p:last-child {
    margin-bottom: 0;
}

/* Loading */
.interpretation-loading {
    text-align: center;
    padding: 2rem;
    margin: 2rem 0;
}

.loading-ember {
    width: 12px;
    height: 12px;
    background: var(--ember);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: ember-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(212, 118, 58, 0.5);
}

@keyframes ember-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; box-shadow: 0 0 20px rgba(212, 118, 58, 0.3); }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 40px rgba(212, 118, 58, 0.6); }
}

.interpretation-loading p {
    color: var(--faded);
    font-style: italic;
    font-size: 1rem;
}

/* Journal section */
.journal-section {
    background: rgba(28, 28, 46, 0.6);
    border: 1px solid rgba(201, 169, 110, 0.15);
    border-radius: 4px;
    padding: 2rem;
    margin-top: 2rem;
    text-align: left;
}

.journal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.journal-icon {
    font-size: 1.3rem;
    color: var(--gold);
}

.journal-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 0.1em;
}

.journal-prompt {
    font-size: 1.1rem;
    color: var(--soft-light);
    font-style: italic;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 118, 58, 0.1);
}

.journal-textarea {
    width: 100%;
    background: rgba(10, 10, 18, 0.6);
    border: 1px solid rgba(212, 118, 58, 0.15);
    border-radius: 4px;
    color: var(--soft-light);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    padding: 1rem;
    resize: vertical;
    line-height: 1.8;
    margin-bottom: 1rem;
    transition: border-color 0.3s;
}

.journal-textarea:focus {
    outline: none;
    border-color: rgba(201, 169, 110, 0.3);
    box-shadow: 0 0 20px rgba(201, 169, 110, 0.05);
}

.journal-textarea::placeholder {
    color: var(--faded);
    opacity: 0.5;
    font-style: italic;
}

.journal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Save confirmation */
.save-confirmation {
    text-align: center;
    padding: 1rem;
    color: var(--gold);
    font-style: italic;
    animation: fadeIn 0.5s ease;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .spread-selector {
        flex-direction: column;
        align-items: center;
    }

    .spread-btn {
        max-width: 100%;
        width: 100%;
    }

    .tarot-card-back {
        width: 50px;
        height: 80px;
    }

    .tarot-card-back::after {
        font-size: 0.9rem;
    }

    .selected-positions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .revealed-cards {
        flex-direction: column;
        align-items: center;
    }

    .revealed-card {
        max-width: 100%;
    }

    .nav {
        padding: 0.8rem 1rem;
    }
}

@media (max-width: 480px) {
    .tarot-card-back {
        width: 42px;
        height: 68px;
    }

    .card-fan {
        gap: 0.3rem;
    }

    .intention-container {
        padding: 5rem 1rem 1rem;
    }
}
