:root {
  --ink: #20324d;
  --paper: #fffdf8;
  --coral: #ff765f;
  --mint: #48c9b0;
  --yellow: #ffc94f;
  --purple: #a98be8;
  --blue: #4b88e5;
  --line: rgba(75, 136, 229, 0.16);
  --shadow: 4px 5px 0 rgba(32, 50, 77, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: #f4efe5;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  touch-action: manipulation;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  padding: 16px;
}

button,
select {
  min-height: 44px;
  color: inherit;
  font: inherit;
}

button,
h1,
h2,
h3,
label,
legend,
summary,
.objective,
.lead,
.selection-label,
.field-note {
  min-width: 0;
  overflow-wrap: break-word;
  line-break: strict;
  text-wrap: pretty;
  word-break: normal;
}

button,
.keypad,
a,
input,
select,
textarea,
summary,
[role="button"] {
  touch-action: manipulation;
}

button:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 4px solid rgba(75, 136, 229, 0.32);
  outline-offset: 3px;
}

.notebook {
  position: relative;
  width: min(100%, 720px);
  min-height: calc(100vh - 32px);
  margin: 0 auto;
  padding: clamp(22px, 5vw, 42px) clamp(18px, 6vw, 48px) 44px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 22px 14px 20px 16px;
  background:
    linear-gradient(90deg, transparent 54px, rgba(255, 118, 95, 0.2) 55px, transparent 57px),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 35px,
      var(--line) 36px,
      transparent 37px
    ),
    var(--paper);
  box-shadow: 7px 9px 0 rgba(32, 50, 77, 0.16);
}

.notebook::before {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 11px;
  width: 18px;
  content: "";
  background: repeating-linear-gradient(
    to bottom,
    var(--ink) 0 5px,
    transparent 5px 27px
  );
  opacity: 0.75;
}

.page-header,
.panel,
.game-screen {
  position: relative;
  z-index: 1;
  margin-left: 36px;
}

.page-header {
  margin-bottom: 26px;
}

