:root {
  color-scheme: light;
  --canvas: #e8f0f4;
  --paper: rgba(253, 254, 251, 0.92);
  --paper-solid: #fcfdfb;
  --ink: #122e54;
  --ink-soft: #536d86;
  --line: #c9d6e0;
  --line-strong: #9aafc2;
  --blue: #1f5aa3;
  --blue-deep: #133f78;
  --blue-soft: #e8f1f7;
  --marker: #e7bd3f;
  --marker-soft: #fff3b9;
  --coral: #d45b4e;
  --coral-soft: #f8e2dd;
  --success: #2f7661;
  --success-soft: #e2f0e9;
  --danger: #a9463e;
  --font-display: "BIZ UD明朝", "BIZ UDMincho", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --font-note: "UD デジタル 教科書体 N-R", "UD Digi Kyokasho", "BIZ UD明朝", "Yu Mincho", serif;
  --font-reading: "BIZ UD明朝", "BIZ UDMincho", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --font-ui: "BIZ UDGothic", "BIZ UDPゴシック", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
  --radius-paper: 2px;
  --radius-control: 4px;
  font-family: var(--font-reading);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 17px;
  line-height: 2;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: url("./assets/paper-texture.jpg");
  background-repeat: repeat;
  background-size: 680px 680px;
  opacity: 0.18;
  mix-blend-mode: multiply;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(212, 91, 78, 0.48);
  outline-offset: 4px;
}

.app-header,
.app-shell,
.app-footer {
  position: relative;
  z-index: 1;
}

.app-header {
  display: flex;
  width: min(calc(100% - 36px), 1120px);
  min-height: 126px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 27px 0 23px;
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  color: inherit;
  text-decoration: none;
}

.brand::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  background: var(--ink);
  clip-path: polygon(0 45%, 18% 35%, 42% 55%, 68% 42%, 100% 51%, 100% 76%, 66% 67%, 41% 79%, 17% 58%, 0 70%);
  transform: rotate(-0.6deg);
}

.brand-mark {
  display: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--font-display);
  font-size: clamp(27px, 3.2vw, 38px);
  font-weight: 500;
  letter-spacing: 0.09em;
  line-height: 1.25;
}

.brand small {
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--font-note);
  font-size: 14px;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-top: 7px;
}

