/* ============================================================
   ORÁCULO DEL I-CHING — Estilos principales
   Estética: Oriental oscura, contemplativa, atemporal
   ============================================================ */

/* --- Variables -------------------------------------------- */
:root {
    --bg-deep:       #0d1117;
    --bg-app:        #171E36;
    --bg-card:       #1e2745;
    --bg-card-hover: #252f56;
    --bg-modal:      #111827;
    --gold:          #c9a84c;
    --gold-light:    #e8c97a;
    --gold-dim:      #7a6530;
    --red-line:      #8b1a1a;
    --white:         #f0ece0;
    --white-dim:     #a09880;
    --border:        rgba(201,168,76,0.18);
    --border-bright: rgba(201,168,76,0.45);
    --shadow:        0 8px 40px rgba(0,0,0,0.6);
    --radius:        6px;
    --radius-lg:     12px;
    --transition:    0.3s ease;
    --font-title:    'Cinzel', serif;
    --font-body:     'IM Fell English', serif;
    --font-ui:       'Crimson Pro', serif;
}

/* --- Reset mínimo (sin !important para no conflictar con WP) -- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* --- Wrapper raíz ------------------------------------------ */
#oraculo-iching-app {
    background-color: var(--bg-app);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201,168,76,0.07) 0%, transparent 70%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a84c' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    min-height: 100vh;
    width: 100%;
    color: var(--white);
    font-family: var(--font-ui);
    font-size: 17px;
    line-height: 1.65;
    position: relative;
    overflow-x: hidden;
}

/* --- Contenedor principal ---------------------------------- */
.oraculo-container {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    padding: 48px 20px 60px;
}

/* --- Encabezado ------------------------------------------- */
.oraculo-header {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
}

.oraculo-header::after {
    content: '';
    display: block;
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 20px auto 0;
}

.trigram-deco {
    font-size: 26px;
    letter-spacing: 10px;
    color: var(--gold-dim);
    margin-bottom: 12px;
    display: block;
    animation: fadeIn 1.2s ease both;
}

.oraculo-title {
    font-family: var(--font-title);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 400;
    letter-spacing: 6px;
    color: var(--gold);
    text-transform: uppercase;
    margin: 0 0 10px;
    animation: fadeInDown 0.9s ease both;
    text-shadow: 0 0 40px rgba(201,168,76,0.3);
}

.oraculo-subtitle {
    font-family: var(--font-body);
    font-size: 18px;
    color: var(--white-dim);
    font-style: italic;
    letter-spacing: 2px;
    margin: 0;
    animation: fadeIn 1.4s ease both;
}

/* --- Pasos (steps) ---------------------------------------- */
.oraculo-step {
    display: none;
    animation: fadeIn 0.5s ease both;
}

.oraculo-step.active {
    display: block;
}

/* --- Sección: Pregunta ------------------------------------- */
.question-section {
    background: rgba(30,39,69,0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 28px;
    backdrop-filter: blur(4px);
}

.question-label {
    display: block;
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 3px;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 14px;
}

.question-optional {
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--white-dim);
    letter-spacing: 1px;
    font-style: italic;
    text-transform: none;
    display: block;
    margin-top: 4px;
}

.question-textarea {
    width: 100%;
    background: rgba(13,17,23,0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font-ui);
    font-size: 16px;
    padding: 14px 16px;
    resize: vertical;
    min-height: 90px;
    max-height: 200px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.question-textarea::placeholder {
    color: var(--white-dim);
    opacity: 0.5;
    font-style: italic;
}

.question-textarea:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 20px rgba(201,168,76,0.1);
}

.char-counter {
    text-align: right;
    font-size: 13px;
    color: var(--white-dim);
    margin-top: 6px;
    opacity: 0.6;
}

/* --- Botón principal -------------------------------------- */
.btn-oracle {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #8b6914 0%, #c9a84c 50%, #8b6914 100%);
    background-size: 200% 100%;
    border: none;
    border-radius: var(--radius);
    color: #0d1117;
    font-family: var(--font-title);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    padding: 16px 24px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background-position 0.4s ease, box-shadow 0.3s ease, transform 0.15s ease;
}

.btn-oracle:hover {
    background-position: 100% 0;
    box-shadow: 0 4px 24px rgba(201,168,76,0.35);
    transform: translateY(-1px);
}

.btn-oracle:active {
    transform: translateY(0);
}

.btn-oracle:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Botón secundario */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    color: var(--gold);
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 12px 24px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: rgba(201,168,76,0.08);
    border-color: var(--gold);
}

/* --- Sección: Lanzamiento de monedas ---------------------- */
.throw-section {
    text-align: center;
}

