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

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    background-color: #0d0a14;
    background-image: 
        radial-gradient(circle at 50% 30%, rgba(70, 30, 90, 0.4) 0%, rgba(13, 10, 20, 1) 70%),
        url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1' fill='%23ffffff' fill-opacity='0.15'/%3E%3Ccircle cx='120' cy='80' r='1.5' fill='%23ffffff' fill-opacity='0.2'/%3E%3Ccircle cx='70' cy='150' r='0.8' fill='%23ffffff' fill-opacity='0.1'/%3E%3C/svg%3E");
    min-height: 100vh;
    color: #f4e9f9;
    font-family: 'Playfair Display', serif;
}

.top-nav {
    padding: 20px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #e5b869;
    text-decoration: none;
    font-size: 1.1rem;
    border: 1px solid rgba(229, 184, 105, 0.5);
    padding: 8px 20px;
    border-radius: 30px;
    transition: all 0.3s ease;
    background: rgba(20, 10, 30, 0.6);
    backdrop-filter: blur(5px);
}

.btn-back:hover {
    background: rgba(229, 184, 105, 0.15);
    color: #fff;
    border-color: #e5b869;
    box-shadow: 0 0 15px rgba(229, 184, 105, 0.4);
}

.tarot-section {
    padding: 80px 20px 60px;
    min-height: 80vh;
    position: relative;
    overflow: hidden;
}

.tarot-section::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    max-width: 100vw;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.tarot-header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    z-index: 1;
}

.tarot-header h2 {
    display: inline-block;
    color: #e5b869;
    font-size: 3rem;
    margin: 0 15px;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(229, 184, 105, 0.5);
    text-transform: uppercase;
}

.tarot-subtitle {
    font-size: 1.2rem;
    color: #c9a0dc;
    margin-top: 10px;
    font-style: italic;
    letter-spacing: 1px;
}

.decorator {
    color: #e5b869;
    font-size: 1.8rem;
    text-shadow: 0 0 10px rgba(229, 184, 105, 0.8);
}

.tarot-board {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.tarot-controls {
    margin-bottom: 60px;
}

.settings-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.question-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.tarot-input, .tarot-select {
    width: 100%;
    max-width: 600px;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-family: 'Playfair Display', serif;
    background: rgba(20, 10, 30, 0.7);
    border: 2px solid rgba(229, 184, 105, 0.4);
    border-radius: 30px;
    color: #f4e9f9;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    appearance: none;
    -webkit-appearance: none;
}

.tarot-input::placeholder {
    color: rgba(201, 160, 220, 0.6);
    font-style: italic;
}

.tarot-input:focus, .tarot-select:focus {
    border-color: #e5b869;
    box-shadow: 0 0 20px rgba(229, 184, 105, 0.4), inset 0 0 10px rgba(0,0,0,0.5);
    background: rgba(20, 10, 30, 0.9);
}

.tarot-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e5b869' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 20px;
    padding-right: 50px;
    text-align: left;
}

.tarot-select option {
    background: #1a0b26;
    color: #f4e9f9;
}

.btn-gold {
    background: linear-gradient(135deg, #e5b869 0%, #c4963b 50%, #e5b869 100%);
    background-size: 200% auto;
    color: #111;
    border: 2px solid #fff;
    padding: 16px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5), 0 0 30px rgba(229, 184, 105, 0.3);
}

.btn-gold:hover {
    background-position: right center;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 25px rgba(0,0,0,0.6), 0 0 40px rgba(229, 184, 105, 0.6);
    color: #000;
}

.btn-gold:disabled {
    background: #444;
    border-color: #555;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tarot-spread {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
    margin-bottom: 50px;
    perspective: 1200px;
    transition: all 0.5s ease;
}

.tarot-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 260px;
}

