:root {
  --blue: #155eef;
  --blue-dark: #0b3fba;
  --blue-soft: #eaf2ff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0ee;
  --surface: #ffffff;
  --bg: #f3f7fc;
  --green: #12805c;
  --green-soft: #e7f8f1;
  --orange: #b54708;
  --orange-soft: #fff4e5;
  --red: #c4320a;
  --yellow: #fdb022;
  --shadow: 0 18px 50px rgba(28, 56, 104, .11);
  font-family: ui-rounded, "Arial Rounded MT Bold", Nunito, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); touch-action: manipulation; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #edf4ff 0, var(--bg) 340px);
  touch-action: manipulation;
}
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(21, 94, 239, .24);
  outline-offset: 2px;
}
.hidden { display: none !important; }

.site-header {
  min-height: 86px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 15px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(21, 94, 239, .24);
  font-size: 1.55rem;
  transform: rotate(-2deg);
}
.brand strong { display: block; font-size: 1.34rem; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .82rem; }
.name-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .88rem; font-weight: 800; }
.name-field span small { font-size: .74rem; font-weight: 600; }
.name-field input {
  width: 166px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--ink);
}

.app-shell { max-width: 1180px; margin: 0 auto; padding: 3px 22px 34px; }
.workspace, .exercise-view, .result-card {
  min-height: min(650px, calc(100dvh - 158px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.setup-layout { display: grid; grid-template-columns: minmax(390px, .88fr) 1.12fr; }
.settings-card { padding: clamp(25px, 3vw, 34px); border-right: 1px solid var(--line); }
.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, p { overflow-wrap: break-word; }
h1 { margin: 0 0 24px; font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.08; letter-spacing: -.04em; }
h2 { margin: 0; font-size: clamp(1.32rem, 2.3vw, 1.9rem); line-height: 1.15; letter-spacing: -.03em; }
fieldset { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
legend, .select-field > span {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  color: #344054;
  font-size: .9rem;
  font-weight: 900;
}
.choice-grid { display: grid; gap: 8px; }
.mode-grid { grid-template-columns: 1fr 1fr; }
.choice {
  min-height: 61px;
  min-width: 0;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #344054;
  background: white;
}
.choice > span {
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f1f4f9;
  font-size: .72rem;
  font-weight: 900;
}
.choice b { align-self: end; font-size: .84rem; line-height: 1.15; }
.choice small { align-self: start; overflow: hidden; color: var(--muted); font-size: .67rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.choice:hover { border-color: #9dbaf6; }
.choice.active { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.choice.active > span { color: white; background: var(--blue); }
.choice.wide { grid-column: 1 / -1; grid-template-columns: 38px auto; justify-content: center; }

.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.level-choice {
  min-height: 40px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #344054;
  background: white;
  font-size: .74rem;
  font-weight: 850;
}
.level-choice.active { border-color: var(--blue); color: white; background: var(--blue); }
.select-field { display: block; margin-bottom: 17px; }
select {
  width: 100%;
  min-height: 44px;
  padding: 9px 38px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: white;
}
.primary-button, .secondary-button, .back-button, .speak-button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 11px;
  font-weight: 900;
}
.primary-button { width: 100%; border: 1px solid var(--blue); color: white; background: var(--blue); box-shadow: 0 8px 18px rgba(21, 94, 239, .18); }
.primary-button:hover { background: var(--blue-dark); }
.primary-button.compact { width: auto; min-width: 160px; }
.secondary-button { border: 1px solid #aabbd8; color: var(--blue-dark); background: white; }
.back-button, .speak-button { border: 1px solid var(--line); color: #344054; background: white; }
.speak-button { min-height: 40px; padding: 8px 12px; font-size: .84rem; white-space: nowrap; }
.adult-note { margin-top: 20px; padding: 14px 15px; border-left: 4px solid var(--yellow); border-radius: 8px; background: #fff8e8; }
.adult-note strong { display: block; color: #7a4d00; font-size: .84rem; }
.adult-note p { margin: 5px 0 0; color: #694b18; font-size: .8rem; line-height: 1.45; }

.welcome-card {
  padding: 40px clamp(30px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: radial-gradient(circle at 76% 23%, #fff4c2 0, transparent 27%), linear-gradient(145deg, #f9fcff, #edf4ff);
}
.welcome-clock { width: min(64%, 290px); margin: 0 auto 20px; filter: drop-shadow(0 13px 15px rgba(28, 56, 104, .12)); transform: rotate(-1deg); }
.welcome-card > p { max-width: 570px; margin: 12px 0 0; color: var(--muted); line-height: 1.6; }
.feature-list { margin: 17px 0 0; padding: 0; display: grid; gap: 10px; list-style: none; color: #344054; font-size: .88rem; font-weight: 700; }
.feature-list span { width: 23px; height: 23px; margin-right: 7px; display: inline-grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: .73rem; }

.exercise-view { padding: clamp(13px, 2.5vw, 23px); }
.exercise-toolbar { display: grid; grid-template-columns: 1fr minmax(210px, 1fr) 1fr; align-items: center; gap: 16px; }
.exercise-toolbar .back-button { justify-self: start; }
.progress-wrap { color: var(--muted); text-align: center; font-size: .8rem; font-weight: 800; }
.progress-track { height: 8px; margin-top: 6px; overflow: hidden; border-radius: 20px; background: #e6edf7; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s ease; }
.score-pill { justify-self: end; padding: 9px 13px; border-radius: 999px; color: #8c6500; background: #fff7d6; font-size: .85rem; font-weight: 750; white-space: nowrap; }
.exercise-card {
  width: min(100%, 820px);
  margin: clamp(15px, 3vh, 27px) auto 0;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 21px;
  text-align: center;
  background: #fbfdff;
}
.question-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; text-align: left; }
.exercise-content { margin: 14px auto 10px; }
.main-clock { width: min(100%, 330px); margin: 0 auto; }
.clock-svg { display: block; width: 100%; height: auto; overflow: visible; }
.clock-svg .clock-face { fill: #fff; stroke: #b8cbea; stroke-width: 5; }
.clock-svg .minute-tick { stroke: #b8c6db; stroke-width: 2; }
.clock-svg .hour-tick { stroke: #31445f; stroke-width: 5; }
.clock-svg .clock-number { fill: #22324c; font-size: 23px; font-weight: 900; text-anchor: middle; dominant-baseline: middle; }
.clock-svg .hour-hand { stroke: #172033; stroke-width: 12; stroke-linecap: round; }
.clock-svg .minute-hand { stroke: var(--blue); stroke-width: 8; stroke-linecap: round; }
.clock-svg .hand-hit { stroke: transparent; stroke-width: 34; stroke-linecap: round; pointer-events: none; }
.clock-svg.interactive .hand-hit { pointer-events: stroke; }
.clock-svg .clock-pin { fill: var(--blue); stroke: #fff; stroke-width: 4; }
.clock-svg.interactive { touch-action: none; cursor: grab; }
.clock-svg.interactive:active { cursor: grabbing; }
.clock-legend { display: flex; justify-content: center; gap: 14px; margin-top: -3px; color: var(--muted); font-size: .74rem; font-weight: 800; }
.legend-line { width: 20px; height: 5px; margin-right: 5px; display: inline-block; border-radius: 5px; vertical-align: middle; background: var(--ink); }
.legend-line.minute { background: var(--blue); }

.answer-area { margin-top: 9px; }
.digital-entry { display: flex; align-items: end; justify-content: center; gap: 8px; }
.time-field { display: block; width: 102px; color: #475467; text-align: left; font-size: .77rem; font-weight: 850; }
.time-field span { display: block; margin-bottom: 5px; }
.time-field input {
  width: 100%;
  min-height: 56px;
  border: 2px solid #b8c6db;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  font-size: 1.55rem;
  font-weight: 900;
  text-align: center;
  caret-color: transparent;
}
.time-field input.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(21, 94, 239, .12); }
.time-colon { padding-bottom: 12px; font-size: 1.75rem; font-weight: 900; }
.number-pad { width: min(100%, 252px); margin: 10px auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.number-key {
  min-height: 38px;
  min-width: 0;
  padding: 5px;
  border: 1px solid #b8c6db;
  border-radius: 9px;
  color: #26364f;
  background: white;
  font-weight: 900;
}
.number-key.action { color: var(--blue-dark); background: #f4f7fb; font-size: .75rem; }
.input-help { margin: 6px 0 0; color: var(--muted); font-size: .73rem; }

.word-builder { width: min(100%, 650px); margin: 0 auto; }
.word-answer {
  min-height: 58px;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid #b8c6db;
  border-radius: 13px;
  color: var(--blue-dark);
  background: white;
  font-size: 1.13rem;
  font-weight: 900;
}
.word-answer.empty::before { content: "Tik de woorden in de juiste volgorde aan"; color: #98a2b3; font-size: .82rem; font-weight: 700; }
.word-bank { margin-top: 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.word-token { min-height: 39px; padding: 7px 12px; border: 1px solid #9eb4d5; border-radius: 9px; color: #26364f; background: white; font-weight: 850; }
.word-token:disabled { opacity: .26; cursor: default; }
.word-actions { margin-top: 8px; display: flex; justify-content: center; gap: 7px; }
.small-action { min-height: 37px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--blue-dark); background: #f4f7fb; font-size: .76rem; font-weight: 850; }

.target-time { margin: 1px 0 9px; color: var(--blue-dark); font-size: clamp(1.35rem, 4vw, 2rem); font-weight: 900; }
.drag-help { margin: 4px 0 0; color: #475467; font-size: .82rem; font-weight: 800; line-height: 1.4; }

.connect-board { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr); gap: 13px; width: min(100%, 660px); margin: 0 auto; }
.connect-column { display: grid; align-content: start; gap: 9px; }
.connect-clock, .connect-label {
  min-height: 105px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: white;
  font-weight: 900;
}
.connect-clock { display: grid; place-items: center; }
.connect-clock .clock-svg { width: 95px; }
.connect-clock .clock-svg .clock-number { font-size: 0; }
.connect-label { display: grid; place-items: center; font-size: clamp(.82rem, 2.2vw, 1.03rem); }
.connect-clock.selected, .connect-label.selected { border-color: var(--blue); background: var(--blue-soft); }
.connect-clock.matched, .connect-label.matched { border-color: var(--green); color: var(--green); background: var(--green-soft); }

.action-row { min-height: 46px; margin-top: 12px; display: flex; justify-content: center; gap: 8px; }
.feedback { min-height: 25px; margin: 10px 0 0; line-height: 1.4; font-weight: 850; }
.feedback.good { color: var(--green); }
.feedback.try { color: var(--orange); }
.feedback.bad { color: var(--red); }
.hint-box { margin: 8px auto 0; padding: 10px 13px; border-radius: 10px; color: #694b18; background: var(--orange-soft); font-size: .84rem; line-height: 1.45; }

.result-card { display: grid; align-content: center; justify-items: center; padding: 28px; text-align: center; }
.result-icon { width: 82px; height: 82px; margin-bottom: 18px; display: grid; place-items: center; border-radius: 25px; color: #9b7000; background: #fff2b8; font-size: 2.7rem; transform: rotate(-4deg); }
.result-score { margin: 13px 0 22px; color: #344054; font-size: 1.18rem; }
.result-actions { display: flex; gap: 9px; }
footer { max-width: 1180px; margin: 0 auto; padding: 2px 22px 26px; color: var(--muted); text-align: center; font-size: .78rem; }

@media (max-width: 820px) {
  .setup-layout { grid-template-columns: 1fr; }
  .settings-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .welcome-card { padding: 35px 28px; }
  .welcome-clock { width: min(50%, 230px); }
  .exercise-toolbar { grid-template-columns: 1fr 1fr; }
  .progress-wrap { grid-row: 2; grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .site-header { min-height: 70px; padding: 11px 13px; gap: 9px; }
  .brand { gap: 8px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 12px; font-size: 1.24rem; }
  .brand strong { font-size: 1.08rem; }
  .brand small, .name-field > span { display: none; }
  .name-field input { width: 122px; min-height: 39px; }
  .app-shell { padding: 0 8px 22px; }
  .workspace, .exercise-view, .result-card { min-height: calc(100dvh - 112px); border-radius: 18px; }
  .settings-card { padding: 21px 16px; }
  h1 { margin-bottom: 20px; }
  .choice { min-height: 58px; padding: 7px; grid-template-columns: 32px 1fr; column-gap: 7px; }
  .choice > span { width: 32px; height: 34px; font-size: .63rem; }
  .choice b { font-size: .76rem; }
  .choice small { font-size: .61rem; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .adult-note { margin-top: 16px; }
  .welcome-card { display: none; }
  .exercise-view { padding: 10px; }
  .exercise-toolbar { gap: 7px; }
  .back-button { min-height: 39px; padding: 7px 10px; font-size: .75rem; }
  .score-pill { padding: 7px 10px; font-size: .75rem; }
  .exercise-card { margin-top: 10px; padding: 15px 10px; border-radius: 16px; }
  .question-heading { align-items: flex-start; }
  .speak-button { min-height: 37px; padding: 6px 8px; font-size: .72rem; }
  .main-clock { width: min(72vw, 280px); }
  .clock-svg .clock-number { font-size: 21px; }
  .exercise-content { margin-top: 9px; }
  .time-field { width: 91px; }
  .time-field input { min-height: 50px; font-size: 1.4rem; }
  .number-pad { width: min(100%, 230px); }
  .number-key { min-height: 36px; }
  .word-answer { min-height: 52px; padding: 9px; font-size: 1rem; }
  .word-token { min-height: 36px; padding: 6px 9px; font-size: .82rem; }
  .target-time { margin-bottom: 5px; }
  .drag-help { max-width: 290px; margin: 3px auto 0; }
  .connect-board { gap: 7px; }
  .connect-clock, .connect-label { min-height: 88px; padding: 5px; }
  .connect-clock .clock-svg { width: 78px; }
  .action-row { margin-top: 9px; }
  .primary-button.compact { min-width: 145px; }
  .result-actions { width: 100%; flex-direction: column; }
  .result-actions .primary-button.compact { width: 100%; }
  footer { padding: 1px 15px 20px; font-size: .7rem; }
}

@media (max-width: 370px) {
  .mode-grid { grid-template-columns: 1fr; }
  .choice.wide { grid-column: auto; justify-content: initial; }
  .main-clock { width: min(69vw, 245px); }
  .connect-clock, .connect-label { min-height: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  body { background: white; }
  .site-header, .back-button, .speak-button, footer { display: none; }
  .app-shell { padding: 0; }
  .workspace, .exercise-view, .result-card { min-height: auto; border: 0; box-shadow: none; }
}
