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

:root {
  --primary:      #FF9801;           /* Naranja corporativo */
  --primary-dark: #e08700;
  --primary-light: rgba(255,152,1,0.12);
  --accent:       #A9D4E8;           /* Azul claro corporativo */
  --blue:         #1F507E;           /* Azul oscuro corporativo */
  --sp-color:     #FF9801;           /* SP — Naranja (Autoconservación) */
  --sx-color:     #fb4654;           /* SX — Rojo (Transmisor) */
  --so-color:     #1F507E;           /* SO — Azul (Social) */
  --success:      #176375;           /* Teal corporativo */
  --danger:       #fb4654;
  --bg:           #061422;
  --bg2:          #0b1f30;
  --surface:      #0f2a3f;
  --surface2:     #153349;
  --border:       rgba(169,212,232,0.12);
  --text:         #ffffff;
  --text-muted:   rgba(169,212,232,0.65);
  --radius: 16px;
}

html { font-size: 16px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ===== BACKGROUND ORBS ===== */
.welcome-bg, .results-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bg-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.3; }
.orb-1 { width: 450px; height: 450px; background: var(--primary); top: -120px; right: -80px; animation: float 8s ease-in-out infinite; }
.orb-2 { width: 350px; height: 350px; background: var(--blue);    bottom: -80px; left: -80px; animation: float 11s ease-in-out infinite reverse; }
.orb-3 { width: 280px; height: 280px; background: var(--accent);  top: 50%; left: 50%; transform: translate(-50%,-50%); animation: float 13s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-28px)} }

/* ===== WELCOME ===== */
.welcome-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; min-height: 100vh; padding: 40px 20px; }
.logo-area { display: flex; align-items: center; gap: 10px; margin-bottom: 40px; align-self: flex-start; }
.logo-badge { width: 42px; height: 42px; background: linear-gradient(135deg, var(--primary), var(--blue)); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.logo-text { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--text); }

.welcome-card { background: rgba(11,31,48,0.75); backdrop-filter: blur(24px); border: 1px solid var(--border); border-radius: 24px; padding: 44px; max-width: 660px; width: 100%; }
.welcome-tag { display: inline-block; background: var(--primary-light); color: var(--primary); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 14px; border-radius: 20px; margin-bottom: 16px; border: 1px solid rgba(255,152,1,0.3); }
.welcome-title { font-family: 'Outfit', sans-serif; font-size: clamp(1.9rem, 5vw, 2.8rem); font-weight: 800; line-height: 1.1; margin-bottom: 16px; }
.gradient-text { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.welcome-desc { color: var(--text-muted); font-size: 1rem; line-height: 1.7; margin-bottom: 24px; }

/* Subtypes preview chips */
.subtypes-preview { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.subtype-chip { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.subtype-chip.sp { border-left: 3px solid var(--sp-color); }
.subtype-chip.sx { border-left: 3px solid var(--sx-color); }
.subtype-chip.so { border-left: 3px solid var(--so-color); }
.chip-icon { font-size: 1.3rem; }
.subtype-chip div { display: flex; flex-direction: column; gap: 2px; }
.subtype-chip strong { font-size: 0.9rem; color: var(--text); }
.subtype-chip span { font-size: 0.78rem; color: var(--text-muted); }

.welcome-stats { display: flex; align-items: center; background: var(--surface); border-radius: 14px; padding: 18px 20px; margin-bottom: 20px; }
.stat-item { flex: 1; text-align: center; }
.stat-num { display: block; font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); }
.stat-divider { width: 1px; height: 36px; background: var(--border); }

.welcome-instructions { background: var(--surface); border-radius: 14px; padding: 18px 20px; margin-bottom: 24px; }
.welcome-instructions h3 { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; }
.welcome-instructions ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.welcome-instructions li { font-size: 0.92rem; color: var(--text-muted); padding-left: 22px; position: relative; line-height: 1.5; }
.welcome-instructions li::before { content: '→'; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.welcome-instructions li strong { color: var(--text); }

/* ===== BUTTONS ===== */
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 600; padding: 14px 28px; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; width: 100%; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,152,1,0.35); }
.btn-secondary { display: flex; align-items: center; gap: 8px; background: var(--surface2); color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.92rem; font-weight: 500; padding: 12px 20px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.btn-secondary:hover { background: var(--surface); }
.btn-secondary:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===== HEADER ===== */
.app-header, .quiz-header, .results-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.header-logo { display: flex; align-items: center; gap: 8px; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.95rem; color: var(--text); }
.header-title { font-size: 0.82rem; color: var(--text-muted); }

/* ===== INFO SCREEN ===== */
.info-container { display: flex; justify-content: center; padding: 36px 20px; }
.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; max-width: 600px; width: 100%; margin-top: 16px; }
.info-icon { width: 52px; height: 52px; background: rgba(0,201,167,0.15); border-radius: 13px; display: flex; align-items: center; justify-content: center; color: var(--primary); margin-bottom: 14px; }
.info-card h2 { font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.info-card p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 24px; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.form-group input { background: var(--bg2); border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 13px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.92rem; outline: none; transition: border-color 0.2s; }
.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--text-muted); opacity: 0.6; }
.field-error { font-size: 0.78rem; color: var(--danger); min-height: 14px; }
.privacy-note { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-muted); background: var(--bg2); border-radius: 10px; padding: 9px 13px; margin-bottom: 18px; }

