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

:root {
    --void-black: #0a0a0f;
    --occult-purple: #6b2d8a;
    --blood-red: #8a1c1c;
    --spectral-teal: #2d8a7a;
    --ghost-white: #e8e4f0;
    --neon-pink: #ff2d95;
    --neon-cyan: #2dffff;
    --neon-gold: #ffd700;
    --card-width: 120px;
    --card-height: 180px;
}

body {
    min-height: 100vh;
    background: var(--void-black);
    font-family: 'Crimson Text', serif;
    color: var(--ghost-white);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 0 2rem;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, rgba(107, 45, 138, 0.15) 0%, transparent 70%),
        repeating-conic-gradient(from 0deg, transparent 0deg 1deg, rgba(107, 45, 138, 0.03) 1deg 2deg);
    pointer-events: none;
    z-index: 0;
}

h1 {
    font-family: 'Cinzel Decorative', cursive;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0.1rem;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan), var(--neon-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 45, 149, 0.5);
    animation: titlePulse 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes titlePulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.instruction {
    text-align: center;
    font-size: 1.3rem;
    color: rgba(160, 155, 170, 0.45);
    margin-bottom: 1.3rem;
    font-style: italic;
    z-index: 1;
}

/* ==================== BREADCRUMB ==================== */

.breadcrumb-container {
    display: none;
    width: 100%;
    margin: 0 auto 2rem;
    padding: 0 1rem;
    z-index: 50;
    text-align: center;
}

.breadcrumb-container.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.breadcrumb {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    list-style: none;
    position: relative;
    padding: 0;
    margin: 0;
}

.breadcrumb-wrapper {
    position: relative;
    display: flex;
}

.breadcrumb > .breadcrumb-wrapper {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.85rem;
    color: rgba(232, 228, 240, 0.4);
    background: linear-gradient(rgba(107, 45, 138, 0.3), rgba(107, 45, 138, 0.3)), var(--void-black);
    padding: 0.5rem 1.2rem 0.5rem 1.8rem;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%, 15px 50%);
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    z-index: 1;
}

.breadcrumb-item.breadcrumb-home {
    padding: 0.5rem 1.2rem;
    min-width: 4.5rem;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);
    background: linear-gradient(rgba(107, 45, 138, 0.3), rgba(107, 45, 138, 0.3)), var(--void-black);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0;
    color: var(--ghost-white);
}

.breadcrumb-item.breadcrumb-home:hover {
    background: var(--neon-purple) !important;
    transform: scale(1.05);
}

.breadcrumb-wrapper:last-child .breadcrumb-item {
    padding-right: 1.2rem;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 15px 50%);
}

.breadcrumb-item.active {
    color: var(--void-black);
    background: var(--neon-cyan);
    transform: scale(1.05);
    font-weight: bold;
}

.breadcrumb-item.completed {
    color: var(--neon-gold);
    background: linear-gradient(rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.2)), var(--void-black);
}

.breadcrumb-wrapper[data-tooltip] {
    position: relative;
}

.breadcrumb-wrapper[data-tooltip]::before,
.breadcrumb-wrapper[data-tooltip]::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

.breadcrumb-wrapper[data-tooltip]::before {
    content: '';
    top: calc(100% + 0px);
    border: 6px solid transparent;
    border-bottom-color: var(--neon-cyan);
}

.breadcrumb-wrapper[data-tooltip]::after {
    content: attr(data-tooltip);
    top: calc(100% + 12px);
    background: rgba(10, 10, 15, 0.95);
    color: var(--ghost-white);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-family: 'Crimson Text', serif;
    font-size: 0.85rem;
    white-space: nowrap;
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 15px rgba(45, 255, 255, 0.2);
    text-shadow: none;
    font-weight: normal;
    letter-spacing: normal;
}

.breadcrumb-wrapper[data-tooltip]:hover {
    z-index: 100;
}

.breadcrumb-wrapper[data-tooltip]:hover::before,
.breadcrumb-wrapper[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
    .breadcrumb-item {
        font-size: 0.6rem;
        padding: 0.4rem 0.8rem 0.4rem 1.2rem;
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
    }

    .breadcrumb-wrapper:last-child .breadcrumb-item {
        padding-right: 0.8rem;
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%);
    }

    .breadcrumb-item.breadcrumb-home {
        padding-left: 0.8rem;
        min-width: 3.5rem;
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
    }
}

.error-message, .warning-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 8px;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1rem;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s;
}

