/* =========================================================================
   OPOS APP — hoja de estilos
   Mobile-first. En escritorio la app se muestra dentro de un marco de móvil
   para validar cómo quedará en React Native.
   Los colores están en variables CSS: al migrar a React se convierten en un
   objeto `theme` y los nombres se mantienen igual.
   ========================================================================= */

:root {
  /* superficies */
  --bg:            #070E1B;
  --surface:       #0E1B30;
  --surface-2:     #142440;
  --surface-3:     #1C3055;
  --border:        #22375C;

  /* texto */
  --text:          #EAF1FF;
  --text-soft:     #9DB2D4;
  --text-dim:      #6B82A8;

  /* marca y estados */
  --primary:       #3B82F6;
  --primary-dark:  #1D4ED8;
  --ok:            #22C55E;
  --ok-bg:         #10331F;
  --ko:            #EF4444;
  --ko-bg:         #3A1518;
  --warn:          #F59E0B;

  /* acentos por módulo */
  --azul:          #3B82F6;
  --verde:         #14B8A6;
  --violeta:       #A78BFA;
  --ambar:         #F59E0B;

  /* medidas */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --pad: 18px;
  --tabbar-h: 68px;
  --header-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* ------------------------------------------------------------------ marco */
.frame-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 700px at 50% -10%, #14294D 0%, #070E1B 60%);
  padding: 0;
}

.device {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 760px) {
  .frame-wrap { padding: 28px 16px; }
  .device {
    max-width: 412px;
    height: 880px;
    max-height: calc(100vh - 56px);
    border-radius: 40px;
    border: 10px solid #05090F;
    box-shadow: 0 40px 90px rgba(0,0,0,.65), 0 0 0 1px #1E3358;
  }
}

/* --------------------------------------------------------------- cabecera */
.app-header {
  flex: 0 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--pad);
  background: rgba(7,14,27,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
}

.app-header .btn-back {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: grid; place-items: center;
  font-size: 18px;
  transition: background .15s;
}
.app-header .btn-back:hover { background: var(--surface-3); }

.app-header .titles { min-width: 0; flex: 1 1 auto; }
.app-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ contenedor */
.screen {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--pad) var(--pad) 28px;
  -webkit-overflow-scrolling: touch;
}
.screen.no-pad { padding: 0; }

/* ------------------------------------------------------------- tab bar */
.tabbar {
  flex: 0 0 auto;
  height: var(--tabbar-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  background: rgba(10,20,38,.96);
  backdrop-filter: blur(12px);
}
.tabbar button {
  border: 0;
  background: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 550;
  padding: 0;
  transition: color .15s;
}
.tabbar button .ic { font-size: 19px; line-height: 1; }
.tabbar button.active { color: var(--primary); }

/* ----------------------------------------------------------- tipografía */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 8px;
}
h2.section { font-size: 15px; font-weight: 650; margin: 26px 0 12px; }
h2.section:first-child { margin-top: 4px; }
.lead { color: var(--text-soft); font-size: 14px; margin: 0 0 18px; }

/* ------------------------------------------------------------- tarjetas */
.hero {
  background: linear-gradient(140deg, #16305A 0%, #0E1B30 70%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 22px;
}
.hero h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.3px; }
.hero p { margin: 0 0 16px; color: var(--text-soft); font-size: 14px; }

.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.module-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 14px;
  text-align: left;
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  min-height: 158px;
  transition: transform .12s, border-color .15s;
}
.module-card:hover { transform: translateY(-2px); }

/* foto de fondo */
.module-card .bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  transition: transform .35s ease;
}
.module-card:hover .bg { transform: scale(1.08); }

/* velo para que el texto se lea siempre */
.module-card .veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7,14,27,.10) 0%, rgba(7,14,27,.62) 48%, rgba(7,14,27,.95) 100%);
}

.module-card .nm {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.22;
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
.module-card .ct {
  font-size: 11.5px;
  color: rgba(234,241,255,.72);
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}

/* línea de acento por módulo */
.module-card::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  z-index: 1;
}
.module-card[data-color="azul"]::after    { background: var(--azul); }
.module-card[data-color="verde"]::after   { background: var(--verde); }
.module-card[data-color="violeta"]::after { background: var(--violeta); }
.module-card[data-color="ambar"]::after   { background: var(--ambar); }

/* --------------------------------------------------------------- listas */
.list { display: flex; flex-direction: column; gap: 10px; }