.record-link {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  gap: 9px;
  padding: 4px 3px;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.record-link:hover {
  color: var(--blue-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.record-icon {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 25px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.record-icon::before,
.record-icon::after {
  position: absolute;
  left: 4px;
  width: 10px;
  height: 1px;
  content: "";
  background: currentColor;
}

.record-icon::before {
  top: 8px;
}

.record-icon::after {
  top: 14px;
}

.app-shell {
  width: min(calc(100% - 36px), 1120px);
  min-height: calc(100dvh - 170px);
  margin: 0 auto;
  padding: 0 0 76px;
}

.app-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(154, 175, 194, 0.6);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.screen {
  animation: screen-in 180ms ease-out;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.06em;
}

h1 {
  margin-bottom: 19px;
  font-size: clamp(40px, 6.8vw, 70px);
  line-height: 1.28;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(28px, 4.7vw, 43px);
  line-height: 1.45;
}

h3 {
  margin-bottom: 10px;
  font-size: 21px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--coral);
  font-family: var(--font-note);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.lead {
  max-width: 43rem;
  color: var(--ink-soft);
  font-family: var(--font-reading);
  font-size: 18px;
  line-height: 2.05;
}

.button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 19px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: #fff;
  background: var(--blue);
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--blue-deep);
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.button:hover {
  background: var(--blue-deep);
  transform: translateY(-1px);
}

.button:active {
  box-shadow: 0 0 0 var(--blue-deep);
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
  transform: none;
}

.button-secondary,
.button-quiet {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(252, 253, 251, 0.5);
  box-shadow: none;
}

.button-secondary:hover,
.button-quiet:hover {
  color: #fff;
  background: var(--blue);
}

.button-danger {
  border-color: rgba(169, 70, 62, 0.52);
  color: var(--danger);
  background: transparent;
}

.button-danger:hover {
  color: #fff;
  background: var(--danger);
}

.button-small {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 13px;
}

.button-wide {
  width: 100%;
  min-height: 72px;
  justify-content: space-between;
  padding-inline: 25px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.button-arrow {
  font-family: var(--font-ui);
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.text-button,
.resume-link {
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-family: var(--font-note);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  cursor: pointer;
  font-weight: 500;
}

/* Setup */
.setup-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr);
  gap: 50px;
  align-items: start;
  padding: clamp(30px, 6vw, 68px);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: var(--radius-paper);
  background: var(--paper);
  box-shadow: 3px 4px 0 rgba(99, 126, 149, 0.12);
}

.setup-screen h1 {
  max-width: 13ch;
}

.setup-side {
  padding: 18px 0 18px 34px;
  border-left: 1px solid var(--line);
}

.setup-side h2 {
  margin-bottom: 24px;
  font-size: 25px;
}

.logic-note {
  display: grid;
  gap: 14px;
}

.logic-note-row {
  padding: 13px 15px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  font-family: var(--font-note);
  font-size: 15px;
  line-height: 1.8;
}

.logic-note-row:nth-child(2) {
  border-left-color: var(--marker);
  background: var(--marker-soft);
}

.logic-note-row:nth-child(3) {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.level-grid {
  display: grid;
  gap: 13px;
  margin-top: 30px;
}

.level-card {
  display: grid;
  width: 100%;
  min-height: 92px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-paper);
  color: var(--ink);
  background: rgba(252, 253, 251, 0.7);
  text-align: left;
  cursor: pointer;
  box-shadow: 1px 2px 0 rgba(116, 144, 164, 0.12);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.level-card:hover,
.level-card:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
  outline: none;
  transform: translateX(3px);
}

.level-card strong,
.level-card span {
  display: block;
}

.level-card strong {
  margin-bottom: 4px;
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
}

.level-card span span {
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.8;
}

/* Home */
.home-layout {
  display: grid;
  grid-template-columns: minmax(215px, 0.32fr) minmax(0, 0.68fr);
  gap: 46px;
  align-items: start;
}

.learning-route {
  min-height: 680px;
  padding: 58px 30px 20px 0;
  border-right: 1px solid var(--line-strong);
}

.route-kicker {
  margin: 0 0 26px;
  color: var(--ink-soft);
  font-family: var(--font-note);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.route-step {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 16px;
  min-height: 126px;
}

.route-step:not(:last-child)::after {
  position: absolute;
  top: 43px;
  bottom: 8px;
  left: 19px;
  width: 2px;
  content: "";
  background: var(--line-strong);
  transform: rotate(-0.8deg);
}

.route-node {
  position: relative;
  z-index: 1;
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  background: rgba(252, 253, 251, 0.85);
  font-family: var(--font-note);
  font-size: 15px;
  line-height: 1;
}

.route-node span {
  transform: rotate(-4deg);
}

.route-step.is-current .route-node {
  border-color: var(--blue);
  color: var(--ink);
  background: var(--marker);
  box-shadow: 1px 2px 0 rgba(139, 108, 12, 0.3);
}

.route-step.is-current .route-title {
  color: var(--blue);
}

.route-title,
.route-step small {
  display: block;
}

.route-title {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.45;
}

.route-step small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-family: var(--font-note);
  font-size: 14px;
  line-height: 1.65;
}

.home-main {
  min-width: 0;
  padding: clamp(38px, 6vw, 72px) clamp(28px, 6vw, 70px) 58px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: var(--radius-paper);
  background: var(--paper);
  box-shadow: 3px 4px 0 rgba(99, 126, 149, 0.13);
}

.home-main > h1 {
  position: relative;
  margin-bottom: 36px;
  padding-bottom: 18px;
  text-align: center;
}

.home-main > h1::after {
  position: absolute;
  right: 17%;
  bottom: 0;
  left: 17%;
  height: 2px;
  content: "";
  background: var(--ink);
  clip-path: polygon(0 40%, 20% 55%, 44% 34%, 70% 52%, 100% 42%, 100% 70%, 69% 67%, 45% 51%, 20% 72%, 0 60%);
  transform: rotate(-0.5deg);
}

.topic-note {
  position: relative;
  margin: 34px 0 28px;
  padding: 35px 28px 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-paper);
  background: rgba(255, 255, 253, 0.74);
  box-shadow: 2px 3px 0 rgba(114, 139, 157, 0.18);
}

.topic-note::after {
  position: absolute;
  top: -13px;
  right: 17px;
  width: 67px;
  height: 27px;
  content: "";
  background: rgba(231, 189, 63, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 1px 2px 0 rgba(140, 108, 12, 0.12);
  transform: rotate(44deg);
}

.topic-note .note-label {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 16px 2px;
  color: #6e5710;
  background: var(--marker-soft);
  font-family: var(--font-note);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.5;
  transform: rotate(-1.7deg);
}

.topic-note .note-label::after {
  position: absolute;
  right: -5px;
  bottom: -2px;
  left: 4px;
  height: 1px;
  content: "";
  background: rgba(139, 108, 12, 0.3);
  transform: rotate(1deg);
}

.topic-note p {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-note);
  font-size: clamp(23px, 3vw, 31px);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.65;
}

.recent-note {
  position: relative;
  margin-top: 31px;
  padding: 23px 18px 24px 57px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.recent-note::before {
  position: absolute;
  top: 28px;
  left: 14px;
  width: 23px;
  height: 18px;
  content: "";
  border: 2px solid var(--blue);
  border-radius: 4px 4px 2px 2px;
  transform: rotate(-2deg);
}

.recent-note::after {
  position: absolute;
  right: 8%;
  bottom: 14px;
  left: 29%;
  height: 2px;
  content: "";
  background: var(--line-strong);
  clip-path: polygon(0 48%, 25% 28%, 50% 60%, 75% 35%, 100% 52%, 100% 74%, 75% 58%, 50% 80%, 25% 50%, 0 71%);
  transform: rotate(-0.4deg);
}

.recent-note strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.recent-note span {
  font-family: var(--font-note);
  font-size: 17px;
  line-height: 1.9;
}

.home-support {
  margin-top: 43px;
  padding: 24px 2px 0;
  border-top: 1px solid var(--line-strong);
}

.home-support summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-family: var(--font-display);
  cursor: pointer;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.home-support summary::marker {
  color: var(--blue);
}

.support-body {
  padding-top: 18px;
}

.history-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
}

.history-list small {
  color: var(--ink-soft);
  font-size: 11px;
}

.support-actions .button {
  min-height: 40px;
  padding: 7px 12px;
  font-size: 13px;
}

.empty-state {
  padding: 17px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-soft);
  background: rgba(243, 247, 247, 0.7);
  font-family: var(--font-note);
}

/* Learning flow */
.play-screen {
  width: min(100%, 1000px);
  margin: 0 auto;
}

.progress-wrap {
  margin-bottom: 0;
  padding: 0 2px 16px;
  border-bottom: 1px solid var(--line-strong);
}

.progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
}