.error-message {
    background: linear-gradient(135deg, var(--blood-red), #5a1a1a);
    border: 2px solid var(--blood-red);
    color: var(--ghost-white);
    box-shadow: 0 0 20px rgba(138, 28, 28, 0.5);
}

.warning-message {
    background: linear-gradient(135deg, #5a4a1a, #3a3a1a);
    border: 2px solid var(--neon-gold);
    color: var(--neon-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.error-message.show, .warning-message.show {
    opacity: 1;
}

/* ==================== READING TYPE SELECTION ==================== */

.reading-types {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    width: 100%;
    max-width: 600px;
    padding: 1rem;
    margin-top: 0.6rem;
}

.reading-types.show {
    display: flex;
}

.reading-type-btn {
    width: 100%;
    max-width: 400px;
    padding: 1.2rem 2rem;
    background: linear-gradient(135deg, rgba(20, 10, 30, 0.9), rgba(10, 10, 15, 0.9));
    border: 2px solid rgba(107, 45, 138, 0.5);
    border-radius: 12px;
    color: var(--ghost-white);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.reading-type-btn:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 25px rgba(45, 255, 255, 0.3);
    transform: scale(1.03);
}

.reading-type-btn.selected {
    border-color: var(--neon-pink);
    background: linear-gradient(135deg, rgba(107, 45, 138, 0.4), rgba(107, 45, 138, 0.2));
    box-shadow: 0 0 30px rgba(255, 45, 149, 0.4);
}

.reading-type-btn .name {
    display: block;
    color: var(--neon-cyan);
    margin-bottom: 0.3rem;
}

.reading-type-btn .desc {
    font-size: 1rem;
    color: rgba(232, 228, 240, 0.6);
    font-family: 'Crimson Text', serif;
}

.reading-type-btn .desc::after {
    content: ' · ';
    color: rgba(232, 228, 240, 0.4);
    margin: 0 0.2em;
}

.reading-type-btn .cards {
    font-size: 0.8rem;
    color: var(--neon-gold);
    display: inline;
}

/* Pending indicator used in Path stage: visible accent color + pulse */
.pending-dot {
    width: 12px;
    height: 12px;
    background: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(45,255,255,0.25);
    border-radius: 50%;
    display: inline-block;
    transform: scale(1);
    animation: pending-pulse 1s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes pending-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==================== SHUFFLE CONTAINER ==================== */

.shuffle-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    z-index: 10;
    width: 100%;
    max-width: 900px;
    padding: 1rem;
    position: relative;
    /* padding-bottom: 1rem; */
    min-height: 640px;
}

.shuffle-container.show {
    display: flex;
}

.shuffle-btn {
    padding: 1rem 3rem;
    background: linear-gradient(135deg, var(--occult-purple), #4a1d6a);
    border: 2px solid var(--neon-pink);
    border-radius: 30px;
    color: var(--ghost-white);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.shuffle-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,45,149,0.3) 0%, transparent 70%);
    animation: btnPulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes btnPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.shuffle-btn:hover {
    background: var(--neon-pink);
    box-shadow: 0 0 30px rgba(255, 45, 149, 0.6), 0 0 60px rgba(255, 45, 149, 0.3);
    transform: scale(1.05);
}

.shuffle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==================== SHUFFLE AREA ==================== */

.shuffle-area {
    position: relative;
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.orbit-stars {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.orbit-star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 6px white, 0 0 12px var(--neon-cyan);
    left: 50%;
    top: 50%;
    margin-left: -1.5px;
    margin-top: -1.5px;
}

.orbit-star:nth-child(1) { --angle: 0deg; --distance: 200px; animation: starWarp 3.5s linear infinite; animation-delay: 0s; }
.orbit-star:nth-child(2) { --angle: 20deg; --distance: 230px; animation: starWarp 4s linear infinite; animation-delay: 0.3s; }
.orbit-star:nth-child(3) { --angle: 40deg; --distance: 180px; animation: starWarp 3.8s linear infinite; animation-delay: 0.6s; }
.orbit-star:nth-child(4) { --angle: 60deg; --distance: 250px; animation: starWarp 4.2s linear infinite; animation-delay: 0.9s; }
.orbit-star:nth-child(5) { --angle: 80deg; --distance: 210px; animation: starWarp 3.6s linear infinite; animation-delay: 1.2s; }
.orbit-star:nth-child(6) { --angle: 100deg; --distance: 240px; animation: starWarp 3.9s linear infinite; animation-delay: 1.5s; }
.orbit-star:nth-child(7) { --angle: 120deg; --distance: 190px; animation: starWarp 4.1s linear infinite; animation-delay: 1.8s; }
.orbit-star:nth-child(8) { --angle: 140deg; --distance: 220px; animation: starWarp 3.7s linear infinite; animation-delay: 2.1s; }
.orbit-star:nth-child(9) { --angle: 160deg; --distance: 260px; animation: starWarp 4.3s linear infinite; animation-delay: 2.4s; }
.orbit-star:nth-child(10) { --angle: 180deg; --distance: 200px; animation: starWarp 3.4s linear infinite; animation-delay: 2.7s; }
.orbit-star:nth-child(11) { --angle: 200deg; --distance: 230px; animation: starWarp 3.9s linear infinite; animation-delay: 3s; }
.orbit-star:nth-child(12) { --angle: 220deg; --distance: 190px; animation: starWarp 4.1s linear infinite; animation-delay: 0.15s; }
.orbit-star:nth-child(13) { --angle: 240deg; --distance: 250px; animation: starWarp 3.6s linear infinite; animation-delay: 0.45s; }
.orbit-star:nth-child(14) { --angle: 260deg; --distance: 210px; animation: starWarp 4s linear infinite; animation-delay: 0.75s; }
.orbit-star:nth-child(15) { --angle: 280deg; --distance: 240px; animation: starWarp 3.8s linear infinite; animation-delay: 1.05s; }
.orbit-star:nth-child(16) { --angle: 300deg; --distance: 180px; animation: starWarp 4.2s linear infinite; animation-delay: 1.35s; }
.orbit-star:nth-child(17) { --angle: 320deg; --distance: 220px; animation: starWarp 3.5s linear infinite; animation-delay: 1.65s; }
.orbit-star:nth-child(18) { --angle: 340deg; --distance: 260px; animation: starWarp 3.7s linear infinite; animation-delay: 1.95s; }
.orbit-star:nth-child(19) { --angle: 10deg; --distance: 200px; animation: starWarp 3.9s linear infinite; animation-delay: 2.25s; }
.orbit-star:nth-child(20) { --angle: 55deg; --distance: 230px; animation: starWarp 4s linear infinite; animation-delay: 2.55s; }
.orbit-star:nth-child(21) { --angle: 115deg; --distance: 190px; animation: starWarp 3.6s linear infinite; animation-delay: 2.85s; }
.orbit-star:nth-child(22) { --angle: 190deg; --distance: 250px; animation: starWarp 4.1s linear infinite; animation-delay: 3.15s; }
.orbit-star:nth-child(23) { --angle: 265deg; --distance: 210px; animation: starWarp 3.8s linear infinite; animation-delay: 3.45s; }

@keyframes starWarp {
    0% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0) scale(0.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(var(--distance)) scale(0.5);
        opacity: 0;
    }
}

/* Mystical Circle */
.mystical-circle {
    position: absolute;
    width: 350px;
    height: 350px;
    top: calc(50% - 175px);
    left: calc(50% - 175px);
    border: 2px solid rgba(107, 45, 138, 0.4);
    border-radius: 50%;
    animation: rotateCircle 20s linear infinite;
    pointer-events: none;
}

.mystical-circle::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: var(--neon-pink);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--neon-pink), 0 0 40px var(--neon-pink);
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
}

.mystical-circle::after {
    content: '';
    position: absolute;
    inset: 20px;
    border: 1px solid rgba(45, 255, 255, 0.3);
    border-radius: 50%;
    animation: rotateCircleReverse 15s linear infinite;
    animation-delay: var(--ritual-mystical-after-delay, 0s);
}

.mystical-circle .yellow-orbit {
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    animation: rotateCircleReverseOffset 6s linear infinite;
    pointer-events: none;
}

.mystical-circle .yellow-orbit::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: var(--neon-gold);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--neon-gold), 0 0 30px var(--neon-gold);
}

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

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

