/* HS Integrated — Quiz Engine
   Brand: navy #0D1B2A, teal #0096AB, light teal #00BCD4, orange #FF6F00
   Mobile-first. No external fonts or CDNs: works offline and on locked-down networks. */

:root {
  --navy: #0d1b2a;
  --navy-2: #1a2d4a;
  --teal: #0096ab;
  --teal-2: #00bcd4;
  --orange: #ff6f00;
  --ink: #1e293b;
  --body: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f8fa;
  --white: #fff;
  --ok: #0f7b5f;
  --bad: #c2185a;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(13, 27, 42, .07);
  --shadow-lg: 0 10px 30px rgba(13, 27, 42, .13);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--body);
  font-family: "Segoe UI", Calibri, system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--teal); }

.wrap { width: min(980px, 100% - 2rem); margin: 0 auto; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--navy);
  color: #c8d8e0;
  padding: .7rem 0;
  border-bottom: 3px solid var(--teal);
}
.topbar .wrap { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; color: #fff; letter-spacing: .2px; }
.topbar .spacer { flex: 1; }
.topbar a, .topbar button.linklike {
  color: #9fb3bf; text-decoration: none; font-size: .9rem;
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
}
.topbar a:hover, .topbar button.linklike:hover { color: #fff; }

/* ---------- cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin: 1.25rem 0;
}

.quiz-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1.25rem 0 2rem; }
@media (min-width: 720px) { .quiz-grid { grid-template-columns: 1fr 1fr; } }

.quiz-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 1rem;
  display: flex; flex-direction: column;
  border-top: 4px solid var(--teal);
  transition: transform .12s ease, box-shadow .12s ease;
}
.quiz-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.quiz-card .tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--orange); margin-bottom: .35rem;
}
.quiz-card h3 { margin-bottom: .35rem; }
.quiz-card p { color: var(--muted); font-size: .95rem; flex: 1; }
.quiz-card .meta { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: .9rem; }
.quiz-card .meta b { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: .7rem 1.2rem; border-radius: 10px; border: 1px solid transparent;
  background: var(--teal); color: #fff; text-decoration: none;
  transition: background .12s ease, transform .06s ease;
}
.btn:hover { background: #00808f; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn.secondary:hover { background: #f1f5f9; }
.btn.ghost { background: transparent; color: var(--teal); border-color: transparent; font-weight: 600; }
.btn.ghost:hover { background: rgba(0, 150, 171, .08); }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- start screen ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; color: var(--ink); margin-bottom: .3rem; font-size: .95rem; }
.field input {
  width: 100%; padding: .7rem .85rem; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.field input:focus { outline: 3px solid rgba(0, 150, 171, .25); border-color: var(--teal); }
.hint { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 1rem 0; }
@media (min-width: 620px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fact { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; }
.fact b { display: block; color: var(--navy); font-size: 1.15rem; }
.fact span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- exam chrome ---------- */
.exam-head {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  padding: .6rem 0; box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
.exam-head .wrap { display: flex; align-items: center; gap: 1rem; }
.exam-head .qcount { font-size: .9rem; color: #9fb3bf; }
.exam-head .qcount b { color: #fff; }
.exam-head .spacer { flex: 1; }
.timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem;
  background: rgba(255, 255, 255, .1); padding: .3rem .7rem; border-radius: 8px;
}
.timer.warn { background: var(--orange); }
.timer.crit { background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.progress { height: 5px; background: #dbe4ea; }
.progress > i { display: block; height: 100%; background: var(--teal-2); width: 0; transition: width .2s ease; }

.qcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; margin: 1.25rem 0; }
.qtext { font-size: 1.12rem; color: var(--ink); font-weight: 600; margin-bottom: 1.1rem; }

.options { display: grid; gap: .6rem; }
.option {
  display: flex; gap: .8rem; align-items: flex-start; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: .85rem 1rem; font: inherit; color: var(--body); cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.option:hover { border-color: var(--teal-2); background: #f7fcfd; }
.option .key {
  flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 8px;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
  background: #eef2f5; color: var(--navy);
}
.option.selected { border-color: var(--teal); background: #eaf7f9; }
.option.selected .key { background: var(--teal); color: #fff; }
.option.correct { border-color: var(--ok); background: #ecfdf5; }
.option.correct .key { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--bad); background: #fdf2f6; }
.option.wrong .key { background: var(--bad); color: #fff; }
.option:disabled { cursor: default; }

.nav-row { display: flex; gap: .6rem; align-items: center; margin: 1.25rem 0 2rem; flex-wrap: wrap; }
.nav-row .spacer { flex: 1; }

/* question grid */
.grid-toggle { background: none; border: 0; color: var(--teal); font: inherit; font-size: .9rem; cursor: pointer; padding: .2rem 0; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr)); gap: .4rem; margin-top: .8rem; }
.qgrid button {
  font: inherit; font-size: .9rem; padding: .4rem 0; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600;
}
.qgrid button.answered { background: var(--teal); border-color: var(--teal); color: #fff; }
.qgrid button.current { outline: 3px solid rgba(0, 150, 171, .3); }

/* ---------- results ---------- */
.score-hero { text-align: center; padding: 1.6rem 1rem; }
.score-hero .pct { font-size: clamp(3rem, 12vw, 4.6rem); font-weight: 800; line-height: 1; color: var(--teal); font-variant-numeric: tabular-nums; }
.score-hero.pass .pct { color: var(--ok); }
.score-hero.fail .pct { color: var(--bad); }
.badge {
  display: inline-block; padding: .3rem .8rem; border-radius: 999px; font-weight: 700; font-size: .85rem;
  letter-spacing: .4px; text-transform: uppercase;
}
.badge.pass { background: #ecfdf5; color: var(--ok); }
.badge.fail { background: #fdf2f6; color: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
th { background: #f1f5f9; color: var(--navy); font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroller { overflow-x: auto; }

.review-item { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: .8rem; background: #fff; }
.review-item .q { font-weight: 600; color: var(--ink); margin-bottom: .5rem; }
.review-item .line { font-size: .92rem; margin: .2rem 0; }
.review-item .line b { color: var(--navy); }
.review-item.is-wrong { border-left: 4px solid var(--bad); }
.review-item.is-right { border-left: 4px solid var(--ok); }

.notice { background: #fffaf0; border: 1px solid #f6d9a8; border-radius: 10px; padding: .8rem 1rem; font-size: .92rem; color: #8a5b00; }
.notice.error { background: #fdf2f6; border-color: #f3c2d5; color: #9d1646; }

footer.site { color: var(--muted); font-size: .85rem; padding: 2rem 0 3rem; text-align: center; }

/* print the results sheet */
@media print {
  .topbar, .exam-head, footer.site, .no-print, .progress { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .review-item { break-inside: avoid; }
}
