/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Reset & Variables --- */
:root {
    --bg-dark: #fcfbfe;
    --bg-light: #f1ecfb;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --gold: #9a7812; /* Darker gold for readability on white background */
    --gold-glow: rgba(154, 120, 18, 0.15);
    --gold-dim: #7d610e;
    --text-white: #1e182d; /* Primary dark text */
    --text-muted: #5b536f; /* Muted dark text */
    --purple-glow: rgba(138, 43, 226, 0.15);
    --border-color: rgba(154, 120, 18, 0.25);
    --font-thai: 'Sarabun', sans-serif;
    --font-mystic: 'Cinzel', serif;
}

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

body {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-dark) 100%);
    font-family: var(--font-thai);
    color: var(--text-white);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Animated Starry Background --- */
.stars, .twinkling {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: -1;
}

.stars {
    background: #000 url('https://www.script-tutorials.com/demos/360/images/stars.png') repeat top center;
}

.twinkling {
    background: transparent url('https://www.script-tutorials.com/demos/360/images/twinkling.png') repeat top center;
    animation: move-twink-back 200s linear infinite;
}

@keyframes move-twink-back {
    from { background-position: 0 0; }
    to { background-position: -10000px 5000px; }
}

/* --- Layout Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    z-index: 2;
}

/* --- Mystic Header --- */
.mystic-header {
    text-align: center;
    margin-bottom: 50px;
}

.logo {
    font-size: 3rem;
    margin-bottom: 10px;
}

.magic-glow {
    color: var(--gold);
    text-shadow: 0 0 20px var(--gold-glow);
    animation: float-logo 4s ease-in-out infinite;
}

@keyframes float-logo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.title-en {
    font-family: var(--font-mystic);
    font-weight: 800;
    font-size: 2.8rem;
    letter-spacing: 6px;
    background: linear-gradient(135deg, #fff 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.subtitle-th {
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* --- Glassmorphic Panels --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.main-card {
    max-width: 800px;
    margin: 0 auto;
}

/* --- Forms & Interactive Cards Selection --- */
.form-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.step-num {
    background: var(--gold);
    color: var(--bg-dark);
    font-family: var(--font-mystic);
    font-weight: 700;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 0.95rem;
    box-shadow: 0 0 10px var(--gold-glow);
}

/* Perspective Grid */
.perspective-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.perspective-card {
    cursor: pointer;
    position: relative;
}

.perspective-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.perspective-card .card-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 25px 20px;
    text-align: center;
    transition: all 0.35s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.perspective-card .icon {
    font-size: 2.2rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    transition: all 0.35s ease;
}

.perspective-card .label {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: #fff;
}

.perspective-card .desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Radio States */
.perspective-card input:checked + .card-content,
.perspective-card.selected .card-content {
    background: rgba(212, 175, 55, 0.05);
    border-color: var(--gold);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.15), inset 0 0 10px rgba(212, 175, 55, 0.05);
}

.perspective-card input:checked + .card-content .icon,
.perspective-card.selected .card-content .icon {
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold-glow);
    transform: scale(1.1);
}

/* Topic Grid */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.topic-card {
    cursor: pointer;
    position: relative;
}

.topic-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.topic-card .topic-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.topic-card .topic-content i {
    font-size: 1.1rem;
}

.topic-card input:checked + .topic-content {
    background: rgba(212, 175, 55, 0.06);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

/* Textarea styling */
.input-wrapper textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 15px;
    color: #fff;
    font-family: var(--font-thai);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    resize: none;
}

.input-wrapper textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

/* Buttons */
.action-wrapper, .bottom-actions {
    text-align: center;
    margin-top: 30px;
}

.btn-mystic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    color: var(--bg-dark);
    font-family: var(--font-thai);
    font-weight: 600;
    font-size: 1.15rem;
    padding: 15px 40px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.35s ease;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
    text-decoration: none;
}

.btn-mystic:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.5);
    background: linear-gradient(135deg, #fff 0%, var(--gold) 100%);
}

.btn-mystic:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-mystic.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--gold);
    box-shadow: none;
}

.btn-mystic.btn-secondary:hover {
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.btn-pulse {
    animation: btn-glow-pulse 2s infinite alternate;
}

@keyframes btn-glow-pulse {
    0% { box-shadow: 0 0 15px rgba(212, 175, 55, 0.3); }
    100% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.7); }
}

