/* =============================================
   LECTURA DE TAROT CON IA — styles.css
   Diseño propio: oscuro, minimalista, elegante
   ============================================= */

:root {
    --black:        #0a0a0f;
    --deep:         #10101a;
    --surface:      #16161f;
    --surface-2:    #1e1e2b;
    --border:       rgba(255,255,255,.07);
    --border-glow:  rgba(160,130,255,.35);

    --gold:         #c9a84c;
    --gold-light:   #e8c87a;
    --violet:       #8b6fe8;
    --violet-light: #a990f5;
    --text:         #e8e6f0;
    --text-muted:   #7a7890;
    --text-dim:     #4a4860;

    --radius:       14px;
    --radius-sm:    8px;
    --transition:   .25s ease;

    --card-w:       90px;
    --card-h:       135px;
}

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

body {
    /* background: var(--black); */ /* Comentado: la web ya tiene fondo estrellado propio */
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    min-height: 100vh;
}

/* ── Fondo ── */
.app { position: relative; min-height: 100vh; overflow: hidden; }

/* Fondo circular desactivado — la web ya tiene su propio fondo estrellado
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .18;
}
.orb-1 { width: 500px; height: 500px; background: var(--violet);    top: -120px; left: -100px; }
.orb-2 { width: 400px; height: 400px; background: var(--gold);      bottom: -80px; right: -80px; }
.orb-3 { width: 300px; height: 300px; background: #3a2a6e;          top: 45%; left: 50%; transform: translate(-50%,-50%); }
*/

/* ── Layout ── */
.step {
    display: none;
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 48px 20px 80px;
    animation: fadeUp .45s ease both;
}
.step.active { display: block; }

.container      { max-width: 1100px; margin: 0 auto; }
.container.narrow { max-width: 640px; margin: 0 auto; }

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

/* ── Hero ── */
.hero { text-align: center; margin-bottom: 48px; }

.hero-sigil {
    width: 80px; height: 80px;
    margin: 0 auto 24px;
    color: var(--violet-light);
    animation: spin-slow 30s linear infinite;
}
@keyframes spin-slow { to { transform: rotate(360deg); } }

.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -.5px;
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--violet-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.hero-sub {
    font-size: 1.05rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Formulario pregunta ── */
.card-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 12px;
}

.form-textarea {
    width: 100%;
    background: var(--deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    padding: 16px;
    resize: vertical;
    min-height: 100px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-textarea:focus {
    outline: none;
    border-color: var(--border-glow);
    box-shadow: 0 0 0 3px rgba(139,111,232,.15);
}
.form-textarea::placeholder { color: var(--text-dim); font-style: italic; }

.char-row {
    text-align: right;
    font-size: .8rem;
    color: var(--text-dim);
    margin: 6px 0 24px;
}
#char-count { color: var(--text-muted); }

/* ── Botones ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--violet) 0%, #6a4fd4 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 28px;
    font-family: 'Inter', sans-serif;
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 20px rgba(139,111,232,.35);
}
.btn-primary:hover  { opacity: .9; transform: translateY(-1px); box-shadow: 0 8px 28px rgba(139,111,232,.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary .arrow { font-size: 1.1em; }

.btn-secondary {
    display: block;
    margin: 32px auto 0;
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: 12px 36px;
    font-family: 'Inter', sans-serif;
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-align: center;
}
.btn-secondary:hover { background: var(--gold); color: var(--black); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-family: 'Inter', sans-serif;
    font-size: .9rem;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* ── Paso 2: Selección ── */
.section-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.4rem, 4vw, 2rem);
    text-align: center;
    color: var(--gold-light);
    margin-bottom: 20px;
}

.pick-counter {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 36px;
}
.dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--violet);
    background: transparent;
    transition: background var(--transition), box-shadow var(--transition);
}
.dot.filled {
    background: var(--violet-light);
    box-shadow: 0 0 10px rgba(139,111,232,.7);
}

