/* Trivia EducaKine: misma paleta que la web */
:root {
  --crema: #ece8dc;
  --crema-osc: #e2dccd;
  --navy: #0a1c33;
  --navy-2: #13294a;
  --dorado: #c5a880;
  --dorado-osc: #8a7350;
  --borde: #b8ad96;
  --texto: #1d2633;
  --texto-suave: #5d5648;
  --blanco: #fbf9f4;
  --ok: #2f6b4f;
  --ok-bg: #e3efe6;
  --mal: #9b3b2f;
  --mal-bg: #f5e3df;
  --radio: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--crema);
  min-height: 100dvh;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Encabezado */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: var(--crema); border-bottom: 1px solid var(--borde);
}
.top__brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--navy); font-family: "Cinzel", serif; font-weight: 700; }
.top__brand img { mix-blend-mode: multiply; }
.top__acc { display: flex; align-items: center; gap: 8px; }
.top__sonido { width: 34px; height: 34px; display: grid; place-items: center; background: none; border: 1px solid var(--borde); border-radius: 50%; color: var(--navy); cursor: pointer; padding: 0; }
.top__sonido svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.top__home { background: none; border: 1px solid var(--borde); border-radius: 999px; padding: .35em 1em; font-size: .88rem; font-weight: 600; color: var(--navy); cursor: pointer; }

.app { width: min(560px, 100% - 32px); margin: 0 auto; padding: 24px 0 48px; }
.screen { animation: entrar .25s ease-out; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--dorado-osc); margin: 0 0 .5em; }
.title { font-family: "Cinzel", Georgia, serif; color: var(--navy); font-size: clamp(1.9rem, 7vw, 2.5rem); line-height: 1.1; margin: 0 0 .4em; }
.title--sm { font-size: clamp(1.4rem, 5.5vw, 1.8rem); }
.lead { color: var(--texto-suave); margin: 0 0 24px; }
.lead--center { text-align: center; }
.fine { font-size: .8rem; color: var(--texto-suave); text-align: center; margin-top: 24px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: .9em 1.4em; border-radius: 999px; border: 2px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--gold { background: var(--dorado); color: var(--navy); }
.btn--navy { background: var(--navy); color: var(--blanco); }
.btn--ghost { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn--link { background: none; color: var(--navy); text-decoration: underline; padding: .6em; }
.btn--block { width: 100%; }
:focus-visible { outline: 3px solid var(--dorado); outline-offset: 2px; }

/* Estadísticas */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 24px; }
.stats div { background: var(--blanco); border: 1px solid var(--borde); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stats dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texto-suave); }
.stats dd { margin: 2px 0 0; font-family: "Cinzel", serif; font-weight: 700; font-size: 1.35rem; color: var(--navy); }

/* Modos */
.modes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mode {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 14px 16px; cursor: pointer; transition: border-color .15s, transform .12s;
}
.mode:hover { border-color: var(--dorado); }
.mode:active { transform: scale(.99); }
.mode:disabled { opacity: .5; cursor: not-allowed; }
.mode__icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--navy); display: grid; place-items: center; }
.mode__icon svg { width: 24px; height: 24px; fill: none; stroke: var(--dorado); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mode__txt { display: flex; flex-direction: column; }
.mode__txt strong { color: var(--navy); font-size: 1.02rem; }
.mode__txt small { color: var(--texto-suave); font-size: .88rem; }

/* Ruleta */
.wheel { position: relative; width: min(340px, 100%); aspect-ratio: 1; margin: 12px auto 8px; }
.wheel__svg { width: 100%; height: 100%; display: block; will-change: transform; }
.wheel__svg text { font-family: "Inter", sans-serif; font-size: 7.4px; font-weight: 600; }
.wheel__pointer {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 24px solid var(--navy);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}
.wheel__hub {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  width: 21%; aspect-ratio: 1; border-radius: 50%; background: var(--navy); color: var(--dorado);
  border: 3px solid var(--dorado); display: grid; place-items: center; font-family: "Cinzel", serif; font-weight: 700;
}
.wheel__result { text-align: center; font-family: "Cinzel", serif; font-weight: 700; color: var(--navy); font-size: 1.3rem; min-height: 1.6em; margin: 8px 0 16px; }
.wheel__unit { text-align: center; font-weight: 600; color: var(--texto-suave); font-size: 1rem; min-height: 1.5em; margin: -12px 0 16px; }
.wheel__unit.is-hit { animation: golpe .45s ease-out; color: var(--navy); }
.wheel__result.is-hit { animation: golpe .45s ease-out; color: var(--dorado-osc, #8a7350); }
@keyframes golpe { 0% { transform: scale(.8); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Unidades */
.units { display: grid; gap: 10px; margin-bottom: 110px; }
.sys { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; }
.sys.is-empty { opacity: .55; }
.sys__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.sys__head::-webkit-details-marker { display: none; }
.sys__head::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(45deg); transition: transform .15s; }
.sys[open] .sys__head::after { transform: rotate(-135deg); }
.sys__name { font-weight: 600; color: var(--navy); }
.sys__count { font-size: .8rem; color: var(--texto-suave); }
.sys__body { padding: 0 14px 12px; display: grid; gap: 2px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--crema-osc); cursor: pointer; }
.chk input { width: 20px; height: 20px; accent-color: var(--navy); flex: none; }
.chk span { flex: 1; }
.chk small { color: var(--texto-suave); }
.chk--all { font-weight: 600; border-top: 0; }
.chk.is-disabled { opacity: .45; cursor: default; }

.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--crema); border-top: 1px solid var(--borde);
}
.sticky-bar .btn { flex: 1; max-width: 340px; white-space: nowrap; padding: .8em 1em; }
.seg { display: flex; border: 1px solid var(--navy); border-radius: 999px; overflow: hidden; flex: none; }
.seg button { background: none; border: 0; padding: .7em .85em; font-weight: 600; font-size: .9rem; color: var(--navy); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--navy); color: var(--blanco); }

