/* ===== VARIABLES ===== */
:root {
    --bg-primary: #171E36;
    --bg-secondary: #1F2937;
    --bg-card: #2D3748;
    --text-primary: #FFFFFF;
    --text-secondary: #A0AEC0;
    --accent-gold: #D4AF37;
    --accent-gold-dark: #B8941F;
    --border-color: #4A5568;
    --shadow: rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

/* ===== RESET & BASE ===== */
#runas-app * {
    box-sizing: border-box;
}

#runas-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    /*min-height: 100vh;*/
    padding: 20px 0;
}

#runas-app .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== SECCIONES ===== */
.section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.section.active {
    display: block;
}

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

/* ===== TIPOGRAFÍA ===== */
.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 1.1rem;
    text-align: center;
    color: var(--text-secondary);
    margin: 0 0 40px 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 1rem;
    text-align: center;
    color: var(--text-secondary);
    margin: 0 0 30px 0;
}

/* ===== FORMULARIO DE PREGUNTA ===== */
.question-form {
    max-width: 720px;
    margin: 0 auto;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
}

#question-input {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    transition: var(--transition);
    font-family: inherit;
}

#question-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

#question-input::placeholder {
    color: var(--text-secondary);
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 8px 0;
}

/* ===== BOTONES ===== */
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    margin-top: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
    color: #1a1a1a;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--accent-gold);
}

.btn-secondary:hover {
    background: var(--accent-gold);
    color: #1a1a1a;
}

/* ===== INDICADOR DE PROGRESO ===== */
.progress-indicator {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 30px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.progress-count {
    font-weight: 700;
    color: var(--accent-gold);
    font-size: 1.5rem;
    margin-left: 10px;
}

/* ===== GRID DE RUNAS ===== */
.runes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

@media (min-width: 768px) {
    .runes-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 20px;
    }
}

/* ===== CARTAS DE RUNAS (REVERSO) ===== */
.rune-card {
    aspect-ratio: 2/3;
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a202c 100%);
    border: 3px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rune-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(45deg, transparent 48%, var(--accent-gold) 49%, var(--accent-gold) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, var(--accent-gold) 49%, var(--accent-gold) 51%, transparent 52%);
    opacity: 0.3;
}

.rune-card-symbol {
    font-size: 2.5rem;
    color: var(--accent-gold);
    opacity: 0.6;
    position: relative;
    z-index: 1;
}

.rune-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-gold);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}

.rune-card.selected {
    animation: goldPulse 1.5s ease-in-out infinite;
    border-color: var(--accent-gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
}

@keyframes goldPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.9);
        transform: scale(1.05);
    }
}

.rune-card.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== DISPLAY DE RUNAS SELECCIONADAS ===== */
.selected-runes-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 900px;
    margin: 0 auto 40px auto;
}

.rune-card-large {
    background: var(--bg-secondary);
    border: 3px solid var(--accent-gold);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    opacity: 0;
    transform: rotateY(180deg);
    animation: flipReveal 0.8s ease forwards;
}

.rune-card-large:nth-child(1) { animation-delay: 0.2s; }
.rune-card-large:nth-child(2) { animation-delay: 0.5s; }
.rune-card-large:nth-child(3) { animation-delay: 0.8s; }

@keyframes flipReveal {
    to {
        opacity: 1;
        transform: rotateY(0deg);
    }
}

.rune-position {
    font-size: 0.875rem;
    color: var(--accent-gold);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.rune-img {
    width: 100%;
    max-width: 180px;
    height: auto;
    border-radius: 33px;
    margin: 0 auto;
    display: block;
}

.rune-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 15px;
    color: var(--text-primary);
}

/* ===== LOADING ===== */
.loading-container {
    text-align: center;
    padding: 60px 20px;
}

.rune-loader {
    margin: 0 auto 20px auto;
    width: 80px;
    height: 80px;
}

.rotating {
    animation: rotate 2s linear infinite;
    transform-origin: center;
}

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

.loading-container p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===== RESULTADO DE LECTURA ===== */
.reading-result {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    margin: 30px auto;
    max-width: 800px;
    border-left: 4px solid var(--accent-gold);
    line-height: 1.8;
    font-size: 1.05rem;
    white-space: pre-wrap;
    display: none;
}

.reading-result.visible {
    display: block;
    animation: fadeIn 0.8s ease;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    border: 2px solid var(--accent-gold);
    animation: slideUp 0.4s ease;
}

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

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.modal-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0 0 30px 0;
    line-height: 1.6;
}

.modal-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.modal-buttons button {
    margin-top: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .app-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .question-form {
        padding: 9px;
    }
    
    .runes-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
        padding: 10px;
    }
    
    .selected-runes-display {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 1.75rem;
    }
    
    .runes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .rune-card-symbol {
        font-size: 2rem;
    }
}

/* ===== UTILIDADES ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}