.tarot-spread.layout-cross {
    display: grid;
    grid-template-columns: 200px 200px 200px;
    grid-template-rows: auto auto auto;
    grid-template-areas: 
        ". pos-top ."
        "pos-left pos-center pos-right"
        ". pos-bottom .";
    gap: 20px 40px;
    align-items: center;
    justify-content: center;
}

.layout-cross .tarot-slot {
    width: 200px;
}

.layout-cross .card-container {
    width: 170px;
    height: 290px;
}

.layout-cross .slot-title {
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.layout-cross .card-description {
    font-size: 0.85rem;
    padding: 10px;
    min-height: 80px;
    margin-top: 15px;
}

@media (min-width: 1100px) {
    .tarot-spread.layout-cross {
        grid-template-columns: 360px 360px 360px;
        gap: 30px 20px;
    }

    .layout-cross .tarot-slot {
        width: 100%;
        display: grid;
        grid-template-columns: 170px 170px;
        grid-template-rows: auto 290px;
        grid-template-areas: 
            "title title"
            "card desc";
        gap: 15px 15px;
        align-items: start;
        justify-items: center;
    }

    .layout-cross .card-container {
        grid-area: card;
        width: 170px;
        height: 290px;
        margin: 0;
    }

    .layout-cross .slot-title {
        grid-area: title;
        margin-bottom: 0;
        text-align: center;
        font-size: 1.2rem;
        align-self: center;
    }
    
    .layout-cross .slot-title::after {
        display: block;
    }

    .layout-cross .card-description {
        grid-area: desc;
        margin-top: 0;
        text-align: left;
        padding: 15px;
        font-size: 0.85rem;
        height: 290px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .layout-cross .card-description strong {
        font-size: 0.85rem;
        letter-spacing: 0px;
        margin-bottom: 5px;
    }
}

.cross-pos-left { grid-area: pos-left; }
.cross-pos-right { grid-area: pos-right; }
.cross-pos-top { grid-area: pos-top; }
.cross-pos-bottom { grid-area: pos-bottom; }
.cross-pos-center { grid-area: pos-center; }

.slot-title {
    font-size: 1.5rem;
    color: #e5b869;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 4px;
    position: relative;
    padding-bottom: 10px;
    text-shadow: 0 0 10px rgba(229, 184, 105, 0.3);
    text-align: center;
}

.slot-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5b869, transparent);
}

.card-container {
    width: 220px;
    height: 380px;
    position: relative;
    cursor: pointer;
    filter: drop-shadow(0 20px 30px rgba(0,0,0,0.6));
    transition: all 0.5s ease;
}

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

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

.tarot-card.hidden-card {
    opacity: 0;
    transform: translateY(-80px) rotateY(180deg) scale(0.9);
}

.is-reversed .card-front {
    transform: rotateZ(180deg);
}

.card-inner {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 14px;
}

.card-back {
    background-color: #1a0b26;
    background-image: 
        radial-gradient(circle at center, rgba(229, 184, 105, 0.15) 0%, transparent 60%),
        repeating-linear-gradient(45deg, rgba(229, 184, 105, 0.05) 0px, rgba(229, 184, 105, 0.05) 2px, transparent 2px, transparent 15px),
        repeating-linear-gradient(-45deg, rgba(229, 184, 105, 0.05) 0px, rgba(229, 184, 105, 0.05) 2px, transparent 2px, transparent 15px);
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #b38b36;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), inset 0 0 5px rgba(229, 184, 105, 0.5);
}

.card-back::before {
    content: "";
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    border: 1px solid rgba(229, 184, 105, 0.4);
    border-radius: 8px;
    pointer-events: none;
}

.card-back-pattern {
    font-size: 5rem;
    color: #e5b869;
    filter: drop-shadow(0 0 10px rgba(229, 184, 105, 0.6));
    animation: pulseGlow 4s infinite alternate;
}

@keyframes pulseGlow {
    0% { filter: drop-shadow(0 0 5px rgba(229, 184, 105, 0.4)); transform: scale(0.95); }
    100% { filter: drop-shadow(0 0 20px rgba(229, 184, 105, 0.8)); transform: scale(1.05); }
}