/* Juego */
.hud { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--navy); font-size: .95rem; }
.hud__timer { font-family: "Cinzel", serif; font-size: 1.4rem; min-width: 2.5ch; text-align: center; }
.hud__timer.is-low { color: var(--mal); }
.bar { height: 6px; background: var(--crema-osc); border-radius: 999px; margin: 10px 0 20px; overflow: hidden; }
.bar__fill { height: 100%; width: 0; background: var(--dorado); transition: width .3s; }

.q__meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dorado-osc); font-weight: 600; }
.q__dif { letter-spacing: 2px; color: var(--dorado); font-size: .9rem; }
.q__text { font-size: clamp(1.12rem, 4.6vw, 1.32rem); line-height: 1.4; color: var(--navy); margin: 0 0 20px; font-weight: 600; }
.q__opts { display: grid; gap: 10px; }
.q__opts--vf { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  background: var(--blanco); border: 2px solid var(--borde); border-radius: 12px;
  padding: 13px 14px; cursor: pointer; line-height: 1.35; transition: border-color .12s, background .12s;
}
.opt:hover:not(:disabled) { border-color: var(--navy); }
.opt:disabled { cursor: default; }
.opt__l { flex: none; width: 26px; height: 26px; border-radius: 7px; background: var(--crema-osc); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.q__opts--vf .opt { justify-content: center; font-weight: 600; padding: 18px 12px; }
.q__opts--vf .opt__l { display: none; }
.opt.is-ok { border-color: var(--ok); background: var(--ok-bg); }
.opt.is-ok .opt__l { background: var(--ok); color: #fff; }
.opt.is-bad { border-color: var(--mal); background: var(--mal-bg); }
.opt.is-bad .opt__l { background: var(--mal); color: #fff; }
.opt.is-picked { border-color: var(--navy); background: var(--crema-osc); }
.opt.is-dim { opacity: .55; }

.fb { margin-top: 18px; background: var(--blanco); border: 1px solid var(--borde); border-left: 4px solid var(--dorado); border-radius: 12px; padding: 14px 16px 16px; animation: entrar .2s ease-out; }
.fb.is-ok { border-left-color: var(--ok); }
.fb.is-bad { border-left-color: var(--mal); }
.fb__title { margin: 0 0 4px; font-weight: 700; }
.fb.is-ok .fb__title { color: var(--ok); }
.fb.is-bad .fb__title { color: var(--mal); }
.fb__text { margin: 0 0 6px; color: var(--texto); font-size: .95rem; }

/* Resultado */
.score { text-align: center; margin: 8px 0 12px; }
.score__big { font-family: "Cinzel", serif; font-weight: 700; color: var(--navy); font-size: clamp(3.4rem, 18vw, 5rem); line-height: 1; margin: 0; }
.score__sub { color: var(--dorado-osc); font-weight: 600; margin: 6px 0 0; }
.actions { display: grid; gap: 10px; margin: 20px 0 28px; }
.review { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; margin-bottom: 24px; }
.review h3 { font-family: "Cinzel", serif; color: var(--navy); margin: 0 0 8px; font-size: 1.1rem; }
.review ol { margin: 0; padding-left: 1.2em; display: grid; gap: 12px; }
.review li { font-size: .92rem; }
.review li p { margin: 2px 0 0; color: var(--texto-suave); }
.review li strong { color: var(--ok); font-weight: 600; }
.cta { background: var(--navy); color: #d9d4c6; border-radius: var(--radio); padding: 20px; text-align: center; }
.cta__title { font-family: "Cinzel", serif; color: var(--dorado); font-size: 1.15rem; margin: 0 0 6px; font-weight: 700; }
.cta p { margin: 0 0 14px; font-size: .92rem; }
.cta .btn--navy { background: var(--dorado); color: var(--navy); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: var(--blanco); padding: .7em 1.2em; border-radius: 999px; font-size: .9rem; z-index: 10; max-width: calc(100% - 32px); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .screen, .fb { animation: none; }
  .wheel__svg { transition-duration: .01s; }
  .bar__fill, .btn, .mode, .opt { transition: none; }
}