.progress-meta strong {
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.progress-track {
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.progress-bar {
  height: 100%;
  background: var(--blue);
  transition: width 220ms ease;
}

.question-card,
.summary-card {
  padding: clamp(27px, 5.5vw, 60px);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-paper) var(--radius-paper);
  background: var(--paper);
  box-shadow: 3px 4px 0 rgba(99, 126, 149, 0.13);
}

.question-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 12px 2px;
  border: 0;
  border-radius: 1px;
  color: #6e5710;
  background: var(--marker-soft);
  font-family: var(--font-note);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  transform: rotate(-1deg);
}

.pill {
  color: var(--blue);
  background: transparent;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  transform: none;
}

.question-card > p:not(.lead) {
  color: var(--ink-soft);
  font-family: var(--font-note);
  font-size: 17px;
  line-height: 1.9;
}

.passage,
.reading-passage {
  margin: 26px 0 31px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 2.12;
}

.passage p {
  margin: 0;
  padding: 3px 0;
}

.passage p + p {
  border-top: 1px solid rgba(201, 214, 224, 0.55);
}

.passage p strong {
  display: inline-block;
  min-width: 30px;
  color: var(--blue);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
}

.blank {
  display: inline-block;
  min-width: 5em;
  margin: 0 0.2em;
  border-bottom: 2px solid var(--coral);
  color: var(--coral);
  text-align: center;
  font-family: var(--font-note);
  font-weight: 500;
}