.eyebrow,
.section-label {
  margin: 0 0 6px;
  color: #3a649c;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

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

h1 {
  margin-bottom: 5px;
  font-size: clamp(1.85rem, 7vw, 2.7rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
}

.lead,
.objective {
  margin-bottom: 0;
  line-height: 1.7;
}

.print-entry-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-top: 14px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 9px 12px 10px 8px;
  color: var(--ink);
  background: #fff1bf;
  box-shadow: 3px 4px 0 var(--ink);
  font-weight: 900;
  text-decoration: none;
  touch-action: manipulation;
}

.print-entry-link:focus-visible {
  outline: 4px solid rgba(75, 136, 229, 0.32);
  outline-offset: 3px;
}

.no-break {
  white-space: nowrap;
}

.panel {
  padding: clamp(18px, 4vw, 28px);
  border: 3px solid var(--ink);
  border-radius: 14px 19px 15px 18px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.stage-heading,
.game-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.stage-heading > :first-child,
.game-status > :first-child {
  min-width: 0;
}

.count-badge,
.selection-label {
  display: inline-block;
  padding: 5px 10px;
  border: 2px solid var(--ink);
  border-radius: 9px 12px 10px 8px;
  background: #e5f7f2;
  font-size: 0.8rem;
  font-weight: 800;
}

.setup-heading-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.setup-block {
  margin-top: 24px;
}

.setup-block label,
.setup-block legend {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

fieldset {
  padding: 0;
  border: 0;
}

select {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: white;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 9px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px 12px 10px 8px;
  background: white;
  color: inherit;
  font: inherit;
}

.account-form {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.account-form label {
  font-weight: 800;
}

.account-form .primary-button {
  margin-top: 7px;
}

.account-message {
  min-height: 1.5em;
  margin: 15px 0 0;
  color: #b54431;
  font-weight: 700;
}

.qa-login-panel {
  display: grid;
  gap: 10px;
  margin-top: 23px;
}

.qa-login-panel[hidden],
.qa-workspace-panel[hidden] {
  display: none;
}

.qa-login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #58708e;
  font-size: 0.78rem;
  font-weight: 800;
}

.qa-login-divider::before,
.qa-login-divider::after {
  flex: 1;
  height: 1px;
  background: rgba(32, 50, 77, 0.25);
  content: "";
}

.qa-login-panel .field-note {
  margin: 0;
}

.qa-workspace-panel {
  display: grid;
  gap: 13px;
  margin-top: 24px;
  padding: 16px;
  border: 2px dashed var(--ink);
  border-radius: 11px 15px 10px 13px;
  background: #f2edff;
}

.qa-workspace-panel strong {
  margin-left: 7px;
}

.qa-workspace-panel p {
  margin: 8px 0 0;
  color: #58708e;
  font-size: 0.82rem;
}

.code-input {
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
  text-align: center;
}

.development-code {
  margin: 16px 0 0;
  padding: 11px;
  border: 2px dashed var(--ink);
  border-radius: 9px;
  background: #fff1c9;
  font-weight: 800;
  text-align: center;
}

.small-text-button {
  min-height: 44px;
  padding: 5px 9px;
  border: 0;
  background: transparent;
  color: #58708e;
  cursor: pointer;
  font-size: 0.78rem;
  text-decoration: underline;
}

.signed-in-email {
  margin: 3px 0 18px;
  color: #58708e;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.initial-setup-copy {
  max-width: 34rem;
  margin-bottom: 0;
}

.initial-setup-sentence {
  display: block;
}

.no-break {
  white-space: nowrap;
}

.initial-child-form {
  margin-top: 24px;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 13px 18px 12px 16px;
  background: #fff7d9;
  box-shadow: 3px 4px 0 var(--ink);
}

.initial-setup-note {
  margin-top: 15px;
}

.children-list {
  display: grid;
  gap: 11px;
}

.child-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.child-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 12px 16px;
  border: 3px solid var(--ink);
  border-radius: 12px 17px 11px 14px;
  background: white;
  box-shadow: 3px 4px 0 var(--ink);
  cursor: pointer;
  font-size: 1.08rem;
  font-weight: 900;
  text-align: left;
  overflow-wrap: break-word;
}

.child-select-button::after {
  flex: 0 0 auto;
  content: "はじめる";
  color: #3a649c;
  font-size: 0.76rem;
}

.child-history-button {
  min-width: 76px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: #fff1c9;
  box-shadow: 2px 3px 0 var(--ink);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
}

.child-history-button:active {
  box-shadow: none;
  transform: translate(2px, 3px);
}

.child-form {
  margin-top: 28px;
  padding-top: 19px;
  border-top: 2px dashed rgba(32, 50, 77, 0.25);
}

.history-intro {
  margin: 7px 0 18px;
  color: #58708e;
  font-size: 0.84rem;
}

.history-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin: 18px 0;
  padding: 5px;
  border: 2px solid var(--ink);
  border-radius: 11px 14px 10px 12px;
  background: #eef3f7;
}

.history-mode-tabs button {
  border: 0;
  border-radius: 7px 10px 7px 9px;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.history-mode-tabs button[aria-selected="true"] {
  background: white;
  box-shadow: 2px 2px 0 rgba(32, 50, 77, 0.22);
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.history-summary-item {
  padding: 12px 8px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: #e5f7f2;
  text-align: center;
}

.history-summary-item strong {
  display: block;
  font-size: 1.35rem;
}

.history-summary-item span {
  font-size: 0.74rem;
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 12px;
}

.analytics-more-button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px 13px 8px 11px;
  background: #eef5ff;
  box-shadow: 2px 3px 0 rgba(32, 50, 77, 0.2);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.analytics-more-button:active {
  box-shadow: none;
  transform: translate(2px, 3px);
}

.history-card {
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 11px 15px 10px 13px;
  background: white;
  box-shadow: 2px 3px 0 rgba(32, 50, 77, 0.14);
}

.history-card-heading,
.history-card-facts {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.history-card-heading > *,
.history-card-facts > * {
  min-width: 0;
}

.history-card-heading {
  margin-bottom: 10px;
}

.history-card-heading time {
  font-weight: 900;
}

.history-card-heading span,
.history-card-facts span {
  color: #58708e;
  font-size: 0.82rem;
  font-weight: 800;
}

.history-card-action {
  width: 100%;
  margin-top: 11px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 8px 10px;
  background: #eef5ff;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.history-card-legacy {
  display: block;
  margin-top: 9px;
  color: #708198;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: right;
}

.history-card-diagnosis {
  margin: 10px 0 0;
  padding: 7px 9px;
  border-left: 4px solid var(--mint);
  background: #edf9f6;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
}

.history-card-paper {
  margin: 10px 0 0;
  padding: 7px 9px;
  border-left: 4px solid var(--yellow);
  background: #fff7da;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.history-card-corrected {
  margin: 7px 0 0;
  color: #587087;
  font-size: 0.72rem;
  font-weight: 800;
}

.paper-correction-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 12px;
  background: #fffdf8;
}

.paper-correction-form h4,
.paper-correction-form p {
  margin: 0;
}

.paper-correction-note,
.paper-correction-status {
  color: #587087;
  font-size: 0.78rem;
  font-weight: 800;
}

.paper-correction-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.paper-correction-fields label {
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
}

.paper-correction-fields input {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border: 2px solid var(--ink);
  border-radius: 8px 10px 7px 9px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
}

.paper-correction-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.paper-correction-confirmation {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-left: 5px solid var(--yellow);
  background: #fff7da;
  font-size: 0.82rem;
  font-weight: 900;
}

.paper-correction-confirmation[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .paper-correction-fields {
    grid-template-columns: 1fr;
  }

  .paper-correction-actions {
    grid-template-columns: 1fr;
  }
}

.history-card-facts strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.answer-filter-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin: 20px 0 13px;
}

.answer-filter-buttons button {
  border: 2px solid var(--ink);
  border-radius: 8px 11px 8px 10px;
  background: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.answer-filter-buttons button[aria-pressed="true"] {
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
}

.session-answer-list {
  display: grid;
  gap: 10px;
}

.session-answer-card {
  padding: 13px;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  background: white;
}

.session-answer-card.is-correct {
  border-left: 8px solid var(--mint);
}

.session-answer-card.is-corrected {
  border-left: 8px solid var(--yellow);
}

.session-answer-card.is-revealed {
  border-left: 8px solid var(--coral);
}

.session-answer-card.is-interrupted {
  border-left: 8px solid var(--coral);
  background: #fff1e8;
}

.session-answer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.session-answer-heading strong {
  font-size: 1.2rem;
}

.answer-result-badge {
  padding: 4px 7px;
  border: 1px solid var(--ink);
  border-radius: 7px 9px 7px 8px;
  background: #eef3f7;
  font-size: 0.68rem;
  font-weight: 900;
}

.session-answer-facts {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin-top: 9px;
  color: #58708e;
  font-size: 0.76rem;
  font-weight: 800;
}

.session-answer-inputs {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.history-empty {
  margin: 0;
  padding: 22px 12px;
  border: 2px dashed rgba(32, 50, 77, 0.35);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-form button {
  min-width: 68px;
  border: 2px solid var(--ink);
  border-radius: 9px 12px 10px 8px;
  background: var(--mint);
  cursor: pointer;
  font-weight: 900;
}

.field-note {
  margin: 7px 0 0;
  color: #58708e;
  font-size: 0.82rem;
}

.duration-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.duration-option {
  position: relative;
}

.duration-option input {
  position: absolute;
  opacity: 0;
}

.duration-option label {
  display: grid;
  min-height: 52px;
  margin: 0;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: white;
  cursor: pointer;
  touch-action: manipulation;
}

.duration-option input:checked + label {
  background: var(--yellow);
  box-shadow: 2px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.duration-option input:focus-visible + label {
  outline: 4px solid rgba(75, 136, 229, 0.32);
  outline-offset: 3px;
}

.primary-button {
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
  border: 3px solid var(--ink);
  border-radius: 12px 16px 11px 14px;
  background: var(--coral);
  box-shadow: 3px 4px 0 var(--ink);
  color: #17273d;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 900;
}

.primary-button:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 3px);
}

.text-button {
  display: block;
  margin: 17px auto 0;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: #58708e;
  cursor: pointer;
  text-decoration: underline;
}

.debug-details {
  margin-top: 18px;
  border-top: 2px dashed rgba(32, 50, 77, 0.25);
  padding-top: 13px;
  color: #405774;
  font-size: 0.86rem;
}

.progress-rules-note {
  margin: 9px 0;
  color: #58708e;
  font-size: 0.72rem;
  font-weight: 800;
}

.progress-route-list {
  display: grid;
  gap: 10px;
}

.progress-route-card {
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  background: white;
}

.progress-route-card.is-complete {
  background: #e5f7f2;
}

.progress-route-card.is-closed {
  background: #eef3f7;
}

.progress-route-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progress-route-heading strong {
  font-size: 0.9rem;
}

.progress-route-heading span {
  padding: 3px 7px;
  border: 2px solid var(--ink);
  border-radius: 7px 10px 7px 9px;
  background: var(--yellow);
  font-size: 0.68rem;
  font-weight: 900;
}

.progress-route-card.is-complete .progress-route-heading span {
  background: var(--mint);
}

.progress-route-card.is-closed .progress-route-heading span {
  background: #dce4ec;
}

.progress-route-card > p {
  margin: 5px 0 9px;
  color: #58708e;
  font-size: 0.72rem;
  line-height: 1.45;
}

.progress-criteria {
  display: grid;
  gap: 6px;
}

.progress-criterion {
  display: grid;
  grid-template-columns: 20px minmax(80px, 1fr) minmax(115px, auto);
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
}

.progress-criterion-mark {
  color: #58708e;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
}

.progress-criterion.is-met .progress-criterion-mark {
  color: #18745f;
}

.progress-criterion > span:nth-child(2) {
  color: #58708e;
  font-weight: 800;
}

.progress-criterion strong {
  text-align: right;
}

.debug-heading {
  margin: 15px 0 8px;
  font-size: 0.78rem;
}

.debug-details summary {
  min-height: 44px;
  cursor: pointer;
  font-weight: 800;
  line-height: 44px;
  touch-action: manipulation;
}

.debug-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 13px;
}

.debug-details dt {
  font-weight: 800;
}

.debug-details dd {
  margin: 0;
}

.game-screen {
  padding-bottom: 10px;
}

.game-status {
  min-height: 58px;
}

.timer {
  min-width: 94px;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: white;
  text-align: center;
}

.game-actions {
  display: grid;
  gap: 7px;
}

.stop-button {
  min-height: 44px;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 9px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #58708e;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.timer span {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
}

.timer strong {
  font-variant-numeric: tabular-nums;
}

.finish-note {
  margin: 10px 0;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: #fff1c9;
  font-weight: 900;
  text-align: center;
}

.question-card {
  position: relative;
  min-height: 140px;
  margin: 18px 0 12px;
  padding: 22px clamp(18px, 6vw, 34px);
  border: 3px solid var(--ink);
  border-radius: 17px 13px 19px 14px;
  background: white;
  box-shadow: var(--shadow);
}

.horizontal-question {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 92px;
}

.horizontal-question.is-remainder {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 18px;
}

.horizontal-question.is-remainder .question {
  font-size: clamp(2.35rem, 12vw, 4.4rem);
}

.column-calculation {
  display: grid;
  grid-template-columns: 1.1em repeat(var(--digit-count), 1.05em);
  align-items: end;
  justify-content: center;
  min-height: 214px;
  column-gap: 0.08em;
  color: var(--ink);
  font-size: clamp(2.55rem, 11vw, 4.3rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.decimal-column-calculation {
  display: grid;
  grid-template-columns:
    1.1em
    repeat(var(--integer-digits), 1.05em)
    0.38em
    repeat(var(--decimal-digits), 1.05em);
  align-items: end;
  justify-content: center;
  min-height: 214px;
  column-gap: 0.06em;
  color: var(--ink);
  font-size: clamp(2.45rem, 10.5vw, 4.15rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.decimal-column-calculation[hidden] {
  display: none;
}

.decimal-operator,
.decimal-digit-cell,
.decimal-point {
  position: relative;
  display: grid;
  min-width: 1em;
  min-height: 1.08em;
  place-items: center;
}

.decimal-operator {
  padding-right: 0.08em;
  font-size: 0.65em;
}

.decimal-point {
  min-width: 0.38em;
  align-items: end;
  padding-bottom: 0.08em;
}

.decimal-calculation-line {
  min-height: 0;
  margin: 0.08em 0 0.12em;
  border-top: 4px solid var(--ink);
}

.decimal-answer-cell {
  min-height: 1.12em;
  color: var(--blue);
}

.decimal-answer-cell.is-entry-target {
  border-bottom: 4px solid var(--blue);
  background: rgba(75, 136, 229, 0.08);
}

.decimal-digit-cell.is-active {
  border-radius: 8px 11px 7px 10px;
  background: #fff0bf;
  box-shadow: 0 0 0 3px rgba(255, 201, 79, 0.52);
}

.decimal-digit-cell.is-adjusted::after {
  position: absolute;
  top: 50%;
  left: 7%;
  width: 86%;
  border-top: 3px solid rgba(181, 68, 49, 0.72);
  content: "";
  transform: rotate(-12deg);
}

.decimal-column-calculation .annotation-row {
  min-height: 0.65em;
}

.decimal-multiplication-calculation {
  display: grid;
  min-height: 214px;
  place-items: center;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.decimal-multiplication-calculation[hidden] {
  display: none;
}

.decimal-multiplication-layout {
  display: grid;
  width: min(100%, 320px);
  gap: 2px;
  font-size: clamp(2.35rem, 10vw, 3.9rem);
  font-weight: 900;
  line-height: 1;
}

.decimal-multiplication-annotations,
.decimal-multiplication-product {
  display: grid;
  grid-template-columns: repeat(var(--product-slots), 1.08em);
  justify-content: end;
}

.decimal-multiplication-work-row {
  display: grid;
  grid-template-columns: repeat(var(--product-slots), 1.08em);
  justify-content: end;
  margin: 4px 0;
}

.decimal-multiplication-work-label {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  font-size: 0.8rem;
  line-height: 1.4;
  font-weight: 500;
}

.decimal-work-expression {
  white-space: nowrap;
}

.decimal-multiplication-work-cell {
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
  border: 1px dashed var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.5em;
  touch-action: manipulation;
}

.decimal-multiplication-work-cell.is-entry-target {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

.decimal-multiplication-annotations {
  min-height: 0.65em;
  color: #b54431;
  font-size: 0.38em;
}

.decimal-multiplication-annotations > span,
.decimal-product-digit {
  display: grid;
  min-width: 1.08em;
  min-height: 1.08em;
  place-items: center;
}

.decimal-multiplication-operand {
  display: grid;
  grid-template-columns: 1em 1fr;
  align-items: end;
}

.decimal-multiplication-operand > span {
  font-size: 0.65em;
}

.decimal-multiplication-operand strong {
  justify-self: end;
  letter-spacing: 0.06em;
}

.decimal-multiplication-line {
  margin: 0.07em 0 0.12em;
  border-top: 4px solid var(--ink);
}

.decimal-product-digit {
  position: relative;
  color: var(--blue);
}

.decimal-product-digit[role="button"] {
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
}

.decimal-product-digit[role="button"]:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}

.decimal-product-help {
  max-width: 28em;
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  font-weight: 400;
}

.decimal-product-digit.answer-placeholder {
  color: rgba(75, 136, 229, 0.34);
}

.decimal-product-digit.is-entry-target {
  border-bottom: 4px solid var(--blue);
  background: rgba(75, 136, 229, 0.08);
}

.decimal-product-digit.is-auto-zero {
  color: var(--blue);
}

.decimal-product-digit.is-active {
  border-radius: 8px 11px 7px 10px;
  background: #fff0bf;
  box-shadow: 0 0 0 3px rgba(255, 201, 79, 0.52);
}

.placed-decimal-point {
  position: absolute;
  left: -0.12em;
  bottom: 0.02em;
  z-index: 1;
  color: var(--blue);
  font-size: 0.9em;
  line-height: 1;
}

.decimal-division-calculation {
  display: grid;
  min-height: 214px;
  place-items: center;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.decimal-division-calculation[hidden] {
  display: none;
}

.decimal-division-wrapper {
  display: grid;
  width: min(100%, 340px);
  justify-items: center;
  gap: 12px;
}

.decimal-division-conversion {
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: 2px dashed var(--ink);
  border-radius: 9px 12px 8px 11px;
  background: #fff8df;
  font-size: clamp(0.86rem, 3vw, 1rem);
  font-weight: 900;
  text-align: center;
}

.decimal-division-layout {
  display: grid;
  grid-template-columns: auto minmax(130px, auto);
  align-items: end;
  color: var(--ink);
}

.decimal-division-spacer {
  min-width: 1.4em;
}

.decimal-division-quotient {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 1.25em;
  padding: 2px 4px;
  color: var(--blue);
  font-size: clamp(2.1rem, 10vw, 3.45rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.decimal-quotient-digit {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
}

.decimal-quotient-digit.is-entry-target {
  background: rgba(75, 136, 229, 0.08);
  border-bottom: 4px solid var(--blue);
}

.decimal-quotient-digit:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}

.decimal-quotient-point {
  min-width: 0.2em;
}

.decimal-division-divisor,
.decimal-division-dividend {
  padding: 7px 10px;
  font-size: clamp(2.1rem, 10vw, 3.45rem);
  line-height: 1;
}

.decimal-division-divisor {
  text-align: right;
}

.decimal-division-dividend {
  border-top: 4px solid var(--ink);
  border-left: 4px solid var(--ink);
  border-radius: 13px 0 0;
  letter-spacing: 0.04em;
}

.decimal-division-work {
  width: min(100%, 320px);
  min-height: 42px;
  margin: 0;
  padding: 8px 12px;
  border: 2px dashed #aeb8c7;
  border-radius: 10px 13px 9px 12px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.55;
  text-align: center;
}

.long-division-calculation {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-height: 214px;
  padding: 4px 0;
}

.long-division-calculation[hidden] {
  display: none;
}

.long-division-layout {
  display: grid;
  grid-template-columns: auto minmax(116px, auto);
  align-items: end;
  gap: 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.division-written-board {
  --written-cell-size: max(30px, 1em);
  display: grid;
  grid-template-columns: auto repeat(var(--division-columns), var(--written-cell-size));
  align-items: center;
  justify-content: center;
  max-width: 100%;
  font-size: clamp(1.65rem, 7vw, 2.3rem);
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.division-written-cell {
  position: relative;
  min-height: 1.3em;
  text-align: center;
}

.division-board-revise {
  z-index: 1;
  align-self: stretch;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 1px dashed var(--mint);
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  touch-action: manipulation;
  cursor: pointer;
}

.division-board-revise:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 1px;
}

.division-point-entry {
  position: absolute;
  z-index: 2;
  right: -22px;
  bottom: -8px;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  line-height: 44px;
  touch-action: manipulation;
}

.division-point-entry::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  bottom: 2px;
  left: 14px;
  border: 1px dashed var(--mint);
  border-radius: 50%;
}

.division-point-entry:focus-visible { outline: 2px solid var(--ink); }

.division-written-board.is-wide {
  --written-cell-size: max(22px, 1em);
  font-size: clamp(1.15rem, 5.5vw, 1.8rem);
}

.written-decimal-point {
  position: absolute;
  right: -0.13em;
  bottom: 0;
}

.written-added-zero {
  text-decoration: underline dotted;
  text-underline-offset: 0.1em;
}

.decimal-division-final-input .decimal-division-spacer {
  min-width: 0;
  padding-right: 0.75rem;
  font-size: 1rem;
}

.written-divisor { padding-right: 0.3em; }
.written-dividend { border-top: 3px solid var(--ink); }
.written-dividend.is-first { border-left: 3px solid var(--ink); }
.written-quotient { color: var(--blue); }
.written-product.has-line { border-bottom: 2px solid var(--ink); }
.written-minus { font-weight: 400; }

.division-work-entry {
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--entry-columns), var(--written-cell-size));
  box-sizing: content-box;
  min-width: 40px;
  min-height: 44px;
  padding: 0;
  margin: 0 -2px;
  border: 2px solid var(--blue);
  border-radius: 4px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  line-height: 1.25;
  cursor: text;
  touch-action: manipulation;
}

.division-work-entry.is-long-entry {
  display: block;
  font-size: 0.5em;
  overflow-wrap: anywhere;
}

.division-work-entry > span {
  align-self: center;
}

.division-work-entry [data-division-board-index] {
  cursor: pointer;
  touch-action: manipulation;
}

.division-work-entry .is-selected-digit {
  box-shadow: inset 0 -3px var(--ink);
  background: var(--paper);
  color: var(--blue);
}

.division-digit-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.question-card .horizontal-question.is-word-question {
  flex-direction: column;
  gap: 16px;
}

.horizontal-question.is-word-question #question-text {
  width: 100%;
  font-size: clamp(1.2rem, 4vw, 1.65rem);
  line-height: 1.6;
  text-align: left;
  overflow-wrap: normal;
}

.division-digit-editor p { flex-basis: 100%; }

.division-digit-editor button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  touch-action: manipulation;
}

.division-digit-editor button[aria-pressed="true"] {
  outline: 3px solid var(--ink);
  outline-offset: 1px;
}

.division-work-rewind {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-block: 6px;
  padding: 8px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

.division-work-rewind:focus-visible,
.division-work-entry:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.division-final-input .long-division-spacer {
  min-width: 0;
  padding-right: 0.75rem;
  font-size: 1rem;
}

.long-division-spacer {
  min-width: 1.4em;
}

.long-division-quotient,
.long-division-remainder {
  min-height: 54px;
  padding: 2px 12px;
  border: 3px solid transparent;
  border-radius: 10px;
  background: white;
  color: var(--blue);
  cursor: pointer;
  font-size: clamp(2rem, 10vw, 3.3rem);
  font-weight: 900;
  line-height: 1;
  touch-action: manipulation;
}

.long-division-quotient.is-active,
.long-division-remainder.is-active {
  border-color: var(--blue);
  box-shadow: 2px 3px 0 var(--blue);
}

.long-division-divisor,
.long-division-dividend {
  padding: 7px 10px;
  font-size: clamp(2.15rem, 11vw, 3.55rem);
  line-height: 1;
}

.long-division-divisor {
  text-align: right;
}

.long-division-dividend {
  position: relative;
  padding-left: 0.85em;
}

.long-division-dividend::after {
  position: absolute;
  top: 6%;
  right: 0;
  left: 0.7em;
  border-top: 4px solid var(--ink);
  content: "";
  pointer-events: none;
}

.long-division-bracket-mark {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.72em;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.long-division-bracket-mark path {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.long-division-remainder-label {
  align-self: center;
  padding-right: 8px;
  font-weight: 900;
  text-align: right;
}

.long-division-remainder {
  min-width: 80px;
  justify-self: start;
}

.long-division-work {
  width: min(100%, 280px);
  min-height: 42px;
  padding: 8px 12px;
  border: 2px dashed #aeb8c7;
  border-radius: 10px 13px 9px 12px;
  background: #f8fbff;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.long-division-work p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0;
}

.long-division-work strong {
  color: var(--ink);
}

.calculation-cell {
  position: relative;
  display: grid;
  min-width: 1em;
  min-height: 1.08em;
  place-items: center;
}

.annotation-row {
  min-height: 0.65em;
  color: #b54431;
  font-size: 0.38em;
  line-height: 1;
}

.annotation-value {
  display: inline-block;
  min-width: 1.25em;
  padding: 2px 3px;
  border: 2px solid #b54431;
  border-radius: 48% 52% 46% 54% / 53% 45% 55% 47%;
  background: #fff8ef;
  text-align: center;
  transform: rotate(-4deg);
}

.operator {
  padding-right: 0.08em;
  font-size: 0.65em;
}

.calculation-line {
  min-height: 0;
  margin: 0.08em 0 0.12em;
  border-top: 4px solid var(--ink);
}

.answer-cell {
  min-height: 1.12em;
  color: var(--blue);
}

.answer-placeholder {
  color: rgba(75, 136, 229, 0.34);
}

.answer-cell.is-entry-target {
  border-bottom: 4px solid var(--blue);
  background: rgba(75, 136, 229, 0.08);
}

.calculation-cell.is-active {
  border-radius: 8px 11px 7px 10px;
  background: #fff0bf;
  box-shadow: 0 0 0 3px rgba(255, 201, 79, 0.52);
}

.calculation-cell.is-adjusted::after {
  position: absolute;
  top: 50%;
  left: 7%;
  width: 86%;
  border-top: 3px solid rgba(181, 68, 49, 0.72);
  content: "";
  transform: rotate(-12deg);
}

.question-hint-button {
  display: grid;
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  margin: 10px 0 0 auto;
  padding: 0;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 48% 52% 47% 53% / 52% 47% 53% 48%;
  background: var(--yellow);
  box-shadow: 2px 3px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: 900;
  touch-action: manipulation;
  transform: rotate(-3deg);
}

.question-hint-button:active {
  box-shadow: none;
  transform: translate(2px, 3px) rotate(-3deg);
}

.question-hint-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.question-hint-button.is-next {
  width: auto;
  min-width: 118px;
  padding: 0 13px;
  border-radius: 9px 13px 8px 11px;
  font-size: 0.86rem;
  transform: rotate(-1deg);
}

.question-hint-button.is-next:active {
  transform: translate(2px, 3px) rotate(-1deg);
}

.question-hint-message {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 2px dashed var(--ink);
  border-radius: 9px 12px 8px 11px;
  background: #fff8df;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.65;
  scroll-margin-block: 12px;
}

.correct-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(92px, 25vw, 126px);
  height: clamp(92px, 25vw, 126px);
  padding: 0;
  border-color: #e64e3e;
  border-style: solid;
  border-width: 7px 9px 8px 6px;
  border-radius: 48% 52% 46% 54% / 53% 47% 55% 45%;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transform: translate(-50%, -50%) rotate(-7deg);
  animation: correct-mark-in 180ms ease-out both;
}

@keyframes correct-mark-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-12deg) scale(1.45);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-7deg) scale(1);
  }
}

.question {
  margin: 0;
  font-size: clamp(2.7rem, 14vw, 5.1rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
}

.answer-display {
  display: grid;
  min-width: 1.6em;
  min-height: 1.45em;
  place-items: center;
  border-bottom: 5px solid var(--blue);
  color: var(--blue);
  font-size: clamp(2.7rem, 14vw, 5.1rem);
  font-weight: 900;
  line-height: 1;
}

.answer-display[hidden] {
  display: none;
}

.remainder-answer-display {
  display: grid;
  grid-template-columns: minmax(78px, 1fr) auto minmax(78px, 1fr);
  align-items: end;
  gap: 10px;
  color: var(--ink);
  font-size: clamp(1.15rem, 5vw, 1.55rem);
  font-weight: 900;
}

.remainder-answer-display[hidden] {
  display: none;
}

.remainder-answer-display button {
  min-width: 78px;
  min-height: 74px;
  padding: 5px 12px 7px;
  border: 3px solid var(--ink);
  border-radius: 10px 13px 9px 12px;
  background: white;
  color: var(--blue);
  cursor: pointer;
  touch-action: manipulation;
}

.remainder-answer-display button.is-active {
  border-color: var(--blue);
  box-shadow: 2px 3px 0 var(--blue);
}

.remainder-answer-display button:disabled {
  cursor: default;
}

.remainder-answer-display small,
.remainder-answer-display strong {
  display: block;
}

.remainder-answer-display small {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.72rem;
}

.remainder-answer-display strong {
  font-size: clamp(2rem, 9vw, 3.3rem);
  line-height: 1;
}

.feedback {
  min-height: 31px;
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
}

.feedback.is-good {
  color: #14715f;
}

.feedback.is-retry {
  color: #b54431;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.keypad button {
  min-height: 57px;
  border: 3px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  background: white;
  box-shadow: 2px 3px 0 var(--ink);
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 900;
}

.keypad button:active {
  box-shadow: none;
  transform: translate(2px, 3px);
}

.keypad button:disabled {
  cursor: default;
  opacity: 0.48;
}

.keypad .submit-key {
  background: var(--mint);
  font-size: 0.88rem;
}

.keypad.has-structured-answer .submit-key {
  grid-column: 1 / -1;
}

.keypad .decimal-key {
  background: #eef5ff;
  font-size: 0.92rem;
}

.keypad .fraction-switch-key {
  background: #fff2bd;
  font-size: 0.92rem;
}

.keypad .fraction-equals-key {
  background: #eef5ff;
  font-size: 1.3rem;
}

.keypad .fraction-undo-key {
  background: #fff8ed;
  font-size: 0.82rem;
}

.keypad.has-decimal .submit-key {
  grid-column: 1 / -1;
}

.keypad button[hidden] {
  display: none;
}

.horizontal-question.is-decimal {
  gap: 14px;
}

.horizontal-question.is-decimal .question {
  font-size: clamp(1.85rem, 8.5vw, 3.6rem);
  line-height: 1.15;
}

.result-panel {
  text-align: center;
}

.result-comment {
  margin: 10px 0 0;
  color: #365372;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.65;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
  margin: 22px 0;
}

.result-stat {
  padding: 14px 8px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: white;
}

.result-stat strong {
  display: block;
  font-size: 1.7rem;
}

.result-stat span {
  font-size: 0.75rem;
  font-weight: 800;
}

.next-stage-card {
  display: grid;
  gap: 5px;
  margin: 12px 0 18px;
  padding: 16px;
  border: 3px solid var(--ink);
  border-radius: 13px 17px 12px 15px;
  background: #fff1c9;
  box-shadow: 3px 4px 0 rgba(32, 50, 77, 0.16);
}

.next-stage-card span {
  color: #58708e;
  font-size: 0.78rem;
  font-weight: 800;
}

.next-stage-card strong {
  font-size: clamp(1.15rem, 5vw, 1.45rem);
}

.mastery-rank,
.next-stage-card .mastery-rank {
  display: inline-block;
  width: fit-content;
  padding: 4px 9px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 7px 10px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
}

.mastery-rank.is-unlearned {
  background: #f1f3f6;
}

.mastery-rank.is-bronze {
  background: #e9bd91;
}

.mastery-rank.is-silver {
  background: #e1e8ef;
}

.mastery-rank.is-gold {
  background: #ffe28b;
}

.mastery-rank.is-master {
  background: #ddd0f6;
}

.adult-details {
  text-align: left;
}

.save-warning {
  margin: 18px 0 0;
  padding: 12px;
  border: 2px solid #9b3a2d;
  border-radius: 10px 13px 9px 11px;
  background: #fff1e8;
  color: #7d3025;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: left;
}

.save-warning p {
  margin-bottom: 9px;
}

.save-warning button {
  width: 100%;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 9px 10px;
  background: white;
  cursor: pointer;
  font-weight: 900;
}

.error-panel {
  border-color: #9b3a2d;
}

.error-panel h1,
.error-panel h2 {
  overflow-wrap: anywhere;
}

.error-reference {
  padding: 8px 10px;
  border: 1px dashed #9b3a2d;
  background: #fff5f1;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.error-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.error-actions a {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.standalone-error-shell {
  width: min(100% - 24px, 680px);
  margin: 32px auto;
}

[hidden] {
  display: none !important;
}

.detailed-period-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 9px;
}

.detailed-period-options button {
  flex: 1 1 72px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 8px 10px;
  background: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.detailed-period-options button[aria-pressed="true"] {
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
}

.detailed-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.overview-card {
  min-width: 0;
  padding: 12px 7px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: white;
  text-align: center;
}

.overview-card:nth-child(3n + 1) {
  background: #e5f7f2;
}

.overview-card:nth-child(3n + 2) {
  background: #fff1c9;
}

.overview-card:nth-child(3n) {
  background: #f0eafb;
}

.overview-card strong {
  display: block;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  line-height: 1.2;
}

.overview-card span {
  color: #58708e;
  font-size: 0.7rem;
  font-weight: 900;
}

.analytics-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 2px dashed rgba(32, 50, 77, 0.25);
}

.analytics-section h3 {
  margin: 0 0 13px;
  font-size: 1rem;
}

.analytics-section-note {
  margin: -5px 0 12px;
  color: #58708e;
  font-size: 0.76rem;
  line-height: 1.6;
}

.weekly-summary {
  display: grid;
  gap: 10px;
}

.weekly-summary-intro,
.weekly-summary-comparison {
  margin: 0;
  line-height: 1.65;
}

.weekly-summary-intro {
  font-weight: 900;
}

.weekly-summary-comparison {
  color: #4f6681;
  font-size: 0.8rem;
}

.weekly-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.learning-level-card {
  padding: 15px;
  border: 3px solid var(--ink);
  border-radius: 12px 16px 11px 14px;
  background: #fff1c9;
  box-shadow: 3px 4px 0 rgba(32, 50, 77, 0.15);
}

.learning-level-card strong {
  display: block;
  font-size: clamp(1.15rem, 4vw, 1.4rem);
}

.learning-level-card p {
  margin: 7px 0 4px;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.6;
}

.learning-level-card small {
  display: block;
  color: #58708e;
  font-size: 0.7rem;
  line-height: 1.55;
}

.parent-progress-list,
.problem-template-list {
  display: grid;
  gap: 9px;
}

.parent-progress-card,
.problem-template-card {
  min-width: 0;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: white;
}

.parent-progress-heading,
.problem-template-heading {
  display: flex;
  min-width: 0;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.parent-progress-heading strong,
.problem-template-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.parent-progress-heading span,
.problem-template-heading span {
  flex: 0 0 auto;
  color: #58708e;
  font-size: 0.7rem;
  font-weight: 900;
}

.parent-progress-card p,
.problem-template-card p {
  margin: 7px 0 0;
  color: #58708e;
  font-size: 0.72rem;
  line-height: 1.55;
}

.problem-template-card.is-attention {
  background: #fff1e8;
}

.problem-template-card.is-strength {
  background: #e5f7f2;
}

.problem-template-card.is-steady {
  background: #eef5ff;
}

.insight-section {
  border-top-style: solid;
}

.insight-list {
  display: grid;
  gap: 9px;
}

.insight-card {
  position: relative;
  margin: 0;
  padding: 12px 12px 12px 38px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: white;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.55;
}

.insight-card::before {
  position: absolute;
  top: 11px;
  left: 12px;
  width: 15px;
  height: 15px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.insight-card.is-positive {
  background: #e5f7f2;
}

.insight-card.is-positive::before {
  background: var(--mint);
}

.insight-card.is-attention {
  background: #fff1e8;
}

.insight-card.is-attention::before {
  background: var(--coral);
}

.insight-card.is-review {
  background: #fff1c9;
}

.insight-card.is-review::before {
  background: var(--yellow);
}

.insight-card.is-info {
  background: #eef5ff;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.comparison-card {
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: white;
}

.comparison-card span {
  display: block;
  margin-bottom: 4px;
  color: #58708e;
  font-size: 0.72rem;
  font-weight: 900;
}

.comparison-card strong {
  font-size: 1.08rem;
}

.comparison-card.is-better {
  background: #e5f7f2;
}

.comparison-card.is-worse {
  background: #fff1e8;
}

.comparison-card.is-neutral {
  background: #eef3f7;
}

.trend-chart {
  display: grid;
  align-items: end;
  min-height: 178px;
  gap: 4px;
  padding: 12px 8px 4px;
  border: 2px solid var(--ink);
  border-radius: 11px 15px 10px 13px;
  background:
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent 39px,
      rgba(75, 136, 229, 0.13) 40px
    ),
    white;
}

.trend-day {
  display: grid;
  align-content: end;
  min-width: 0;
  height: 150px;
  gap: 3px;
}

.trend-bar {
  width: 100%;
  min-height: 7px;
  border: 2px solid var(--ink);
  border-bottom-width: 3px;
  border-radius: 5px 5px 2px 2px;
  background: var(--mint);
}

.trend-day span {
  overflow: hidden;
  font-size: 0.6rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.practice-stacked-bar {
  display: flex;
  min-height: 30px;
  margin-bottom: 11px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 9px 12px 8px 10px;
  background: #e9edf2;
}

.practice-stack-segment {
  min-width: 3px;
}

.practice-stack-segment.is-stage-practice {
  background: var(--blue);
}

.practice-stack-segment.is-mistake-review {
  background: var(--coral);
}

.practice-stack-segment.is-focused-practice {
  background: var(--blue);
}

.practice-stack-segment.is-retention-review {
  background: var(--mint);
}

.practice-stack-segment.is-other-review {
  background: var(--purple);
}

.practice-stack-segment.is-paper {
  background: var(--yellow);
}

.practice-breakdown-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.practice-category-card {
  padding: 11px;
  border: 2px solid var(--ink);
  border-radius: 9px 12px 8px 10px;
  background: white;
}

.practice-category-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  font-size: 0.76rem;
  font-weight: 900;
}

.practice-category-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.practice-category-dot.is-stage-practice {
  background: var(--blue);
}

.practice-category-dot.is-mistake-review {
  background: var(--coral);
}

.practice-category-dot.is-focused-practice {
  background: var(--blue);
}

.practice-category-dot.is-retention-review {
  background: var(--mint);
}

.practice-category-dot.is-other-review {
  background: var(--purple);
}

.practice-category-dot.is-paper {
  background: var(--yellow);
}

.practice-category-card strong {
  font-size: 1.05rem;
}

.practice-category-card p {
  margin: 3px 0 0;
  color: #58708e;
  font-size: 0.68rem;
  font-weight: 800;
}

.accuracy-time-layout {
  display: grid;
  grid-template-columns: minmax(145px, 0.7fr) 1.3fr;
  gap: 13px;
}

.accuracy-visual,
.time-trend {
  padding: 13px;
  border: 2px solid var(--ink);
  border-radius: 11px 15px 10px 13px;
  background: white;
}

.accuracy-ring {
  display: grid;
  width: 124px;
  height: 124px;
  margin: 0 auto 8px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: conic-gradient(
    var(--mint) 0 var(--accuracy-angle),
    #e9edf2 var(--accuracy-angle) 360deg
  );
}

.accuracy-ring::before {
  grid-area: 1 / 1;
  width: 82px;
  height: 82px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: white;
  content: "";
}

.accuracy-ring strong {
  z-index: 1;
  grid-area: 1 / 1;
  font-size: 1.35rem;
}

.accuracy-caption {
  margin: 0;
  color: #58708e;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.time-trend {
  display: grid;
  align-content: start;
  gap: 9px;
}

.time-row {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 7px;
  font-size: 0.69rem;
  font-weight: 800;
}

.time-track,
.analysis-track {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #e9edf2;
}

.time-fill,
.analysis-fill {
  height: 100%;
  background: var(--blue);
}

.weak-problem-list,
.stage-analysis-list {
  display: grid;
  gap: 10px;
}

.weak-problem-card,
.stage-analysis-card {
  padding: 13px;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  background: white;
}

.weak-problem-heading,
.stage-analysis-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.weak-problem-heading > *,
.stage-analysis-heading > * {
  min-width: 0;
}

.weak-problem-heading strong {
  font-size: 1.25rem;
}

.weak-problem-heading span,
.stage-analysis-heading span {
  color: #58708e;
  font-size: 0.74rem;
  font-weight: 800;
}

.analysis-fill {
  background: var(--mint);
}

.analysis-fill.is-weak {
  background: var(--coral);
}

.mastery-stage-list {
  display: grid;
  gap: 8px;
}

.mastery-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px 13px 8px 11px;
  background: white;
}

.mastery-stage-row > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mastery-stage-row small {
  color: #58708e;
  font-size: 0.7rem;
  font-weight: 800;
}

.problem-detail {
  margin: 8px 0 0;
  color: #58708e;
  font-size: 0.72rem;
  line-height: 1.55;
}

.problem-practice-action {
  margin-top: 15px;
}

.problem-practice-action .primary-button {
  margin: 0;
}

.problem-practice-action .field-note {
  margin-top: 7px;
}

.setup-review-note {
  margin: 13px 0;
  padding: 11px 13px;
  border: 2px solid var(--ink);
  border-radius: 9px 13px 8px 11px;
  background: #eef5ff;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.55;
}

.qa-mode-panel {
  margin: 18px 0;
  padding: 16px;
  border: 3px solid var(--ink);
  border-radius: 12px 16px 11px 14px;
  background: #fff4c9;
  box-shadow: 3px 4px 0 var(--ink);
}

.qa-mode-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
}

.qa-mode-badge {
  display: inline-block;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 7px 10px 6px 9px;
  background: var(--purple);
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
  transform: rotate(-2deg);
}

.qa-mode-panel label {
  display: block;
  margin-bottom: 6px;
  font-weight: 900;
}

.qa-mode-panel select {
  width: 100%;
  min-height: 48px;
  touch-action: manipulation;
}

.qa-mode-panel .field-note {
  margin-bottom: 0;
}

.weak-problem-action {
  width: 100%;
  margin-top: 10px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 8px 10px;
  background: #eef5ff;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 900;
}

.problem-attempt-trend {
  display: grid;
  align-items: end;
  min-height: 170px;
  gap: 3px;
  padding: 12px 7px 5px;
  border: 2px solid var(--ink);
  border-radius: 11px 15px 10px 13px;
  background:
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent 39px,
      rgba(75, 136, 229, 0.13) 40px
    ),
    white;
}

.problem-trend-attempt {
  min-width: 0;
  min-height: 8px;
  border: 1px solid var(--ink);
  border-radius: 4px 4px 2px 2px;
  background: var(--mint);
}

.problem-trend-attempt.is-corrected {
  background: var(--yellow);
}

.problem-trend-attempt.is-revealed {
  background: var(--coral);
}

.problem-trend-attempt.is-interrupted {
  background:
    repeating-linear-gradient(
      -45deg,
      var(--coral) 0,
      var(--coral) 5px,
      #fff1e8 5px,
      #fff1e8 9px
    );
}

.wrong-answer-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.wrong-answer-chip {
  flex: 1 1 100px;
  padding: 11px;
  border: 2px solid var(--ink);
  border-radius: 9px 12px 8px 10px;
  background: #fff1e8;
  text-align: center;
}

.wrong-answer-chip strong {
  display: block;
  font-size: 1.25rem;
}

.wrong-answer-chip span {
  color: #58708e;
  font-size: 0.7rem;
  font-weight: 800;
}

.problem-attempt-list {
  display: grid;
  gap: 8px;
}

.problem-attempt-row {
  display: grid;
  grid-template-columns: minmax(105px, 1fr) auto;
  gap: 5px 12px;
  padding: 11px;
  border: 2px solid var(--ink);
  border-left-width: 7px;
  border-radius: 9px 12px 8px 10px;
  background: white;
  font-size: 0.76rem;
}

.problem-attempt-row.is-correct {
  border-left-color: var(--mint);
}

.problem-attempt-row.is-corrected {
  border-left-color: var(--yellow);
}

.problem-attempt-row.is-revealed {
  border-left-color: var(--coral);
}

.problem-attempt-row.is-interrupted {
  border-left-color: var(--coral);
  background: #fff1e8;
}
.problem-attempt-row time {
  font-weight: 900;
}

.problem-attempt-row span {
  color: #58708e;
  font-weight: 800;
}

.adult-settings-panel {
  max-width: 680px;
}

.adult-gate-note,
.deletion-warning {
  margin: 15px 0;
  padding: 13px 15px;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  background: #fff4cb;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.65;
}

.deletion-warning.is-account {
  border-color: #a43e31;
  background: #fff0ec;
}

.deletion-warning h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.deletion-warning p {
  margin: 0;
}

.settings-menu,
.management-list {
  display: grid;
  gap: 11px;
  margin-top: 18px;
}

.settings-menu button,
.management-row {
  width: 100%;
  min-height: 64px;
  padding: 13px 15px;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  background: white;
}

.settings-menu button {
  display: grid;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
}

.settings-menu button strong {
  font-size: 1rem;
}

.settings-menu button span,
.management-row small {
  color: #58708e;
  font-size: 0.74rem;
  font-weight: 800;
}

.management-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.management-row-info {
  display: grid;
  gap: 4px;
}

.management-row-action,
.secondary-button {
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 8px 10px;
  background: #eef5ff;
  cursor: pointer;
  font-weight: 900;
  touch-action: manipulation;
}

.trash-link-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.destructive-form {
  padding-top: 16px;
  border-top: 2px dashed rgba(164, 62, 49, 0.35);
}

.danger-button {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  border: 3px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  background: #ff8b78;
  box-shadow: 3px 4px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  touch-action: manipulation;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.danger-text-button {
  display: block;
  min-height: 44px;
  margin: 18px auto 0;
  border: 0;
  background: transparent;
  color: #a43e31;
  cursor: pointer;
  font-weight: 900;
  text-decoration: underline;
  touch-action: manipulation;
}

.deletion-mode-options {
  display: grid;
  gap: 9px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.deletion-mode-options label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px 13px 8px 11px;
  background: white;
  cursor: pointer;
  touch-action: manipulation;
}

.deletion-mode-options label:has(input:checked) {
  background: #fff0ec;
  box-shadow: 2px 3px 0 var(--ink);
}

.deletion-mode-options input {
  width: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--coral);
}

.deletion-mode-options span {
  display: grid;
  gap: 2px;
}

.deletion-mode-options small {
  color: #58708e;
  font-size: 0.72rem;
}

.deletion-mode-options .immediate-deletion-note {
  color: #a43e31;
  font-weight: 800;
  line-height: 1.45;
}

.diagnosis-panel {
  max-width: 650px;
}

.start-method-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.start-method-card {
  position: relative;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 11px 15px 10px 13px;
  background: white;
}

.start-method-card.is-recommended {
  background: #fffaf0;
  box-shadow: 3px 4px 0 rgba(32, 50, 77, 0.16);
}

.start-method-card h3 {
  margin: 0 0 7px;
  font-size: 1.04rem;
}

.start-method-card p {
  margin: 0 0 13px;
  color: #58708e;
  font-size: 0.82rem;
  line-height: 1.65;
}

.start-method-card > label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.84rem;
  font-weight: 900;
}

.start-method-card > button {
  width: 100%;
  margin-top: 12px;
}

.start-method-badge {
  display: inline-block;
  margin: 0 0 7px !important;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  border-radius: 7px 10px 6px 9px;
  background: var(--yellow);
  color: var(--ink) !important;
  font-size: 0.7rem !important;
  font-weight: 900;
}

.diagnosis-grade-fieldset {
  margin-top: 16px;
}

.diagnosis-grade-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.diagnosis-grade-options label {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px 13px 8px 11px;
  background: white;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 900;
  touch-action: manipulation;
}

.diagnosis-grade-options label:has(input:checked) {
  background: #fff0bf;
  box-shadow: 3px 4px 0 var(--ink);
}

.diagnosis-grade-options input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--coral);
}