@keyframes rotateCircleReverseOffset {
    from { transform: rotate(180deg); }
    to { transform: rotate(-180deg); }
}

/* Inner pentagram */
.pentagram {
    position: absolute;
    width: 250px;
    height: 250px;
    pointer-events: none;
}

.pentagram svg {
    width: 100%;
    height: 100%;
    animation: pulsePentagram 3s ease-in-out infinite;
}

@keyframes pulsePentagram {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

/* Particle effects */
.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--neon-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-cyan);
    animation: floatParticle 4s ease-in-out infinite;
}

@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateY(-200px) scale(0);
        opacity: 0;
    }
}

/* Energy wave */
.energy-wave {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid var(--occult-purple);
    animation: energyPulse 2s ease-out infinite;
    opacity: 0;
    transform-origin: center center;
}

@keyframes energyPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0.8;
        border-width: 4px;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
        border-width: 1px;
    }
}

/* ==================== DECK & CARD STYLES ==================== */

.deck-container {
    position: relative;
    width: 140px;
    height: 200px;
    perspective: 1000px;
    z-index: 10;
}

.deck-card {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.deck-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.deck-card-front {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid var(--occult-purple);
    box-shadow: 0 0 20px rgba(107, 45, 138, 0.6), inset 0 0 30px rgba(107, 45, 138, 0.2);
}

.deck-card-front::before {
    content: '✦';
    font-size: 2.5rem;
    color: var(--occult-purple);
    opacity: 0.6;
    text-shadow: 0 0 15px var(--occult-purple);
}

.deck-card-back {
    background: linear-gradient(135deg, #2d1b4e, #1a1a2e);
    border: 2px solid var(--neon-cyan);
    transform: rotateY(180deg);
    box-shadow: 0 0 25px rgba(45, 255, 255, 0.4);
}

/* Spreading cards */
.spreading-cards {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spread-card {
    position: absolute;
    width: 100px;
    height: 150px;
    transform-style: preserve-3d;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

.spread-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spread-card-front {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid rgba(107, 45, 138, 0.7);
    box-shadow: 0 0 15px rgba(107, 45, 138, 0.4);
}

.spread-card-front::before {
    content: '✦';
    font-size: 1.8rem;
    color: var(--occult-purple);
    opacity: 0.5;
}

/* Swirling cards */
.swirl-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.swirl-card {
    position: absolute;
    width: 90px;
    height: 135px;
    transform-style: preserve-3d;
    opacity: 0;
}

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

.swirl-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swirl-card-front {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid var(--occult-purple);
    box-shadow: 0 0 20px rgba(107, 45, 138, 0.5);
}

.swirl-card-front::before {
    content: '✦';
    font-size: 1.5rem;
    color: var(--occult-purple);
    opacity: 0.4;
}

.swirl-card-back {
    background: linear-gradient(135deg, #2d1b4e, #1a1a2e);
    border: 2px solid var(--neon-cyan);
    transform: rotateY(180deg);
}

/* Shuffle phase indicator */
.shuffle-phase {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.4rem;
    color: var(--neon-pink);
    text-shadow: 0 0 30px var(--neon-pink), 0 0 60px rgba(255, 45, 149, 0.4);
    animation: phaseGlow 1.5s ease-in-out infinite;
    /* min-height: 2rem; */
    margin-top: 0px;
}

@keyframes phaseGlow {
    0%, 100% { text-shadow: 0 0 20px var(--neon-pink), 0 0 40px rgba(255, 45, 149, 0.3); }
    50% { text-shadow: 0 0 40px var(--neon-pink), 0 0 80px rgba(255, 45, 149, 0.6); }
}

.shuffle-subphase {
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    color: var(--neon-cyan);
    opacity: 0.8;
    margin-top: -1.2rem;
    /* min-height: 1.5rem; */
}

/* Old shuffle styles - keeping for fallback */
.shuffling-cards {
    display: flex;
    gap: 10px;
    perspective: 1000px;
}

.shuffle-card {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.shuffle-animate {
    animation: shuffleCards 0.15s ease-in-out infinite;
}

@keyframes shuffleCards {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-20px) rotate(2deg); }
}

.shuffle-status {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.2rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px var(--occult-purple);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ==================== CARDS CONTAINER ==================== */

.cards-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 15;
    width: min(900px, 90vw);
    padding: 1rem;
    position: relative;
    margin-top: 0;
    pointer-events: auto;
    transform: none;
}

.cards-container.show {
    display: flex;
}

.drawn-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    max-width: 900px;
    margin-bottom: 1rem;
}

.drawn-card {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    margin-bottom: 30px;
    transform-style: preserve-3d;
}

.drawn-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    box-shadow: 0 0 15px rgba(107, 45, 138, 0.4);
    transform-style: preserve-3d;
}

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

.drawn-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.drawn-card-front {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 3px solid var(--occult-purple);
    box-shadow: 0 0 20px rgba(107, 45, 138, 0.5);
}

.drawn-card-front::before {
    content: '✦';
    font-size: 2.5rem;
    color: var(--occult-purple);
    opacity: 0.4;
}

.drawn-card-back {
    background: linear-gradient(135deg, #2d1b4e, #1a1a2e);
    border: 3px solid var(--neon-cyan);
    transform: rotateY(180deg);
    box-shadow: 0 0 30px rgba(45, 255, 255, 0.4);
    overflow: hidden;
}

.drawn-card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.card-position {
    position: absolute;
    top: -21px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.7rem;
    color: var(--neon-gold);
    white-space: nowrap;
    text-align: center;
    width: 140px;
}

.card-position,
.card-name {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.drawn-card.flipped .card-position,
.drawn-card.flipped .card-name {
    opacity: 1;
}

.card-orientation {
    font-size: 0.65rem;
    color: var(--neon-pink);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-name {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.7rem;
    color: var(--ghost-white);
    white-space: nowrap;
    text-align: center;
    width: 140px;
    min-height: 2.5em;
}

.card-name .reversed-label {
    font-size: 0.6rem;
    color: var(--neon-pink);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}

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

.drawn-card.reversed:hover .drawn-card-inner {
    box-shadow: 0 0 30px rgba(255, 45, 149, 0.6), 0 0 60px rgba(255, 45, 149, 0.3);
    transform: scale(1.05);
}

.drawn-card.reversed.flipped:hover .drawn-card-inner {
    box-shadow: 0 0 30px rgba(255, 45, 149, 0.6), 0 0 60px rgba(255, 45, 149, 0.3);
    transform: rotateY(180deg) scale(1.05);
}

.drawn-card:hover .drawn-card-inner {
    box-shadow: 0 0 30px rgba(45, 255, 255, 0.6), 0 0 60px rgba(45, 255, 255, 0.3);
    transform: scale(1.05);
}

.drawn-card.flipped:hover .drawn-card-inner {
    transform: rotateY(180deg) scale(1.05);
    box-shadow: 0 0 30px rgba(45, 255, 255, 0.6), 0 0 60px rgba(45, 255, 255, 0.3);
}

.drawn-card.revealing {
    animation: cardReveal 0.6s ease-out forwards;
}

@keyframes cardReveal {
    0% {
        transform: translateY(-100px) scale(0.8);
        opacity: 0;
    }
    60% {
        transform: translateY(20px) scale(1.1);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.continue-btn {
    padding: 0.8rem 2rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, #2a4a4a, #1a3a3a);
    border: 2px solid rgba(45, 255, 255, 0.3);
    border-radius: 25px;
    color: rgba(232, 228, 240, 0.4);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1rem;
    cursor: not-allowed;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.continue-btn.enabled {
    background: linear-gradient(135deg, var(--spectral-teal), #1a6a5a);
    border: 2px solid var(--neon-cyan);
    color: var(--ghost-white);
    cursor: pointer;
    opacity: 1;
}

.continue-btn.enabled:hover {
    background: var(--neon-cyan);
    color: var(--void-black);
    box-shadow: 0 0 25px rgba(45, 255, 255, 0.5);
}
.shuffle-container.cards-stage-active .shuffle-btn {
    opacity: 0;
    transform: translateY(15px);
    pointer-events: none;
}

.shuffle-container.cards-stage-active .deck-container,
.shuffle-container.cards-stage-active .swirl-container,
.shuffle-container.cards-stage-active .spreading-cards {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

.shuffle-container.cards-stage-active .cards-container {
    margin-top: -395px;
    padding-top: 0;
}

.shuffle-container.cards-stage-active .drawn-card {
    margin-top: 0;
    margin-bottom: 64px;
}

.shuffle-container.cards-stage-active .drawn-cards {
    margin-bottom: 0;
}

.shuffle-container.cards-stage-active .continue-btn {
    margin-top: -14px;
}

.shuffle-container.cards-route-active .shuffle-btn,
.shuffle-container.cards-route-active .shuffle-phase,
.shuffle-container.cards-route-active .shuffle-subphase {
    display: none;
}

.shuffle-container.cards-route-active .deck-container,
.shuffle-container.cards-route-active .swirl-container,
.shuffle-container.cards-route-active .spreading-cards {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

.shuffle-container.cards-route-active .cards-container {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(900px, 90vw);
    min-height: 400px;
    justify-content: flex-start;
    padding-top: 28px;
    margin-top: 0;
    z-index: 15;
}

.shuffle-container.cards-route-active .drawn-card {
    margin-top: 0;
    margin-bottom: 64px;
}

.shuffle-container.cards-route-active .drawn-cards {
    margin-bottom: 0;
}

.shuffle-container.cards-route-active .continue-btn {
    margin-top: -14px;
}

/* ==================== Q&A CONTAINER ==================== */

.qa-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    z-index: 10;
    width: 100%;
    padding: 1rem;
}

.qa-container.show {
    display: flex;
}

.qa-dialog {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 10, 30, 0.98), rgba(10, 10, 15, 0.98));
    border: 2px solid var(--occult-purple);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 0 40px rgba(107, 45, 138, 0.4);
    max-width: 600px;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

@keyframes qaSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.qa-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.qa-title {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.4rem;
    color: var(--neon-pink);
    margin-bottom: 0.5rem;
}

.qa-progress-container {
    margin: 1rem 0;
}

.qa-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(107, 45, 138, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.qa-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.qa-progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--neon-cyan);
    margin-top: 0.5rem;
}

.qa-question-container {
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.qa-question {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.1rem;
    color: var(--ghost-white);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.qa-answer-input {
    flex: 1;
    min-height: 100px;
    max-height: 200px;
    padding: 1rem;
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid rgba(107, 45, 138, 0.5);
    border-radius: 12px;
    color: var(--ghost-white);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    transition: all 0.3s ease;
}

.qa-answer-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(45, 255, 255, 0.2);
}

.qa-answer-input::placeholder {
    color: rgba(232, 228, 240, 0.4);
}

.qa-char-count {
    text-align: right;
    font-size: 0.8rem;
    color: rgba(232, 228, 240, 0.5);
    margin-top: 0.5rem;
}

.qa-char-count.warning {
    color: var(--neon-gold);
}

.qa-char-count.error {
    color: var(--blood-red);
}

.qa-error {
    color: var(--blood-red);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.qa-error.show {
    opacity: 1;
}

.qa-buttons {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
}

.qa-back {
    padding: 0.7rem 1.8rem;
    border-radius: 25px;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    border: 2px solid var(--occult-purple);
    color: var(--ghost-white);
    grid-column: 1;
    grid-row: 1;
}

.qa-back:hover:not(:disabled) {
    background: var(--occult-purple);
    box-shadow: 0 0 15px rgba(107, 45, 138, 0.5);
}

.qa-back:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.qa-next, .qa-submit {
    padding: 0.7rem 1.8rem;
    border-radius: 25px;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    grid-column: 3;
    grid-row: 1;
    /* background: rgba(255, 255, 255, 0.1);
    border-width: 2px;
    border-style: solid;
    border-color: var(--neon-cyan);
    color: var(--neon-cyan); */
}

.qa-skip {
    padding: 0.7rem 1.8rem;
    border-radius: 25px;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    border: 2px solid rgba(45, 255, 255, 0.5);
    color: rgba(45, 255, 255, 0.6);
    grid-column: 2;
    grid-row: 1;
}

.qa-skip:hover {
    background: rgba(45, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(45, 255, 255, 0.4);
    transform: scale(1.05);
}

.qa-reset {
    padding: 0.7rem 1.8rem;
    border-radius: 25px;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
}

.qa-reset:hover {
    background: rgba(255, 45, 170, 0.2);
    box-shadow: 0 0 15px rgba(255, 45, 170, 0.4);
    transform: scale(1.05);
}

.qa-next:hover, .qa-submit:hover {
    background: var(--neon-pink);
    box-shadow: 0 0 20px rgba(255, 45, 149, 0.5);
    transform: scale(1.05);
}

.qa-next {
    background: linear-gradient(to bottom, #cfcfcf, #adadad);
    border: 1px solid #8f8f8f;
    color: #2f2f2f;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(0, 0, 0, 0.35);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Skipping indicator: small moving dot next to text */
.skipping {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.skipping-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    display: inline-block;
    transform: translateX(0);
    animation: skipping-move 0.9s linear infinite;
}
@keyframes skipping-move {
    0% { transform: translateX(0); }
    50% { transform: translateX(8px); }
    100% { transform: translateX(0); }
}

/* Consolidated pending-dot rules above to use neon variant. */

.qa-next:hover {
    background: linear-gradient(to bottom, #d8d8d8, #b5b5b5);
    border-color: #989898;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(0, 0, 0, 0.35);
    transform: none;
}

.qa-submit {
    background: linear-gradient(135deg, var(--spectral-teal), #1a6a5a);
    border-width: 2px;
    border-style: solid;
    border-color: var(--neon-cyan);
}

.qa-submit:hover {
    background: var(--neon-cyan);
    color: var(--void-black);
    box-shadow: 0 0 25px rgba(45, 255, 255, 0.5);
}

.qa-loading {
    text-align: center;
    padding: 2rem;
    color: var(--neon-cyan);
    font-family: 'Cinzel Decorative', cursive;
}

.qa-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(45, 255, 255, 0.2);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

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

/* Generic loading spinner used across pages */
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* ==================== CONFIRMATION MODAL ==================== */

.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 700;
    align-items: center;
    justify-content: center;
}

.confirm-modal.show {
    display: flex;
}

.confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
}

.confirm-dialog {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 10, 30, 0.98), rgba(10, 10, 15, 0.98));
    border: 2px solid var(--blood-red);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 0 60px rgba(138, 28, 28, 0.5);
    max-width: 400px;
    width: 90%;
    margin: 1rem;
    text-align: center;
    animation: confirmSlideIn 0.3s ease-out;
}

@keyframes confirmSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.confirm-title {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.3rem;
    color: var(--neon-pink);
    margin-bottom: 0.5rem;
}

.confirm-message {
    color: rgba(232, 228, 240, 0.8);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirm-cancel, .confirm-ok {
    padding: 0.7rem 1.8rem;
    border-radius: 25px;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-cancel {
    background: transparent;
    border: 2px solid var(--occult-purple);
    color: var(--ghost-white);
}

.confirm-cancel:hover {
    background: var(--occult-purple);
    box-shadow: 0 0 15px rgba(107, 45, 138, 0.5);
}

.confirm-ok {
    background: linear-gradient(135deg, var(--blood-red), #5a1a1a);
    border: 2px solid var(--neon-pink);
    color: var(--ghost-white);
}

.confirm-ok:hover {
    background: var(--neon-pink);
    box-shadow: 0 0 20px rgba(255, 45, 149, 0.5);
}

/* ==================== RESTART OVERLAY ==================== */
.restart-overlay {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--ghost-white);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1rem;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.65);
    padding: 0.75rem 1.25rem;
    border: 1px solid rgba(107, 45, 138, 0.45);
    min-width: 280px;
}

.restart-overlay .loading-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Backdrop spacing so the restart box never touches screen edges */
.restart-backdrop {
    padding: 1.5rem;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .restart-overlay {
        min-width: 220px;
        padding: 0.6rem 1rem;
        gap: 0.5rem;
        font-size: 0.95rem;
    }
}

/* ==================== Q&A PREVIEW MODAL ==================== */

.qa-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 650;
    align-items: center;
    justify-content: center;
}

.qa-preview-modal.show {
    display: flex;
}

.qa-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.qa-preview-dialog {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 10, 30, 0.98), rgba(10, 10, 15, 0.98));
    border: 2px solid var(--spectral-teal);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 0 60px rgba(45, 138, 122, 0.5);
    max-width: 500px;
    width: 90%;
    margin: 1rem;
    max-height: 80vh;
    overflow-y: auto;
    animation: qaSlideIn 0.4s ease-out;
}

.qa-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(107, 45, 138, 0.5);
    padding-bottom: 1rem;
}

.qa-preview-title {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.3rem;
    color: var(--neon-cyan);
}

.qa-preview-close {
    background: none;
    border: none;
    color: var(--ghost-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.3rem;
    line-height: 1;
    transition: color 0.3s;
}

.qa-preview-close:hover {
    color: var(--neon-pink);
}

.qa-preview-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.qa-preview-item {
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid rgba(107, 45, 138, 0.4);
    border-radius: 10px;
    padding: 1rem;
}

.qa-preview-q {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.9rem;
    color: var(--neon-gold);
    margin-bottom: 0.5rem;
}

.qa-preview-a {
    font-family: 'Crimson Text', serif;
    font-size: 0.95rem;
    color: var(--ghost-white);
    line-height: 1.4;
}

.qa-preview-empty {
    text-align: center;
    color: rgba(232, 228, 240, 0.5);
    font-style: italic;
    padding: 2rem;
}

/* ==================== CHAT CONTAINER ==================== */

.chat-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-black);
    z-index: 100;
    flex-direction: column;
    animation: fadeIn 0.5s ease;
}

.chat-container.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chat-title {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.4rem;
    margin: 0;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 8px rgba(255, 45, 149, 0.5));
    animation: titlePulse 3s ease-in-out infinite;
}

.chat-reading-type {
    font-family: 'Crimson Text', serif;
    font-size: 0.95rem;
    color: var(--neon-gold);
    margin-top: 0.3rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.9;
}

.chat-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, rgba(107, 45, 138, 0.3) 0%, transparent 100%);
    border-bottom: 1px solid rgba(107, 45, 138, 0.5);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1rem;
    align-items: start;
    width: 100%;
}

.chat-header > div:first-child {
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.chat-header-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    margin-left: 0;
    flex: 0 0 auto;
    gap: 4px;
    justify-self: end;
    align-self: start;
}

.view-qa,
.close-chat {
    width: 130px;
    height: 40px;
    padding: 0.6rem 1rem;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.8rem;
    border-radius: 5px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    min-width: 0;
}

.view-qa {
    margin-right: 0;
}

.close-chat {
    margin-left: 0;
}

.drawn-cards-display {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 0.5rem;
    padding-left: 0;
    margin-left: 0;
}

.drawn-cards-display .mini-card {
    width: 40px;
    height: 60px;
    border-radius: 4px;
    overflow: visible;
    border: 1px solid var(--occult-purple);
    position: relative;
    cursor: default;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.drawn-cards-display .mini-card::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 8px;
    background: radial-gradient(ellipse at center, rgba(107, 45, 138, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    pointer-events: none;
}

.drawn-cards-display .mini-card:hover {
    transform: scale(1.3);
    box-shadow: 0 0 20px rgba(107, 45, 138, 0.6), 0 0 40px rgba(78, 205, 196, 0.3);
    z-index: 5;
}

.drawn-cards-display .mini-card:hover::before {
    opacity: 1;
}

.drawn-cards-display .mini-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.drawn-cards-display .mini-card.reversed img {
    transform: rotate(180deg);
}

.drawn-cards-display .mini-card:first-child .mini-card-tooltip {
    left: 0;
    transform: translateX(0);
}

.drawn-cards-display .mini-card .mini-card-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid var(--neon-cyan);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.drawn-cards-display .mini-card:hover .mini-card-tooltip {
    opacity: 1;
}

.drawn-cards-display .mini-card .mini-card-tooltip .card-name-text {
    display: block;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.7rem;
    color: var(--ghost-white);
    line-height: 1.1;
}

.drawn-cards-display .mini-card .mini-card-tooltip .reversed-label {
    display: block;
    margin-top: 2px;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.6rem;
    color: var(--neon-pink);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.1;
}

.close-chat {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 2px solid var(--occult-purple);
    color: var(--ghost-white);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 5px;
    margin-left: 0;
    min-width: 100px;
    text-align: center;
}

.close-chat:hover {
    background: var(--occult-purple);
    box-shadow: 0 0 15px rgba(107, 45, 138, 0.5);
}

.view-qa {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, var(--spectral-teal), #1a6a5a);
    border: 2px solid var(--neon-cyan);
    color: var(--ghost-white);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 5px;
    margin-right: 0;
    min-width: 100px;
    text-align: center;
}

.view-qa:hover {
    background: var(--neon-cyan);
    color: var(--void-black);
    box-shadow: 0 0 15px rgba(45, 255, 255, 0.5);
}

.view-qa:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==================== CHAT MESSAGES ==================== */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    max-width: 80%;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    line-height: 1.5;
    overflow: visible;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(45, 255, 255, 0.2), rgba(45, 255, 255, 0.1));
    border: 1px solid rgba(45, 255, 255, 0.3);
}

.message.bot {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(107, 45, 138, 0.3), rgba(107, 45, 138, 0.1));
    border: 1px solid rgba(107, 45, 138, 0.5);
}

.message .sender {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.75rem;
    color: var(--neon-cyan);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.message.user .sender {
    color: var(--neon-cyan);
}

.message.bot .sender {
    color: var(--neon-pink);
}

.message .content {
    color: var(--ghost-white);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    line-height: 1.2;
    white-space: pre-wrap;
    text-align: left;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: visible;
}

.message .content > *:first-child {
    margin-top: 0;
}

.message .content p {
    margin: 0 0 0.1rem 0;
}

.message .content p:has(+ ul),
.message .content p:has(+ ol) {
    margin-bottom: 0;
}

.message .content hr {
    border: none;
    border-top: 1px solid rgba(107, 45, 138, 0.5);
    margin: 0 0;
}

.message .content h1, .message .content h2, .message .content h3 {
    color: var(--neon-gold);
    margin: 0.2rem 0 0.2rem 0;
    font-family: 'Crimson Text', serif;
    font-weight: bold;
    text-align: left;
}

.message .content h1 {
    font-size: 1.6rem;
}

.message .content h2 {
    font-size: 1.4rem;
}

.message .content h3 {
    font-size: 1.2rem;
}

.message .content h1:first-child, .message .content h2:first-child, .message .content h3:first-child {
    margin-top: 0;
}

.message .content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.message .content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message .content pre code {
    background: none;
    padding: 0;
}

.message .content ul, .message .content ol {
    margin: 0.5rem 0;
    padding-left: 2rem;
}

.message .content ul {
    list-style-type: disc;
}

.message .content ol {
    list-style-type: decimal;
}

.message .content li {
    margin: 0.4rem 0;
    display: list-item;
    list-style: inherit;
}

.message .content li:last-child {
    margin-bottom: 0;
}

.message .content li > ul,
.message .content li > ol {
    margin: 0.3rem 0 0.3rem 1.5rem !important;
    padding-left: 1.5rem !important;
}

.message .content li > *:first-child {
    margin-top: 0;
}

.message .content li > *:last-child {
    margin-bottom: 0;
}

.message .content li p {
    margin: 0.2rem 0;
    display: block;
}

.message .content strong {
    color: var(--neon-gold);
}

.message .content em {
    color: var(--neon-pink);
}

.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(107, 45, 138, 0.3), rgba(107, 45, 138, 0.1));
    border: 1px solid rgba(107, 45, 138, 0.5);
    border-radius: 15px;
}

.typing-indicator.show {
    display: block;
}

.typing-dots {
    display: flex;
    gap: 0.3rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--neon-pink);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* ==================== CHAT INPUT ==================== */

.chat-input-container {
    padding: 1.5rem 2rem;
    background: linear-gradient(0deg, rgba(107, 45, 138, 0.2) 0%, transparent 100%);
    border-top: 1px solid rgba(107, 45, 138, 0.3);
}

.chat-input-wrapper {
    display: flex;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input {
    flex: 1;
    padding: 1rem 1.5rem;
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid rgba(107, 45, 138, 0.5);
    border-radius: 25px;
    color: var(--ghost-white);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(45, 255, 255, 0.2);
}

.chat-input::placeholder {
    color: rgba(232, 228, 240, 0.4);
}

.send-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--occult-purple), #4a1d6a);
    border: 2px solid var(--neon-pink);
    border-radius: 25px;
    color: var(--ghost-white);
    font-family: 'Cinzel Decorative', cursive;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: var(--neon-pink);
    box-shadow: 0 0 20px rgba(255, 45, 149, 0.5);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 500px) {
    :root {
        --card-width: 80px;
        --card-height: 120px;
    }
    .message {
        max-width: 90%;
        padding: 0.8rem 1rem;
    }
    .chat-messages {
        padding: 1rem;
    }
    .chat-input-container {
        padding: 1rem;
    }
    .reading-type-btn {
        padding: 1rem;
        font-size: 1rem;
    }
}