.choice-list,
.order-list {
  display: grid;
  gap: 11px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.choice {
  display: grid;
  grid-template-columns: 34px 1fr;
  width: 100%;
  min-height: 60px;
  align-items: center;
  gap: 13px;
  padding: 11px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  color: var(--ink);
  background: rgba(252, 253, 251, 0.72);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-reading);
  font-size: 17px;
  line-height: 1.75;
  box-shadow: 1px 2px 0 rgba(116, 144, 164, 0.1);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.choice:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateX(2px);
}

.choice[aria-pressed="true"],
.choice.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 2px 2px 0 rgba(31, 90, 163, 0.18);
}

.choice-marker {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
}

.choice[aria-pressed="true"] .choice-marker,
.choice.selected .choice-marker {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.order-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-family: var(--font-reading);
}

.order-item.dragging {
  opacity: 0.55;
}

.order-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
}

.order-controls {
  display: flex;
  gap: 5px;
}

.order-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  color: var(--blue);
  background: var(--paper-solid);
  cursor: pointer;
}

.order-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.hint-box,
.feedback,
.notice {
  margin-top: 22px;
  padding: 16px 18px;
  border-left: 3px solid var(--marker);
  color: var(--ink);
  background: var(--marker-soft);
  font-family: var(--font-note);
  line-height: 1.85;
}

