/* Adaptlyx - one stylesheet. Tokens first; children's screens use larger type and targets (spec 4.2, WCAG 2.2 AA). */
:root {
  --ink: #1f2a44; --ink-2: #3c4a68; --muted: #66748f; --line: #dfe5ef; --bg: #f7f9fc; --card: #ffffff;
  --teal: #1f9e8f; --teal-2: #2fb5a3; --teal-soft: #e6f6f3; --sun: #ffb347; --sun-soft: #fff4e2;
  --rose: #c2410c; --rose-soft: #fdeee7; --violet: #5b5bd6; --violet-soft: #eeeefd;
  --ok: #157a5b; --ok-soft: #e3f5ee; --warn: #9a5b00; --warn-soft: #fff3dc;
  --radius: 16px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(31, 42, 68, .06), 0 6px 24px rgba(31, 42, 68, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --scale: 1;
}
html[data-text="large"] { --scale: 1.15; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: calc(16px * var(--scale)); line-height: 1.5; color: var(--ink);
  background: var(--bg); }
a { color: var(--teal); }
a:hover { color: var(--ink); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9em; } h2 { font-size: 1.35em; } h3 { font-size: 1.1em; }
p { margin: 0 0 1em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
.muted { color: var(--muted); } .small { font-size: .875em; } .center { text-align: center; }
.stack > * + * { margin-top: var(--gap, 14px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 6px; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2em; color: var(--ink);
  text-decoration: none; letter-spacing: -.02em; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.linkish { padding: 8px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none;
  font-weight: 600; font-size: .95em; }
.nav a:hover, .nav a.on { background: var(--teal-soft); color: var(--ink); }
main { padding: 28px 0 56px; }
footer.foot { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: .9em; }
footer.foot a { color: var(--muted); margin-right: 14px; }

/* cards, buttons, forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; }
.card h2, .card h3 { margin-top: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit;
  font-weight: 650; text-decoration: none; cursor: pointer; transition: transform .05s, background .15s; }
.btn:hover { background: var(--bg); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: #18857a; color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #2c3a5c; color: #fff; }
.btn-danger { color: var(--rose); border-color: #f2c3b0; }
.btn-lg { min-height: 56px; padding: 14px 26px; font-size: 1.1em; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); cursor: pointer;
  text-decoration: underline; }
form p { margin: 0 0 14px; }
label { display: block; font-weight: 650; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date],
select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 12px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.helptext, .help { display: block; color: var(--muted); font-size: .875em; font-weight: 400; margin-top: 4px; }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--rose); font-size: .9em; }
.msg { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; background: var(--teal-soft); }
.msg.error { background: var(--rose-soft); } .msg.info { background: var(--violet-soft); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8em;
  font-weight: 700; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.pill.rose { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
table.t { width: 100%; border-collapse: collapse; font-size: .92em; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--muted); font-weight: 650; font-size: .85em; }
.scroll { overflow-x: auto; }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--teal-2); border-radius: 999px; }
.stat { font-size: 1.8em; font-weight: 800; line-height: 1.1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.kpis .card { padding: 14px 16px; }

/* public home */
.hero { padding: 36px 0 12px; }
.hero h1 { font-size: clamp(2em, 5vw, 3.1em); max-width: 15ch; }
.hero .lede { font-size: 1.15em; color: var(--ink-2); max-width: 46ch; }
.loop { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.loop .card { padding: 16px; }
.loop b { display: block; font-size: .8em; letter-spacing: .08em; color: var(--teal); }
.price { font-size: 2em; font-weight: 800; }

/* children: big, calm, friendly */
.kid main { padding-top: 18px; }
.kid h1 { font-size: 1.7em; }
.kid-hello { display: flex; gap: 14px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 30px;
  background: var(--sun-soft); flex: none; }
.today-cta { padding: 26px; border-radius: 22px; background: linear-gradient(135deg, var(--teal) 0%, #2a8fc1 100%);
  color: #fff; border: 0; }
.today-cta h2 { font-size: 1.5em; }
.today-cta .btn { background: #fff; color: var(--ink); border: 0; }
.mission { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 18px; }
.mission .pill { background: rgba(255,255,255,.2); color: #fff; border: 0; font-size: .9em; padding: 6px 12px; }
.pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.picker { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 12px; text-align: center;
  font-weight: 700; font-size: 1.15em; text-decoration: none; color: var(--ink); }
.picker .avatar { width: 84px; height: 84px; font-size: 46px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.pinpad button { min-height: 64px; font-size: 1.5em; font-weight: 700; border-radius: 16px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; color: var(--ink); }
.pindots { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.pindots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink-2); }
.pindots span.on { background: var(--ink); }

/* skill map */
.map { display: grid; gap: 18px; }
.path { display: flex; flex-wrap: wrap; gap: 10px; }
.node { display: flex; flex-direction: column; gap: 6px; width: 150px; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; font-size: .85em; font-weight: 600; text-decoration: none; color: var(--ink); }
.node .state { font-size: .8em; font-weight: 700; }
.node.locked { opacity: .55; background: var(--bg); }
.node.learning .state { color: var(--violet); } .node.strong .state { color: var(--teal); }
.node.mastered { border-color: var(--teal-2); background: var(--teal-soft); } .node.mastered .state { color: var(--ok); }
.node.refresh .state { color: var(--warn); }

/* the practice player */
.player { max-width: 760px; margin: 0 auto; }
.player-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dots i.done { background: var(--teal-2); }
.dots i.now { background: var(--ink); }
.qcard { padding: 26px; }
.qskill { font-size: .8em; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.stem { font-size: 1.45em; font-weight: 650; margin: 8px 0 18px; line-height: 1.35; }
.diagram-box { display: flex; justify-content: center; margin: 4px 0 18px; }
.diagram-box svg { max-height: 260px; width: auto; }
.diagram-box img { max-height: 120px; }
.answer-area { margin: 6px 0 18px; }
.num-input { font-size: 1.6em !important; font-weight: 700; max-width: 260px; text-align: center; }
.unit { font-size: 1.2em; color: var(--muted); font-weight: 650; }
.frac-input { display: inline-flex; align-items: center; gap: 12px; }
.frac-input .whole { width: 80px; }
.frac-input .stackf { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.frac-input .stackf input { width: 110px; text-align: center; font-size: 1.4em; font-weight: 700; }
.frac-input .line { width: 120px; height: 3px; background: var(--ink); border-radius: 2px; }
.options { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opt { min-height: 64px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: inherit;
  font-size: 1.25em; font-weight: 700; cursor: pointer; color: var(--ink); text-align: center; }
.opt:hover { border-color: var(--teal-2); }
.opt[aria-pressed=true] { border-color: var(--ink); background: var(--violet-soft); box-shadow: inset 0 0 0 2px var(--ink); }
.tiles { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px;
  background: #fff; font-size: 1.3em; font-weight: 700; touch-action: none; cursor: grab; user-select: none; }
.tile .grip { color: var(--muted); font-size: .8em; }
.tile .mv { margin-left: auto; display: flex; gap: 6px; }
.tile .mv button { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg);
  font-size: .8em; cursor: pointer; }
.tile.dragging { opacity: .6; border-style: dashed; }
.order-label { font-size: .9em; font-weight: 700; color: var(--muted); }
.nl { width: 100%; max-width: 560px; touch-action: none; cursor: pointer; }
.bars { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.barcol { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.barcol .col { width: 64px; height: 220px; border: 1.5px solid var(--line); border-radius: 10px; position: relative; background:
  repeating-linear-gradient(to top, #fff 0 21px, var(--line) 21px 22px); }
.barcol .fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--teal-2); border-radius: 0 0 8px 8px; }
.barcol .v { font-weight: 800; font-size: 1.2em; }
.barcol .ctl { display: flex; gap: 6px; }
.barcol .ctl button { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff;
  font-size: 1.2em; cursor: pointer; }
.keypad { display: none; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 320px; margin-top: 12px; }
.keypad button { min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 1.25em;
  font-weight: 700; cursor: pointer; }
@media (pointer: coarse) { .keypad { display: grid; } }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.helpbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.helpbar .btn { min-height: 40px; font-size: .9em; }
.bubble { margin-top: 16px; padding: 14px 16px; border-radius: 16px; background: var(--violet-soft); border: 1px solid #d9d9fb; }
.bubble b { display: block; font-size: .78em; color: var(--violet); letter-spacing: .04em; margin-bottom: 4px; }
.ask { display: flex; gap: 8px; margin-top: 10px; }
.feedback { margin-top: 18px; padding: 20px; border-radius: 18px; }
.feedback.right { background: var(--ok-soft); border: 1.5px solid #b8e5d3; }
.feedback.wrong { background: var(--sun-soft); border: 1.5px solid #f7d9a8; }
.feedback h3 { display: flex; align-items: center; gap: 10px; font-size: 1.25em; }
.feedback .steps { margin: 8px 0 12px; padding-left: 20px; }
.feedback .example { background: #fff; border-radius: 12px; padding: 12px 14px; margin: 10px 0; border: 1px solid var(--line); }
.timeout-modal { position: fixed; inset: 0; background: rgba(31, 42, 68, .45); display: grid; place-items: center; z-index: 50;
  padding: 16px; }
.timeout-modal .card { max-width: 420px; text-align: center; }
.summary-skill { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line); }

/* studio */
.studio-tag { background: var(--ink); color: #fff; font-size: .7em; padding: 3px 8px; border-radius: 6px; margin-left: 6px; }
.variants { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.variant { font-size: .9em; }
.variant .stem { font-size: 1.05em; margin: 4px 0 8px; }
.variant .diagram-box svg { max-height: 150px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
pre { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 10px; border: 1px solid var(--line); }

@media (max-width: 640px) {
  .stem { font-size: 1.25em; }
  .qcard { padding: 18px; }
  .nav a { padding: 8px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