/* --- Selection Page Layout --- */
.select-page {
    text-align: center;
}

.select-header h1 {
    font-family: var(--font-mystic);
    font-size: 2.2rem;
    letter-spacing: 4px;
    color: var(--gold);
    margin-bottom: 15px;
}

.question-display {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 10px;
}

.question-display strong {
    color: var(--gold);
}

.instructions {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.success-text {
    color: #4cd137;
    font-weight: 500;
}

/* Selection Drawn Tray */
.drawn-tray-section {
    margin-bottom: 50px;
}

.drawn-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.slot-card {
    width: 80px;
    height: 125px;
    perspective: 1000px;
}

.slot-outline {
    width: 100%;
    height: 100%;
    border: 1.5px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 5px;
    transition: all 0.3s ease;
}

.slot-number {
    font-family: var(--font-mystic);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 5px;
}

.slot-label {
    font-size: 0.6rem;
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
}

.slot-filled-card {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

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

/* 78 Deck Grid */
.deck-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-height: 500px;
    overflow-y: auto;
}

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    grid-auto-rows: 55px;
    column-gap: 12px;
    row-gap: 0px;
    padding-bottom: 60px;
}

.tarot-card-wrapper {
    position: relative;
    aspect-ratio: 1 / 1.55;
    cursor: pointer;
    perspective: 1000px;
    transition: all 0.3s ease;
}

.tarot-card-wrapper:hover {
    z-index: 10;
}

.tarot-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.tarot-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

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

/* Hover effect */
.tarot-card-wrapper:hover:not(.disabled):not(.selected) .tarot-card-back {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--gold);
    box-shadow: 0 0 15px var(--gold-glow);
}

/* Selection and Draw state animations */
.tarot-card-wrapper.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tarot-card-wrapper.selected {
    pointer-events: none;
}

.tarot-card-wrapper.fly-away {
    animation: shrink-fade-out 0.8s forwards ease-in-out;
}

@keyframes shrink-fade-out {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.1) translateY(-100px); opacity: 0; }
}

/* Animations */
.fade-in-scale {
    animation: fade-in-scale-anim 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes fade-in-scale-anim {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Results / Reading Page --- */
.reading-header {
    text-align: center;
    margin-bottom: 40px;
}

.reading-header h1 {
    font-family: var(--font-mystic);
    font-size: 2.5rem;
    color: var(--gold);
    letter-spacing: 4px;
    margin-bottom: 15px;
}

.meta-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Toggle Views Tab Bar */
.reveal-toggle-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 10px 25px;
    color: var(--text-muted);
    font-family: var(--font-thai);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: rgba(212, 175, 55, 0.08);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15);
}

/* Graphical Card Layout Section */
.cards-layout-section {
    margin-bottom: 50px;
}

