:root {
    --bg: #0f0b16;
    --panel: #1b1326;
    --panel-soft: #241832;
    --text: #f5edf8;
    --muted: #b9a8c7;
    --accent: #d6b36a;
    --border: rgba(214, 179, 106, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Georgia, "Times New Roman", serif;
    background:
            radial-gradient(circle at top, rgba(92, 56, 130, 0.35), transparent 35%),
            linear-gradient(135deg, #08060c, var(--bg));
    color: var(--text);
    background-attachment: fixed;
    animation: slowGlow 18s ease-in-out infinite alternate;
}

@keyframes slowGlow {
    from { background-position: 0% 0%; }
    to { background-position: 100% 100%; }
}

.tarot-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

.tarot-hero {
    text-align: center;
    margin-bottom: 32px;
}

.tarot-hero h1 {
    font-size: 48px;
    margin: 0 0 10px;
    letter-spacing: 2px;
    color: var(--accent);
}

.tarot-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 18px;
}

.tarot-panel {
    background: rgba(27, 19, 38, 0.9);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.tarot-controls {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: end;
    justify-content: center;
    margin-bottom: 28px;
}

.tarot-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tarot-field label {
    color: var(--muted);
    font-size: 14px;
}

.tarot-field select {
    min-width: 280px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--text);
    font-size: 15px;
}

.tarot-btn {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 18px;
    cursor: pointer;
    background: var(--panel-soft);
    color: var(--text);
    font-weight: bold;
}

.tarot-btn-primary {
    background: linear-gradient(135deg, #d6b36a, #9f7831);
    color: #140d1d;
}

.tarot-status {
    text-align: center;
    color: var(--muted);
    margin-bottom: 22px;
}

.spread-title {
    text-align: center;
    margin: 24px 0 6px;
    color: var(--accent);
}

.spread-description {
    text-align: center;
    margin: 0 0 28px;
    color: var(--muted);
}

.tarot-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 250px));
    gap: 26px;
    justify-content: center;
}

.tarot-card {
    background: rgba(36, 24, 50, 0.92);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 14px 35px rgba(0,0,0,0.35);
}

.tarot-card-position {
    text-align: center;
    min-height: 95px;
}

.tarot-card-position h3 {
    color: var(--accent);
    margin: 0 0 8px;
    font-size: 19px;
}

.tarot-card-position p {
    color: var(--muted);
    margin: 0;
    font-size: 14px;
    line-height: 1.35;
}

.tarot-card-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    margin: 12px 0;
    box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}

.tarot-card-image.reversed {
    transform: rotate(180deg);
}

.tarot-card h4 {
    margin: 12px 0 8px;
    color: var(--text);
    text-align: center;
    font-size: 18px;
}

.tarot-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(214, 179, 106, 0.15);
    color: var(--accent);
    font-size: 12px;
}

.tarot-meta {
    color: var(--muted);
    font-size: 13px;
}

.tarot-meaning {
    line-height: 1.45;
    font-size: 14px;
}

.spread-layout {
    display: grid;
    gap: 26px;
    justify-content: center;
}

.tarot-cards {
    grid-template-columns: repeat(auto-fit, minmax(250px, 250px));
}

.tarot-correspondences {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 10px 0;
}

.tarot-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(214, 179, 106, 0.10);
    color: var(--accent);
    font-size: 12px;
    cursor: help;
}

/* One card */
.spread-one_card {
    grid-template-columns: 250px;
}

/* Three-card spreads */
.spread-three_card,
.spread-mind_body_spirit {
    grid-template-columns: repeat(3, 250px);
}

/* Five-card situation */
.spread-five_card_situation {
    grid-template-columns: repeat(5, 250px);
}

/* Horseshoe */
.spread-horseshoe {
    grid-template-columns: repeat(7, 250px);
    align-items: start;
}

.spread-horseshoe .tarot-card:nth-child(1),
.spread-horseshoe .tarot-card:nth-child(7) {
    margin-top: 80px;
}

.spread-horseshoe .tarot-card:nth-child(2),
.spread-horseshoe .tarot-card:nth-child(6) {
    margin-top: 40px;
}

.spread-horseshoe .tarot-card:nth-child(4) {
    margin-top: 110px;
}

/* Celtic Cross */
.spread-celtic_cross {
    grid-template-columns: repeat(5, 250px);
    grid-template-areas:
        ".      crown   .        staff1  ."
        "past   center  future   staff2  ."
        ".      base    .        staff3  ."
        ".      .       .        staff4  .";
    align-items: start;
}

