/* ============================================================
   TAROT PREGUNTA — Tarotki
   Paleta: #111 fondo · #b03a48 rojo · #c8a96b dorado
           #f5f1e8 marfil · #b8b8b8 humo
   ============================================================ */

:root {
    --tp-bg:           #111111;
    --tp-bg-alt:       #1a1a1a;
    --tp-surface:      #1a1a1a;
    --tp-border:       rgba(245, 241, 232, 0.08);
    --tp-border-light: rgba(200, 169, 107, 0.25);
    --tp-white:        #f5f1e8;
    --tp-white-dim:    #b8b8b8;
    --tp-gold:         #c8a96b;
    --tp-gold-light:   #d8bd80;
    --tp-gold-glow:    rgba(200, 169, 107, 0.22);
    --tp-red:          #dc4356;
    --tp-red-deep:     #b03a48;
    --tp-red-glow:     rgba(220, 67, 86, 0.28);
    --tp-card-back:    #1a1117;

    --font-display: 'Cinzel', Georgia, serif;
    --font-body:    'Manrope', system-ui, sans-serif;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

.tp-container {
    position: relative;
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
    font-family: var(--font-body);
    color: var(--tp-white);
    background: var(--tp-bg);
    min-height: 100vh;
    overflow: hidden;
}

/* ── Backgrounds ──────────────────────────────────────────── */
.tp-bg-grain {
    position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px;
}
.tp-bg-glow {
    position: fixed; top: -15%; left: 50%; transform: translateX(-50%);
    width: 600px; height: 400px; pointer-events: none; z-index: 0;
    background: radial-gradient(ellipse at center, rgba(200, 169, 107, 0.06) 0%, transparent 65%);
}

.tp-section { position: relative; z-index: 1; }
.hidden { display: none !important; }

/* ── Hero ──────────────────────────────────────────────────── */
.tp-hero {
    text-align: center;
    padding: 1.5rem 0 1rem;
    position: relative; z-index: 1;
}
.tp-hero__symbol {
    font-size: 2rem;
    color: var(--tp-gold);
    opacity: 0.7;
    margin-bottom: 0.3rem;
}
.tp-hero__title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--tp-gold);
    letter-spacing: 0.04em;
    text-shadow: 0 2px 15px var(--tp-gold-glow);
    margin-bottom: 0.4rem;
    line-height: 1.3;
}
.tp-hero__subtitle {
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--tp-white-dim);
    font-style: italic;
}

/* ── Progress ──────────────────────────────────────────────── */
.tp-progress {
    text-align: center;
    margin-bottom: 1.2rem;
    position: relative; z-index: 1;
}
.tp-progress__text {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--tp-white-dim);
    letter-spacing: 0.04em;
}
.tp-progress__bar {
    width: 100%; max-width: 200px; height: 3px;
    background: var(--tp-border); border-radius: 2px;
    margin: 0.5rem auto 0; overflow: hidden;
}
.tp-progress__fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--tp-gold), var(--tp-gold-light));
    border-radius: 2px; transition: width 0.4s ease;
}

/* ── Deck grid ─────────────────────────────────────────────── */
.tp-deck__grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    max-width: 540px;
    margin: 0 auto;
}

