/* ========================================================
   TAROT AI - MYSTICAL DARK THEME STYLESHEET
   3D Card Transforms, Glassmorphism, Ambient Aura & Rituals
   ======================================================== */

:root {
    --bg-deep: #07080d;
    --bg-surface: #0e111a;
    --bg-card: #151824;
    --surface-glass: rgba(21, 24, 36, 0.72);
    --border-glass: rgba(167, 139, 250, 0.18);
    --border-gold: rgba(217, 175, 95, 0.35);
    
    --primary-purple: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.45);
    --gold: #d4af37;
    --gold-glow: rgba(212, 175, 55, 0.35);
    --teal-calm: #2dd4bf;
    --rose-soft: #f43f5e;
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --font-heading: 'Playfair Display SC', 'Playfair Display', Georgia, serif; /* Cinzel lacks Vietnamese diacritics */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --card-width: 155px;
    --card-height: 245px;
    --card-radius: 12px;
}

@media (min-width: 768px) {
    :root {
        --card-width: 185px;
        --card-height: 290px;
    }
}

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

body {
    background: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image: 
        radial-gradient(circle at 50% 15%, rgba(139, 92, 246, 0.12) 0%, transparent 60%),
        radial-gradient(circle at 85% 75%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 15% 85%, rgba(45, 212, 191, 0.05) 0%, transparent 50%);
}

/* Background Stars Canvas */
#mystic-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

.tarot-app {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

/* Header & Navigation */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 36px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px var(--primary-glow));
    animation: pulse-glow 3s infinite ease-in-out;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #fff 40%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary-purple);
    font-weight: 600;
    display: block;
    margin-top: -3px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn-icon {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-icon:hover {
    color: var(--text-main);
    border-color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Steps / Workflow */
.stepper-nav {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 36px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    transition: all 0.3s ease;
}

.step-item.active {
    color: var(--primary-purple);
}

.step-item.completed {
    color: var(--teal-calm);
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Section Containers */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
    display: block;
}

/* Hero / Query Setup Card */
.setup-card {
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    max-width: 820px;
    margin: 0 auto;
}

.setup-title {
    font-family: var(--font-heading);
    font-size: 32px;
    text-align: center;
    margin-bottom: 8px;
    color: #fff;
}

.setup-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 32px;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

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

.topic-btn {
    background: rgba(14, 17, 26, 0.7);
    border: 1px solid var(--border-glass);
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.topic-btn:hover {
    border-color: var(--primary-purple);
    background: rgba(139, 92, 246, 0.1);
}

.topic-btn.selected {
    border-color: var(--primary-purple);
    background: rgba(139, 92, 246, 0.25);
    box-shadow: 0 0 16px var(--primary-glow);
    color: #fff;
    font-weight: 600;
}

/* Spread Selector Cards */
.spread-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.spread-card {
    background: rgba(14, 17, 26, 0.7);
    border: 1px solid var(--border-glass);
    padding: 18px 20px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.spread-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.spread-card.selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 20px var(--gold-glow);
}

.spread-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.spread-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    margin: 0;
    flex: 1;
    min-width: 0;
}

.spread-badge {
    position: static;
    flex-shrink: 0;
    background: rgba(212, 175, 55, 0.18);
    color: var(--gold);
    border: 1px solid var(--border-gold);
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    align-self: flex-start;
}

.spread-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Interpretation Mode Selector Cards */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.mode-card {
    background: rgba(14, 17, 26, 0.7);
    border: 1px solid var(--border-glass);
    padding: 20px 22px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.mode-card:hover {
    border-color: var(--teal-calm);
    background: rgba(45, 212, 191, 0.06);
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.mode-card[data-mode="ai"]:hover {
    border-color: var(--primary-purple);
    background: rgba(139, 92, 246, 0.08);
}

.mode-card.selected {
    border-color: var(--teal-calm);
    background: rgba(45, 212, 191, 0.12);
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.25);
}

.mode-card[data-mode="ai"].selected {
    border-color: var(--primary-purple);
    background: rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 20px var(--primary-glow);
}

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

.mode-quota-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.mode-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mode-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}

.mode-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    margin: 0;
}

.mode-badge {
    position: static;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    align-self: flex-start;
}

.mode-badge.free {
    background: rgba(45, 212, 191, 0.18);
    color: var(--teal-calm);
    border: 1px solid rgba(45, 212, 191, 0.35);
}

.mode-badge.ai {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.mode-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Text Inputs */
.input-textarea {
    width: 100%;
    background: rgba(7, 8, 13, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    transition: border-color 0.25s ease;
}

.input-textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 12px var(--primary-glow);
}

.input-text {
    width: 100%;
    background: rgba(7, 8, 13, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 18px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.25s ease;
}

.input-text:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 12px var(--primary-glow);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}

/* Action Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple) 0%, #6d28d9 100%);
    color: #fff;
    border: 0;
    padding: 16px 36px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.6);
}

/* ========================================================
   STAGE 2: 3D CARD RITUAL & SPREAD TABLE
   ======================================================== */
.ritual-arena {
    text-align: center;
    perspective: 1200px;
}

.ritual-header {
    margin-bottom: 30px;
}

.ritual-title {
    font-family: var(--font-heading);
    font-size: 26px;
    color: #fff;
    margin-bottom: 6px;
}

.ritual-hint {
    color: var(--text-muted);
    font-size: 14px;
}

/* Spread Slots Table */
.spread-table {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 28px;
    margin: 40px 0;
    min-height: 380px;
}

.slot-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.slot-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold);
    font-weight: 600;
}