.diagnosis-game-screen .game-status {
  align-items: center;
}

.diagnosis-game-screen .question-card {
  margin-top: 20px;
}

.diagnosis-panel .text-button + .text-button {
  margin-top: 4px;
}

@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  .notebook {
    min-height: calc(100vh - 10px);
    padding: 18px 10px 32px 6px;
    border-width: 2px;
    border-radius: 16px 10px 14px 11px;
    background:
      linear-gradient(90deg, transparent 37px, rgba(255, 118, 95, 0.2) 38px, transparent 40px),
      repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 35px,
        var(--line) 36px,
        transparent 37px
      ),
      var(--paper);
  }

  .notebook::before {
    left: 5px;
    width: 13px;
  }

  .page-header,
  .panel,
  .game-screen {
    margin-left: 20px;
  }

  .panel {
    padding: 15px 12px;
  }

  .page-header {
    margin-bottom: 20px;
  }

  .stage-heading {
    gap: 9px;
  }

  .stage-heading > :first-child {
    flex: 1 1 145px;
  }

  .setup-heading-actions {
    min-width: 78px;
  }

  .small-text-button {
    min-width: 44px;
    padding-right: 6px;
    padding-left: 6px;
  }

  .child-row {
    grid-template-columns: minmax(0, 1fr) 68px;
    gap: 7px;
  }

  .child-select-button {
    min-height: 58px;
    gap: 7px;
    padding: 10px 11px;
    font-size: 1rem;
  }

  .child-select-button::after {
    content: "▶";
    font-size: 0.7rem;
  }

  .child-history-button {
    min-width: 0;
    padding: 7px 5px;
  }

  #setup-screen #start-button {
    position: sticky;
    z-index: 5;
    bottom: 7px;
  }

  .question-card {
    min-height: 119px;
    padding: 18px 14px;
  }

  .keypad {
    gap: 7px;
  }

  .detailed-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-card-heading,
  .history-card-facts {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .mastery-stage-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .accuracy-time-layout {
    grid-template-columns: 1fr;
  }

  .trend-chart {
    min-height: 156px;
    padding-right: 5px;
    padding-left: 5px;
  }

  .trend-day {
    height: 130px;
  }

  .diagnosis-grade-options {
    grid-template-columns: 1fr;
  }

  .notebook:has(#game-screen:not([hidden])) .page-header,
  .notebook:has(#diagnosis-game-screen:not([hidden])) .page-header {
    margin-bottom: 10px;
  }

  .notebook:has(#game-screen:not([hidden])) .page-header .eyebrow,
  .notebook:has(#game-screen:not([hidden])) .page-header .lead,
  .notebook:has(#diagnosis-game-screen:not([hidden])) .page-header .eyebrow,
  .notebook:has(#diagnosis-game-screen:not([hidden])) .page-header .lead {
    display: none;
  }

  .notebook:has(#game-screen:not([hidden])) .page-header h1,
  .notebook:has(#diagnosis-game-screen:not([hidden])) .page-header h1 {
    margin: 0;
    font-size: 1.55rem;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 1.72rem;
  }

  h2 {
    font-size: 1.28rem;
    line-height: 1.28;
  }

  .eyebrow,
  .section-label {
    letter-spacing: 0.035em;
  }

  .stage-heading {
    flex-wrap: wrap;
  }

  .stage-heading .small-text-button {
    margin-left: auto;
  }

  .setup-heading-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, auto));
    justify-content: end;
    justify-items: stretch;
  }

  .setup-heading-actions > :only-child {
    grid-column: 1 / -1;
  }

  .game-status {
    gap: 8px;
  }

  .game-actions {
    min-width: 76px;
  }

  .timer {
    min-width: 76px;
    padding-right: 7px;
    padding-left: 7px;
  }

  .question {
    font-size: clamp(2.25rem, 13vw, 3.25rem);
  }

  .answer-display {
    font-size: clamp(2.25rem, 13vw, 3.25rem);
  }

  .duration-options {
    gap: 6px;
  }

  .duration-option label {
    padding: 4px;
  }

  .practice-breakdown-list {
    grid-template-columns: 1fr;
  }

  .detailed-period-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Registration-free Web experience */
.guest-start-panel {
  width: min(100%, 760px);
}

.guest-start-lead {
  max-width: 620px;
  padding-right: 86px;
}

.guest-mode-options {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  align-items: start;
  gap: 16px;
  margin-top: 24px;
}

.guest-mode-options.is-web-only {
  grid-template-columns: minmax(0, 1fr);
}

.guest-mode-card {
  min-width: 0;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 14px 18px 13px 16px;
  background: #fff7dc;
  box-shadow: 4px 5px 0 rgba(32, 50, 77, 0.2);
}

.guest-mode-card.is-print {
  background: #e3f8f2;
  transform: rotate(0.35deg);
}

.guest-mode-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.guest-mode-heading h3,
.guest-mode-heading p {
  margin-bottom: 0;
}

.guest-mode-icon {
  display: inline-flex;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 12px 9px 13px 10px;
  background: var(--paper);
  box-shadow: 2px 3px 0 var(--ink);
  font-size: 1.25rem;
  font-weight: 900;
}

.guest-stage-fields {
  display: grid;
  gap: 11px;
}

.guest-stage-fields label {
  display: grid;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 900;
}

.guest-stage-description {
  min-height: 3.2em;
  margin: 13px 0 0;
  color: #4d6581;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.6;
}

.guest-mode-card .primary-button {
  margin-top: 14px;
}

.guest-print-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  text-decoration: none;
}

.registration-benefit-card {
  margin-top: 22px;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 15px 11px 17px 13px;
  background: #eee8ff;
  box-shadow: 4px 5px 0 rgba(32, 50, 77, 0.2);
  text-align: left;
}

.registration-benefit-card h3 {
  margin-bottom: 11px;
}

.registration-benefit-card ul {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 8px;
  list-style: none;
}

.registration-benefit-card li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-weight: 800;
  line-height: 1.55;
}

.registration-benefit-card li span {
  display: inline-flex;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #dff7f0;
  font-size: 0.72rem;
  box-shadow: 1px 2px 0 var(--ink);
}

.registration-benefit-card .primary-button {
  margin-top: 16px;
}

.registration-benefit-card > p:last-child {
  margin: 12px 0 0;
  color: #526b87;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.55;
}

.registration-benefit-card.is-result {
  margin-bottom: 20px;
}

@media (max-width: 620px) {
  .guest-start-panel .mode-back-button {
    position: static;
    width: fit-content;
    margin: 0 0 16px auto;
  }

  .guest-start-lead {
    padding-right: 0;
  }

  .guest-mode-options {
    grid-template-columns: 1fr;
  }

  .guest-mode-card.is-print {
    transform: none;
  }
}

@media (min-width: 900px) {
  .notebook:has(#game-screen:not([hidden])) {
    width: min(100%, 1080px);
  }

  #game-screen:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
    grid-template-rows: auto auto auto auto;
    align-items: start;
    gap: 0 26px;
  }

  #game-screen .game-status,
  #game-screen .finish-note {
    grid-column: 1 / -1;
  }

  #game-screen .game-status {
    grid-row: 1;
  }

  #game-screen .finish-note {
    grid-row: 2;
  }

  #game-screen .question-card {
    grid-column: 1;
    grid-row: 3;
    margin-top: 18px;
  }

  #game-screen .feedback {
    grid-column: 1;
    grid-row: 4;
  }

  #game-screen .keypad {
    grid-column: 2;
    grid-row: 3;
    margin-top: 18px;
  }

  #game-screen #continue-button {
    grid-column: 2;
    grid-row: 4;
    margin-top: 0;
  }

  .notebook:has(#history-screen:not([hidden])),
  .notebook:has(#session-detail-screen:not([hidden])),
  .notebook:has(#problem-detail-screen:not([hidden])) {
    width: min(100%, 1120px);
  }

  .notebook:has(#children-screen:not([hidden])) {
    width: min(100%, 940px);
  }

  #children-screen .children-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #history-simple-panel .history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #history-detailed-panel:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 0 22px;
  }

  #history-detailed-panel > .detailed-period-options,
  #history-detailed-panel > .history-intro,
  #history-detailed-panel > .detailed-overview {
    grid-column: 1 / -1;
  }

  #history-detailed-panel > .analytics-section {
    min-width: 0;
  }

  #history-detailed-panel > .analytics-section.is-wide {
    grid-column: 1 / -1;
  }

  .session-answer-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