/* Grid del mazo */
.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
    gap: 14px;
    justify-items: center;
}
@media (min-width: 600px)  { .deck-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 900px)  { .deck-grid { grid-template-columns: repeat(8, 1fr); } }

/* Carta del mazo */
.tarot-card {
    width: var(--card-w);
    height: var(--card-h);
    cursor: pointer;
    border-radius: var(--radius-sm);
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition);
}
.tarot-card:hover:not(.selected) {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.tarot-card.selected {
    transform: scale(1.06);
    box-shadow: 0 0 0 2px var(--violet-light), 0 0 22px rgba(139,111,232,.5);
}

.card-inner {
    width: 100%;
    height: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
/* Patrón decorativo en el dorso */
.card-inner::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(139,111,232,.25);
    border-radius: 4px;
}
.card-inner::after {
    content: '✦';
    font-size: 1.6rem;
    color: var(--violet);
    opacity: .3;
}

/* ── Paso 3: Lectura ── */
.revealed-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.rev-card { text-align: center; width: 110px; }

.rev-flip {
    width: 110px;
    height: 165px;
    perspective: 900px;
    margin-bottom: 10px;
}
.rev-flip-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .7s cubic-bezier(.4,0,.2,1);
}
.rev-flip.flipped .rev-flip-inner { transform: rotateY(180deg); }

.rev-front, .rev-back {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-sm);
    backface-visibility: hidden;
}
.rev-back {
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.rev-back::after { content: '✦'; font-size: 2rem; color: var(--violet); opacity: .3; }

.rev-front {
    transform: rotateY(180deg);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    border: 1px solid var(--border);
}
.rev-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rev-name {
    font-size: .78rem;
    font-weight: 500;
    color: var(--gold);
    letter-spacing: .04em;
    line-height: 1.3;
}

/* ── Loading ── */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-style: italic;
}
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}
.loading-dots span {
    width: 10px; height: 10px;
    background: var(--violet);
    border-radius: 50%;
    animation: dot-bounce 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(1) { animation-delay: -.32s; }
.loading-dots span:nth-child(2) { animation-delay: -.16s; }
@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: .4; }
    40%           { transform: scale(1); opacity: 1; }
}

/* ── Resultado ── */
.reading-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    transition: opacity .5s ease;
}
.reading-box.hidden { display: none; }

.user-question {
    font-size: .85rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-bottom: 28px;
    padding: 12px 16px;
    border-left: 2px solid var(--violet);
    background: rgba(139,111,232,.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    line-height: 1.5;
}
.user-question::before {
    content: '"';
    color: var(--violet-light);
    font-size: 1.1em;
    margin-right: 2px;
}
.user-question::after {
    content: '"';
    color: var(--violet-light);
    font-size: 1.1em;
    margin-left: 2px;
}

.reset-wrap {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.reading-heading {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--gold-light);
    margin-bottom: 24px;
    text-align: center;
}

.user-question {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--deep);
    border-left: 3px solid var(--violet);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 14px 18px;
    margin-bottom: 28px;
}
.user-question-icon {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--violet-light);
    white-space: nowrap;
    padding-top: 2px;
}
.user-question-text {
    font-size: .95rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.55;
}

.reading-body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
    text-align: justify;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--surface-2);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    padding: 44px 36px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
    animation: fadeUp .35s ease;
}
.modal-icon { font-size: 2.5rem; color: var(--gold); margin-bottom: 16px; }
.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--gold-light);
    margin-bottom: 12px;
}
.modal-msg  { color: var(--text-muted); margin-bottom: 28px; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.modal-actions .btn-primary { width: auto; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .card-form    { padding: 24px 18px; }
    .reading-box  { padding: 28px 18px; }
    .modal-box    { padding: 32px 20px; }
    :root         { --card-w: 76px; --card-h: 114px; }
    .deck-grid    { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .rev-flip     { width: 90px; height: 135px; }
    .rev-card     { width: 90px; }
}

/* ── Accesibilidad ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