/* ===== QUIZ ===== */
.quiz-progress-bar { height: 4px; background: var(--surface2); position: sticky; top: 0; z-index: 10; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.4s ease; border-radius: 0 4px 4px 0; }
.quiz-counter { font-size: 0.82rem; font-weight: 600; color: var(--primary); }
.quiz-container { max-width: 680px; margin: 0 auto; padding: 36px 20px 100px; }
.question-section { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; margin-bottom: 22px; }
.question-badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-weight: 700; font-size: 0.82rem; border-radius: 10px; margin-bottom: 14px; }
.question-text { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 600; line-height: 1.5; margin-bottom: 24px; }
.options-container { display: flex; flex-direction: column; gap: 10px; }
.option-btn { display: flex; align-items: flex-start; gap: 12px; background: var(--bg2); border: 1.5px solid var(--border); border-radius: 13px; padding: 14px 16px; cursor: pointer; transition: all 0.2s; text-align: left; width: 100%; color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.92rem; line-height: 1.5; }
.option-btn:hover { border-color: var(--primary); background: rgba(255,152,1,0.07); transform: translateX(2px); }
.option-btn.selected { border-color: var(--primary); background: rgba(255,152,1,0.13); box-shadow: 0 0 0 3px rgba(255,152,1,0.13); }
.option-indicator { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; margin-top: 1px; transition: all 0.2s; }
.option-btn.selected .option-indicator { background: var(--primary); border-color: var(--primary); }
.option-btn.selected .option-indicator::after { content: ''; display: block; width: 7px; height: 7px; background: #fff; border-radius: 50%; }
.option-letter { font-weight: 700; color: var(--primary); font-size: 0.82rem; margin-right: 6px; }

/* ── Verdadero/Falso ── */
.vf-wrapper { display: flex; flex-direction: column; gap: 10px; }
.vf-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg2); border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.vf-stmt { flex: 1; font-size: 0.9rem; color: var(--text); line-height: 1.5; }
.vf-btn-group { display: flex; gap: 8px; flex-shrink: 0; }
.vf-btn { padding: 6px 14px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface2); color: var(--text-muted); font-family: 'Inter', sans-serif; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.18s; }
.vf-btn:hover { border-color: var(--primary); color: var(--text); }
.vf-btn.selected-V { background: rgba(34,197,94,0.18); border-color: var(--success); color: var(--success); }
.vf-btn.selected-F { background: rgba(239,68,68,0.15); border-color: #ef4444; color: #ef4444; }
.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.btn-next { display: flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-family: 'Inter', sans-serif; font-size: 0.92rem; font-weight: 600; padding: 12px 22px; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.btn-next:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,152,1,0.35); }
.btn-next:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-dots { display: flex; gap: 4px; overflow: visible; flex-wrap: nowrap; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface2); flex-shrink: 0; transition: background 0.3s ease; }
.nav-dot.answered { background: var(--primary); }
.nav-dot.current { background: var(--accent); }

/* ===== RESULTS ===== */
.results-container { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 28px 20px 56px; }
.results-intro { text-align: center; margin-bottom: 28px; }
.results-tag { display: inline-block; background: rgba(23,99,117,0.2); color: var(--accent); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 5px 14px; border-radius: 20px; margin-bottom: 10px; border: 1px solid rgba(169,212,232,0.3); }
.results-title { font-family: 'Outfit', sans-serif; font-size: 1.9rem; font-weight: 800; margin-bottom: 4px; }
.results-name { color: var(--text-muted); font-size: 0.95rem; }

