/* ── Fonts ────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
    --bg-primary: #0a0a14;
    --bg-secondary: #12121f;
    --bg-card: #1a1a2e;
    --accent: #c9a84c;
    --accent-glow: #e8c84c;
    --accent-dim: #8a6d2b;
    --text-primary: #e8e4dd;
    --text-secondary: #9d97a0;
    --text-muted: #5e5a63;
    --purple: #6c3ea6;
    --purple-dim: #3d1f6d;
    --danger: #c94c4c;
    --radius: 12px;
    --radius-lg: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 62, 166, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(201, 168, 76, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(108, 62, 166, 0.08) 0%, transparent 40%),
        var(--bg-primary);
}

/* ── Step Container ───────────────────────────────────────────────────────── */
.step {
    display: none;
    width: 100%;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    animation: fadeIn 0.6s ease;
}

.step.active {
    display: flex;
}

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

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

/* ── Landing Page ─────────────────────────────────────────────────────────── */
.landing {
    text-align: center;
    gap: 40px;
}

.landing-logo {
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 0 40px rgba(201, 168, 76, 0.3));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

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

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

.landing h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #e8c84c, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
}

.landing p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 500px;
    line-height: 1.6;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 16px 48px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    color: var(--bg-primary);
    box-shadow: 0 4px 25px rgba(201, 168, 76, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 35px rgba(201, 168, 76, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent-dim);
}

.btn-secondary:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: var(--accent);
}

.btn-copy {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 12px 28px;
    background: rgba(201, 168, 76, 0.15);
    color: var(--accent);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: none;
    margin-top: 20px;
}

.btn-copy:hover {
    background: rgba(201, 168, 76, 0.25);
    border-color: var(--accent);
}

.btn-copy.visible {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.4s ease;
}

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-container {
    width: 100%;
    max-width: 520px;
}

.form-container h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    color: var(--accent);
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid rgba(201, 168, 76, 0.15);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Spread selector */
.spread-options {
    display: flex;
    gap: 12px;
}

.spread-option {
    flex: 1;
    padding: 16px 12px;
    background: var(--bg-secondary);
    border: 2px solid rgba(201, 168, 76, 0.15);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.spread-option:hover {
    border-color: var(--accent-dim);
    background: rgba(201, 168, 76, 0.05);
}

.spread-option.selected {
    border-color: var(--accent);
    background: rgba(201, 168, 76, 0.1);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.1);
}

.spread-option .spread-count {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.spread-option .spread-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

/* ── Choose Options Grid ──────────────────────────────────────────────────── */
.choose-grid {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.choose-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 24px 20px;
    background: var(--bg-secondary);
    border: 2px solid rgba(201, 168, 76, 0.15);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    min-width: 180px;
}

.choose-option:hover {
    border-color: var(--accent);
    background: rgba(201, 168, 76, 0.08);
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.15);
    transform: translateY(-4px);
}

.choose-option-title {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
}

.choose-cards-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.mini-card {
    width: 55px;
    height: 95px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

/* ── Cards Area ───────────────────────────────────────────────────────────── */
.cards-area {
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.cards-area h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 30px;
}

.cards-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    perspective: 1200px;
}

/* Single card wrapper */
.card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.card-wrapper {
    width: 160px;
    height: 280px;
    perspective: 800px;
    cursor: default;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius);
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

.card-back {
    background: var(--bg-card);
}

.card-front {
    transform: rotateY(180deg);
    background: var(--bg-card);
}

.card-front.reversed img {
    transform: rotate(180deg);
}

/* Card label (name) */
.card-label {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.6s ease;
    text-align: center;
    max-width: 160px;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-label.visible {
    opacity: 1;
}

.card-label .position-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.card-label .reversed-tag {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    color: var(--danger);
    font-weight: 500;
    margin-top: 2px;
}

/* ── Interpretation Section ───────────────────────────────────────────────── */
.interpretation-area {
    width: 100%;
    max-width: 700px;
    margin: 40px auto 0;
    padding: 30px;
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid rgba(201, 168, 76, 0.1);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    display: none;
}

.interpretation-area.visible {
    display: block;
    animation: fadeIn 0.6s ease;
}

.interpretation-area h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.15);
}

.interpretation-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
    word-wrap: break-word;
    text-align: justify;
}

.interpretation-text p {
    margin-bottom: 14px;
}

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

.interpretation-text strong {
    color: var(--accent);
    font-weight: 600;
}

.interpretation-text em {
    color: #c4b5e2;
    font-style: italic;
}

.interpretation-text .md-h1,
.interpretation-text .md-h2,
.interpretation-text .md-h3 {
    font-family: 'Cinzel', serif;
    color: var(--accent);
    margin: 20px 0 10px;
}

.interpretation-text .md-h1 {
    font-size: 1.2rem;
}

.interpretation-text .md-h2 {
    font-size: 1.1rem;
}

.interpretation-text .md-h3 {
    font-size: 1rem;
}

.interpretation-text .md-hr {
    border: none;
    border-top: 1px solid rgba(201, 168, 76, 0.2);
    margin: 18px 0;
}

/* Typewriter cursor */
.interpretation-text.typing::after {
    content: '▊';
    color: var(--accent);
    animation: blink 0.7s infinite;
    margin-left: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ── Copy confirmation toast ──────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--accent);
    color: var(--bg-primary);
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.loading-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 20px;
}

.loading-indicator.visible {
    display: flex;
    justify-content: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(201, 168, 76, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Back button ──────────────────────────────────────────────────────────── */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

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

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

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: drift 8s infinite;
}

@keyframes drift {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }

    10% {
        opacity: 0.6;
    }

    90% {
        opacity: 0;
    }

    100% {
        transform: translateY(-20vh) scale(1);
        opacity: 0;
    }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .landing h1 {
        font-size: 2rem;
    }

    .landing-logo {
        width: 150px;
        height: 150px;
    }

    .card-wrapper {
        width: 120px;
        height: 210px;
    }

    .cards-grid {
        gap: 12px;
    }

    .card-label {
        font-size: 0.7rem;
        max-width: 120px;
    }

    .spread-options {
        flex-direction: column;
    }

    .btn {
        padding: 14px 36px;
        font-size: 1rem;
    }

    .interpretation-area {
        padding: 20px;
    }

    .choose-grid {
        flex-direction: column;
        align-items: center;
    }

    .mini-card {
        width: 45px;
        height: 78px;
    }
}

@media (max-width: 480px) {
    .card-wrapper {
        width: 100px;
        height: 175px;
    }

    .cards-grid {
        gap: 8px;
    }
}