/* Fraction questions */
.fraction-calculation {
  width: 100%;
  padding: 18px 8px 8px;
  text-align: center;
}

.fraction-expression {
  display: flex;
  min-height: 126px;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.4vw, 20px);
  color: var(--ink);
  font-size: clamp(1.45rem, 6vw, 2.35rem);
  font-weight: 800;
}

.fraction-model {
  display: grid;
  width: min(310px, 90%);
  height: 52px;
  margin: 0 auto 10px;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(32, 50, 77, 0.18);
}

.fraction-model-prompt {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

.fraction-model-part + .fraction-model-part {
  border-left: 2px solid var(--ink);
}

.fraction-model-part.is-filled {
  background: var(--yellow);
}

.stacked-fraction {
  display: inline-grid;
  min-width: 52px;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  line-height: 1.05;
  vertical-align: middle;
}

.fraction-numerator,
.fraction-denominator,
.fraction-answer-part {
  display: flex;
  min-width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
}

.fraction-numerator,
.stacked-fraction .fraction-answer-part:first-child {
  border-bottom: 3px solid var(--ink);
}

.fraction-answer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

button.fraction-answer-part {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1.35rem;
  touch-action: manipulation;
}

button.fraction-answer-part.is-active {
  background: #fff2bd;
  box-shadow: 3px 3px 0 var(--ink);
}

.fraction-input-note {
  margin: 8px 0 0;
  color: #55708f;
  font-size: 0.9rem;
  font-weight: 700;
}

.fraction-work-row {
  display: flex;
  flex-wrap: wrap;
  min-height: 96px;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.4vw, 20px);
  color: var(--ink);
  font-size: clamp(1.35rem, 5.5vw, 2.1rem);
  font-weight: 800;
}

