@font-face{
  font-family: "AbhayaLibre";
  src: url("./fonts/AbhayaLibre-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg:#f6f2e8;
  --brand:#9c0f0f;

  --text:#161616;
  --muted:rgba(0,0,0,.55);

  --border:rgba(0,0,0,.10);
  --shadow:0 24px 70px rgba(0,0,0,.16);
  --shadowSoft:0 12px 28px rgba(0,0,0,.12);
}

*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  margin:0;
  font-family: "AbhayaLibre", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
  color:var(--text);
  background:
    radial-gradient(1100px 650px at 10% 5%, rgba(156,15,15,.12), transparent 55%),
    radial-gradient(900px 600px at 95% 12%, rgba(156,15,15,.08), transparent 60%),
    radial-gradient(1100px 700px at 60% 110%, rgba(156,15,15,.07), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0)),
    var(--bg);
  padding: env(safe-area-inset-top) 14px env(safe-area-inset-bottom) 14px;
}

.wrap{
  min-height:100%;
  display:grid;
  place-items:center;
}

/* PANEL */
.panel{
  width:min(520px, 100%);
  height:min(900px, 100vh);
  border-radius:26px;
  border:1px solid rgba(0,0,0,.09);
  background: linear-gradient(180deg, rgba(255,255,255,.70), rgba(255,255,255,.52));
  box-shadow: var(--shadow);
  overflow:hidden;
  position:relative;
  display:grid;
  grid-template-rows:auto 1fr auto;
}

/* HEADER */
.panelHeader{
  padding:14px 14px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,255,255,.72));
  border-bottom:1px solid rgba(0,0,0,.06);
  display:grid;
  gap:10px;
}

.topRow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  font-size:13px;
  color:var(--muted);
  letter-spacing:.2px;
}
.topRow.small{ font-size:12px; }
.muted{ color: var(--muted); }

#qPos{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.60);
  border:1px solid rgba(0,0,0,.06);
  box-shadow: 0 10px 22px rgba(0,0,0,.06);
}

.progressOuter{
  width:100%;
  height:12px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.05);
  overflow:hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.progressInner{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--brand), rgba(156,15,15,.55));
  box-shadow: 0 8px 18px rgba(156,15,15,.18);
}

/* BODY */
.panelCard{
  display:grid;
  padding:16px;
  background:
    radial-gradient(900px 600px at 50% 20%, rgba(0,0,0,.035), transparent 55%),
    rgba(0,0,0,.02);
  min-height:0;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

.quizArea, .doneArea{
  max-width: 520px;
  width:100%;
  margin: 0 auto;
  display:grid;
  gap:12px;
}

.qTitle{
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: .2px;
}

.qOptions{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}

/* OPTION (pregunta vs respuesta claro + letra) */
.qOpt{
  width:100%;
  text-align:left;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.82);
  padding: 12px 12px;
  cursor:pointer;
  box-shadow: var(--shadowSoft);
  color: rgba(0,0,0,.78);
  -webkit-tap-highlight-color: transparent;

  display:flex;
  gap:10px;
  align-items:flex-start;
}
.qOpt:active{ transform: translateY(1px); }

.qOpt.selected{
  border-color: rgba(156,15,15,.55);
  box-shadow: 0 0 0 4px rgba(156,15,15,.14), var(--shadowSoft);
}

.optLetter{
  flex: 0 0 auto;
  min-width: 36px;
  height: 28px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-weight: 1000;
  background: rgba(156,15,15,.10);
  color: var(--brand);
  border: 1px solid rgba(156,15,15,.18);
}

.qOpt.selected .optLetter{
  background: rgba(156,15,15,.16);
  border-color: rgba(156,15,15,.28);
}

.optText{
  flex: 1 1 auto;
  line-height: 1.25;
  font-weight: 800;
}

/* NAV */
.panelActions{
  padding:12px 14px calc(12px + env(safe-area-inset-bottom));
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  border-top:1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Buttons */
.btn{
  border-radius:14px;
  border:1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.90);
  padding:10px 12px;
  cursor:pointer;
  box-shadow: var(--shadowSoft);
  transition: transform .06s ease, filter .2s ease;
  font-weight: 900;
}
.btn:active{ transform: translateY(1px); }
.btn.secondary{ background: rgba(255,255,255,.70); }
.btn.small{ padding:10px 12px; font-size:13px; }

