:root {
  --bg: #fff8ee;
  --card: #ffffff;
  --ink: #1c2630;
  --muted: #627284;
  --blue: #0aa9c5;
  --orange: #ff914d;
  --pink: #ff5f8f;
  --green: #8bd447;
  --red: #ff483d;
  --yellow: #ffd45e;
  --shadow: 0 20px 60px rgba(33, 42, 55, .15);
  --soft-shadow: 0 12px 28px rgba(33, 42, 55, .10);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-rounded, "Nunito", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, rgba(10,169,197,.18), transparent 34rem),
              radial-gradient(circle at top right, rgba(255,145,77,.18), transparent 32rem),
              var(--bg);
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(10,169,197,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10,169,197,.07) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 75%);
}

button, input { font: inherit; }
button { cursor: pointer; }

.hero, main, footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 10px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}


.brand-logo {
  width: 210px;
  max-width: 38vw;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(3px 3px 0 rgba(28,38,48,.18));
}

.brand small, .timer span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: .88rem;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 4px 4px 0 var(--ink);
}

.timer strong {
  font-size: 1.4rem;
  color: var(--red);
  min-width: 72px;
  text-align: right;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: center;
  padding: 40px 0 24px;
}

.hero-copy {
  padding: 30px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.74);
  border: 3px solid rgba(28,38,48,.08);
  backdrop-filter: blur(8px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 1000;
  font-size: .78rem;
}