.fraction-expression-pairs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  flex-basis: 100%;
  font-size: 1rem;
}

.fraction-expression-pairs button[aria-pressed="true"] {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

@media (max-width: 360px) {
  .fraction-expression {
    gap: 6px;
    font-size: 1.3rem;
  }

  .stacked-fraction {
    min-width: 46px;
  }
}
/* Public-page footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  padding: 14px 20px 28px;
}

.site-footer a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--ink);
  font-weight: 800;
}

/* Service landing page */
.home-only {
  display: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup h1,
.brand-lockup .lead {
  margin-bottom: 0;
}

.header-account-actions {
  position: absolute;
  z-index: 6;
  top: 3px;
  right: 0;
  display: flex;
  max-width: calc(100% - 250px);
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-account-button,
.header-logout-button {
  min-height: 44px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  touch-action: manipulation;
}

.header-account-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 2px solid var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: #eef5ff;
  box-shadow: 2px 3px 0 var(--ink);
}

.header-account-button svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: currentColor;
}

.header-logout-button {
  padding: 7px 3px;
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.header-account-button:hover,
.header-account-button:focus-visible {
  transform: translateY(-1px);
}

.parent-home-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.parent-home-list .child-select-button {
  width: 100%;
}

.parent-home-list .child-select-button::after {
  content: "きろく";
}

.unknown-answer-button {
  display: block;
  width: min(100%, 360px);
  min-height: 46px;
  margin: 12px auto 0;
  padding: 8px 16px;
  border: 2px dashed var(--ink);
  border-radius: 10px 13px 9px 11px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  touch-action: manipulation;
}

.unknown-answer-button:hover,
.unknown-answer-button:focus-visible {
  background: #eef5ff;
}

.unknown-answer-note {
  margin: 7px 0 0;
  color: #58708e;
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 760px) {
  .page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .header-account-actions {
    position: static;
    width: 100%;
    max-width: none;
    margin-top: 12px;
    flex-wrap: wrap;
  }

  .home-showcase {
    flex-basis: 100%;
  }
}

@media (max-width: 420px) {
  .header-account-actions {
    gap: 6px;
  }

  .header-account-button,
  .header-logout-button {
    min-height: 42px;
    font-size: 0.74rem;
  }

  .header-account-button {
    padding-right: 8px;
    padding-left: 8px;
  }

  .header-account-button svg {
    width: 18px;
    height: 18px;
  }
}

.brand-mark {
  position: relative;
  display: block;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  border: 3px solid var(--ink);
  border-radius: 18px 14px 19px 13px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
}

.brand-mark-loop {
  position: absolute;
  top: 13px;
  left: 11px;
  width: 25px;
  height: 25px;
  border: 5px solid var(--ink);
  border-radius: 50%;
}

.brand-mark-loop::after {
  position: absolute;
  right: -13px;
  bottom: -7px;
  width: 17px;
  height: 5px;
  border-radius: 4px;
  background: var(--ink);
  content: "";
  transform: rotate(-43deg);
}

.brand-mark-step {
  position: absolute;
  right: 7px;
  bottom: 8px;
  width: 7px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--coral);
}

.brand-mark-step.is-one { height: 8px; }
.brand-mark-step.is-two { right: 15px; height: 14px; background: var(--mint); }
.brand-mark-step.is-three { right: 23px; height: 20px; background: var(--blue); }

.notebook:has(#auth-screen:not([hidden])),
.notebook:has(#home-screen:not([hidden])),
.notebook:has(#loading-screen:not([hidden])) {
  width: min(100%, 1120px);
}

.notebook:has(#auth-screen:not([hidden])) .home-only,
.notebook:has(#home-screen:not([hidden])) .home-only,
.notebook:has(#loading-screen:not([hidden])) .home-only {
  display: block;
}

.notebook:has(#auth-screen:not([hidden])) .app-only,
.notebook:has(#home-screen:not([hidden])) .app-only,
.notebook:has(#loading-screen:not([hidden])) .app-only {
  display: none;
}

.home-hero {
  margin-top: clamp(30px, 5vw, 58px);
}

.home-kicker {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px 11px 7px 10px;
  background: #dff7f0;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  transform: rotate(-1deg);
}

.home-hero h2 {
  max-width: 620px;
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3.05rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.home-highlight {
  position: relative;
  z-index: 0;
  white-space: nowrap;
}

.home-highlight::after {
  position: absolute;
  z-index: -1;
  right: -5px;
  bottom: 1px;
  left: -5px;
  height: 0.38em;
  border-radius: 5px 9px 4px 8px;
  background: var(--yellow);
  content: "";
  transform: rotate(-1deg);
}

.home-description {
  max-width: 610px;
  margin-bottom: 20px;
  color: #425b79;
  font-size: clamp(0.98rem, 2vw, 1.08rem);
  font-weight: 700;
  line-height: 1.85;
}

.home-benefits {
  display: grid;
  margin: 0 0 22px;
  padding: 0;
  gap: 9px;
  list-style: none;
}

.home-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.home-benefits li > span {
  display: inline-flex;
  width: 27px;
  height: 27px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-size: 0.78rem;
  box-shadow: 2px 2px 0 var(--ink);
}

.home-benefits li:nth-child(1) > span { background: #ffd9d2; }
.home-benefits li:nth-child(2) > span { background: #dff7f0; }
.home-benefits li:nth-child(3) > span { background: #eee7ff; }

.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.home-start-link {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 11px 24px;
  border: 3px solid var(--ink);
  border-radius: 11px 14px 10px 13px;
  background: var(--coral);
  color: var(--ink);
  box-shadow: 4px 5px 0 var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
  text-decoration: none;
}

.home-actions .print-entry-link {
  min-height: 52px;
  margin-top: 0;
}

.home-start-link:hover,
.home-start-link:focus-visible {
  transform: translateY(-2px);
}

.home-secondary-link {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border: 3px solid var(--ink);
  border-radius: 13px 10px 14px 11px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 4px 0 rgba(32, 50, 77, 0.24);
  font-size: 0.96rem;
  font-weight: 900;
  touch-action: manipulation;
}

.home-secondary-link:hover,
.home-secondary-link:focus-visible {
  background: #eef5ff;
  transform: translateY(-2px);
}

.home-guest-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 19px;
}

.home-guest-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 7px 0;
  border: 0;
  border-bottom: 2px solid currentcolor;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
  touch-action: manipulation;
}

.home-guest-link:hover,
.home-guest-link:focus-visible {
  color: #2f67b7;
}

.home-small-note {
  margin: 14px 0 0 3px;
  color: #58708e;
  font-size: 0.8rem;
  font-weight: 800;
}

.home-visual {
  position: relative;
  min-height: 220px;
  margin-top: 34px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 20px 13px 24px 16px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 35px, rgba(75, 136, 229, 0.13) 36px 37px),
    #f6fbff;
  box-shadow: 5px 6px 0 var(--ink);
}

.home-visual-loop {
  position: absolute;
  top: 42px;
  right: 90px;
  width: 210px;
  height: 114px;
  border: 13px solid rgba(72, 201, 176, 0.45);
  border-left-color: rgba(255, 118, 95, 0.44);
  border-radius: 50%;
  transform: rotate(-10deg);
}

.math-card {
  position: absolute;
  display: flex;
  min-width: 138px;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 14px;
  border: 3px solid var(--ink);
  border-radius: 10px 15px 9px 13px;
  background: var(--paper);
  font-size: 1.04rem;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--ink);
}

.math-card span {
  display: inline-flex;
  min-width: 42px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-size: 1.2rem;
}

.math-card.is-add { top: 23px; left: 28px; transform: rotate(-3deg); }
.math-card.is-carry { top: 112px; left: 118px; transform: rotate(2deg); }
.math-card.is-fraction { top: 31px; right: 24px; transform: rotate(3deg); }
.math-card.is-fraction span { background: #eee7ff; }
.math-card.is-carry span { background: #dff7f0; }

.growth-steps {
  position: absolute;
  right: 26px;
  bottom: 28px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.growth-step {
  display: inline-flex;
  width: 72px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-size: 0.65rem;
  font-weight: 900;
}

.growth-step.is-one { height: 34px; background: #ffd9d2; }
.growth-step.is-two { height: 52px; background: #fff0bf; }
.growth-step.is-three { height: 70px; background: #dff7f0; }

.home-visual > p {
  position: absolute;
  bottom: 10px;
  left: 24px;
  margin: 0;
  font-size: 0.77rem;
  font-weight: 900;
}

.auth-panel {
  overflow: hidden;
}

.auth-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 9px;
  background: repeating-linear-gradient(90deg, var(--coral) 0 25%, var(--yellow) 25% 50%, var(--mint) 50% 75%, var(--blue) 75% 100%);
  content: "";
}

.auth-panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.auth-panel-heading h2,
.auth-panel-heading .section-label {
  margin-bottom: 0;
}

.auth-panel-icon {
  display: inline-flex;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 12px 9px 13px 10px;
  background: #fff0bf;
  font-size: 1.4rem;
  box-shadow: 3px 3px 0 var(--ink);
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 15px 0;
}

.auth-points span {
  padding: 4px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 7px 9px 6px 8px;
  background: #eef5ff;
  font-size: 0.72rem;
  font-weight: 900;
}

.auth-points span:nth-child(2) { background: #fff0bf; }
.auth-points span:nth-child(3) { background: #dff7f0; }

.auth-privacy-note {
  margin: 14px 0 0;
  color: #58708e;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.65;
}

.profile-edit-card {
  margin-bottom: 22px;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 11px 14px 10px 13px;
  background: #eef5ff;
  box-shadow: 3px 3px 0 rgba(32, 50, 77, 0.2);
}

.profile-edit-card h3 { margin: 0 0 5px; }
.profile-edit-card > p {
  margin: 0 0 12px;
  color: #4f6784;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.6;
}

.compact-account-form { gap: 8px; }

@media (min-width: 900px) {
  .notebook:has(#auth-screen:not([hidden])),
  .notebook:has(#loading-screen:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
    align-items: center;
    column-gap: clamp(28px, 4vw, 54px);
  }

  .notebook:has(#auth-screen:not([hidden])) .page-header,
  .notebook:has(#loading-screen:not([hidden])) .page-header {
    grid-column: 1;
    margin-bottom: 0;
  }

  .notebook:has(#auth-screen:not([hidden])) #auth-screen,
  .notebook:has(#loading-screen:not([hidden])) #loading-screen {
    grid-column: 2;
    margin-left: 0;
  }

  .home-visual { min-height: 242px; }
}

@media (max-width: 899px) {
  .home-hero h2 { max-width: 680px; }

  .notebook:has(#auth-screen:not([hidden])) #auth-screen,
  .notebook:has(#loading-screen:not([hidden])) #loading-screen {
    margin-top: 34px;
  }
}

@media (max-width: 600px) {
  .brand-mark {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
    border-radius: 14px 11px 15px 10px;
  }

  .brand-mark-loop {
    top: 10px;
    left: 8px;
    transform: scale(0.82);
    transform-origin: top left;
  }

  .brand-mark-step { display: none; }
  .home-hero { margin-top: 28px; }
  .home-hero h2 { font-size: clamp(1.75rem, 9.5vw, 2.65rem); }
  .home-description { line-height: 1.72; }

  .home-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .home-start-link,
  .home-secondary-link,
  .home-actions .print-entry-link {
    width: 100%;
    justify-content: center;
  }

  .home-visual { min-height: 200px; }

  .math-card {
    min-width: 115px;
    min-height: 61px;
    gap: 8px;
    padding: 9px;
    font-size: 0.82rem;
  }

  .math-card span {
    min-width: 35px;
    min-height: 35px;
    font-size: 1rem;
  }

  .math-card.is-add { top: 18px; left: 15px; }
  .math-card.is-carry { top: 91px; left: 58px; }
  .math-card.is-fraction { top: 22px; right: 12px; }

  .growth-steps { right: 13px; bottom: 18px; }
  .growth-step { width: 54px; font-size: 0.55rem; }

  .home-visual > p {
    bottom: 8px;
    left: 12px;
    max-width: 150px;
    font-size: 0.63rem;
  }
}

@media (max-width: 390px) {
  .home-visual { min-height: 172px; }
  .math-card.is-fraction,
  .growth-steps { display: none; }

  .home-visual-loop {
    top: 31px;
    right: 10px;
    width: 135px;
    height: 86px;
  }

  .math-card.is-carry { top: 84px; left: 85px; }
}

/* Illustration-led landing page */
.home-showcase,
.home-picture-features {
  display: none;
}

.notebook:has(#auth-screen:not([hidden])),
.notebook:has(#home-screen:not([hidden])),
.notebook:has(#loading-screen:not([hidden])) {
  display: block;
  width: min(100%, 1180px);
}

.notebook:has(#auth-screen:not([hidden])) .page-header,
.notebook:has(#home-screen:not([hidden])) .page-header,
.notebook:has(#loading-screen:not([hidden])) .page-header {
  margin-bottom: 0;
}

.notebook:has(#auth-screen:not([hidden])) .home-showcase,
.notebook:has(#home-screen:not([hidden])) .home-showcase,
.notebook:has(#loading-screen:not([hidden])) .home-showcase {
  display: grid;
}

.notebook:has(#loading-screen:not([hidden])) #guest-home-content,
.notebook:has(#loading-screen:not([hidden])) #member-home-content {
  visibility: hidden;
  pointer-events: none;
}

.home-showcase {
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  align-items: center;
  gap: clamp(22px, 4vw, 54px);
  margin-top: clamp(28px, 4vw, 48px);
}

.home-showcase .home-hero {
  margin-top: 0;
}

.home-showcase .home-hero h2 {
  margin-bottom: 18px;
  font-size: clamp(2.15rem, 3.7vw, 3.2rem);
  line-height: 1.18;
}

.home-showcase .home-description {
  margin-bottom: 22px;
  font-size: clamp(0.96rem, 1.6vw, 1.08rem);
  line-height: 1.8;
}

.home-showcase .home-visual {
  min-height: 0;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: rotate(0.5deg);
}

.home-visual img {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--ink);
  border-radius: 22px 14px 24px 16px;
  background: var(--paper);
  box-shadow: 6px 7px 0 var(--ink);
}

.notebook:has(#auth-screen:not([hidden])) #auth-screen,
.notebook:has(#loading-screen:not([hidden])) #loading-screen {
  width: min(calc(100% - 72px), 680px);
  margin: clamp(34px, 5vw, 54px) auto 0;
}

.notebook:has(#auth-screen:not([hidden])) .home-picture-features,
.notebook:has(#home-screen:not([hidden])) .home-picture-features,
.notebook:has(#loading-screen:not([hidden])) .home-picture-features {
  display: grid;
}

.home-picture-features {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 72px), 940px);
  margin: clamp(28px, 4vw, 44px) auto 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.home-picture-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 12px 17px 12px 12px;
  border: 2px solid var(--ink);
  border-radius: 16px 11px 18px 13px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 4px 4px 0 rgba(32, 50, 77, 0.2);
}

.home-picture-card:nth-child(2) {
  transform: rotate(0.6deg);
}

.home-picture-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px 8px 13px 10px;
}

.home-picture-card h3 {
  margin: 0 0 6px;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.home-picture-card p {
  margin: 0;
  color: #4a627f;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.65;
}

@media (min-width: 760px) {
  .auth-panel .account-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .auth-panel .account-form label {
    grid-column: 1 / -1;
  }

  .auth-panel .account-form .primary-button {
    min-width: 220px;
  }
}

@media (max-width: 820px) {
  .home-showcase {
    grid-template-columns: 1fr;
  }

  .home-showcase .home-visual {
    width: min(100%, 650px);
    margin: 0 auto;
  }

  .home-showcase .home-hero {
    text-align: center;
  }

  .home-showcase .home-description {
    margin-right: auto;
    margin-left: auto;
  }

  .home-showcase .home-actions {
    justify-content: center;
  }

  .home-showcase .home-guest-actions {
    justify-content: center;
  }

  .home-showcase .home-small-note {
    text-align: center;
  }

  .home-picture-features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .notebook:has(#auth-screen:not([hidden])) #auth-screen,
  .notebook:has(#loading-screen:not([hidden])) #loading-screen,
  .home-picture-features {
    width: calc(100% - 20px);
    margin-left: 20px;
  }

  .home-showcase {
    gap: 26px;
  }

  .home-showcase .home-hero {
    text-align: left;
  }

  .home-showcase .home-hero h2 {
    font-size: clamp(1.85rem, 10vw, 2.55rem);
  }

  .home-showcase .home-description {
    margin-left: 0;
  }

  .home-showcase .home-actions {
    justify-content: flex-start;
  }

  .home-showcase .home-guest-actions {
    display: grid;
    justify-content: stretch;
  }

  .home-showcase .home-small-note {
    text-align: left;
  }

  .home-picture-card {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 11px 9px 9px;
  }

  .home-picture-card p {
    font-size: 0.78rem;
  }
}

@media (max-width: 350px) {
  .home-picture-card {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .home-picture-card p {
    font-size: 0.73rem;
  }
}

/* Simplified navigation and learning setup */
.brand-home-link {
  width: fit-content;
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

.brand-home-link:hover h1,
.brand-home-link:focus-visible h1 {
  text-decoration: underline;
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 0.22em;
  text-underline-offset: -0.08em;
}

.brand-home-link:focus-visible {
  outline: 4px solid rgba(75, 136, 229, 0.32);
  outline-offset: 7px;
  border-radius: 12px;
}

.learning-mode-panel {
  text-align: center;
}

.mode-back-button {
  position: absolute;
  top: 15px;
  right: 18px;
}

.learning-mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.learning-mode-card {
  display: flex;
  min-width: 0;
  min-height: 136px;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 14px 18px 13px 16px;
  color: var(--ink);
  background: #fff1bf;
  box-shadow: 4px 5px 0 var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  text-decoration: none;
  touch-action: manipulation;
}

.learning-mode-card.is-print {
  background: #dff7f0;
  transform: rotate(0.4deg);
}

.learning-mode-card:hover,
.learning-mode-card:focus-visible {
  transform: translateY(-2px);
}

.learning-mode-card.is-print:hover,
.learning-mode-card.is-print:focus-visible {
  transform: rotate(0.4deg) translateY(-2px);
}

.learning-mode-icon {
  display: inline-flex;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 14px 10px 15px 11px;
  background: var(--paper);
  font-size: 1.45rem;
  box-shadow: 3px 3px 0 var(--ink);
}

.learning-mode-card strong,
.learning-mode-card small {
  display: block;
}

.learning-mode-card strong {
  margin-bottom: 7px;
  font-size: 1.12rem;
}

.learning-mode-card small {
  color: #4d6581;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.55;
}

#setup-screen .stage-heading {
  display: block;
  padding-right: 58px;
}

#setup-screen .setup-heading-actions {
  margin-top: 12px;
  justify-items: start;
}

.setup-stage-heading {
  margin: 0;
}

.setup-stage-number {
  display: block;
  color: #3a649c;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.3;
  white-space: nowrap;
}

.setup-stage-title {
  display: block;
  margin-top: 7px;
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  line-height: 1.35;
  text-wrap: pretty;
}

.change-child-icon-button {
  position: absolute;
  z-index: 3;
  top: 15px;
  right: 16px;
  display: inline-flex;
  width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 9px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #eef5ff;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.change-child-icon-button svg {
  width: 25px;
  height: 25px;
  fill: currentColor;
}

.change-child-icon-button:hover,
.change-child-icon-button:focus-visible {
  transform: translateY(-2px);
}

@media (max-width: 560px) {
  .learning-mode-options {
    grid-template-columns: 1fr;
  }

  .learning-mode-card {
    min-height: 108px;
  }
}

@media (max-width: 360px) {
  #setup-screen .setup-heading-actions {
    width: auto;
    grid-template-columns: 1fr;
    justify-content: start;
  }

  .setup-stage-title {
    font-size: 1.5rem;
  }
}