.btn.ok{
  background: var(--brand);
  border-color: rgba(156,15,15,.65);
  color: #fff;
  font-weight: 1000;
}
.btn.ok:disabled{
  opacity:.55;
  cursor:not-allowed;
}

/* Resultado */
.resultBox{
  border:1px solid rgba(0,0,0,.10);
  border-radius:18px;
  background: rgba(255,255,255,.78);
  padding:14px;
  box-shadow: var(--shadowSoft);
  display:grid;
  gap:10px;
}

.resultTitle{
  font-weight: 1000;
  color: rgba(0,0,0,.75);
  font-size: 13px;
}

.resultStyle{
  display:flex;
  align-items:center;
  gap:10px;
}

.resultBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 42px;
  height: 32px;
  border-radius:999px;
  background: rgba(156,15,15,.12);
  border:1px solid rgba(156,15,15,.22);
  color: var(--brand);
  font-weight: 1000;
  letter-spacing:.4px;
}

.resultName{
  font-size: 16px;
  font-weight: 1000;
  color: var(--brand);
}

.resultDesc{
  font-size: 13px;
  color: rgba(0,0,0,.72);
  line-height: 1.35;
}

.pdfHint{
  margin: 0;
  text-align:center;
  font-size:12px;
  color: rgba(0,0,0,.60);
}

/* Done actions */
.doneActions{
  display:flex;
  justify-content:center;
  margin-top: 4px;
}

/* Header button */
.topRight{ display:flex; align-items:center; gap:10px; }

.ghostBtnTop{
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.70);
  box-shadow: var(--shadowSoft);
  cursor:pointer;
  font-weight: 900;
  color: rgba(0,0,0,.70);
  white-space: nowrap;
}
.ghostBtnTop:active{ transform: translateY(1px); }

.ghostBtnTopIcon{
  width: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display:none;
  place-items:center;
  background: rgba(0,0,0,.35);
  z-index: 10000;
  padding: 18px;
}
.modal.show{ display:grid; }

.modalCard{
  width: min(460px, 100%);
  background: rgba(246,242,232,.96);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.20);
  display:grid;
  gap:10px;
}
.modalCard h3{ margin:0; font-size:16px; }
.modalCard p{ margin:0; color: rgba(0,0,0,.70); line-height:1.35; font-size: 13px; }
.modalCard p.small{ font-size:12px; color: rgba(0,0,0,.60); }

/* Toast */
.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform: translateX(-50%);
  background: rgba(17,17,17,.92);
  border:1px solid rgba(255,255,255,.14);
  color:#fff;
  padding:10px 12px;
  border-radius:999px;
  box-shadow: var(--shadowSoft);
  font-size:13px;
  opacity:0;
  pointer-events:none;
  transition: opacity .2s ease, transform .2s ease;
  z-index:99999;
}
.toast.show{
  opacity:1;
  transform: translateX(-50%) translateY(-2px);
}

/* ===== COVER (portada) ===== */
.coverArea{
  width:100%;
  display:grid;
  place-items:center;
}

.coverCard{
  width:100%;
  border:1px solid rgba(0,0,0,.10);
  border-radius:18px;
  background: rgba(255,255,255,.78);
  padding:16px;
  box-shadow: var(--shadowSoft);
  display:grid;
  gap:10px;
}

.coverKicker{
  display:inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius:999px;
  border:1px solid rgba(156,15,15,.18);
  background: rgba(156,15,15,.10);
  color: var(--brand);
  font-weight: 1000;
  font-size: 12px;
  letter-spacing:.3px;
}

.coverTitle{
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 1000;
  letter-spacing:.2px;
}

.coverText{
  margin: 0;
  font-size: 13px;
  color: rgba(0,0,0,.72);
  line-height: 1.45;
}

.coverList{
  margin: 0;
  padding-left: 18px;
  display:grid;
  gap:6px;
  font-size: 13px;
  color: rgba(0,0,0,.70);
}

.coverBtn{
  margin-top: 6px;
  width: 100%;
}

.coverSmall{
  text-align:center;
  font-size: 12px;
  color: rgba(0,0,0,.58);
  margin-top: 2px;
}
/* Por defecto: solo portada visible */
#quiz,
#done{
  display: none;
}
