:root {
  color-scheme: light;
  --ink: #132b38;
  --muted: #526773;
  --bluegray: #f2f6f8;
  --teal: #007464;
  --mint: #c4f6e7;
  --line: #d9e4e7;
  font-family: Inter, "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bluegray);
  font-size: 16px;
  line-height: 1.65;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid #007b90; outline-offset: 3px; }
button:disabled { opacity: .58; cursor: default; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.42; letter-spacing: -.035em; }
h1 { font-size: clamp(1.7rem, 3.3vw, 2.75rem); }
h2 { font-size: clamp(1.18rem, 2vw, 1.55rem); }
h3 { font-size: 1.06rem; }
p { margin: .5em 0 1em; }
small { font-size: .85rem; }
.shell { max-width: 1176px; width: calc(100% - 72px); margin: 0 auto; }
.topbar {
  min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-bottom: 1px solid var(--line); background: #fff; padding: 0 max(36px, calc((100% - 1176px)/2));
}
.topbar.shell { padding: 0; background: transparent; }
.topbar > .shell { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #102c37; font-size: 1.46rem; font-weight: 770; letter-spacing: -.055em; text-decoration: none; white-space: nowrap; }
.brand-mark {
  display: inline-grid; place-items: center; position: relative; width: 34px; height: 34px;
  border-radius: 9px; background: var(--teal); color: white; font-size: 1rem; line-height: 1; letter-spacing: -.08em;
}
.brand-mark:empty::after { content: ""; width: 16px; height: 15px; background: white; clip-path: polygon(0 100%, 42% 0, 69% 0, 100% 100%, 74% 100%, 53% 33%, 27% 100%); }
.nav { display: flex; align-items: center; gap: 5px; }
.nav :is(a,button) {
  display: inline-flex; align-items: center; gap: 7px; color: var(--muted); background: transparent; border: 0;
  border-radius: 8px; padding: 8px 14px; text-decoration: none; font-size: .9rem; font-weight: 650;
}
.nav :is(.active,[aria-current="page"]) { color: #006956; background: #e6f4ef; }
.nav :is(a,button):hover { background: #eef5f4; }
.hero {
  position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center;
  min-height: 246px; margin: 32px 0 24px; padding: clamp(26px,4vw,52px);
  color: white; background: radial-gradient(ellipse at 88% 120%, #126154 0%, transparent 56%), linear-gradient(107deg,#112938 8%,#143844 70%,#16443f);
  border-radius: 22px;
}
.hero-copy { position: relative; z-index: 2; width: min(66%,660px); }
.hero h1 { margin: .23em 0; font-weight: 730; }
.hero p { color: #d4e5e8; margin-bottom: 0; }
.eyebrow { margin: 0 0 .45rem; color: var(--teal); font-size: .76rem; font-weight: 760; letter-spacing: .10em; text-transform: uppercase; }
.hero .eyebrow { color: #a2efcb; }
.hero-art {
  position: absolute; z-index: 0; inset: 0 0 0 auto; width: 38%; display: grid; place-items: center;
  background: radial-gradient(ellipse at 56% 62%,#65ddbc20,transparent 65%); pointer-events: none;
}
.hero-art::before {
  content: ""; position: absolute; inset: 0; opacity: .4;
  background-image: radial-gradient(#94d5cb65 .9px,transparent .9px); background-size: 15px 15px;
  mask-image: linear-gradient(90deg,transparent 0%,black 28%,black 85%,transparent 100%);
}
.keyboard {
  position: relative; width: min(78%,290px); padding: 6.4% 4.4% 5%; border: 1px solid #effef9; border-radius: 17px;
  background: linear-gradient(145deg,#fff,#d1e5df 76%,#b7cec9);
  transform: perspective(680px) rotateX(35deg) rotateZ(-15deg) rotateY(-12deg);
  box-shadow: 0 3px 0 #86a7a2,0 7px 0 #74948f,0 13px 0 -3px #476964,0 24px 24px #071e27a8;
}
.keyrow { display: flex; gap: 4px; margin-bottom: 5px; }
.keyrow:last-child { margin-bottom: 0; }
.keyrow span {
  display: grid; place-items: center; flex: 1; min-width: 0; height: clamp(18px,2.5vw,28px); overflow: hidden;
  border: 1px solid #adc7c1; border-radius: 4px; background: linear-gradient(145deg,#fff,#ebf6f0);
  box-shadow: 0 2px 0 #839f9a; font-size: .63rem; line-height: 1; color: #536f6d; font-weight: 680;
}
.keyrow:first-child span:nth-child(3), .keyrow:nth-child(2) span:last-child { background: linear-gradient(145deg,#a1ebc6,#57c89d); color: #174c40; }
.keyrow:last-child span:nth-last-child(2) { flex-grow: 3; }
.layout { display: grid; grid-template-columns: minmax(0,1.85fr) minmax(245px,1fr); align-items: start; gap: 22px; }
.layout > *, .hero-copy, .step > *, .row > * { min-width: 0; }
.panel { padding: clamp(20px,3vw,32px); background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 3px 12px #18394807; }
.panel + .panel, .rail > * + * { margin-top: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 20px; }
.section-head :is(h1,h2,h3,p) { margin: 0; }
.steps,.rows { padding: 0; margin: 0; list-style: none; }
.step,.row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid #e3ebee; overflow-wrap: anywhere; }
.step:last-child,.row:last-child { border-bottom: 0; }
.step :is(h3,p), .row :is(h3,p) { margin: 0; }
.num {
  display: inline-grid; flex: 0 0 auto; place-items: center; min-width: 35px; height: 35px;
  border-radius: 10px; background: #edf6f3; color: #206657; font-size: .88rem; font-weight: 750; font-variant-numeric: tabular-nums;
}
.muted { color: var(--muted); }
.primary,.secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; font-weight: 660;
  border: 1px solid transparent; border-radius: 9px; padding: 9px 19px; text-decoration: none; line-height: 1.45; text-align: center;
}
.primary { color: #fff; background: var(--teal); }
.primary:hover:enabled, a.primary:hover { background: #005f52; }
.secondary { color: #24434b; background: #fff; border-color: #c8d7d9; }
.secondary:hover:enabled,a.secondary:hover { background: #f0f6f4; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.tag,.good,.bad { display: inline-flex; align-items: center; border-radius: 20px; font-size: .84rem; padding: 3px 11px; font-weight: 640; }
.tag { color: #435860; background: #eef3f5; }
.good { color: #086548; background: #e4f6ed; }
.bad { color: #8c401c; background: #fff0e6; }
.hero .tag { color: #e1f7ed; background: #ffffff15; border: 1px solid #ffffff29; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(134px,100%),1fr)); gap: 12px; margin: 18px 0; }
.metric { padding: 15px 17px; background: #f4f8f8; border: 1px solid #e1eaea; border-radius: 12px; }
.metric strong { display: block; font-size: clamp(1.35rem,3vw,1.85rem); line-height: 1.35; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.track { height: 8px; border-radius: 8px; overflow: hidden; background: #e2eceb; margin: 10px 0; }
.track i { display: block; height: 100%; background: #168374; border-radius: inherit; }
.narrow { max-width: 820px; margin: 28px auto; }
.field { display: block; margin: 16px 0; }
:is(input:not([type="checkbox"]):not([type="radio"]),textarea,.editable-answer,select) { width: 100%; color: var(--ink); background: #fff; border: 1px solid #a3babb; border-radius: 8px; padding: 11px 13px; }
textarea { resize: vertical; min-height: 88px; }
label { font-weight: 630; }
label > :is(textarea,input,select) { display: block; margin-top: .4rem; font-weight: 400; }
.prompt { margin: 20px 0; padding: 18px 20px; border-left: 4px solid #198778; border-radius: 0 9px 9px 0; background: #edf6f3; font-size: clamp(1.04rem,2vw,1.25rem); line-height: 1.85; font-weight: 620; white-space: pre-wrap; }
.notice { border: 1px solid #d0e5de; color: #28584d; background: #f0f7f4; padding: 10px 14px; border-radius: 9px; margin: 12px 0; }
.notice:empty { display: none; }
.footer { padding: 28px 0; margin-top: 28px; color: var(--muted); border-top: 1px solid var(--line); font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media(max-width: 780px) {
  .shell { width: calc(100% - 36px); }
  .topbar { padding-inline: 18px; }
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .hero { margin-top: 20px; min-height: 204px; border-radius: 16px; }
  .hero-copy { width: 70%; }
  .hero-art { width: 32%; }
  .keyboard { width: 88%; }
}
@media(max-width: 560px) {
  .shell { width: calc(100% - 28px); }
  .topbar, .topbar > .shell { gap: 6px; flex-wrap: wrap; }
  .topbar { min-height: 60px; padding: 8px 14px; }
  .brand { font-size: 1.15rem; gap: 6px; }
  .brand-mark { width: 29px; height: 29px; }
  .nav { gap: 2px; }
  .nav :is(button,a) { font-size: .82rem; padding: 8px; }
  .hero { padding: 24px 19px 22px; min-height: 0; }
  .hero-copy { width: 100%; }
  .hero-art { width: 70px; right: 15px; height: 44px; top: 6px; opacity: .5; }
  .keyboard { border-radius: 4px; box-shadow: 0 2px 0 #86a7a2; }
  .keyrow { gap: 1px; margin-bottom: 2px; }
  .keyrow span { height: 5px; font-size: 0; border-radius: 1px; }
  .panel { padding: 18px; border-radius: 13px; }
  .step,.row { gap: 10px; }
  .narrow { margin: 17px auto; }
}
@media(prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* Training record lists and their summary controls share one reading order. */
main > .section-head, .narrow > .section-head { display: block; margin-top: 30px; }
main > .section-head h1, .narrow > .section-head h1 { margin: .15em 0; }
.step .tag { flex-shrink: 0; margin-left: auto; }
.row { justify-content: space-between; }
.row > strong { flex: 0 0 auto; }
.rail > .eyebrow + h2 { margin-top: 0; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; }
details { border-top: 1px solid var(--line); }
details > summary { cursor: pointer; padding: 12px 2px; color: #21575a; font-weight: 640; overflow-wrap: anywhere; }
details > summary::marker { color: var(--teal); }
details > summary .tag { margin-left: 4px; }
details[open] > summary { color: var(--teal); }
details > p, details > .row { margin-inline: 5px; }
#storage-warning { max-width: 820px; margin: 20px auto; padding: 10px 16px; background: #fff0e6; color: #773907; }
@media(max-width: 560px) {
  .step { display: grid; grid-template-columns: auto 1fr auto; align-items: start; }
  .step .tag { padding-inline: 7px; }
  .step .muted { font-size: .9rem; }
  .hero .primary { color: #133d33; background: #a1ecca; }
}

.answer-hint { display: block; text-align: right; color: #63747c; font-size: .8125rem; font-weight: 400; line-height: 1.5; }
.answer-hint + .field { margin-top: 6px; }

.progress-map {
  padding: 18px 20px; margin-top: 18px; border: 1px solid var(--line);
  border-radius: 13px; background: #f8fbfb;
}
.map-head { display: flex; justify-content: space-between; gap: 5px 16px; flex-wrap: wrap; align-items: baseline; }
.map-head strong { font-size: .98rem; color: #294550; }
.map-head span,.progress-map small { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.map-cells {
  display: grid; grid-template-columns: repeat(10,minmax(0,1fr)); gap: 5px;
  margin: 11px 0 8px; font-variant-numeric: tabular-nums;
}
.map-cells > span {
  position: relative; display: grid; place-items: center; min-height: 24px; border: 1px solid #d6e3e4;
  border-radius: 4px; background: #eaf0f1; color: #405a62; font-size: .78rem; line-height: 1.15;
}
.map-cells > .done { color: #fff; border-color: #247768; background: #247768; }
.map-cells > .current { color: #07574c; background: #f7fffb; border: 2px solid #007464; font-weight: 750; }
.map-cells > .missed {
  color: #703e1b; border: 1px dashed #916339;
  background: repeating-linear-gradient(135deg,#fff4e8 0 5px,#f7e7d2 5px 7px);
}
.fx-note {
  position: relative; isolation: isolate; display: flex; align-items: center; gap: 10px;
  margin: 13px 0; padding: 11px 15px; border: 1px solid #c6e2d8; border-radius: 10px;
  background: #edf8f2; color: #165441; font-size: .94rem;
}
.fx-note:empty { display: none; }
.fx-note strong { font-weight: 700; }
.fx-check {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px;
  border-radius: 50%; background: #197659; color: white; font-size: .86rem; font-weight: 740; line-height: 1;
}
.fx-check:empty::before { content: "✓"; }
.fx-note.milestone {
  overflow: hidden; padding: 14px 52px 14px 15px;
  color: #103f34; border-color: #98ceb7; background: linear-gradient(100deg,#e1f4e9,#f0faf3);
}
.fx-note.milestone::after {
  content: ""; position: absolute; right: 14px; top: calc(50% - 13px); width: 30px; height: 26px; pointer-events: none;
  background: radial-gradient(circle at 8% 66%,#35836c 0 1.7px,transparent 2px),
    radial-gradient(circle at 74% 20%,#7bc3a0 0 2.2px,transparent 2.6px),
    radial-gradient(circle at 95% 79%,#35836c 0 1.4px,transparent 1.8px);
}
.fx-note.milestone::before {
  content: ""; position: absolute; right: 27px; top: calc(50% - 5px); width: 11px; height: 11px; background: #258361;
  clip-path: polygon(50% 0,63% 37%,100% 50%,63% 62%,50% 100%,38% 62%,0 50%,38% 37%); pointer-events: none;
}
.sound-switch {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 12px;
  color: #405b64; border: 1px solid #c5d6d9; border-radius: 20px; background: #fff; font-size: .85rem; font-weight: 640;
}
.sound-switch:hover { border-color: #829f9f; }
.sound-switch[aria-pressed="true"] { color: #0a5e4f; border-color: #aed5c6; background: #eff8f3; }
.fx-settings {
  margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #f7faf9;
}
.fx-settings label { display: block; font-size: .91rem; color: #25474b; }
.fx-settings select { font-size: 1rem; padding: 8px 12px; margin: 4px 0 10px; }
.fx-settings label:last-child select,.fx-settings > select:last-child { margin-bottom: 0; }
@keyframes training-progress { from { width: var(--from,0%); } }
@keyframes confirmation-check {
  from { opacity: .55; transform: scale(.78); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes milestone-spark {
  from { opacity: 0; transform: scale(.5) rotate(-18deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
@media(min-width: 700px) { .map-cells:has(> span:nth-child(11)) { grid-template-columns: repeat(20,minmax(0,1fr)); } }
@media(prefers-reduced-motion: no-preference) {
  main:not(.fx-quiet) :is(.track.advance i,.track i.advance) { animation: training-progress .36s ease-out; }
  main:not(.fx-quiet) .fx-check { animation: confirmation-check .22s ease-out; }
  main:not(.fx-quiet) .fx-note.milestone::before,
  main:not(.fx-quiet) .fx-note.milestone::after { animation: milestone-spark .48s ease-out both; }
}
@media(max-width: 560px) {
  .progress-map, .fx-settings { padding: 13px; }
  .map-cells { gap: 3px; }
}

.editable-answer { min-height: 88px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }

.brand img { display: block; width: clamp(114px, 15vw, 156px); height: auto; }

:root { --portal-wash: #e1f5ee; --portal-line: #c2e5d8; --portal-accent: #106557; }
:root[data-portal-theme="sky"] { --portal-wash: #e4f1fc; --portal-line: #c6deef; --portal-accent: #215d88; }
:root[data-portal-theme="sand"] { --portal-wash: #f8eedb; --portal-line: #ead9ba; --portal-accent: #765323; }
.hero {
  color: #193635;
  background: linear-gradient(108deg, #fff 8%, var(--portal-wash) 92%);
  border: 1px solid var(--portal-line);
}
.client-name { color: var(--portal-accent); font-weight: 700; font-size: .94rem; letter-spacing: .045em; }
.hero h1 { margin: .36em 0 .3em; letter-spacing: -.04em; }
.hero p { color: #405853; }
.hero .primary { color: white; background: var(--portal-accent); }
.hero .primary:hover { filter: brightness(.92); }
.key-stage {
  position: absolute; inset: 0 0 0 auto; width: 36%; display: grid; place-items: center;
  background: repeating-radial-gradient(circle at 56% 50%, transparent 0 58px, var(--portal-line) 59px, transparent 60px 83px);
  mask-image: linear-gradient(90deg, transparent, black 16%);
}
.key-stage img { width: clamp(110px,14vw,168px); height: auto; border-radius: 16%; }
.portal-settings { margin-top: 18px; }
.portal-settings label { display: block; margin-top: 10px; }
@media(max-width:560px) {
  .key-stage { width: 54px; height: 46px; inset: 4px 10px auto auto; background: none; mask-image: none; }
  .key-stage img { width: 38px; }
  .client-name { font-size: .82rem; }
}