.card-front {
    background: #fdfbf7;
    width: 100%;
    height: 100%;
    transform: rotateY(0deg);
    border: 2px solid #d4af37;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(139, 101, 8, 0.3);
    display: flex;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-description {
    margin-top: 25px;
    font-size: 1rem;
    line-height: 1.6;
    color: #e2d1eb;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease-in-out;
    min-height: 120px;
    width: 100%;
    background: rgba(20, 10, 30, 0.6);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(229, 184, 105, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.card-description.show {
    opacity: 1;
    transform: translateY(0);
}

.card-description strong {
    color: #e5b869;
    display: block;
    font-size: 1.1rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#tarotReadingResult {
    display: none;
    margin-top: 50px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(42, 22, 53, 0.8), rgba(13, 10, 20, 0.9));
    border: 1px solid #e5b869;
    border-radius: 15px;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(229, 184, 105, 0.1);
    animation: fadeIn 1s ease-in;
}

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

#geminiLoading {
    display: none;
    margin-bottom: 20px;
}

.gemini-spinner {
    font-size: 2rem;
    color: #c9a0dc;
}

.gemini-loading-text {
    color: #c9a0dc;
    margin-top: 10px;
    font-style: italic;
}

#geminiResponse {
    margin-bottom: 25px;
    line-height: 1.8;
    text-align: justify;
    font-size: 1.15rem;
}

#audioPlayerContainer {
    display: none;
    margin-bottom: 25px;
    text-align: center;
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(229, 184, 105, 0.3);
}

.listen-btn {
    font-size: 1rem;
    padding: 10px 25px;
}

#audioLoading {
    display: none;
    color: #e5b869;
    font-size: 0.9rem;
    margin-top: 10px;
}

#tarotAudio {
    display: none;
    width: 100%;
    height: 40px;
    margin-top: 15px;
    border-radius: 20px;
}

#audioError {
    display: none;
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-top: 10px;
}

.tarot-disclaimer {
    font-size: 0.9rem;
    color: #aaa;
    border-top: 1px solid rgba(229, 184, 105, 0.2);
    padding-top: 15px;
}

.btn-purple {
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    color: white;
    border: 1px solid #9d6cf9;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.btn-purple:hover {
    background: linear-gradient(135deg, #8b5cf6, #5b21b6);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.6);
    color: white;
}

.mt-3 {
    margin-top: 20px;
}

@media (max-width: 900px) {
    .tarot-spread {
        flex-direction: column;
        align-items: center;
        gap: 40px;
    }
    .tarot-slot {
        width: 100%;
        max-width: 320px;
    }
    .tarot-header h2 {
        font-size: 2.2rem;
    }
    .tarot-spread.layout-cross {
        display: flex;
        flex-direction: column;
        gap: 40px;
    }
    .layout-cross .tarot-slot {
        width: 100%;
        max-width: 320px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .layout-cross .card-container {
        width: 220px;
        height: 380px;
    }
    .layout-cross .card-description {
        margin-top: 15px;
        height: auto;
    }
    .tarot-input, .tarot-select {
        font-size: 1rem;
        padding: 12px 20px;
    }
    .btn-gold {
        padding: 12px 25px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .tarot-section {
        padding: 60px 15px 40px;
    }
    .tarot-header h2 {
        font-size: 1.8rem;
        margin: 0 5px;
    }
    .decorator {
        font-size: 1.4rem;
    }
    .tarot-subtitle {
        font-size: 1rem;
    }
    .card-container, .layout-cross .card-container {
        width: 200px;
        height: 345px;
    }
    .card-number {
        font-size: 1.5rem;
    }
    .card-image-placeholder {
        font-size: 3.5rem;
        margin: 15px 0;
    }
    .card-name {
        font-size: 1rem;
    }
    .slot-title {
        font-size: 1.2rem;
    }
}