.spread-celtic_cross .tarot-card:nth-child(1) {
    grid-area: center;
    z-index: 2;
}

.spread-celtic_cross .tarot-card:nth-child(2) {
    grid-area: center;
    transform: rotate(90deg);
    z-index: 3;
    align-self: center;
    justify-self: center;
}
.spread-celtic_cross .tarot-card:nth-child(1),
.spread-celtic_cross .tarot-card:nth-child(2) {
    align-self: center;
    justify-self: center;
}
.spread-celtic_cross .tarot-card:nth-child(2) {
    margin-left: -30px;
}

.spread-celtic_cross .tarot-card:nth-child(3) {
    grid-area: base;
}

.spread-celtic_cross .tarot-card:nth-child(4) {
    grid-area: past;
    z-index: 2;
}

.spread-celtic_cross .tarot-card:nth-child(5) {
    grid-area: crown;
}

.spread-celtic_cross .tarot-card:nth-child(6) {
    grid-area: future;
    z-index: 2;
}

.spread-celtic_cross .tarot-card:nth-child(7) {
    grid-area: staff4;
}

.spread-celtic_cross .tarot-card:nth-child(8) {
    grid-area: staff3;
}

.spread-celtic_cross .tarot-card:nth-child(9) {
    grid-area: staff2;
}

.spread-celtic_cross .tarot-card:nth-child(10) {
    grid-area: staff1;
}

@media (max-width: 1500px) {
    .spread-five_card_situation,
    .spread-horseshoe,
    .spread-celtic_cross {
        grid-template-columns: repeat(auto-fit, minmax(250px, 250px));
        grid-template-areas: none;
    }

    .spread-celtic_cross .tarot-card,
    .spread-horseshoe .tarot-card {
        grid-area: auto !important;
        margin-top: 0 !important;
        transform: none !important;
    }
}

.reading-summary {
    max-width: 900px;
    margin: 0 auto 28px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(214, 179, 106, 0.08);
    color: var(--text);
    line-height: 1.55;
    text-align: center;
}
.tarot-field-question {
    flex-basis: 100%;
    max-width: 700px;
    width: 100%;
}

.tarot-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--text);
    font-size: 15px;
}
.reading-question {
    text-align: center;
    color: var(--accent);
    font-size: 20px;
    font-style: italic;
    margin: -12px 0 24px;
}

.tarot-card-image-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.tarot-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.tarot-modal.is-open {
    display: block;
}

.tarot-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.tarot-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: 980px;
    margin: 5vh auto;
    padding: 24px;
    border-radius: 22px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 30px 90px rgba(0,0,0,0.65);
}

.tarot-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 34px;
    cursor: pointer;
}

.tarot-modal-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 28px;
    align-items: start;
}

.tarot-modal-image {
    width: 340px;
    max-width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(0,0,0,0.55);
}

.tarot-modal-content h2 {
    margin: 8px 0 12px;
    color: var(--accent);
    font-size: 34px;
}

.tarot-modal-position {
    color: var(--muted);
    margin: 0;
    font-size: 15px;
}

.tarot-modal-content p {
    line-height: 1.65;
}

@media (max-width: 800px) {
    .tarot-modal-dialog {
        margin: 2vh 12px;
        max-height: 96vh;
        overflow: auto;
    }

    .tarot-modal-grid {
        grid-template-columns: 1fr;
    }

    .tarot-modal-image {
        width: 260px;
        display: block;
        margin: 0 auto;
    }
}

.reveal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 0 0 28px;
    flex-wrap: wrap;
}

.tarot-card {
    position: relative;
    min-height: 620px;
}

