/* ═══════════════════════════════════════════════════════════
   La Bola de Cristal — styles.css
   Estética: Místico nocturno, profundo, con glow violeta/azul
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --bg-deep:       #04020e;
    --bg-mid:        #0a0520;
    --crystal-1:     #1a0540;
    --crystal-2:     #2d1060;
    --crystal-3:     #4a1fa0;
    --glow-violet:   #9b59f5;
    --glow-blue:     #4fc3f7;
    --glow-pink:     #e040fb;
    --gold:          #d4a84b;
    --gold-light:    #f5e08a;
    --text-main:     #e8d5ff;
    --text-soft:     #9b80cc;
    --positive:      #64ffb4;
    --negative:      #ff6b8a;
    --neutral:       #c9b3ff;
    --font-title:    'Uncial Antiqua', cursive;
    --font-body:     'Raleway', sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-deep);
    font-family: var(--font-body);
    color: var(--text-main);
}

/* ── App wrapper ────────────────────────────────────────── */
#bola-app {
    /*min-height: 100vh;*/
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* ── Estrellas ──────────────────────────────────────────── */
.stars-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.1; transform: scale(1); }
    50%       { opacity: 0.9; transform: scale(1.4); }
}

/* ── Nebulosa de fondo ──────────────────────────────────── */
#bola-app::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 20% 30%, rgba(100, 30, 200, 0.18) 0%, transparent 70%),
        radial-gradient(ellipse 50% 30% at 80% 70%, rgba(30, 80, 200, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 40% 50% at 50% 50%, rgba(60, 10, 120, 0.25) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── Contenedor principal ───────────────────────────────── */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    width: 100%;
    max-width: 480px;
    padding: 20px 10px 30px;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
    text-align: center;
}

.app-title {
    font-family: var(--font-title);
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    color: var(--gold-light);
    text-shadow:
        0 0 20px rgba(212, 168, 75, 0.8),
        0 0 50px rgba(212, 168, 75, 0.4);
    letter-spacing: 2px;
    line-height: 1.1;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(212,168,75,0.8), 0 0 50px rgba(212,168,75,0.4); }
    50%       { text-shadow: 0 0 30px rgba(212,168,75,1),   0 0 80px rgba(212,168,75,0.6); }
}

.app-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-top: 6px;
}

/* ── Sección pregunta ───────────────────────────────────── */
.question-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.question-label {
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-soft);
    padding-left: 4px;
}

.question-input {
    width: 100%;
    background: rgba(30, 10, 60, 0.6);
    border: 1px solid rgba(155, 89, 245, 0.3);
    border-radius: 10px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 300;
    padding: 10px 14px;
    resize: none;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    line-height: 1.5;
}

.question-input::placeholder {
    color: rgba(155, 89, 245, 0.4);
}

.question-input:focus {
    border-color: rgba(155, 89, 245, 0.7);
    box-shadow: 0 0 15px rgba(155, 89, 245, 0.2);
}

/* ── Crystal wrap ───────────────────────────────────────── */
.crystal-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Glow exterior */
.crystal-glow-outer {
    position: absolute;
    width: 370px;
    height: 370px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(155,89,245,0.15) 0%, transparent 70%);
    animation: outerPulse 4s ease-in-out infinite;
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
}

@keyframes outerPulse {
    0%, 100% { transform: translate(-50%, -52%) scale(1);   opacity: 0.6; }
    50%       { transform: translate(-50%, -52%) scale(1.1); opacity: 1; }
}

/* ── Bola de cristal ────────────────────────────────────── */
.crystal-ball {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;

    background: radial-gradient(circle at 38% 35%,
        rgba(180, 140, 255, 0.35) 0%,
        rgba(100, 50, 200, 0.5) 35%,
        rgba(30, 10, 80, 0.85) 70%,
        rgba(10, 5, 40, 0.95) 100%
    );

    box-shadow:
        0 0 30px rgba(155, 89, 245, 0.5),
        0 0 60px rgba(100, 50, 200, 0.3),
        inset 0 0 40px rgba(0, 0, 0, 0.6),
        inset 0 0 15px rgba(155, 89, 245, 0.2);

    animation: crystalFloat 5s ease-in-out infinite;
}

@keyframes crystalFloat {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-8px); }
}

.crystal-ball:hover:not(.revealed):not(.activating) {
    box-shadow:
        0 0 45px rgba(155, 89, 245, 0.8),
        0 0 90px rgba(100, 50, 200, 0.5),
        inset 0 0 40px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(155, 89, 245, 0.3);
    transform: translateY(-4px) scale(1.02);
}

/* Estado activando */
.crystal-ball.activating {
    animation: crystalFloat 5s ease-in-out infinite, activatingPulse 0.6s ease-in-out infinite;
}

@keyframes activatingPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(155,89,245,0.5), 0 0 60px rgba(100,50,200,0.3), inset 0 0 40px rgba(0,0,0,0.6); }
    50%       { box-shadow: 0 0 60px rgba(155,89,245,0.9), 0 0 120px rgba(100,50,200,0.6), inset 0 0 40px rgba(0,0,0,0.4), inset 0 0 30px rgba(155,89,245,0.3); }
}