.row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  color: var(--text);
  text-align: left;
  transition: background .15s, border-color .15s;
}
.row:hover { background: var(--surface-2); }
.row .badge {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  background: var(--surface-3);
  color: var(--text-soft);
}
.row .body { flex: 1 1 auto; min-width: 0; }
.row .t { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.row .s { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.row .chev { flex: 0 0 auto; color: var(--text-dim); font-size: 17px; }
.row .pill {
  flex: 0 0 auto;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-soft);
}
.row .pill.on { background: rgba(34,197,94,.16); color: var(--ok); }
.row .pill.off { background: rgba(107,130,168,.14); color: var(--text-dim); }

/* -------------------------------------------------------------- botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
  font-size: 15px;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn.subtle { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn.sm { padding: 10px 14px; font-size: 13.5px; width: auto; }

.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1 1 0; }

/* ---------------------------------------------------------- ficha tema */
.study-block { margin-bottom: 22px; }
.study-block h3 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 650;
}
.study-block ul { margin: 0; padding-left: 18px; }
.study-block li { margin-bottom: 9px; font-size: 14px; color: var(--text-soft); }
.study-block li::marker { color: var(--text-dim); }

.keys { display: flex; flex-direction: column; gap: 8px; }
.key {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--r-sm);
}
.key .d { font-weight: 700; font-size: 13px; color: var(--warn); flex: 0 0 auto; min-width: 76px; }
.key .x { font-size: 13px; color: var(--text-soft); }

.tip {
  background: rgba(59,130,246,.09);
  border: 1px solid rgba(59,130,246,.28);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-soft);
  margin-bottom: 10px;
}
.tip b { color: var(--primary); }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty .big { font-size: 34px; margin-bottom: 12px; }
.empty p { font-size: 14px; margin: 0 0 6px; }

/* ------------------------------------------------------------------ quiz */
.quiz-top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px var(--pad);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.progress {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress > i {
  display: block; height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width .25s ease;
}
.counter { font-size: 12px; font-weight: 650; color: var(--text-soft); flex: 0 0 auto; }
.timer { font-size: 12px; font-weight: 700; color: var(--warn); flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.q-text { font-size: 17px; font-weight: 600; line-height: 1.35; margin: 6px 0 16px; }

.apoyo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 16px;
  margin-bottom: 18px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 16px;
  letter-spacing: .06em;
  text-align: center;
  color: var(--text);
  line-height: 1.7;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 14.5px;
  line-height: 1.35;
  transition: border-color .15s, background .15s;
}
.option:hover { border-color: var(--text-dim); }
.option .letter {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-soft);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.option.selected { border-color: var(--primary); background: rgba(59,130,246,.10); }
.option.selected .letter { background: var(--primary); color: #fff; }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.correct .letter { background: var(--ok); color: #05230F; }
.option.wrong { border-color: var(--ko); background: var(--ko-bg); }
.option.wrong .letter { background: var(--ko); color: #fff; }
.option:disabled { cursor: default; }

.feedback {
  margin-top: 16px;
  border-radius: var(--r-md);
  padding: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--surface);
}
.feedback .head { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.feedback.ok .head { color: var(--ok); }
.feedback.ko .head { color: var(--ko); }
.feedback p { margin: 0; color: var(--text-soft); }

.quiz-footer {
  position: sticky;
  bottom: 0;
  padding: 14px var(--pad) 18px;
  background: linear-gradient(180deg, rgba(7,14,27,0) 0%, var(--bg) 30%);
}

/* -------------------------------------------------------------- resultado */
.score-ring {
  width: 150px; height: 150px;
  margin: 10px auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
}
.score-ring .val { font-size: 38px; font-weight: 750; letter-spacing: -1px; }
.score-ring .lab { font-size: 12px; color: var(--text-dim); }

.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 22px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 10px;
  text-align: center;
}
.stat .n { font-size: 21px; font-weight: 700; }
.stat .l { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.stat.ok .n { color: var(--ok); }
.stat.ko .n { color: var(--ko); }

.review-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--ko);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.review-item .q { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.review-item .a { font-size: 12.5px; margin-bottom: 3px; }
.review-item .a.good { color: var(--ok); }
.review-item .a.bad { color: var(--ko); }
.review-item .e { font-size: 12.5px; color: var(--text-dim); margin-top: 7px; }

/* --------------------------------------------------------------- ajustes */
.setting {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.setting .l { font-size: 14px; font-weight: 600; }
.setting .h { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* -------------------------------------------------------------- progreso */
.bar-item { margin-bottom: 16px; }
.bar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bar-head .n { font-weight: 600; }
.bar-head .v { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; }

/* -------------------------------------------------------------- utilidad */
.spacer { height: 10px; }
.center { text-align: center; }
.hidden { display: none !important; }

.screen::-webkit-scrollbar { width: 0; }