.tp-card {
    width: calc((100% - 2.5rem) / 6);
    aspect-ratio: 2/3;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tp-card__back {
    width: 100%; height: 100%;
    border-radius: var(--radius-sm);
    /* Radial sutil rojo en el centro + gradient cálido oscuro */
    background:
        radial-gradient(circle at 50% 50%, rgba(220, 67, 86, 0.22), transparent 65%),
        linear-gradient(160deg, #2b1820 0%, #1f1015 50%, #150a0d 100%);
    border: 1.5px solid rgba(220, 67, 86, 0.35);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
}

.tp-card__pattern {
    text-align: center;
}
.tp-card__pattern span {
    font-size: 1.15rem;
    color: var(--tp-red);
    opacity: 0.85;
    text-shadow: 0 0 8px rgba(220, 67, 86, 0.4);
    transition: color .25s, opacity .25s, text-shadow .25s;
}
.tp-card:hover .tp-card__pattern span {
    opacity: 1;
    text-shadow: 0 0 14px rgba(220, 67, 86, 0.7);
}

.tp-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.tp-card:hover .tp-card__back {
    border-color: var(--tp-border-light);
}

/* Selected — pulso rojo para más energía */
.tp-card.selected .tp-card__back {
    border-color: var(--tp-red);
    box-shadow: 0 0 18px var(--tp-red-glow);
    animation: tp-pulse 1.8s ease-in-out infinite;
}
.tp-card.selected .tp-card__pattern span {
    opacity: 1;
    color: var(--tp-red);
}

@keyframes tp-pulse {
    0%, 100% { box-shadow: 0 0 12px var(--tp-red-glow); }
    50%      { box-shadow: 0 0 30px rgba(220, 67, 86, 0.5); }
}

.tp-card.disabled {
    opacity: 0.25;
    pointer-events: none;
    transform: scale(0.95);
}

/* ── Revealed cards (with flip) ────────────────────────────── */
.tp-reading__cards {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tp-revealed {
    text-align: center;
    width: 110px;
    perspective: 600px;
}

.tp-revealed__flipper {
    width: 110px;
    height: 165px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.tp-revealed__flipper.flipped {
    transform: rotateY(180deg);
}

.tp-revealed__back,
.tp-revealed__front {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.tp-revealed__back {
    background: linear-gradient(160deg, #1a1117 0%, #1f0e10 50%, #0f0608 100%);
    border: 1.5px solid var(--tp-gold);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 15px var(--tp-gold-glow);
}

.tp-revealed__front {
    transform: rotateY(180deg);
    border: 1.5px solid var(--tp-border-light);
    box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}

.tp-revealed__front img {
    width: 100%; height: 100%; object-fit: cover;
}

.tp-revealed__name {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--tp-gold);
    margin-top: 0.5rem;
    letter-spacing: 0.03em;
    opacity: 0;
    transition: opacity 0.5s ease 0.8s;
}

.tp-revealed__flipper.flipped ~ .tp-revealed__name {
    opacity: 1;
}

/* ── Reading card ──────────────────────────────────────────── */
.tp-reading { padding: 1rem 0; }

.tp-reading__card {
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    max-width: 520px;
    margin: 0 auto 1.5rem;
    position: relative; overflow: hidden;
}
.tp-reading__card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--tp-gold), transparent);
    opacity: 0.4;
}

.tp-reading__loading { text-align: center; padding: 1rem 0; }

.tp-spinner {
    width: 38px; height: 38px; margin: 0 auto 1rem;
    border: 3px solid var(--tp-border);
    border-top-color: var(--tp-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tp-reading__loading p {
    font-style: italic; color: var(--tp-white-dim);
    animation: pulse-text 2s ease-in-out infinite;
}
@keyframes pulse-text { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

.tp-reading__result { text-align: center; animation: fadeIn 0.7s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tp-reading__ornament {
    color: var(--tp-gold); opacity: 0.35;
    font-size: 0.8rem; letter-spacing: 0.5em; margin: 0.4rem 0;
}
.tp-reading__text {
    font-family: var(--font-body);
    font-size: 1.1rem; font-weight: 400;
    line-height: 1.8; color: var(--tp-white);
    padding: 0.8rem 0; white-space: pre-wrap;
}

/* ── Buttons ───────────────────────────────────────────────── */
.tp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.85rem 2rem; border: none; border-radius: var(--radius-md);
    font-family: var(--font-display); font-size: 0.95rem; font-weight: 600;
    letter-spacing: 0.04em; cursor: pointer; transition: all 0.3s;
    width: 100%; max-width: 280px;
}
.tp-reading .tp-btn { display: flex; margin: 0 auto; }

.tp-btn--primary {
    background: linear-gradient(135deg, var(--tp-red) 0%, #8b2d39 100%);
    color: var(--tp-bg); box-shadow: 0 4px 18px var(--tp-gold-glow);
}
.tp-btn--primary:hover { transform: translateY(-2px); filter: brightness(1.1); }

.tp-btn--secondary {
    background: transparent; color: var(--tp-gold);
    border: 1.5px solid var(--tp-border-light);
}
.tp-btn--secondary:hover { border-color: var(--tp-gold); background: rgba(200, 169, 107, 0.06); }
.tp-btn--small { padding: 0.6rem 1.4rem; font-size: 0.85rem; width: auto; max-width: none; }
.tp-btn__icon { font-size: 1em; }

/* ── Modal ─────────────────────────────────────────────────── */
.tp-modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.tp-modal__overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); }
.tp-modal__content {
    position: relative; background: var(--tp-surface); border: 1px solid var(--tp-border);
    border-radius: var(--radius-lg); padding: 2rem 1.5rem; max-width: 400px; width: 100%;
    text-align: center; animation: modal-in 0.3s ease;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.93); } to { opacity: 1; transform: scale(1); } }
.tp-modal__icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.tp-modal__title { font-family: var(--font-display); font-size: 1.2rem; color: var(--tp-gold); margin-bottom: 0.75rem; }
.tp-modal__message { font-size: 0.95rem; color: var(--tp-white-dim); line-height: 1.6; margin-bottom: 1.5rem; }
.tp-modal__buttons { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 520px) {
    .tp-container { padding: 1.5rem 1rem 2rem; }
    .tp-hero__title { font-size: 1.5rem; }
    .tp-deck__grid { max-width: 400px; }
    .tp-card { width: calc((100% - 1.2rem) / 4); }
    .tp-revealed { width: 90px; }
    .tp-revealed__flipper { width: 90px; height: 135px; }
    .tp-reading__card { padding: 1.5rem 1.1rem; }
    .tp-reading__text { font-size: 1rem; }
}

@media (max-width: 360px) {
    .tp-hero__title { font-size: 1.3rem; }
    .tp-deck__grid { max-width: 300px; }
    .tp-card { width: calc((100% - 0.8rem) / 3); }
    .tp-revealed { width: 80px; }
    .tp-revealed__flipper { width: 80px; height: 120px; }
    .tp-revealed__name { font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* ── Mejoras Tarotki (overrides editoriales) ─────────────── */

/* Hero con pregunta: rojo carmín en lugar de oro */
.tp-hero__title {
    color: var(--tp-white);
    text-shadow: none;
}
.tp-hero__title::after {
    content: '';
    display: block;
    width: 50px;
    height: 1px;
    background: var(--tp-red);
    margin: 0.7rem auto 0;
    opacity: 0.7;
}
.tp-hero__symbol {
    color: var(--tp-red);
    opacity: 0.85;
}

/* Drop cap editorial en el primer párrafo de la lectura */
.tp-reading__text p:first-of-type::first-letter {
    font-family: var(--font-display);
    font-size: 3.4em;
    font-weight: 700;
    color: var(--tp-red);
    float: left;
    line-height: 0.9;
    margin: 0.1em 0.12em 0 0;
    padding-top: 0.05em;
}

/* Botón "nueva tirada" con acento rojo en hover */
.tp-btn--secondary:hover {
    border-color: var(--tp-red);
    color: var(--tp-red);
    background: rgba(176, 58, 72, 0.08);
}

/* Modal con borde superior rojo */
.tp-modal__content::before {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background: var(--tp-red);
    margin: 0 auto 1rem;
    opacity: 0.6;
}
