:root {
  --ink: #102331;
  --muted: #526b7a;
  --paper: #eef5f9;
  --line: #c8d8e2;
  --blue: #42b8e8;
  --blue-dark: #0f80b3;
  --blue-soft: #e8f7fd;
  --green: #77d39a;
  --yellow: #f6c24a;
  --red: #d95045;
  --touch: 48px;
  --radius: 10px;
  --shadow: 0 10px 24px rgba(15, 33, 49, 0.1);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

body { overflow: hidden; }

button,
input,
select { font: inherit; }

button {
  min-height: var(--touch);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 4px solid rgba(20, 155, 215, 0.35);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.app {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100vh;
  height: 100dvh;
  min-width: 320px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: #071018;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  width: 142px;
  height: auto;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-logo {
  display: inline-flex;
  border-radius: 6px;
}

.title-block { min-width: 0; }

h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.9rem);
  line-height: 1.05;
  font-weight: 800;
}

.title-subtitle {
  display: block;
  margin-top: 3px;
  color: #b9d4e5;
  font-size: 0.8rem;
  font-weight: 700;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: end;
  flex-wrap: wrap;
}

.icon-button {
  width: var(--touch);
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #122436;
  color: #ffffff;
  border-color: #263d51;
}

.icon-button:hover,
.icon-button[aria-pressed="true"] {
  background: var(--blue);
  border-color: #8fd8f3;
  color: #06111a;
}

.home-button {
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 2px solid #263d51;
  border-radius: var(--radius);
  background: #122436;
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.home-button:hover,
.home-button:focus-visible {
  background: var(--blue);
  border-color: #8fd8f3;
  color: #06111a;
}

.icon {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}

#fdpGridModel { display: contents; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(15, 33, 49, 0.06);
  z-index: 5;
}

.toolbar-left,
.toolbar-right,
.control-group,
.explore-controls,
.practise-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-left { flex: 1 1 700px; }

.toolbar-right {
  margin-left: auto;
  justify-content: end;
}

.control-label {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.88rem;
}

.wide-button,
.quick-button,
.primary-button {
  min-height: var(--touch);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: var(--line);
  background: #f8fbfd;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.quick-button {
  min-width: var(--touch);
  padding: 0 10px;
}

.primary-button,
.wide-button[aria-pressed="true"],
.quick-button[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue-dark);
  color: #06111a;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #edf4f8;
}

.segmented button {
  min-width: 86px;
  min-height: var(--touch);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 900;
}

.segmented button[aria-pressed="true"] {
  background: var(--blue);
  color: #06111a;
}

.count-input {
  width: 82px;
  min-height: var(--touch);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
}

.target-select { width: 132px; }

.tool-menu { position: relative; }

.tool-menu summary {
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfd;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
  white-space: nowrap;
  user-select: none;
}

.tool-menu summary::-webkit-details-marker { display: none; }

