* { box-sizing: border-box; }
:root {
  --bg: #fff8f0;
  --card: #ffffff;
  --text: #222;
  --accent: #ff6600;
  --accent-2: #ff9a3c;
  --muted: #666;
  --good: #0a8f3c;
  --bad: #c62828;
  --shadow: rgba(0,0,0,0.08);
  --radius: 16px;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
header, footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
h1 { margin: 0; color: var(--accent); font-size: 1.6rem; }
main { padding: 16px; max-width: 900px; width: 100%; margin: 0 auto; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.group { margin-bottom: 12px; }
.group-title { font-weight: 600; margin-bottom: 8px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns-wrap { flex-wrap: wrap; }
.button, .toggle, .start, .ghost, .zoom-button {
  border: none;
  padding: 12px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .02s ease, background-color .2s ease, box-shadow .2s ease;
}
.button, .start {
  background: var(--accent);
  color: white;
}
.button:active, .start:active, .toggle:active, .ghost:active, .zoom-button:active { transform: translateY(1px); }
.toggle {
  background: #ffe3cf;
  color: #a04500;
  min-width: 48px;
}
.toggle.active { background: var(--accent); color: white; }
.ghost {
  background: #f1f1f1;
  color: #333;
}
.start { font-size: 1.1rem; padding: 14px 20px; }
.zoom-button { background: var(--accent-2); color: white; }
.zoom-button[aria-pressed="true"] { filter: saturate(1.2); }

.progress {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  margin-bottom: 8px;
}
.question {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 12px 0 6px;
  font-weight: 700;
}
input#answerInput {
  width: 100%;
  font-size: 1.4rem;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid #ffe0cc;
  outline: none;
}
input#answerInput:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,102,0,.12); }

.feedback { min-height: 24px; margin-top: 8px; font-weight: 600; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 16px; margin: 8px 0 12px; }

.hidden { display: none; }
.visually-hidden { position: absolute; left: -9999px; }

/* Zoomed mode */
body.zoomed { font-size: 120%; }

/* Active button highlight for clarity */
.button.active,
.toggle.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 0 2px rgba(255,102,0,0.3);
}

/* v21: highlight active options for totals/range */
:root{ --accent:#ff6600; --muted:#ececec; --muted-text:#444; }
button[data-total], button[data-range]{
  background: var(--muted);
  color: var(--muted-text);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
button[data-total].active,
button[data-range].active,
button[data-op].active{
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255,102,0,.25);
}