/* Dominant hero */
.dominant-hero { display: flex; align-items: center; gap: 20px; background: linear-gradient(135deg, rgba(255,152,1,0.13), rgba(255,152,1,0.04)); border: 1px solid rgba(255,152,1,0.35); border-radius: 20px; padding: 28px; margin-bottom: 28px; }
.dominant-badge { font-family: 'Outfit', sans-serif; font-size: 2.2rem; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); width: 72px; height: 72px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; letter-spacing: -0.03em; }
.dominant-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin-bottom: 4px; }
.dominant-name { font-family: 'Outfit', sans-serif; font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.dominant-score { display: inline-block; background: var(--surface2); font-size: 0.8rem; padding: 3px 12px; border-radius: 20px; color: var(--text-muted); }

/* Stack */
.stack-section { margin-bottom: 28px; }
.section-title { font-family: 'Outfit', sans-serif; font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.stack-note { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }
.stack-cards { display: flex; flex-direction: column; gap: 10px; }
.stack-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.stack-card.rank-1 { border-color: rgba(0,201,167,0.4); background: rgba(0,201,167,0.07); }
.stack-position { font-family: 'Outfit', sans-serif; font-size: 1.4rem; font-weight: 800; color: var(--text-muted); width: 28px; flex-shrink: 0; }
.stack-card.rank-1 .stack-position { color: var(--primary); }
.stack-icon { font-size: 1.3rem; flex-shrink: 0; }
.stack-info { flex: 1; }
.stack-name { font-weight: 700; font-size: 0.95rem; }
.stack-code { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.stack-bar-wrap { width: 100px; height: 6px; background: var(--surface2); border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.stack-bar-fill { height: 100%; border-radius: 6px; transition: width 0.8s ease; }
.stack-pts { font-weight: 700; font-size: 0.9rem; color: var(--primary); flex-shrink: 0; min-width: 36px; text-align: right; }

/* Bar chart */
.chart-section { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; margin-bottom: 24px; }
.bar-chart-wrapper { max-width: 480px; margin: 0 auto; height: 180px; }

/* Description */
.desc-section { margin-bottom: 20px; }
.desc-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 26px; }
.desc-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.desc-icon { font-size: 2rem; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; background: var(--surface2); border-radius: 14px; }
.desc-name { font-family: 'Outfit', sans-serif; font-size: 1.15rem; font-weight: 700; }
.desc-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.desc-text { font-size: 0.92rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 14px; }
.desc-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.desc-tag { font-size: 0.76rem; font-weight: 600; padding: 3px 11px; border-radius: 20px; background: rgba(255,152,1,0.12); color: var(--primary); border: 1px solid rgba(255,152,1,0.25); }

/* Repressed */
.repressed-section { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; margin-bottom: 24px; opacity: 0.8; }
.repressed-icon { font-size: 1.2rem; color: var(--text-muted); }
.repressed-text { display: flex; flex-direction: column; gap: 2px; }
.repressed-text strong { font-size: 0.9rem; color: var(--text-muted); }
.repressed-text span { font-size: 0.82rem; color: var(--text-muted); }

/* Save & actions */
.save-status { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; border-radius: 12px; padding: 11px 16px; margin-bottom: 14px; }
.save-pending { background: rgba(31,80,126,0.2); border: 1px solid rgba(169,212,232,0.25); color: var(--text-muted); }
.save-success { background: rgba(23,99,117,0.15); border: 1px solid rgba(23,99,117,0.4); color: var(--success); }
.save-error   { background: rgba(251,70,84,0.1);  border: 1px solid rgba(251,70,84,0.35); color: var(--danger); }
.save-icon { font-size: 1rem; }
.save-spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.results-actions { display: flex; gap: 12px; margin-bottom: 28px; }
.results-actions .btn-primary { flex: 1; }
.results-actions .btn-secondary { flex: 1; justify-content: center; }
.results-footer { text-align: center; font-size: 0.78rem; color: var(--text-muted); padding-top: 14px; border-top: 1px solid var(--border); }

@media (max-width: 580px) {
  .welcome-card { padding: 24px 18px; }
  .form-row { grid-template-columns: 1fr; }
  .dominant-hero { flex-direction: column; text-align: center; }
  .results-actions { flex-direction: column; }
}
@media print {
  .quiz-header, .results-header, .results-actions, .save-status { display: none !important; }
  body { background: #fff; color: #000; }
}