.menu-panel {
  width: max-content;
  max-width: min(360px, calc(100vw - 36px));
  padding: 10px;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.workspace {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background:
    linear-gradient(#dce8f0 1px, transparent 1px),
    linear-gradient(90deg, #dce8f0 1px, transparent 1px);
  background-size: 34px 34px;
}

.stage {
  width: min(760px, 100%);
  margin: 0 auto;
  transform-origin: top center;
}

.stage.is-comparing { width: min(1120px, 100%); }

.purpose-card,
.challenge-card {
  min-height: 76px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.purpose-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #071018;
  color: #ffffff;
  font-weight: 900;
}

.purpose-card strong,
.purpose-card span { display: block; }

.purpose-action { justify-self: end; }

.purpose-card strong {
  margin-bottom: 4px;
  font-size: 1.08rem;
}

.purpose-card span {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.3;
}

.challenge-card {
  border-color: #e0b13c;
  background: #fff5d8;
}

.target-badge {
  min-width: 76px;
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: #071018;
  color: #ffffff;
  font-size: 1.55rem;
  font-weight: 900;
}

.challenge-title {
  margin: 0 0 4px;
  font-size: 1.12rem;
  font-weight: 900;
}

.challenge-text {
  margin: 0;
  color: #5f4600;
  font-weight: 800;
}

.streak {
  min-width: 92px;
  min-height: var(--touch);
  display: grid;
  place-items: center;
  padding: 6px 10px;
  border: 2px solid #e0b13c;
  border-radius: var(--radius);
  background: #ffffff;
  font-weight: 900;
  color: #6b4e00;
}

.grid-area {
  display: grid;
  align-items: start;
}

.grid-area.is-single {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.grid-area.is-comparing {
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  gap: 12px;
}

.grid-card {
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.grid-card.is-active {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 4px rgba(20, 155, 215, 0.2), var(--shadow);
}

.grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.grid-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-letter {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #071018;
  color: #ffffff;
  font-weight: 900;
}

.grid-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 900;
}

.grid-count {
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

.grid-body {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 14px;
}

.grid-area.is-single .grid-body {
  grid-template-columns: minmax(300px, 390px) minmax(260px, 1fr);
  align-items: center;
}

.hundred-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  width: min(100%, 470px);
}

.is-comparing .hundred-shell { width: min(100%, 370px); }

.hundred-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  aspect-ratio: 1;
  width: 100%;
  border: 3px solid #273848;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  touch-action: none;
}

.cell {
  min-width: 0;
  min-height: 0;
  border: 1px solid #9db4c0;
  border-radius: 0;
  background: #ffffff;
  color: transparent;
  padding: 0;
}

.cell:nth-child(10n) { border-right-width: 0; }
.cell:nth-child(n + 91) { border-bottom-width: 0; }

.show-tenths .cell:nth-child(10n + 1) {
  border-top-width: 3px;
  border-top-color: #273848;
}

.show-tenths .cell:nth-child(-n + 10) {
  border-top-width: 1px;
  border-top-color: #9db4c0;
}

.cell.is-filled {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0)),
    #48a8d8;
  box-shadow: inset 0 -3px 0 rgba(6, 17, 26, 0.12);
}

.cell.is-hint:not(.is-filled) { background: #fff1b3; }

.row-totals {
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  width: 38px;
  min-height: 100%;
}

.row-total {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.equivalence-panel {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.equivalence-heading {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.equivalence-sentence {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr) auto minmax(82px, 1fr) auto minmax(92px, 1fr);
  align-items: center;
  gap: 7px;
}

.grid-area.is-single .equivalence-sentence {
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
}

.grid-area.is-single .equivalence-panel { padding: 8px; }

.grid-area.is-single .equivalence-heading { margin-bottom: 5px; }

.grid-area.is-single .equivalence-term {
  min-height: 50px;
  gap: 2px;
  padding: 4px;
}

.grid-area.is-single .equivalence-label { font-size: 0.62rem; }

.grid-area.is-single .equivalence-value {
  min-height: 26px;
  font-size: 1.16rem;
}

.grid-area.is-single .equals-sign {
  min-height: 14px;
  font-size: 1.08rem;
  line-height: 14px;
  text-align: center;
}

.equivalence-term {
  min-width: 0;
  min-height: 72px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid #b9d4e5;
  border-radius: 8px;
  background: #ffffff;
}

.equivalence-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.equivalence-value {
  min-height: 32px;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.equals-sign {
  color: #34566a;
  font-size: 1.45rem;
  font-weight: 900;
}

.hidden-value {
  color: #7a8c98;
  font-size: 1.5rem;
}

.stacked-fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: stretch;
  min-width: 1.45em;
  color: inherit;
  font-size: 0.92em;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}

.fraction-numerator,
.fraction-denominator {
  display: block;
  padding: 0 0.15em;
  text-align: center;
}

.fraction-numerator { padding-bottom: 0.1em; }

.fraction-denominator {
  padding-top: 0.1em;
  border-top: 0.11em solid currentColor;
}

.compare-column {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 540px;
}

.compare-symbol {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow);
  font-size: 2rem;
  font-weight: 900;
}

.feedback {
  margin-top: 12px;
  min-height: 52px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.28;
  box-shadow: var(--shadow);
}

.feedback.good {
  border-color: #78b95f;
  background: #eef9e8;
  color: #22510f;
}

.feedback.try {
  border-color: #e0b13c;
  background: #fff8e6;
  color: #6a4300;
}

.feedback.bad {
  border-color: var(--red);
  background: #fff1ef;
  color: #7c2018;
}

.instructions-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: min(790px, calc(100vh - 32px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(6, 17, 26, 0.32);
}

.instructions-dialog::backdrop { background: rgba(6, 17, 26, 0.5); }

.instructions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #071018;
  color: #ffffff;
}

.instructions-header h2 {
  margin: 0;
  font-size: 1.22rem;
}

.instructions-body {
  max-height: calc(min(790px, 100vh - 32px) - 76px);
  overflow: auto;
  padding: 16px 18px 20px;
  line-height: 1.45;
}

.instructions-body h3 {
  margin: 16px 0 8px;
  font-size: 1.04rem;
}

.instructions-body h3:first-child { margin-top: 0; }

.instructions-body p,
.instructions-body ul { margin: 0 0 10px; }

.instructions-body li { margin-bottom: 6px; }

.print-logo,
.print-copyright { display: none; }

.print-only-duplicate { display: none; }

.fdp-worksheet-sheet { display: none; }

@media (max-width: 1120px) {
  body { overflow: auto; }

  .app {
    min-height: 100vh;
    height: auto;
  }

  .topbar { grid-template-columns: 1fr; }
  .top-actions { justify-content: start; }

  .grid-area.is-comparing {
    grid-template-columns: minmax(0, 1fr);
  }

  .compare-column {
    min-height: 0;
    grid-template-columns: auto auto;
    justify-content: center;
  }

  .is-comparing .hundred-shell { width: min(100%, 440px); }
}

@media (max-width: 760px) {
  .brand img { width: 116px; }
  .title-subtitle { display: none; }

  .toolbar,
  .toolbar-left,
  .toolbar-right,
  .explore-controls,
  .practise-controls,
  .control-group { width: 100%; }

  .toolbar-right {
    margin-left: 0;
    justify-content: start;
  }

  .mode-control .segmented { flex: 1; }

  .purpose-card,
  .challenge-card { grid-template-columns: auto minmax(0, 1fr); }

  .streak { grid-column: 1 / -1; }

  .equivalence-sentence {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-area.is-single .grid-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .equals-sign {
    min-height: 22px;
    line-height: 22px;
    text-align: center;
  }
}

@media (max-width: 460px) {
  .workspace { padding: 10px; }
  .grid-body { padding: 10px; }
  .hundred-shell { gap: 4px; }
  .row-totals { width: 32px; }
  .purpose-icon { display: none; }
  .purpose-card { grid-template-columns: 1fr; }
}

@page fdp-worksheet { size: A4 portrait; margin: 8mm; }

@media print {

  body {
    overflow: visible;
    background: #ffffff;
  }

  .topbar,
  .toolbar,
  .purpose-card,
  .challenge-card,
  .feedback,
  .instructions-dialog { display: none !important; }

  .app {
    display: block;
    height: auto;
  }

  .workspace {
    overflow: visible;
    padding: 0;
    background: #ffffff;
  }

  .stage,
  .stage.is-comparing {
    width: 100%;
    height: 190mm;
    min-height: 0;
    max-height: 190mm;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 3mm;
    overflow: hidden;
    transform: none !important;
    margin: 0 !important;
  }

  .grid-area {
    min-height: 0;
    align-items: stretch;
  }

  .grid-card {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    break-inside: avoid-page;
  }

  .grid-body {
    min-height: 0;
    align-content: center;
  }

  .hundred-grid,
  .hundred-grid .cell {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .hundred-grid .cell.is-filled {
    background: #48a8d8 !important;
    box-shadow: none;
  }

  .grid-area.is-single {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .grid-area.is-single .grid-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 8px;
  }

  .grid-area.is-single .print-only-duplicate { display: grid; }
  .grid-area.is-single .hundred-shell { width: min(100%, 430px); }
  .grid-area.is-single .equivalence-panel { padding: 7px; }
  .grid-area.is-single .equivalence-heading { display: none; }
  .grid-area.is-single .equivalence-sentence {
    grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr) auto minmax(82px, 1fr) auto minmax(92px, 1fr);
    gap: 7px;
  }
  .grid-area.is-single .equivalence-term { min-height: 58px; }
  .grid-area.is-single .equivalence-value { font-size: 1.05rem; }

  .grid-area.is-comparing {
    grid-template-columns: 1fr 42px 1fr;
    gap: 6px;
  }

  .grid-card,
  .compare-symbol { box-shadow: none; }

  .hundred-shell,
  .is-comparing .hundred-shell { width: min(100%, 420px); }

  .grid-area.is-comparing .hundred-shell { width: min(100%, 430px); }

  .grid-area.is-comparing .grid-body {
    gap: 7px;
    padding: 8px;
  }

  .grid-area.is-comparing .equivalence-panel { padding: 7px; }
  .grid-area.is-comparing .equivalence-heading { display: none; }
  .grid-area.is-comparing .equivalence-sentence {
    grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr) auto minmax(82px, 1fr) auto minmax(92px, 1fr);
    gap: 7px;
  }
  .grid-area.is-comparing .equivalence-term { min-height: 58px; }
  .grid-area.is-comparing .equivalence-value { font-size: 1.05rem; }

  .compare-column {
    min-width: 0;
    min-height: 0;
  }

  .grid-area.is-comparing .compare-symbol {
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
  }

  .print-logo {
    display: block;
    width: 145px;
    margin: 0;
  }

  .print-copyright {
    display: block;
    margin: 0;
    color: #000000;
    font-size: 10pt;
    font-weight: 700;
    text-align: right;
  }

  body:not([data-fdp-print-mode="worksheet"]) .fdp-worksheet-sheet {
    display: none !important;
  }

  html[data-spire-print-page="fdp-worksheet"],
  html[data-spire-print-page="fdp-worksheet"] body {
    page: fdp-worksheet;
    width: 194mm !important;
    height: 281mm !important;
    min-height: 0 !important;
    max-height: 281mm !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  body[data-fdp-print-mode="worksheet"] .app {
    display: block !important;
    width: 194mm !important;
    height: 281mm !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: 281mm !important;
    overflow: hidden !important;
  }

  body[data-fdp-print-mode="worksheet"] .topbar,
  body[data-fdp-print-mode="worksheet"] .toolbar,
  body[data-fdp-print-mode="worksheet"] .workspace,
  body[data-fdp-print-mode="worksheet"] .instructions-dialog {
    display: none !important;
  }

  body[data-fdp-print-mode="worksheet"] #fdpGridModel {
    width: 194mm;
    height: 281mm;
    overflow: hidden;
  }

  body[data-fdp-print-mode="worksheet"] .fdp-worksheet-sheet {
    page: fdp-worksheet;
    width: 194mm;
    height: 281mm;
    min-height: 0;
    display: grid !important;
    grid-template-rows: 13mm 7mm minmax(0, 1fr);
    gap: 2.5mm;
    overflow: hidden;
    color: #000000;
    background: #ffffff;
  }

  .fdp-worksheet-brand {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: 38mm minmax(0, 1fr) auto;
    gap: 5mm;
    align-items: end;
  }

  .fdp-worksheet-brand img {
    display: block;
    width: 34mm;
    height: auto;
  }

  .fdp-worksheet-brand h2 {
    margin: 0;
    font-size: 13pt;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }

  .fdp-worksheet-brand span {
    color: #4f5d75;
    font-size: 8pt;
    font-weight: 700;
    white-space: nowrap;
  }

  .fdp-worksheet-name {
    min-width: 0;
    display: flex;
    justify-content: space-between;
    gap: 12mm;
    margin: 0;
    font-size: 9pt;
    font-weight: 700;
    line-height: 7mm;
    white-space: nowrap;
  }

  .fdp-worksheet-panels {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 4mm;
    overflow: hidden;
  }

  .fdp-worksheet-panel {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 72mm minmax(0, 1fr);
    justify-items: center;
    gap: 2.5mm;
    padding: 2.5mm;
    border: 0.45mm solid #8296a3;
    border-radius: 2mm;
    overflow: hidden;
    break-inside: avoid-page;
    background: #ffffff;
  }

  .fdp-worksheet-grid {
    width: 72mm;
    height: 72mm;
    aspect-ratio: 1;
    border: 0.7mm solid #273848;
    border-radius: 0;
    touch-action: auto;
  }

  .fdp-worksheet-grid .cell {
    display: block;
    border-width: 0 0.22mm 0.22mm 0;
    border-style: solid;
    border-color: #5f7481;
    background: #ffffff !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .fdp-worksheet-answers {
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 2mm;
  }

  .fdp-worksheet-answer {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: center;
    justify-items: center;
    gap: 0.7mm;
    padding: 1.2mm 1.5mm;
    border: 0.35mm solid #8296a3;
    border-radius: 1.5mm;
    overflow: hidden;
  }

  .fdp-worksheet-label {
    font-size: 7.4pt;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }

  .fdp-worksheet-fraction {
    width: 14mm;
    height: 10mm;
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    font-size: 9pt;
    font-weight: 700;
    line-height: 1;
  }

  .fdp-worksheet-fraction > :first-child {
    width: 100%;
    height: 100%;
    border-bottom: 0.35mm solid #000000;
  }

  .fdp-worksheet-fraction-blank { display: block; }

  .fdp-worksheet-writing-line {
    display: block;
    width: 24mm;
    height: 7mm;
    border-bottom: 0.35mm solid #000000;
  }

  .fdp-worksheet-percent {
    display: flex;
    align-items: end;
    gap: 1.2mm;
    font-size: 10pt;
    font-weight: 700;
  }
}