.tarot-card-inner {
    opacity: 1;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.tarot-card.is-hidden-card .tarot-card-inner {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
}

.tarot-card-back {
    position: absolute;
    inset: 14px;
    z-index: 5;
    border-radius: 14px;
    border: 1px solid var(--border);
    cursor: pointer;
    background:
            radial-gradient(circle at center, rgba(214,179,106,0.18), transparent 35%),
            linear-gradient(135deg, #1a1026, #09060f);
    color: var(--accent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: inset 0 0 0 2px rgba(214,179,106,0.08), 0 16px 40px rgba(0,0,0,0.45);
}

.tarot-card-back::before {
    content: "✦";
    display: block;
    font-size: 54px;
    margin-bottom: 14px;
}

.tarot-card-back span {
    display: block;
}

.tarot-card:not(.is-hidden-card) .tarot-card-back {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.04);
    transition: opacity 0.35s ease, transform 0.35s ease;
}
@media (max-width: 900px) {
    .spread-three_card,
    .spread-mind_body_spirit,
    .spread-five_card_situation,
    .spread-horseshoe,
    .spread-celtic_cross {
        grid-template-columns: 250px;
    }
}

.tarot-card:not(.is-hidden-card) .tarot-card-inner {
    animation: revealCard 0.45s ease forwards;
}

@keyframes revealCard {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.spread-celtic_cross .tarot-card:nth-child(2):not(.is-hidden-card) {
    animation: revealCrossingCard 0.55s ease forwards;
}

@keyframes revealCrossingCard {
    from {
        opacity: 0;
        transform: rotate(90deg) translateX(-40px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: rotate(90deg) translateX(0) scale(1);
    }
}

.pattern-insights {
    max-width: 1000px;
    margin: 0 auto 28px;
    display: grid;
    gap: 12px;
}

.pattern-insight {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(36, 24, 50, 0.8);
}

.pattern-insight strong {
    display: block;
    color: var(--accent);
    margin-bottom: 5px;
}

.pattern-insight span {
    color: var(--muted);
    line-height: 1.45;
}

.story-view {
    max-width: 1000px;
    margin: 0 auto 32px;
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(15, 11, 22, 0.55);
}

.story-view-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

.story-view-header h3 {
    margin: 0;
    color: var(--accent);
    font-size: 24px;
}

.story-view-body {
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
}

.story-view-body.is-hidden {
    display: none;
}

#toggleStoryView:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.story-view-body.is-hidden {
    display: none;
}

.story-hint {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}
/* Final reveal glow animation */
.tarot-card.final-glow {
    animation: finalGlow 0.9s ease-out;
}

@keyframes finalGlow {
    0% {
        box-shadow: 0 0 0 rgba(214,179,106,0);
        transform: scale(1);
    }
    40% {
        box-shadow: 0 0 40px rgba(214,179,106,0.35);
        transform: scale(1.03);
    }
    100% {
        box-shadow: 0 0 0 rgba(214,179,106,0);
        transform: scale(1);
    }
}

/* Optional: glow the Story button when unlocked */
#toggleStoryView.unlocked {
    animation: glowButton 1s ease;
}

@keyframes glowButton {
    0% {
        box-shadow: 0 0 0 rgba(214,179,106,0);
    }
    50% {
        box-shadow: 0 0 20px rgba(214,179,106,0.45);
    }
    100% {
        box-shadow: 0 0 0 rgba(214,179,106,0);
    }
}

body.final-reveal {
    animation: finalRevealBg 1.2s ease;
}

@keyframes finalRevealBg {
    0% { filter: brightness(1); }
    40% { filter: brightness(1.15); }
    100% { filter: brightness(1); }
}

.daily-card-intro {
    text-align: center;
    color: var(--muted);
    margin: -8px 0 22px;
}
.tarot-card {
    transition: opacity 0.25s ease;
}

.tarot-cards:hover .tarot-card {
    opacity: 0.4;
}

.tarot-card:hover {
    opacity: 1 !important;
}
.share-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    /*margin: 0 0 28px; */
}

.copy-textarea {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

.tarot-btn-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}

.focus-overlay.is-active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.focus-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(10, 6, 18, 0.92);
    backdrop-filter: blur(6px);
}

.focus-overlay-content {
    position: relative;
    z-index: 1;
    max-width: 520px;
    text-align: center;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

.focus-overlay h2 {
    color: var(--accent);
    margin: 0 0 12px;
    font-size: 32px;
}

.focus-question {
    font-style: italic;
    color: var(--text);
    margin: 0 0 12px;
}

.focus-subtext {
    color: var(--muted);
    margin-bottom: 22px;
}

.focus-breath {
    animation: breathing 4.5s ease-in-out infinite;
    transform-origin: center;
}

@keyframes breathing {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.04);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.85;
    }
}

.focus-overlay-content h2 {
    animation-delay: 0s;
}

.focus-question {
    animation-delay: 0.4s;
}

.focus-subtext {
    animation-delay: 0.8s;
}
@keyframes breathingGlow {
    0% {
        text-shadow: 0 0 0 rgba(214,179,106,0);
    }
    50% {
        text-shadow: 0 0 18px rgba(214,179,106,0.35);
    }
    100% {
        text-shadow: 0 0 0 rgba(214,179,106,0);
    }
}

.focus-breath {
    animation:
            breathing 4.5s ease-in-out infinite,
            breathingGlow 4.5s ease-in-out infinite;
}

body.focus-active main {
    filter: blur(2px) brightness(0.6);
}