/* Estado revelado */
.crystal-ball.revealed {
    box-shadow:
        0 0 50px rgba(155, 89, 245, 0.8),
        0 0 100px rgba(100, 50, 200, 0.5),
        inset 0 0 40px rgba(0, 0, 0, 0.5),
        inset 0 0 25px rgba(155, 89, 245, 0.35);
}

/* ── Interior bola ──────────────────────────────────────── */
.crystal-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Brillos */
.crystal-shine-1 {
    position: absolute;
    width: 65px;
    height: 44px;
    top: 30px;
    left: 40px;
    background: radial-gradient(ellipse, rgba(255,255,255,0.45) 0%, transparent 70%);
    border-radius: 50%;
    transform: rotate(-30deg);
    pointer-events: none;
}

.crystal-shine-2 {
    position: absolute;
    width: 28px;
    height: 20px;
    top: 56px;
    left: 66px;
    background: radial-gradient(ellipse, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ── Humo / niebla ──────────────────────────────────────── */
.crystal-smoke {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: transparent;
    transition: background 0.5s;
    pointer-events: none;
}

.crystal-smoke.smoke-active {
    background: radial-gradient(circle at 50% 60%,
        rgba(155, 89, 245, 0.25) 0%,
        rgba(79, 195, 247, 0.15) 40%,
        transparent 70%
    );
    animation: smokeSwirl 2.2s ease-in-out forwards;
}

@keyframes smokeSwirl {
    0%   { opacity: 0; transform: scale(0.5) rotate(0deg); }
    40%  { opacity: 1; transform: scale(1.1) rotate(15deg); }
    70%  { opacity: 0.8; transform: scale(1) rotate(-8deg); }
    100% { opacity: 0.4; transform: scale(1) rotate(0deg); }
}

/* ── Mensaje dentro de la bola ──────────────────────────── */
.crystal-message-wrap {
    position: absolute;
    inset: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: none;
    z-index: 2;
    padding: 10px;
}

.crystal-message-wrap.message-visible {
    animation: messageReveal 0.7s 2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes messageReveal {
    0%   { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

.crystal-message {
    font-family: var(--font-title);
    font-size: clamp(0.9rem, 4vw, 1.2rem);
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0.5px;
    text-shadow: 0 0 15px currentColor;
}

.crystal-message.msg-positive {
    color: var(--positive);
    text-shadow: 0 0 20px rgba(100, 255, 180, 0.8), 0 0 40px rgba(100, 255, 180, 0.4);
}

.crystal-message.msg-negative {
    color: var(--negative);
    text-shadow: 0 0 20px rgba(255, 107, 138, 0.8), 0 0 40px rgba(255, 107, 138, 0.4);
}

.crystal-message.msg-neutral {
    color: var(--neutral);
    text-shadow: 0 0 20px rgba(201, 179, 255, 0.8), 0 0 40px rgba(201, 179, 255, 0.4);
}

/* ── Base de la bola ────────────────────────────────────── */
.crystal-base {
    width: 90px;
    height: 22px;
    background: linear-gradient(180deg, #2a1060 0%, #160530 100%);
    border-radius: 50%;
    margin-top: -4px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 2px 6px rgba(155, 89, 245, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.crystal-base-ring {
    width: 60px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(90deg, transparent, rgba(212,168,75,0.4), transparent);
}

/* ── Botón Revelar ──────────────────────────────────────── */
.btn-reveal {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(80,20,160,0.8) 0%, rgba(40,10,100,0.9) 100%);
    border: 1px solid rgba(155, 89, 245, 0.5);
    border-radius: 50px;
    color: var(--gold-light);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 13px 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 0 20px rgba(155, 89, 245, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-reveal:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(110,30,210,0.9) 0%, rgba(60,15,140,0.95) 100%);
    border-color: rgba(155, 89, 245, 0.9);
    box-shadow:
        0 0 35px rgba(155, 89, 245, 0.6),
        0 0 70px rgba(155, 89, 245, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    color: #fff;
}

.btn-reveal:disabled,
.btn-reveal.btn-loading {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-sparkle {
    font-size: 0.9rem;
    animation: sparkleSpin 3s linear infinite;
}

@keyframes sparkleSpin {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(180deg) scale(1.3); }
    100% { transform: rotate(360deg) scale(1); }
}

/* ── Botón Nueva consulta ───────────────────────────────── */
.btn-new {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(155, 89, 245, 0.3);
    border-radius: 50px;
    color: var(--text-soft);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 9px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
}

.btn-new.btn-new-show {
    animation: btnNewFadeIn 0.5s 2.8s ease forwards;
}

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

.btn-new:hover {
    border-color: rgba(155, 89, 245, 0.7);
    color: var(--text-main);
    background: rgba(155, 89, 245, 0.1);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 400px) {
    .crystal-ball {
        width: 220px;
        height: 220px;
    }
    .crystal-glow-outer {
        width: 300px;
        height: 300px;
    }
    .app-title {
        font-size: 1.6rem;
    }
}