.throw-title {
    font-family: var(--font-title);
    font-size: 14px;
    letter-spacing: 4px;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.throw-hint {
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--white-dim);
    font-style: italic;
    margin-bottom: 32px;
}

/* Progreso */
.throw-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 36px;
}

.progress-label {
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--white-dim);
    text-transform: uppercase;
}

.progress-dots {
    display: flex;
    gap: 7px;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(201,168,76,0.2);
    border: 1px solid var(--gold-dim);
    transition: all 0.4s ease;
}

.progress-dot.done {
    background: var(--gold);
    box-shadow: 0 0 8px rgba(201,168,76,0.6);
}

.progress-dot.current {
    background: rgba(201,168,76,0.5);
    border-color: var(--gold);
    animation: pulse 1.2s ease infinite;
}

/* --- Área de monedas -------------------------------------- */
.coins-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 28px;
    margin-bottom: 36px;
    min-height: 110px;
}

/* Moneda individual */
.coin {
    width: 80px;
    height: 80px;
    position: relative;
    perspective: 600px;
    cursor: default;
}

.coin-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

/* Cara de la moneda */
.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
}

.coin-yang { /* cara — valor 3 */
    background: radial-gradient(circle at 35% 35%, #e8c97a, #8b6914);
    border: 2px solid #c9a84c;
    box-shadow: inset 0 1px 4px rgba(255,255,255,0.3), 0 4px 16px rgba(0,0,0,0.4);
    color: #3d2a00;
    font-size: 28px;
}

.coin-yin { /* cruz — valor 2 */
    background: radial-gradient(circle at 35% 35%, #3a3a5c, #1a1a2e);
    border: 2px solid #5a5a8a;
    box-shadow: inset 0 1px 4px rgba(255,255,255,0.1), 0 4px 16px rgba(0,0,0,0.4);
    color: #a0a0cc;
    font-size: 22px;
    transform: rotateY(180deg);
}

/* Estado inicial: moneda en espera */
.coin.idle .coin-inner {
    transform: rotateY(0deg);
}

/* Animación de lanzamiento */
@keyframes coinSpin {
    0%   { transform: rotateY(0deg) rotateX(0deg); }
    30%  { transform: rotateY(360deg) rotateX(30deg); }
    60%  { transform: rotateY(720deg) rotateX(-10deg); }
    80%  { transform: rotateY(900deg) rotateX(5deg); }
    100% { transform: rotateY(var(--final-rot)) rotateX(0deg); }
}

.coin.spinning .coin-inner {
    animation: coinSpin 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Resultado visual */
.coin.yang-result .coin-inner { transform: rotateY(0deg); }
.coin.yin-result  .coin-inner { transform: rotateY(180deg); }

/* Etiqueta de resultado de cada moneda */
.coin-label {
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--white-dim);
    font-family: var(--font-ui);
    height: 18px;
    transition: color 0.3s;
}

.coin-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Hexagrama en construcción ---------------------------- */
.hexagram-build-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    margin-top: 8px;
}

.hexagram-builder {
    display: flex;
    flex-direction: column-reverse; /* línea 1 abajo, línea 6 arriba */
    gap: 5px;
}

/* Línea de hexagrama */
.hex-line {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 12px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hex-line.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Partes de la línea */
.hex-line-part {
    height: 12px;
    border-radius: 2px;
    background: var(--gold);
    box-shadow: 0 0 8px rgba(201,168,76,0.4);
    transition: background 0.3s;
}

/* Línea yang (continua) */
.hex-line.yang .hex-line-part {
    width: 88px;
}

.hex-line.yang .hex-line-part:only-child {
    width: 88px;
}

/* Línea yin (rota) */
.hex-line.yin .hex-line-part {
    width: 38px;
}

/* Líneas mutantes (yang → yin o yin → yang) */
/* mutante-yang: línea continua (como yang) pero en rojo */
.hex-line.mutante-yang .hex-line-part {
    width: 88px;
    background: #cc4444;
    box-shadow: 0 0 10px rgba(204,68,68,0.5);
}

/* mutante-yin: línea rota (como yin) pero en rojo */
.hex-line.mutante-yin .hex-line-part {
    width: 38px;
    background: #cc4444;
    box-shadow: 0 0 10px rgba(204,68,68,0.5);
}

/* Número de línea */
.hex-line-num {
    font-size: 10px;
    color: var(--white-dim);
    opacity: 0.4;
    width: 14px;
    text-align: right;
    font-family: var(--font-ui);
    margin-right: 4px;
}

/* --- Nombre del hexagrama (bajo el dibujo) ---------------- */
.hex-name-badge {
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hex-name-badge.visible {
    opacity: 1;
}

.hex-number {
    font-family: var(--font-title);
    font-size: 11px;
    color: var(--gold-dim);
    letter-spacing: 4px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.hex-name {
    font-family: var(--font-title);
    font-size: 20px;
    color: var(--gold);
    letter-spacing: 2px;
}

.hex-meaning {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--white-dim);
    font-style: italic;
    margin-top: 4px;
}

/* --- Botón lanzar ---------------------------------------- */
.btn-throw {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #1e2745, #2a3560);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    color: var(--gold);
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 15px 40px;
    cursor: pointer;
    transition: all var(--transition);
    min-width: 220px;
}

.btn-throw:hover:not(:disabled) {
    background: linear-gradient(135deg, #252f56, #303d70);
    border-color: var(--gold);
    box-shadow: 0 0 24px rgba(201,168,76,0.2);
}

.btn-throw:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-throw-icon {
    font-size: 20px;
    display: inline-block;
    transition: transform 0.3s;
}

.btn-throw:hover:not(:disabled) .btn-throw-icon {
    transform: rotate(15deg) scale(1.2);
}

/* --- Sección: Consultar la IA ----------------------------- */
.btn-consultar-ia {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease both;
}

/* --- Loading --------------------------------------------- */
.loading-area {
    text-align: center;
    padding: 48px 0;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--gold);
    border-right-color: var(--gold-dim);
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--white-dim);
    font-size: 17px;
    letter-spacing: 1px;
}

/* --- Resultado de la lectura ----------------------------- */
.reading-result-section {
    animation: fadeInUp 0.7s ease both;
}

.result-hexagram-display {
    display: flex;
    align-items: center;
    gap: 32px;
    background: rgba(13,17,23,0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
}

.result-hex-svg {
    flex-shrink: 0;
}

.result-hex-info {
    flex: 1;
}

.result-hex-num {
    font-family: var(--font-title);
    font-size: 11px;
    color: var(--gold-dim);
    letter-spacing: 4px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}

.result-hex-name {
    font-family: var(--font-title);
    font-size: 24px;
    color: var(--gold);
    display: block;
    margin-bottom: 6px;
}

.result-hex-meaning {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--white-dim);
    font-style: italic;
}

.reading-text-box {
    background: rgba(30,39,69,0.5);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold-dim);
    border-radius: var(--radius);
    padding: 28px 30px;
    margin-bottom: 32px;
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.75;
    color: var(--white);
}

.reading-actions {
    display: flex;
    justify-content: center;
}

/* --- Divisor ornamental ----------------------------------- */
.ornament {
    text-align: center;
    color: var(--gold-dim);
    font-size: 16px;
    letter-spacing: 8px;
    margin: 28px 0;
    opacity: 0.6;
}

/* --- Modal ----------------------------------------------- */
.oraculo-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.oraculo-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.oraculo-modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 36px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.oraculo-modal-overlay.active .oraculo-modal {
    transform: translateY(0);
}

.modal-icon {
    font-size: 36px;
    margin-bottom: 16px;
    display: block;
}

.modal-title {
    font-family: var(--font-title);
    font-size: 16px;
    letter-spacing: 3px;
    color: var(--gold);
    text-transform: uppercase;
    margin: 0 0 14px;
}

.modal-message {
    font-family: var(--font-body);
    font-size: 17px;
    color: var(--white-dim);
    line-height: 1.65;
    margin: 0 0 28px;
    white-space: pre-line;
}

.modal-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btns .btn-secondary {
    font-size: 11px;
    padding: 10px 20px;
}

.modal-btns .btn-oracle {
    width: auto;
    display: inline-block;
    font-size: 11px;
    padding: 10px 20px;
    letter-spacing: 2px;
}

/* --- Animaciones ----------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%       { transform: scale(1.25); opacity: 1; }
}

@keyframes glowFade {
    from { box-shadow: 0 0 20px rgba(201,168,76,0.6); }
    to   { box-shadow: 0 0 4px rgba(201,168,76,0.15); }
}

.hex-line.revealed.new {
    animation: glowFade 1.5s ease forwards;
}

/* --- Responsive ------------------------------------------ */
@media (max-width: 520px) {
    .oraculo-container {
        padding: 32px 16px 48px;
    }

    .coins-area {
        gap: 16px;
    }

    .coin {
        width: 64px;
        height: 64px;
    }

    .coin-yang { font-size: 22px; }
    .coin-yin  { font-size: 18px; }

    .question-section {
        padding: 22px 18px;
    }

    .result-hexagram-display {
        flex-direction: column;
        text-align: center;
        gap: 18px;
    }

    .reading-text-box {
        padding: 20px;
        font-size: 16px;
    }

    .hex-line.yang .hex-line-part { width: 70px; }
    .hex-line.yin  .hex-line-part { width: 30px; }
}
