/* Calm, predictable, low-stimulation styling.
   No autoplay, no flashing, no sounds. Same layout on every screen. */

:root {
  --bg: #F3F6F8;
  --card: #FFFFFF;
  --text: #1F2D3A;
  --muted: #4B5B69;
  --line: #C9D4DC;
  --primary: #2F6F80;
  --primary-dark: #245A68;
  --on-primary: #FFFFFF;
  --good: #2F6B45;
  --good-bg: #E4F2E9;
  --try: #7A5200;
  --try-bg: #FFF3D6;
  --focus: #1B4DB3;
  --radius: 16px;
  --base: 1.125rem;
}

* { box-sizing: border-box; }

html { font-size: 100%; }
html.size-large { font-size: 118%; }
html.size-xlarge { font-size: 136%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--base);
  line-height: 1.6;
  letter-spacing: 0.01em;
}

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
  outline: none;
}

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--primary); color: var(--on-primary);
  padding: .5rem 1rem; z-index: 10;
}
.skip:focus { left: 0; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.muted { color: var(--muted); }

/* ---- Buttons ---- */
button, .btn {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: .7rem 1.1rem;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
button:hover, .btn:hover { border-color: var(--primary); }
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}
button.primary, .btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
button.primary:hover, .btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
button.quiet { border-color: transparent; background: transparent; color: var(--primary-dark); text-decoration: underline; }
button[disabled] { opacity: .55; cursor: not-allowed; }

.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row.spread { justify-content: space-between; }

/* ---- Choice groups on home screen ---- */
.pick { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pick button { flex-direction: column; text-align: center; padding: .9rem .6rem; }
.pick button small { color: var(--muted); font-size: .85rem; line-height: 1.3; }
.pick button[aria-pressed="true"] {
  border-color: var(--primary);
  background: #E3EFF2;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.pick button[aria-pressed="true"]::after { content: "✓ chosen"; font-size: .85rem; color: var(--primary-dark); font-weight: 600; }
.pick.small { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }

.switches label { display: flex; gap: .7rem; align-items: center; padding: .4rem 0; cursor: pointer; }
.switches input { width: 1.4rem; height: 1.4rem; }

/* ---- Visual schedule ---- */
.schedule { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: .25rem 0 1rem; }
.schedule .dot {
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 2px solid var(--primary); background: transparent;
}
.schedule .dot.done { background: var(--primary); }
.schedule .dot.now { box-shadow: 0 0 0 3px #BFD9DF; background: #BFD9DF; }
.schedule .then { margin-left: .5rem; color: var(--muted); font-size: .95rem; }

/* ---- Question ---- */
.wh-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  color: #fff; font-weight: 700; padding: .25rem .9rem; border-radius: 999px;
  font-size: 1.1rem; margin-bottom: .75rem;
}
.scene { font-size: 4.5rem; line-height: 1.1; text-align: center; margin: .25rem 0 .75rem; }
.story {
  background: #F7F9FA; border-left: 6px solid var(--primary);
  padding: .8rem 1rem; border-radius: 8px; font-size: 1.2rem; margin-bottom: 1rem;
}
.question { font-size: 1.6rem; font-weight: 700; margin-bottom: 1rem; }

.choices { display: grid; gap: .75rem; }
.choice {
  justify-content: flex-start;
  text-align: left;
  font-size: 1.3rem;
  min-height: 72px;
  padding: .8rem 1.1rem;
}
.choice .em { font-size: 2.2rem; line-height: 1; min-width: 2.6rem; text-align: center; }
.choice .num {
  margin-left: auto; color: var(--muted); font-size: .85rem;
  border: 1px solid var(--line); border-radius: 6px; padding: 0 .45rem;
}
.choice.wrong { opacity: .4; text-decoration: line-through; pointer-events: none; }
.choice.right { background: var(--good-bg); border-color: var(--good); }

.feedback { margin-top: 1rem; padding: 1rem; border-radius: 12px; font-size: 1.2rem; min-height: 0; }
.feedback:empty { display: none; }
.feedback.good { background: var(--good-bg); color: var(--good); border: 2px solid var(--good); }
.feedback.try { background: var(--try-bg); color: var(--try); border: 2px solid #E0B65A; }

/* ---- Break screen ---- */
.breathe-wrap { display: flex; justify-content: center; margin: 2rem 0; }
.breathe {
  width: 160px; height: 160px; border-radius: 50%;
  background: #BFD9DF; border: 4px solid var(--primary);
  animation: breathe 8s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { transform: scale(.7); } 50% { transform: scale(1.05); } }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; font-size: 1rem; }
th, td { border-bottom: 1px solid var(--line); padding: .5rem; text-align: left; }
th { font-weight: 700; }

/* ---- Calm mode and reduced motion: nothing moves ---- */
html.calm *, html.calm *::before, html.calm *::after { animation: none !important; transition: none !important; }
html.calm .breathe { transform: scale(.9); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .breathe { transform: scale(.9); }
}

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .scene { font-size: 3.5rem; }
  .question { font-size: 1.35rem; }
}

/* Higher-contrast preference */
@media (prefers-contrast: more) {
  :root { --line: #5B6B78; --muted: #2E3C48; }
}