.feedback {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.feedback.error {
  border-left-color: var(--danger);
  background: var(--coral-soft);
}

.notice {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.structure {
  display: grid;
  gap: 0;
  margin: 29px 0;
  border-top: 1px solid var(--line);
}

.structure-node {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.structure-node strong,
.structure-node span {
  display: block;
}

.structure-node strong {
  color: var(--blue);
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.structure-node span {
  margin-top: 3px;
  font-family: var(--font-reading);
  font-size: 18px;
}

.structure-link {
  padding: 8px 0;
  color: var(--coral);
  font-family: var(--font-note);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.score-grid,
.metric-grid {
  display: grid;
  gap: 0;
  margin: 25px 0;
  border-top: 1px solid var(--line);
}

.score-row,
.metric {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
}

.score-row strong,
.metric strong {
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
}

.score-row span,
.metric span {
  color: var(--ink-soft);
  font-size: 14px;
}

.phase-nav {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 37px -60px -36px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-strong);
  background: rgba(232, 240, 244, 0.96);
}

.phase-step {
  display: flex;
  min-height: 61px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 2px solid transparent;
  color: #91a5b8;
  font-family: var(--font-note);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
}

.phase-step.is-done {
  color: var(--ink-soft);
}

.phase-step.is-current {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.phase-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: currentColor;
}

.phase-icon-answer {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.phase-icon-answer::after {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 9px;
  height: 2px;
  content: "";
  background: currentColor;
  transform: rotate(-45deg);
}

.phase-icon-evidence {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.phase-icon-evidence::after {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 9px;
  height: 2px;
  content: "";
  background: currentColor;
  transform: rotate(45deg);
}

.phase-icon-relation::before,
.phase-icon-relation::after {
  position: absolute;
  top: 9px;
  width: 16px;
  height: 7px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 6px;
  transform: rotate(-42deg);
}

.phase-icon-relation::before {
  left: 0;
}

.phase-icon-relation::after {
  right: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 760px) {
  .support-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .support-actions .button-row {
    margin-top: 0;
  }
}

@media (max-width: 860px) {
  .home-layout {
    grid-template-columns: minmax(180px, 0.28fr) minmax(0, 0.72fr);
    gap: 28px;
  }

  .learning-route {
    padding-right: 22px;
  }

  .route-step {
    grid-template-columns: 36px 1fr;
    gap: 12px;
  }

  .route-node {
    width: 34px;
    height: 34px;
  }

  .route-step:not(:last-child)::after {
    left: 16px;
  }

  .route-title {
    font-size: 19px;
  }

  .route-step small {
    font-size: 12px;
  }
}

@media (max-width: 759px) {
  .app-header {
    min-height: 112px;
  }

  .header-actions {
    padding-top: 3px;
  }

  .record-link {
    font-size: 14px;
  }

  .setup-screen {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .setup-side {
    padding: 25px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .home-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .learning-route {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    min-height: 0;
    padding: 0 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .route-kicker {
    grid-column: 1 / -1;
    margin-bottom: 2px;
  }

  .route-step {
    display: block;
    min-height: 0;
    text-align: center;
  }

  .route-step:not(:last-child)::after {
    top: 17px;
    right: -2px;
    bottom: auto;
    left: auto;
    width: 100%;
    height: 1px;
    transform: none;
  }

  .route-node {
    margin: 0 auto 6px;
  }

  .route-title {
    font-size: 15px;
  }

  .route-step small {
    display: none;
  }

  .phase-nav {
    margin-right: -27px;
    margin-left: -27px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .app-header {
    width: min(calc(100% - 24px), 1120px);
    min-height: 93px;
    align-items: flex-start;
    padding: 18px 0 17px;
  }

  .brand strong {
    font-size: 25px;
  }

  .brand small {
    font-size: 12px;
  }

  .record-link {
    min-height: 34px;
    gap: 6px;
    font-size: 12px;
  }

  .record-icon {
    width: 18px;
    height: 21px;
  }

  .record-icon::before,
  .record-icon::after {
    left: 3px;
    width: 8px;
  }

  .record-icon::before {
    top: 6px;
  }

  .record-icon::after {
    top: 12px;
  }

  #install-button {
    display: none;
  }

  .app-shell {
    width: min(calc(100% - 20px), 1120px);
    padding-bottom: 60px;
  }

  h1 {
    font-size: 38px;
    line-height: 1.35;
  }

  h2 {
    font-size: 29px;
  }

  .lead {
    font-size: 16px;
  }

  .home-main,
  .question-card,
  .summary-card,
  .setup-screen {
    padding: 28px 19px 31px;
  }

  .home-main > h1 {
    margin-bottom: 30px;
    padding-bottom: 14px;
  }

  .home-main > h1::after {
    right: 12%;
    left: 12%;
  }

  .topic-note {
    margin-top: 27px;
    padding: 31px 18px 24px;
  }

  .topic-note p {
    font-size: 23px;
  }

  .recent-note {
    padding-left: 48px;
  }

  .recent-note span {
    font-size: 16px;
  }

  .button-row .button {
    flex: 1 1 100%;
  }

  .button-wide {
    min-height: 66px;
    font-size: 18px;
  }

  .question-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .passage,
  .reading-passage {
    font-size: 18px;
    line-height: 2.05;
  }

  .choice {
    grid-template-columns: 32px 1fr;
    min-height: 57px;
    padding: 10px 11px;
    gap: 10px;
    font-size: 16px;
  }

  .phase-nav {
    margin-top: 30px;
    margin-right: -19px;
    margin-left: -19px;
    padding-right: 4px;
    padding-left: 4px;
  }

  .phase-step {
    min-height: 56px;
    gap: 5px;
    padding-inline: 3px;
    font-size: 12px;
  }

  .phase-icon {
    width: 18px;
    height: 18px;
  }

  .order-item {
    grid-template-columns: 30px 1fr;
  }

  .order-controls {
    grid-column: 2;
  }
}

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