/* Celtic Cross Layout Shapes */
.celtic-cross-grid {
    display: grid;
    grid-template-areas:
        ".       c-goal    .       ."
        "c-left  c-center  c-right ."
        ".       c-subcon  .       ."
        ".       .         .       .";
    grid-template-columns: 1fr 1.2fr 1fr auto;
    grid-template-rows: repeat(3, auto);
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.c-goal { grid-area: c-goal; }
.c-left { grid-area: c-left; }
.c-center { grid-area: c-center; justify-self: center; align-self: center; }
.c-right { grid-area: c-right; }
.c-subcon { grid-area: c-subcon; }

/* Vertically aligned column for right section of celtic cross */
.celtic-column {
    grid-column: 4;
    grid-row: 1 / span 3;
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
}

.celtic-cell, .column-cell, .weekly-cell, .yearly-cell {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.grid-cell-label, .col-cell-label, .cell-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-align: center;
    font-weight: 500;
}

/* Image controls */
.grid-tarot-img {
    width: 100px;
    height: 155px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.grid-tarot-img.reversed {
    transform: rotate(180deg);
}

/* Hover details in grid */
.celtic-cell:hover .grid-tarot-img,
.column-cell:hover .grid-tarot-img,
.weekly-cell:hover .grid-tarot-img,
.yearly-cell:hover .grid-tarot-img {
    border-color: var(--gold);
    box-shadow: 0 0 15px var(--gold-glow);
    transform: scale(1.04);
}
.celtic-cell:hover .grid-tarot-img.reversed,
.column-cell:hover .grid-tarot-img.reversed,
.weekly-cell:hover .grid-tarot-img.reversed,
.yearly-cell:hover .grid-tarot-img.reversed {
    border-color: var(--gold);
    box-shadow: 0 0 15px var(--gold-glow);
    transform: scale(1.04) rotate(180deg);
}

/* Stacking for central Celtic Cross card 1 + 2 */
.stacked-cards {
    position: relative;
    width: 130px;
    height: 175px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stacked-cards .main-c1 {
    position: absolute;
    z-index: 1;
}

.stacked-cards .challenge-c2 {
    position: absolute;
    z-index: 2;
    transform: rotate(90deg);
    opacity: 0.95;
    box-shadow: 0 5px 15px rgba(0,0,0,0.6);
}

.stacked-cards .challenge-c2.reversed {
    transform: rotate(270deg);
}

/* Weekly row layout */
.weekly-row-layout {
    display: flex;
    justify-content: center;
    gap: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.weekly-cell .grid-tarot-img {
    width: 120px;
    height: 185px;
}

/* Yearly Grid Layout */
.yearly-grid-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 15px;
    width: 100%;
}

.yearly-cell .grid-tarot-img {
    width: 85px;
    height: 130px;
}

.yearly-advice-cell {
    max-width: 180px;
    border-color: var(--gold);
    box-shadow: 0 0 15px var(--gold-glow);
}

.yearly-advice-cell .grid-tarot-img {
    width: 120px;
    height: 185px;
}

/* --- Report Text & Markdown --- */
.report-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.report-box {
    margin-bottom: 10px;
}

.report-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.report-header h4 {
    font-size: 1.25rem;
    color: var(--gold);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-body {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-white);
}

/* Narrative card by card items */
.narrative-card-item {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 20px;
    border-left: 3px solid var(--gold);
}

.narrative-card-item h4 {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-gold {
    color: var(--gold);
}

.pos-context {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.card-meaning-text {
    font-weight: 300;
}

/* Relationships / Point connections */
.point-analysis-box {
    background: rgba(212, 175, 55, 0.04);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    font-size: 0.95rem;
}

.point-analysis-box h5 {
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 8px;
}

.special-warning {
    margin-top: 8px;
    color: #ff9f43;
    font-size: 0.9rem;
}

.points-connections, .fortune-teller-advice-box {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 30px;
}

.points-connections h4, .fortune-teller-advice-box h4 {
    font-size: 1.15rem;
    color: var(--gold);
    margin-bottom: 15px;
}

.points-connections p {
    margin-bottom: 10px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.overlap-text {
    font-size: 0.9rem;
    margin-top: 10px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.15);
    padding: 6px 12px;
    border-radius: 6px;
}

/* Temporal breakdowns styling */
.week-item {
    margin-bottom: 20px;
    background: rgba(255,255,255,0.01);
    padding: 18px;
    border-radius: 10px;
}

.week-item h5 {
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 6px;
}

.cards-involved {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.daily-mantra {
    background: rgba(212, 175, 55, 0.04);
    border-top: 2px solid var(--gold);
    padding: 20px;
    border-radius: 0 0 10px 10px;
    margin-top: 25px;
}

.daily-mantra h5 {
    color: var(--gold);
    margin-bottom: 8px;
}

/* Summary section styling */
.summary-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed rgba(255,255,255,0.06);
}

.summary-section h5 {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 10px;
}

.analysis-note-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.alchemy-alert-box {
    margin-top: 15px;
    background: rgba(255, 159, 67, 0.05);
    border-left: 3px solid #ff9f43;
    padding: 12px;
    border-radius: 4px;
}

.alchemy-alert-box h6 {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.alchemy-alert-box p {
    font-size: 0.85rem;
    margin-bottom: 5px;
    line-height: 1.4;
}

.synergy-note {
    background: rgba(138, 43, 226, 0.05);
    border-left: 3px solid var(--purple-glow);
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.final-prophecy-quote {
    background: rgba(255,255,255,0.02);
    padding: 20px;
    border-radius: 12px;
    border-bottom: none !important;
}

.final-prophecy-quote p {
    font-style: italic;
    color: var(--text-muted);
    font-weight: 300;
}

/* --- Gemini Synthesis UI Panels --- */
.gemini-trigger-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    border-color: rgba(138, 43, 226, 0.3);
    background: linear-gradient(135deg, rgba(29, 13, 59, 0.6) 0%, rgba(11, 4, 43, 0.7) 100%);
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.15);
}

.ai-intro {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ai-intro h4 {
    font-size: 1.15rem;
    color: #fff;
    margin-bottom: 5px;
}

.ai-intro p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.ai-sparkle {
    font-size: 2.2rem;
    text-shadow: 0 0 15px var(--purple-glow);
}

#btnGemini {
    background: linear-gradient(135deg, #8a2be2 0%, #4b0082 100%);
    box-shadow: 0 5px 20px rgba(138, 43, 226, 0.4);
    color: #fff;
    white-space: nowrap;
}

#btnGemini:hover {
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.7);
    background: linear-gradient(135deg, #ba55d3 0%, #8a2be2 100%);
}

.ai-report-panel {
    border-color: #8a2be2;
    background: rgba(15, 6, 32, 0.85);
    box-shadow: 0 15px 40px rgba(138, 43, 226, 0.25);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(138, 43, 226, 0.2);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.panel-header h4 {
    font-size: 1.3rem;
    color: #fff;
}

.ai-tag {
    background: #8a2be2;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.ai-content-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Markdown styling inside AI content */
.markdown-body h4 {
    font-size: 1.2rem;
    color: var(--gold);
    margin-top: 30px;
    margin-bottom: 12px;
}

.markdown-body h5 {
    font-size: 1.1rem;
    color: #fff;
    margin-top: 20px;
    margin-bottom: 8px;
}

.markdown-body p {
    margin-bottom: 15px;
}

.mystic-ul {
    list-style-type: square;
    margin-left: 25px;
    margin-bottom: 20px;
}

.mystic-ul li {
    margin-bottom: 6px;
    font-weight: 300;
}

blockquote {
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--gold);
    padding: 15px 20px;
    margin-bottom: 20px;
    font-style: italic;
    color: var(--text-muted);
}

/* --- Step-by-Step Reveal Interactive Section --- */
.step-reveal-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.step-container {
    display: flex;
    gap: 40px;
    align-items: center;
    width: 100%;
}

.step-card-display {
    flex: 0 0 240px;
    display: flex;
    justify-content: center;
}

.step-details-panel {
    flex: 1;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    min-height: 350px;
    display: flex;
    flex-direction: column;
}

.step-details-panel h3 {
    font-size: 1.3rem;
    color: var(--gold);
    margin-bottom: 8px;
}

.pos-context-box {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.step-card-name-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
}

.en-sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-family: var(--font-mystic);
}

.orient-sub {
    font-size: 0.9rem;
    color: var(--gold);
}

.step-meaning-text {
    font-size: 1.05rem;
    line-height: 1.7;
    font-weight: 300;
}

/* Step navigation styling */
.step-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.btn-step-nav {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-thai);
    transition: all 0.3s ease;
}

.btn-step-nav:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
    color: var(--gold);
}

.btn-step-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.step-indicator {
    font-family: var(--font-mystic);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--gold);
}

/* Interactive Flipping Card Structure */
.flip-card {
    background-color: transparent;
    width: 200px;
    height: 310px;
    perspective: 1000px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

/* Toggle flip class */
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

.flip-card-front {
    background-color: #1a0f3d;
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

.click-reveal-prompt {
    position: absolute;
    background: rgba(0, 0, 0, 0.65);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.flip-card-front:hover .click-reveal-prompt {
    opacity: 1;
}

.flip-card-back {
    transform: rotateY(180deg);
    border: 2px solid var(--gold);
    box-shadow: 0 0 20px var(--gold-glow);
}

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

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

/* Helpers */
.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }
.border-bottom { border-bottom: 1px solid rgba(255,255,255,0.08); }
.pb-1 { padding-bottom: 0.25rem; }
.text-danger { color: #ff6b6b; }
.text-success { color: #2ecc71; }
.text-muted { color: var(--text-muted); }

/* --- Responsive Layout Adjustments --- */
@media (max-width: 991px) {
    .container {
        padding: 20px 15px;
    }
    
    .celtic-cross-grid {
        grid-template-areas:
            ".       c-goal    ."
            "c-left  c-center  c-right"
            ".       c-subcon  .";
        grid-template-columns: 1fr 1.2fr 1fr;
        max-width: 600px;
    }
    
    .celtic-column {
        grid-column: 1 / span 3;
        grid-row: 4;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 20px;
    }
    
    .column-cell {
        flex: 1 1 100px;
        max-width: 120px;
    }
    
    .gemini-trigger-panel {
        flex-direction: column;
        text-align: center;
    }
    
    .ai-intro {
        flex-direction: column;
    }
    
    .step-container {
        flex-direction: column;
    }
    
    .step-card-display {
        flex: none;
    }
}

@media (max-width: 576px) {
    .title-en {
        font-size: 2rem;
        letter-spacing: 3px;
    }
    
    .subtitle-th {
        font-size: 0.95rem;
    }
    
    .glass-panel {
        padding: 20px 15px;
    }
    
    .weekly-row-layout {
        gap: 15px;
    }
    
    .yearly-cell .grid-tarot-img {
        width: 70px;
        height: 110px;
    }
}

/* --- LIGHT MODE OPTIMIZATIONS & CONTRAST OVERRIDES --- */

/* Hide stars in light mode */
.stars, .twinkling {
    display: none !important;
}

/* Base text color overrides for hardcoded #fff elements */
.section-title,
.perspective-card .label,
.input-wrapper textarea,
.question-display,
.narrative-card-item h4,
.week-item h5,
.summary-section h5,
.panel-header h4,
.step-card-name-title,
.btn-step-nav {
    color: var(--text-white) !important;
}

/* Glass panel light mode shadows */
.glass-panel {
    box-shadow: 0 10px 30px rgba(31, 38, 135, 0.06), inset 0 0 15px rgba(255, 255, 255, 0.5) !important;
}

/* Selection Cards outlines & content */
.perspective-card .card-content,
.topic-card .topic-content {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.perspective-card input:checked + .card-content,
.perspective-card.selected .card-content {
    background: rgba(154, 120, 18, 0.05) !important;
    border-color: var(--gold) !important;
}

.topic-card input:checked + .topic-content {
    background: rgba(154, 120, 18, 0.06) !important;
    border-color: var(--gold) !important;
}

.input-wrapper textarea {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

/* Selection Tray and Deck Grid */
.slot-outline {
    border: 1.5px dashed rgba(154, 120, 18, 0.4) !important;
}

.deck-section {
    background: rgba(255, 255, 255, 0.4) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.tarot-card-back {
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Celtic Cross Layout cells */
.celtic-cell, .column-cell, .weekly-cell, .yearly-cell {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

.grid-tarot-img {
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Narrative item light background */
.narrative-card-item {
    background: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
    border-left: 3px solid var(--gold) !important;
}

.point-analysis-box {
    background: rgba(154, 120, 18, 0.03) !important;
    border: 1px solid rgba(154, 120, 18, 0.12) !important;
}

.pos-context {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--text-muted) !important;
}

.points-connections, .fortune-teller-advice-box, .week-item {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
}

.daily-mantra {
    background: rgba(154, 120, 18, 0.03) !important;
    border-top: 2px solid var(--gold) !important;
}

.overlap-text {
    background: rgba(0, 0, 0, 0.03) !important;
}

/* Summary section dashed borders */
.summary-section {
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08) !important;
}

.alchemy-alert-box {
    background: rgba(255, 159, 67, 0.06) !important;
    border-left: 3px solid #ff9f43 !important;
    color: #cc6d00 !important;
}

.alchemy-alert-box h6 {
    color: #d35400 !important;
}

.synergy-note {
    background: rgba(138, 43, 226, 0.03) !important;
    border-left: 3px solid #8a2be2 !important;
}

.final-prophecy-quote {
    background: rgba(255, 255, 255, 0.6) !important;
}

/* Gemini Trigger Panel */
.gemini-trigger-panel {
    background: linear-gradient(135deg, rgba(243, 237, 255, 0.9) 0%, rgba(255, 255, 255, 0.95) 100%) !important;
    box-shadow: 0 8px 25px rgba(138, 43, 226, 0.08) !important;
}

.ai-intro h4 {
    color: #4a148c !important;
    font-weight: 600;
}

.ai-report-panel {
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 15px 40px rgba(138, 43, 226, 0.12) !important;
}

.panel-header {
    border-bottom: 1px solid rgba(138, 43, 226, 0.1) !important;
}

/* Step-by-Step details panel */
.step-details-panel {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

.step-card-name-title {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.btn-step-nav {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: var(--text-white) !important;
}

.btn-step-nav:hover:not(:disabled) {
    background: rgba(154, 120, 18, 0.08) !important;
    border-color: var(--gold) !important;
    color: var(--gold) !important;
}

.flip-card-front {
    background-color: #f7f5fa !important;
    border: 2px solid rgba(0, 0, 0, 0.08) !important;
}

/* Title colors in light mode */
.title-en {
    background: linear-gradient(135deg, #1b1625 0%, var(--gold) 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: none !important;
}

/* --- Credibility & Info Section --- */
.mystic-info-section {
    margin-top: 50px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 15px 40px rgba(31, 38, 135, 0.08), inset 0 0 20px rgba(255, 255, 255, 0.6) !important;
    text-align: center;
}

.mystic-info-section h3 {
    font-family: var(--font-mystic), var(--font-thai);
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 2px;
    color: var(--gold) !important;
    margin-bottom: 10px;
}

/* Section divider with star */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.section-divider .line {
    height: 1px;
    width: 60px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
}

.section-divider .star {
    color: var(--gold);
    font-size: 0.9rem;
    opacity: 0.8;
}

.section-intro {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted) !important;
    max-width: 700px;
    margin: 0 auto 35px auto;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
}

.info-item {
    background: linear-gradient(135deg, #ffffff 0%, #fcfbfe 100%) !important;
    border: 1px solid rgba(154, 120, 18, 0.12) !important;
    border-radius: 18px;
    padding: 30px 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 8px 24px rgba(31, 38, 135, 0.03) !important;
}

.info-item:hover {
    transform: translateY(-8px);
    border-color: var(--gold) !important;
    box-shadow: 0 15px 35px var(--gold-glow), 0 5px 15px rgba(154, 120, 18, 0.05) !important;
}

/* Icon badge styling */
.icon-badge {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 20px;
    transition: all 0.4s ease;
    border: 1px solid rgba(154, 120, 18, 0.15);
}

.item-archetype .icon-badge {
    background: rgba(138, 43, 226, 0.06);
    color: #8a2be2;
}
.item-spread .icon-badge {
    background: rgba(46, 204, 113, 0.06);
    color: #2ecc71;
}
.item-alchemy .icon-badge {
    background: rgba(230, 126, 34, 0.06);
    color: #e67e22;
}
.item-ai .icon-badge {
    background: rgba(52, 152, 219, 0.06);
    color: #3498db;
}

.info-item:hover .icon-badge {
    transform: rotate(15deg) scale(1.1);
    box-shadow: 0 0 15px rgba(154, 120, 18, 0.15);
}

.info-item h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-white) !important;
    margin-bottom: 12px;
    text-align: center;
}

.info-item p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-muted) !important;
    text-align: center;
    margin: 0;
}

/* Language Switcher Styling */
.lang-switcher-container {
    display: flex;
    justify-content: flex-end;
    padding: 10px 0;
    margin-bottom: 15px;
    width: 100%;
}
.lang-switcher {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    padding: 2px;
    backdrop-filter: blur(10px);
}
.lang-btn {
    color: #ffd700;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 18px;
    transition: all 0.3s ease;
    font-family: 'Prompt', sans-serif;
}
.lang-btn:hover {
    color: #ffd700;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}
.lang-btn.active {
    background: linear-gradient(135deg, #d4af37, #aa7c11);
    color: #120e24;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}
.lang-switcher .divider {
    color: rgba(212, 175, 55, 0.2);
    font-size: 0.75rem;
    pointer-events: none;
}

/* Hide english sub titles on mobile in Thai mode */
@media (max-width: 768px) {
    .card-en-name {
        display: none !important;
    }
}