.slot-description {
    font-size: 12px;
    color: var(--text-dim);
    max-width: 170px;
    text-align: center;
}

/* 3D Card Element */
.tarot-card-3d {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tarot-card-3d:hover {
    transform: translateY(-8px) scale(1.02);
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: var(--card-radius);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

/* Card Flipped State */
.tarot-card-3d.flipped .card-inner {
    transform: rotateY(180deg);
}

/* Card Flipped + Reversed: Keep card body & text upright */
.tarot-card-3d.flipped.is-reversed .card-inner {
    transform: rotateY(180deg);
}

/* Only invert the illustration/symbol upside down for reversed cards */
.tarot-card-3d.is-reversed .card-illustration {
    transform: rotate(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--card-radius);
    border: 2px solid var(--border-gold);
    overflow: hidden;
}

/* Card Back (Mystical Pattern) */
.card-back {
    background: radial-gradient(circle at center, #1b1e30 0%, #0c0e17 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-color: rgba(212, 175, 55, 0.4);
}

.card-back-pattern {
    width: 90%;
    height: 90%;
    border: 1px dashed rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
}

.card-back-rune {
    font-size: 38px;
    color: var(--gold);
    filter: drop-shadow(0 0 12px var(--gold-glow));
    animation: rotate-slow 20s infinite linear;
}

/* Card Front */
.card-front {
    background: linear-gradient(180deg, #181b29 0%, #0d0f17 100%);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    padding: 14px;
    justify-content: space-between;
}

.card-front-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-number {
    font-size: 11px;
    font-family: var(--font-heading);
    color: var(--gold);
    font-weight: 700;
}

.card-orientation-badge {
    font-size: 10px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.card-orientation-badge.upright {
    background: rgba(45, 212, 191, 0.15);
    color: var(--teal-calm);
    border: 1px solid rgba(45, 212, 191, 0.3);
}

.card-orientation-badge.reversed {
    background: rgba(244, 63, 94, 0.15);
    color: var(--rose-soft);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.card-illustration {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
    filter: drop-shadow(0 0 14px var(--primary-glow));
    margin: 10px 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.card-illustration .card-image {
    max-width: 100%;
    max-height: 165px;
    object-fit: contain;
    border-radius: 6px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

@media (min-width: 768px) {
    .card-illustration .card-image {
        max-height: 195px;
    }
}

.card-rune-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.card-front-footer {
    text-align: center;
}

.card-title-vi {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.card-title-en {
    font-size: 11px;
    color: var(--text-dim);
}

.card-keywords {
    font-size: 11px;
    color: var(--gold);
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================================
   STAGE 3: AURA AI INTERPRETATION & STREAMING
   ======================================================== */
.reading-container {
    background: var(--surface-glass);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    margin-top: 40px;
}

.aura-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 28px;
}

.aura-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #a855f7 0%, #4c1d95 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 0 20px var(--primary-glow);
    position: relative;
}

.aura-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--teal-calm);
    border: 2px solid var(--bg-surface);
}

.aura-name {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.aura-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Markdown Stream Box */
.stream-content {
    font-size: 16px;
    line-height: 1.8;
    color: #e2e8f0;
    min-height: 160px;
}

.stream-content h3 {
    font-family: var(--font-heading);
    color: var(--gold);
    font-size: 20px;
    margin: 32px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.stream-content h3:first-child {
    margin-top: 0;
}

.stream-content p {
    margin-bottom: 16px;
}

.stream-content ul {
    margin: 14px 0 20px 24px;
}

.stream-content li {
    margin-bottom: 8px;
}

.stream-content blockquote {
    background: rgba(139, 92, 246, 0.1);
    border-left: 4px solid var(--primary-purple);
    padding: 16px 20px;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    font-size: 17px;
    color: #c4b5fd;
    margin: 24px 0;
}

/* Typing cursor */
.typing-cursor::after {
    content: "▋";
    display: inline-block;
    color: var(--primary-purple);
    animation: blink 0.8s infinite;
}

/* Animations */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px var(--primary-glow)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 18px var(--primary-glow)); }
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* Playfair Display SC uses old-style figures by default; keep numbers aligned. */
.card-number,
.spread-badge {
    font-variant-numeric: lining-nums;
}

/* Interrupted / Recovery Actions Box */
.tarot-recovery-box {
    margin-top: 28px;
    padding: 22px 24px;
    border-radius: 16px;
    background: rgba(30, 20, 10, 0.85);
    border: 1px solid rgba(245, 199, 106, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    animation: fadeIn 0.4s ease;
}

.tarot-recovery-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    color: #f5c76a;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tarot-recovery-desc {
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.6;
    margin-bottom: 16px;
}

.tarot-recovery-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tarot-recovery-actions .btn {
    padding: 11px 22px;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Mini Card Preview Strip in Reading View */
.reading-cards-preview {
    display: flex;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-card-item {
    background: rgba(14, 17, 26, 0.7);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 220px;
    max-width: 290px;
    flex: 1;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.preview-card-item:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
    background: rgba(21, 24, 36, 0.85);
}

.preview-card-thumb {
    width: 64px;
    height: 102px;
    object-fit: contain;
    border-radius: 6px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.preview-card-thumb.is-reversed {
    transform: rotate(180deg);
}

.preview-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.preview-card-pos {
    font-size: 11px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.preview-card-name {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-card-badge {
    font-size: 10px;
    display: inline-block;
    width: fit-content;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.preview-card-badge.upright {
    background: rgba(45, 212, 191, 0.15);
    color: var(--teal-calm);
}

.preview-card-badge.reversed {
    background: rgba(244, 63, 94, 0.15);
    color: var(--rose-soft);
}

.preview-card-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.preview-card-link {
    font-size: 11px;
    color: var(--gold, #facc15);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease, text-decoration 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.preview-card-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.step-item.clickable {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.step-item.clickable:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* AI Mode Privacy Note */
.mode-privacy-note {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.4;
}

/* App Footer Credits & Disclaimer */
.app-footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.6;
}

.app-footer .footer-note {
    margin-bottom: 6px;
    font-style: italic;
}

.app-footer .footer-sub {
    font-size: 11px;
    opacity: 0.8;
}

/* Mobile Stepper Responsiveness */
@media (max-width: 480px) {
    .stepper-nav {
        gap: 8px;
        font-size: 11px;
    }
    .stepper-nav .step-arrow {
        font-size: 11px;
    }
    .step-item {
        gap: 5px;
    }
    .step-item span.step-text {
        white-space: nowrap;
    }
}

@media (max-width: 380px) {
    .step-item:not(.active) span.step-text {
        display: none;
    }
}

/* Topic 1-3 Multiple Selection */
.topic-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.topic-count-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.25);
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
}

.topic-grid.max-reached .topic-btn:not(.selected) {
    opacity: 0.45;
}

/* 1-Shot Follow-up Inquiry Container */
.followup-container {
    margin-top: 36px;
    padding: 24px;
    background: rgba(30, 27, 75, 0.5);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    animation: fadeIn 0.4s ease forwards;
}

.followup-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.followup-icon {
    font-size: 26px;
    filter: drop-shadow(0 0 8px var(--primary-glow));
    flex-shrink: 0;
}

.followup-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px 0;
    letter-spacing: 0.5px;
}

.followup-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.followup-input-wrap {
    margin-bottom: 10px;
}

.followup-textarea {
    width: 100%;
    min-height: 76px;
    padding: 12px 14px;
    box-sizing: border-box;
}

.followup-counter {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
    padding-right: 4px;
    line-height: 1.2;
}

.followup-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.followup-privacy-hint {
    font-size: 11px;
    color: var(--text-dim);
    flex: 1;
    min-width: 220px;
    line-height: 1.4;
}

.btn-followup {
    max-width: 260px;
    padding: 10px 20px;
    font-size: 13px;
}

.followup-result {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.followup-question-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.followup-q-badge {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--primary-purple);
    background: rgba(168, 85, 247, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
}

.followup-question-display strong {
    font-size: 14px;
    color: var(--text-main);
    font-style: italic;
}

.followup-stream-content {
    background: rgba(15, 23, 42, 0.4);
    padding: 16px 20px;
    border-radius: 12px;
    border-left: 3px solid var(--primary-purple);
}

.followup-hint-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 220px;
}

.mode-badge.ai-quota {
    background: rgba(234, 179, 8, 0.15);
    color: var(--gold);
    border: 1px solid rgba(234, 179, 8, 0.35);
    text-transform: none;
    font-weight: 600;
}

.mode-badge.ai-quota.exhausted {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}

.followup-quota-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.followup-quota-badge.exhausted {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Reading Action Bar (Copy & Share) */
.reading-action-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.btn-reading-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    min-width: 44px;
    padding: 12px 22px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reading-action:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--primary-purple);
    color: #fff;
    transform: translateY(-1px);
}

.btn-reading-action.copied {
    background: rgba(45, 212, 191, 0.2);
    border-color: var(--teal-calm);
    color: #2dd4bf;
}

.reading-share-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
    width: 100%;
    line-height: 1.4;
}

/* Setup View Action Wrap (Item 3) */
.setup-action-wrap {
    display: block;
    width: 100%;
    margin-top: 24px;
}

/* Mobile Responsive: Sticky Setup Action, 3-Card Horizontal Arena, Large Preview */
@media (max-width: 640px) {
    .setup-card {
        padding: 24px 16px 16px;
        position: relative;
    }

    .setup-action-wrap {
        position: -webkit-sticky;
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        width: auto; /* base rule width:100% + negative margins made the bar shift left; auto lets margins stretch it */
        margin: 28px -16px -16px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: rgba(10, 12, 20, 0.96);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(139, 92, 246, 0.35);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.75);
        z-index: 50;
        display: flex;
        justify-content: center;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
    }

    .setup-action-wrap #btn-start-ritual {
        width: 100%;
        max-width: 100%;
        min-height: 48px;
        margin: 0;
        box-shadow: 0 4px 18px var(--primary-glow);
    }

    /* Item 4: 3-Card Mobile Spread Layout */
    :root {
        --card-width: 104px;
        --card-height: 168px;
        --card-radius: 8px;
    }

    .spread-table {
        gap: 10px;
        margin: 20px 0 28px;
        min-height: auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .slot-container {
        gap: 8px;
        flex: 0 0 calc(33.333% - 8px);
        max-width: 112px;
    }

    .slot-label {
        font-size: 11px;
        letter-spacing: 0.5px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .slot-description {
        display: none;
    }

    .card-front {
        padding: 8px 6px;
    }

    .card-number {
        font-size: 9px;
    }

    .card-orientation-badge {
        font-size: 8px;
        padding: 1px 4px;
    }

    .card-illustration {
        margin: 4px 0;
    }

    .card-illustration .card-image {
        max-height: 95px;
    }

    .card-title-vi {
        font-size: 11px;
        line-height: 1.2;
    }

    .card-title-en {
        display: none;
    }

    .card-keywords {
        font-size: 9px;
        line-height: 1.2;
        margin-top: 2px;
        -webkit-line-clamp: 1;
    }

    .card-back-rune {
        font-size: 26px;
    }

    /* Reading view thumbnails swipe on mobile */
    .reading-cards-preview {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .preview-card-item {
        min-width: 200px;
        scroll-snap-align: start;
        flex-shrink: 0;
        padding: 10px 12px;
    }

    .preview-card-thumb {
        width: 54px;
        height: 86px;
    }
}

@media (max-width: 375px) {
    :root {
        --card-width: 96px;
        --card-height: 154px;
    }

    .spread-table {
        gap: 6px;
    }

    .slot-container {
        flex: 0 0 calc(33.333% - 5px);
        max-width: 100px;
    }

    .card-illustration .card-image {
        max-height: 84px;
    }
}



/* Mô tả vị trí dưới lá bài: sáng và rõ hơn */
.slot-description{font-size:13.5px;line-height:1.5;color:rgba(238,232,255,.92);max-width:200px;text-shadow:0 1px 6px rgba(0,0,0,.7)}
