/* Estilos para la página del quiz de nombres */
.quiz-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 30px 20px 80px;
}

/* Barra de progreso */
.quiz-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 36px;
}
.quiz-progress-step {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    background: rgba(180,100,220,0.12);
    color: #a78cc0;
    border: 2px solid rgba(180,100,220,0.2);
    transition: all 0.3s;
    flex-shrink: 0;
}
.quiz-progress-step.active {
    background: #8B2635;
    color: white;
    border-color: #8B2635;
    box-shadow: 0 0 0 4px rgba(139,38,53,0.2);
}
.quiz-progress-step.done {
    background: #4a0e6e;
    color: white;
    border-color: #4a0e6e;
}
.quiz-progress-line {
    flex: 1;
    height: 2px;
    background: rgba(180,100,220,0.15);
    border-radius: 2px;
    overflow: hidden;
}
.quiz-progress-line-fill {
    height: 100%;
    background: #4a0e6e;
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0%;
}

/* Pasos del quiz */
.quiz-step {
    display: none;
    animation: fadeSlideIn 0.35s ease;
}
.quiz-step.active { display: block; }

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

.quiz-q {
    font-size: 1.5rem;
    font-weight: 800;
    color: #2c1810;
    margin-bottom: 6px;
    line-height: 1.3;
}
[data-theme="dark"] .quiz-q { color: #e8d5f5; }

.quiz-sub {
    font-size: 14px;
    color: #a78cc0;
    margin-bottom: 28px;
}

/* Opciones de tarjetas */
.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.quiz-opt {
    background: rgba(255,255,255,0.7);
    border: 2px solid rgba(180,100,220,0.2);
    border-radius: 18px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
[data-theme="dark"] .quiz-opt {
    background: rgba(30,15,45,0.8);
    border-color: rgba(180,100,220,0.2);
    color: #e8d5f5;
}
.quiz-opt:hover {
    border-color: #8B2635;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139,38,53,0.15);
}
.quiz-opt.selected {
    background: linear-gradient(135deg, rgba(139,38,53,0.12), rgba(74,14,110,0.12));
    border-color: #8B2635;
    color: #8B2635;
}
[data-theme="dark"] .quiz-opt.selected {
    background: rgba(139,38,53,0.2);
    color: #f9a8b8;
}
.quiz-opt-icon { font-size: 2rem; margin-bottom: 8px; display: block; }
.quiz-opt-label { font-size: 14px; font-weight: 700; }
.quiz-opt-desc { font-size: 11px; color: #a78cc0; margin-top: 3px; }

/* ── شبكة الأصول: بلاطات مدمجة موحّدة (Any + 19 أصل) ── */
.quiz-origin-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 8px;
    margin-bottom: 24px;
}
.quiz-origin-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 8px 10px;
    border-radius: 12px;
}
/* نخفي الأيقونة المنفصلة حتى تتوحّد أطوال كل البلاطات */
.quiz-origin-chip .quiz-opt-icon  { display: none; }
.quiz-origin-chip .quiz-opt-label { font-size: 13px; margin: 0; line-height: 1.25; }

/* Input de letra */
.quiz-letter-input {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    border: 2px solid rgba(180,100,220,0.3);
    background: rgba(255,255,255,0.7);
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    color: #4a0e6e;
    outline: none;
    transition: border-color 0.2s;
    text-transform: uppercase;
}
[data-theme="dark"] .quiz-letter-input {
    background: rgba(30,15,45,0.8);
    color: #e8d5f5;
    border-color: rgba(180,100,220,0.3);
}
.quiz-letter-input:focus { border-color: #8B2635; }

.quiz-letter-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.quiz-skip-letter {
    font-size: 13px;
    color: #a78cc0;
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
}
.quiz-skip-letter:hover { color: #8B2635; }

/* Botones de navegación */
.quiz-nav {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}
.quiz-btn-back {
    padding: 12px 24px;
    border-radius: 12px;
    border: 2px solid rgba(180,100,220,0.3);
    background: transparent;
    color: #a78cc0;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.quiz-btn-back:hover { border-color: #a78cc0; color: #4a0e6e; }
.quiz-btn-next {
    padding: 12px 32px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #8B2635, #4a0e6e);
    color: white;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(139,38,53,0.3);
}
.quiz-btn-next:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(139,38,53,0.4); }
.quiz-btn-next:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Sección de resultados */
#quiz-results { display: none; }
#quiz-results.show { display: block; animation: fadeSlideIn 0.4s ease; }

.results-hero {
    text-align: center;
    margin-bottom: 32px;
    padding: 28px 20px;
    background: linear-gradient(135deg, rgba(139,38,53,0.08), rgba(74,14,110,0.08));
    border-radius: 20px;
    border: 1px solid rgba(180,100,220,0.15);
}
.results-hero h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #4a0e6e;
    margin-bottom: 6px;
}
[data-theme="dark"] .results-hero h2 { color: #c890e8; }
.results-hero p { color: #a78cc0; font-size: 14px; }

/* Tarjetas top 3 */
.top3-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}
@media (max-width: 500px) { .top3-grid { grid-template-columns: 1fr; } }

.top3-card {
    background: white;
    border-radius: 20px;
    padding: 20px 14px;
    text-align: center;
    border: 2px solid rgba(180,100,220,0.15);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: block;
}
[data-theme="dark"] .top3-card {
    background: rgba(30,15,45,0.9);
    border-color: rgba(180,100,220,0.2);
}
.top3-card:hover { transform: translateY(-3px); border-color: #8B2635; box-shadow: 0 6px 20px rgba(139,38,53,0.15); }
.top3-rank { font-size: 1.4rem; margin-bottom: 6px; }
.top3-name-en { font-size: 1.2rem; font-weight: 800; color: #2c1810; margin-bottom: 2px; }
[data-theme="dark"] .top3-name-en { color: #e8d5f5; }
.top3-name-ar { font-size: 1rem; color: #8B2635; font-weight: 600; margin-bottom: 6px; }
.top3-meaning { font-size: 11px; color: #a78cc0; line-height: 1.5; }
.top3-badge { font-size: 10px; padding: 3px 10px; border-radius: 999px; font-weight: 700; display: inline-block; margin-top: 8px; }
.top3-badge-boy { background: rgba(59,130,246,0.12); color: #3b82f6; }
.top3-badge-girl { background: rgba(236,72,153,0.12); color: #ec4899; }

/* Grid de nombres restantes */
.names-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #a78cc0;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 32px;
}
.name-chip {
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(180,100,220,0.15);
    border-radius: 12px;
    padding: 12px 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
[data-theme="dark"] .name-chip {
    background: rgba(30,15,45,0.7);
    border-color: rgba(180,100,220,0.2);
}
.name-chip:hover { border-color: #8B2635; transform: translateX(2px); }
.name-chip-en { font-weight: 700; font-size: 13px; color: #2c1810; }
[data-theme="dark"] .name-chip-en { color: #e8d5f5; }
.name-chip-ar { font-size: 12px; color: #8B2635; margin-right: auto; }
.name-chip-gender { font-size: 14px; }

/* Botón de reintentar */
.quiz-retry-btn {
    display: block;
    margin: 0 auto;
    padding: 12px 32px;
    border-radius: 12px;
    border: 2px solid rgba(180,100,220,0.3);
    background: transparent;
    color: #a78cc0;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.quiz-retry-btn:hover { border-color: #4a0e6e; color: #4a0e6e; }

/* Resumen de filtros */
.quiz-summary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 10px;
}
.quiz-summary-tag {
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(139,38,53,0.1);
    color: #8B2635;
    font-weight: 600;
}

/* Hero de la página */
.quiz-hero {
    text-align: center;
    margin-bottom: 36px;
}
.quiz-hero h1 {
    font-size: 1.8rem;
    font-weight: 900;
    color: #2c1810;
    margin-bottom: 8px;
}
[data-theme="dark"] .quiz-hero h1 { color: #e8d5f5; }
.quiz-hero p { color: #a78cc0; font-size: 15px; }

/* Sin resultados */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #a78cc0;
}
.no-results .no-icon { font-size: 3rem; margin-bottom: 12px; }