h1, h2, h3 { line-height: 1.05; margin: 0; }
h1 { font-size: clamp(2.4rem, 8vw, 5rem); letter-spacing: -0.06em; }
h2 { font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -0.04em; }
h3 { font-size: 1.35rem; }
.lead { font-size: 1.18rem; line-height: 1.6; color: #314153; }

.hero-actions, .quiz-actions, .result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.primary, .ghost, .secondary {
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 13px 18px;
  font-weight: 1000;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.primary { background: var(--orange); color: #111; }
.ghost { background: #fff; color: var(--ink); }
.secondary { background: var(--blue); color: #fff; }
.primary:hover, .ghost:hover, .secondary:hover { transform: translate(-1px, -1px); box-shadow: 7px 7px 0 var(--ink); }
.primary:active, .ghost:active, .secondary:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
button[disabled] { opacity: .55; cursor: not-allowed; }

.hero-art {
  position: relative;
  border-radius: 34px;
  overflow: hidden;
  background: white;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow);
  transform: rotate(1deg);
}
.hero-art::after {
  content: "70% → next level";
  position: absolute;
  left: 18px;
  bottom: 18px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  padding: 9px 14px;
  font-weight: 1000;
  box-shadow: 4px 4px 0 var(--ink);
}
.hero-art img { display: block; width: 100%; height: auto; }

.card {
  background: rgba(255,255,255,.9);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.rules {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  padding: 26px;
  margin: 18px 0 26px;
}
.rules p { line-height: 1.55; color: #33465a; }
.rule-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.rule-list div {
  min-height: 150px;
  border-radius: 22px;
  padding: 18px;
  background: #f7fbff;
  border: 3px dashed rgba(28,38,48,.25);
}
.rule-list strong { display: block; font-size: 1.35rem; margin-bottom: 10px; }
.rule-list span { color: var(--muted); font-weight: 800; }

.level-map {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.level-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--soft-shadow);
  position: relative;
  overflow: hidden;
}
.level-card img {
  width: 100%;
  height: 130px;
  object-fit: contain;
}
.level-card strong { font-size: 2rem; line-height: 1; }
.level-card span { display: block; color: var(--muted); font-weight: 900; }
.level-card.active { background: #e9faff; box-shadow: 6px 6px 0 var(--ink); }
.level-card.passed { background: #efffe7; }
.level-card.failed { background: #fff0f0; }
.level-card.locked { filter: grayscale(1); opacity: .55; }
.level-card.locked::after {
  content: "LOCKED";
  position: absolute;
  inset: auto 10px 10px auto;
  font-weight: 1000;
  font-size: .72rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 5px 8px;
  background: #fff;
}

.quiz-shell, .result { padding: 26px; margin-bottom: 26px; }
.empty-state {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
  min-height: 260px;
}
.empty-state img { width: 100%; }
.empty-state p { color: var(--muted); font-size: 1.08rem; line-height: 1.55; }

.quiz-head {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 18px;
  align-items: center;
  border-bottom: 3px solid rgba(28,38,48,.12);
  padding-bottom: 18px;
  margin-bottom: 20px;
}
.quiz-head img { width: 100%; height: 100px; object-fit: contain; }
.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--yellow);
  font-weight: 1000;
  margin-bottom: 8px;
}
.score-target {
  text-align: right;
  font-weight: 1000;
  color: var(--muted);
}
.score-target strong { display: block; color: var(--ink); font-size: 1.45rem; }

.question-list {
  display: grid;
  gap: 16px;
  counter-reset: questions;
}
.question-card {
  border: 3px solid rgba(28,38,48,.14);
  border-radius: 22px;
  padding: 18px;
  background: #fff;
  counter-increment: questions;
}
.question-card.correct { border-color: rgba(54, 156, 87, .6); background: #f1fff4; }
.question-card.incorrect { border-color: rgba(255, 72, 61, .65); background: #fff4f3; }
.question-title {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
  font-weight: 1000;
  line-height: 1.35;
}
.question-title::before {
  content: counter(questions);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 15px;
  border: 2px solid rgba(28,38,48,.14);
  background: #fbfdff;
  font-weight: 800;
}
.option:hover { border-color: rgba(10,169,197,.65); background: #f0fbff; }
.option input { margin-top: 4px; accent-color: var(--blue); }
.feedback {
  margin-top: 12px;
  font-weight: 900;
  color: var(--muted);
}
.feedback.good { color: #24753f; }
.feedback.bad { color: #b3251c; }

.progress-wrap {
  margin: 18px 0 4px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 8px;
}
.progress-bar {
  height: 18px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: white;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--yellow));
  transition: width .3s ease;
}

.notice {
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 18px;
  margin-top: 18px;
  background: #fff9df;
  box-shadow: 4px 4px 0 var(--ink);
}
.notice.fail { background: #fff0f0; }
.notice.pass { background: #efffe7; }
.notice h3 { margin-bottom: 8px; }
.notice p { color: #34475a; line-height: 1.5; margin: 0; }

.result-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 26px;
  align-items: center;
}
.result-grid img { width: 100%; }
.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  border: 4px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  padding: 9px 18px;
  font-size: 2rem;
  font-weight: 1000;
  box-shadow: 5px 5px 0 var(--ink);
  margin: 12px 0;
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 18px;
}
.summary-table th, .summary-table td {
  text-align: left;
  padding: 13px;
  border-bottom: 2px solid rgba(28,38,48,.1);
}
.summary-table th { background: #f2fbff; }
.summary-table tr:last-child td { border-bottom: 0; }

.hidden { display: none !important; }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-weight: 900;
  padding: 18px 0 32px;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.footer-brand img {
  width: 150px;
  height: auto;
  display: block;
}
.linklike {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 1000;
  text-decoration: underline;
}

@media (max-width: 900px) {
  .hero-grid, .rules, .empty-state, .quiz-head, .result-grid { grid-template-columns: 1fr; }
  .hero-copy { padding: 22px; }
  .rule-list, .level-map { grid-template-columns: repeat(2, 1fr); }
  .score-target { text-align: left; }
  .quiz-head img { width: 140px; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .brand-logo { width: 180px; max-width: 70vw; }
  .timer { width: 100%; justify-content: space-between; }
  .rule-list, .level-map, .options { grid-template-columns: 1fr; }
  h1 { font-size: 2.5rem; }
  .level-card { min-height: 170px; }
}
