:root {
      --blue: #149bd7;
      --ink: #102131;
      --muted: #5c6b78;
      --paper: #fbfcfe;
      --panel: #ffffff;
      --line: #d8e2ea;
      --shadow: 0 12px 32px rgba(15, 33, 49, 0.12);
      --radius: 8px;
      --touch: 48px;
      --scale: 1;
    }

    * { box-sizing: border-box; }

    html,
    body {
      min-height: 100%;
      margin: 0;
      color: var(--ink);
      background: #eef4f8;
      font-family: Arial, Helvetica, sans-serif;
      letter-spacing: 0;
      touch-action: manipulation;
    }

    body { overflow: hidden; }

    button,
    input,
    select { font: inherit; }

    button {
      min-height: var(--touch);
      border: 2px solid transparent;
      border-radius: var(--radius);
      background: #ffffff;
      color: var(--ink);
      cursor: pointer;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
    }

    button:focus-visible,
    select:focus-visible,
    input:focus-visible {
      outline: 4px solid rgba(20, 155, 215, 0.35);
      outline-offset: 2px;
    }

    select,
    input {
      min-height: var(--touch);
      border: 2px solid var(--line);
      border-radius: var(--radius);
      background: #ffffff;
      color: var(--ink);
      padding: 0 12px;
      font-weight: 800;
    }

    .app {
      display: grid;
      grid-template-rows: auto auto 1fr;
      height: 100vh;
      height: 100dvh;
      min-width: 320px;
    }

    .topbar {
      display: grid;
      grid-template-columns: minmax(190px, 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;
  }

  .brand-logo:focus-visible {
    outline: 4px solid rgba(20, 155, 215, 0.35);
    outline-offset: 3px;
  }

  .home-button {
    min-height: var(--touch, 48px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 2px solid #263d51;
    border-radius: 8px;
    background: #122436;
    color: #ffffff;
    text-decoration: none;
    font-weight: 800;
    white-space: nowrap;
  }

  .home-button:hover,
  .home-button:focus-visible {
    background: var(--blue, #149bd7);
    border-color: #8fd8f3;
    color: #06111a;
  }h1 {
      margin: 0;
      font-size: clamp(1.35rem, 2vw, 2.05rem);
      line-height: 1.05;
      font-weight: 800;
    }
.top-actions,
    .control-group,
    .toolbar,
    .question-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .top-actions { justify-content: end; }

    .icon-button {
      width: var(--touch);
      padding: 0;
      display: inline-grid;
      place-items: center;
      background: #122436;
      color: #ffffff;
      border-color: #263d51;
    }

    .icon-button:hover {
      background: var(--blue);
      border-color: #8fd8f3;
      color: #06111a;
    }

    .icon {
      width: 24px;
      height: 24px;
      display: block;
      pointer-events: none;
    }

    .toolbar {
      padding: 12px 18px;
      background: #ffffff;
      border-bottom: 1px solid var(--line);
      box-shadow: 0 6px 14px rgba(15, 33, 49, 0.06);
      z-index: 3;
    }

    .challenge-controls {
      margin-left: auto;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }

    .control-label {
      color: var(--muted);
      font-weight: 700;
      font-size: 0.9rem;
    }

    .wide-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;
    }

    .wide-button[aria-pressed="true"],
    .primary {
      background: var(--blue);
      border-color: #0f80b3;
      color: #06111a;
    }

    #showTotalButton[aria-pressed="true"],
    #exchangeButton.primary,
    #checkButton.primary {
      background: #f8fbfd;
      border-color: var(--line);
      color: var(--ink);
    }

    #showTotalButton:hover,
    #exchangeButton:hover,
    #checkButton:hover {
      background: #eef4f8;
      border-color: #a7bfcd;
      color: var(--ink);
    }

    .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: 800;
      list-style: none;
      white-space: nowrap;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
    }

    .tool-menu summary::-webkit-details-marker { display: none; }

    .menu-panel {
      width: min(360px, calc(100vw - 36px));
      padding: 10px;
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      z-index: 20;
      display: grid;
      gap: 10px;
      border: 2px solid var(--line);
      border-radius: var(--radius);
      background: #ffffff;
      box-shadow: var(--shadow);
    }

    .field {
      display: grid;
      gap: 5px;
    }

    .field span,
    .toggle-row span {
      color: var(--muted);
      font-size: 0.86rem;
      font-weight: 800;
    }

    .toggle-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .workspace {
      min-height: 0;
      overflow: auto;
      padding: 18px;
      background:
        linear-gradient(#dce8f0 1px, transparent 1px),
        linear-gradient(90deg, #dce8f0 1px, transparent 1px);
      background-size: 34px 34px;
    }

    .tool-surface {
      width: min(1220px, 100%);
      min-height: 660px;
      margin: 0 auto;
      display: grid;
      grid-template-rows: auto 1fr;
      gap: 12px;
      transform: scale(var(--scale));
      transform-origin: top center;
    }

    .challenge-panel {
      display: grid;
      grid-template-columns: minmax(220px, 1fr) auto;
      gap: 12px;
      align-items: stretch;
      padding: 14px;
      border: 2px solid var(--line);
      border-radius: var(--radius);
      background: rgba(255, 255, 255, 0.96);
      box-shadow: var(--shadow);
    }

    .question-card {
      display: grid;
      gap: 8px;
      min-width: 0;
    }

    .question-actions {
      display: grid;
      grid-template-columns: repeat(2, minmax(132px, 1fr));
      gap: 8px;
      align-items: stretch;
      align-self: stretch;
      min-width: min(320px, 100%);
    }

    .question-actions .wide-button {
      width: 100%;
      min-height: var(--touch);
    }

    .question-text {
      font-size: clamp(1.05rem, 2vw, 1.45rem);
      font-weight: 900;
      line-height: 1.18;
    }

    .answer-line {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
      color: var(--muted);
      font-weight: 800;
    }

    .answer-line input {
      width: 120px;
      text-align: center;
    }

    .money-layout {
      min-height: 520px;
      display: grid;
      grid-template-columns: 240px 1fr;
      gap: 12px;
    }

    .denomination-panel,
    .mat-panel,
    .totals-panel {
      border: 2px solid var(--line);
      border-radius: var(--radius);
      background: rgba(255, 255, 255, 0.96);
      box-shadow: var(--shadow);
    }

    .denomination-panel {
      min-height: 0;
      display: grid;
      grid-template-rows: auto 1fr;
      overflow: hidden;
    }

    .panel-title {
      padding: 9px 10px;
      border-bottom: 1px solid var(--line);
      font-weight: 900;
      display: flex;
      justify-content: space-between;
      gap: 8px;
      align-items: center;
    }

    .denom-list {
      min-height: 0;
      overflow: auto;
      padding: 6px;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
      gap: 5px;
      align-content: start;
    }

    .denom-button {
      min-height: 52px;
      padding: 4px;
      display: grid;
      place-items: center;
      border: 2px solid var(--line);
      background: #ffffff;
      overflow: hidden;
    }

    .denom-button:hover { border-color: var(--blue); }

    .mini-money {
      min-width: 70px;
      height: 42px;
      display: grid;
      place-items: center;
    }

    .mat-panel {
      min-width: 0;
      min-height: 520px;
      display: grid;
      grid-template-rows: auto 1fr;
      overflow: hidden;
    }

    .mat-header {
      padding: 10px 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      border-bottom: 1px solid var(--line);
      background: #fbfdff;
    }

    .total-display {
      font-size: clamp(1.05rem, 2vw, 1.5rem);
      font-weight: 900;
      color: #0c5f86;
    }

    .mat {
      position: relative;
      min-height: 460px;
      overflow: hidden;
      background:
        radial-gradient(circle at 25px 25px, rgba(20,155,215,0.14) 2px, transparent 2px),
        linear-gradient(#f9fcfe, #eef7fb);
      background-size: 50px 50px, auto;
    }

    .money-model {
      position: absolute;
      z-index: 120;
      pointer-events: auto;
      color: #183248;
      cursor: grab;
      touch-action: none;
      user-select: none;
    }

    .money-model.dragging {
      cursor: grabbing;
      z-index: 350;
    }

    .money-model.selected {
      filter: drop-shadow(0 0 12px rgba(20, 155, 215, 0.8));
      z-index: 330;
    }

    .money-model.selected::after {
      content: "";
      position: absolute;
      inset: -5px;
      border: 3px solid var(--blue);
      border-radius: 14px;
      pointer-events: none;
    }

    .model-section {
      position: absolute;
      display: grid;
      place-items: end;
      padding: 10px;
      border: 3px solid rgba(20, 155, 215, 0.42);
      background: rgba(255, 255, 255, 0.58);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
      transition: width 180ms ease, height 180ms ease, left 180ms ease, top 180ms ease;
    }

    .model-section.has-money {
      background: rgba(232, 246, 253, 0.72);
      border-color: rgba(20, 155, 215, 0.72);
    }

    .model-total {
      align-self: end;
      justify-self: end;
      padding: 3px 6px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.86);
      font-size: 0.85rem;
      font-weight: 900;
      color: #0c5f86;
    }

    .model-label {
      align-self: start;
      justify-self: start;
      color: #557080;
      font-size: 0.76rem;
      font-weight: 900;
      text-transform: uppercase;
    }

    .bar-model .whole {
      left: 0;
      top: 0;
      width: 100%;
      height: 50%;
      border-radius: 10px 10px 0 0;
    }

    .bar-model .part-a {
      left: 0;
      top: 50%;
      width: 50%;
      height: 50%;
      border-radius: 0 0 0 10px;
    }

    .bar-model .part-b {
      left: 50%;
      top: 50%;
      width: 50%;
      height: 50%;
      border-radius: 0 0 10px 0;
    }

    .part-whole-model .model-section {
      border-radius: 50%;
      place-items: center;
      text-align: center;
    }

    .part-whole-links {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
    }

    .part-whole-links line {
      stroke: rgba(20, 155, 215, 0.62);
      stroke-width: 4;
      stroke-linecap: round;
    }

    .ten-frame-model,
    .five-frame-model,
    .place-value-model,
    .receipt-model,
    .number-line-model,
    .balance-model {
      border: 3px solid rgba(20, 155, 215, 0.42);
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.62);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
    }

    .frame-grid {
      position: absolute;
      inset: 14px;
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 6px;
    }

    .ten-frame-model .frame-grid {
      grid-template-rows: repeat(2, 1fr);
    }

    .five-frame-model .frame-grid {
      grid-template-rows: 1fr;
    }

    .frame-grid .model-section,
    .chart-grid .model-section,
    .receipt-grid .model-section,
    .balance-grid .model-section {
      position: relative;
      inset: auto;
      left: auto;
      top: auto;
      width: auto;
      height: auto;
    }

    .frame-cell,
    .chart-cell,
    .receipt-row,
    .balance-side {
      border: 2px solid rgba(85, 112, 128, 0.34);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.5);
    }

    .chart-grid,
    .receipt-grid,
    .balance-grid {
      position: absolute;
      inset: 14px;
      display: grid;
      gap: 8px;
    }

    .chart-grid {
      grid-template-columns: repeat(3, 1fr) 22px repeat(2, 1fr);
    }

    .decimal-column {
      display: grid;
      place-items: end center;
      padding-bottom: 14px;
      color: #0c5f86;
      font-size: 2.1rem;
      font-weight: 900;
    }

    .receipt-grid {
      grid-template-rows: repeat(3, 1fr);
    }

    .balance-grid {
      grid-template-columns: 1fr 1fr;
      align-items: stretch;
    }

    .chart-cell,
    .receipt-row,
    .balance-side {
      position: relative;
      display: grid;
      place-items: end;
      padding: 10px;
    }

    .number-line-track {
      position: absolute;
      left: 18px;
      right: 18px;
      top: 50%;
      height: 4px;
      background: #557080;
      border-radius: 999px;
    }

    .number-line-track::before,
    .number-line-track::after {
      content: "";
      position: absolute;
      top: -12px;
      width: 4px;
      height: 28px;
      background: #557080;
      border-radius: 999px;
    }

    .number-line-track::before { left: 0; }
    .number-line-track::after { right: 0; }

    .number-line-hit {
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      border: 0;
      background: transparent;
      box-shadow: none;
      pointer-events: none;
    }

    .number-line-hit .model-total {
      position: absolute;
      right: 16px;
      bottom: 12px;
    }

    .delete-zone {
      position: absolute;
      right: 14px;
      bottom: 14px;
      z-index: 950;
      width: 76px;
      height: 76px;
      display: grid;
      place-items: center;
      border: 2px dashed rgba(85, 112, 128, 0.5);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.28);
      opacity: 0.66;
      cursor: pointer;
      transition: opacity 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
    }

    .delete-zone:hover,
    .delete-zone:focus-visible,
    .delete-zone.delete-zone-active {
      opacity: 1;
      background: rgba(255, 255, 255, 0.72);
      border-color: #d25a4b;
      transform: translateY(-1px);
    }

    .bin-icon {
      position: relative;
      width: 30px;
      height: 34px;
      border: 4px solid #557080;
      border-top: 0;
      border-radius: 0 0 5px 5px;
    }

    .bin-icon::before,
    .bin-icon::after {
      content: "";
      position: absolute;
      left: 50%;
      translate: -50% 0;
      background: #557080;
    }

    .bin-icon::before {
      top: -10px;
      width: 38px;
      height: 5px;
      border-radius: 4px;
    }

    .bin-icon::after {
      top: -16px;
      width: 16px;
      height: 5px;
      border-radius: 4px 4px 0 0;
    }

    .delete-zone:hover .bin-icon,
    .delete-zone:focus-visible .bin-icon,
    .delete-zone.delete-zone-active .bin-icon {
      border-color: #d25a4b;
    }

    .delete-zone:hover .bin-icon::before,
    .delete-zone:hover .bin-icon::after,
    .delete-zone:focus-visible .bin-icon::before,
    .delete-zone:focus-visible .bin-icon::after,
    .delete-zone.delete-zone-active .bin-icon::before,
    .delete-zone.delete-zone-active .bin-icon::after {
      background: #d25a4b;
    }

    .mat.empty::after {
      content: "Tap money on the left to add it here";
      position: absolute;
      left: 50%;
      top: 50%;
      translate: -50% -50%;
      padding: 14px 18px;
      border: 2px dashed #a7bfcd;
      border-radius: var(--radius);
      color: #557080;
      background: rgba(255,255,255,0.78);
      font-weight: 900;
      text-align: center;
      pointer-events: none;
    }

    .money-piece {
      position: absolute;
      z-index: 400;
      display: grid;
      place-items: center;
      filter: drop-shadow(0 8px 8px rgba(15, 33, 49, 0.18));
      touch-action: none;
      user-select: none;
      cursor: grab;
    }

    .money-piece.dragging {
      cursor: grabbing;
      z-index: 1000;
    }

    .money-piece.selected {
      filter: drop-shadow(0 0 0 rgba(0,0,0,0)) drop-shadow(0 0 12px rgba(20, 155, 215, 0.85));
      z-index: 900;
    }

    .money-piece.selected::after {
      content: "";
      position: absolute;
      inset: -3px;
      border: 3px solid var(--blue);
      border-radius: 9px;
      pointer-events: none;
    }

    .money-piece.coin-piece.selected::after {
      border-radius: 50%;
    }

    .money-piece.shape-heptagon.selected::after {
      border-radius: 8px;
      clip-path: polygon(50% 0%, 89% 19%, 99% 61%, 72% 96%, 28% 96%, 1% 61%, 11% 19%);
    }

    .money-piece.shape-dodecagon.selected::after {
      border-radius: 8px;
      clip-path: polygon(50% 0%, 74% 7%, 93% 26%, 100% 50%, 93% 74%, 74% 93%, 50% 100%, 26% 93%, 7% 74%, 0% 50%, 7% 26%, 26% 7%);
    }

    .coin {
      position: relative;
      width: var(--money-w, 74px);
      height: var(--money-h, 74px);
      border-radius: 50%;
      display: grid;
      place-items: center;
      border: 5px solid rgba(255,255,255,0.50);
      box-shadow:
        inset 0 0 0 2px rgba(0,0,0,0.18),
        inset 0 -9px 14px rgba(0,0,0,0.16),
        inset 0 10px 16px rgba(255,255,255,0.18);
      font-weight: 900;
      text-align: center;
      color: #102131;
      isolation: isolate;
    }

    .coin::before {
      content: "";
      position: absolute;
      inset: 7px;
      border: 2px solid rgba(16, 33, 49, 0.20);
      border-radius: inherit;
      pointer-events: none;
    }

    .coin-detail {
      position: absolute;
      width: 28%;
      height: 40%;
      left: 14%;
      top: 29%;
      border-radius: 48% 42% 44% 50%;
      background: rgba(255,255,255,0.22);
      box-shadow: inset -3px 0 rgba(16,33,49,0.10);
      pointer-events: none;
      z-index: 0;
    }

    .coin-ridges {
      position: absolute;
      inset: 2px;
      border-radius: inherit;
      background: repeating-conic-gradient(rgba(16,33,49,0.18) 0 4deg, transparent 4deg 9deg);
      opacity: 0.32;
      -webkit-mask: radial-gradient(circle, transparent 0 76%, #000 77%);
      mask: radial-gradient(circle, transparent 0 76%, #000 77%);
      pointer-events: none;
    }

    .coin.shape-heptagon {
      border-radius: 8px;
      clip-path: polygon(50% 0%, 89% 19%, 99% 61%, 72% 96%, 28% 96%, 1% 61%, 11% 19%);
    }

    .coin.shape-dodecagon {
      border-radius: 8px;
      clip-path: polygon(50% 0%, 74% 7%, 93% 26%, 100% 50%, 93% 74%, 74% 93%, 50% 100%, 26% 93%, 7% 74%, 0% 50%, 7% 26%, 26% 7%);
    }

    .coin.bimetal {
      background:
        radial-gradient(circle, #d8b04a 0 45%, #cfd6dc 46% 100%) !important;
    }

    .coin .coin-label {
      width: calc(var(--money-w, 74px) * 0.72);
      height: calc(var(--money-h, 74px) * 0.72);
      border-radius: 50%;
      display: grid;
      place-items: center;
      border: 2px solid rgba(0,0,0,0.16);
      background: rgba(255,255,255,0.36);
      line-height: 1;
      font-size: clamp(0.78rem, calc(var(--money-w, 74px) / 55), 1.14rem);
      position: relative;
      z-index: 2;
      box-shadow: 0 1px 4px rgba(255,255,255,0.35);
    }

    .note {
      position: relative;
      width: var(--money-w, 150px);
      height: var(--money-h, 72px);
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: center;
      padding: 8px 10px;
      border-radius: 7px;
      border: 3px solid rgba(255,255,255,0.65);
      box-shadow: inset 0 0 0 2px rgba(0,0,0,0.16), inset 0 -12px 24px rgba(0,0,0,0.12);
      color: #102131;
      font-weight: 900;
      overflow: hidden;
      background-image:
        linear-gradient(120deg, rgba(255,255,255,0.42), rgba(255,255,255,0) 42%),
        radial-gradient(circle at 78% 22%, rgba(255,255,255,0.40) 0 10%, transparent 11%),
        repeating-linear-gradient(90deg, rgba(16,33,49,0.08) 0 2px, transparent 2px 10px);
      isolation: isolate;
    }

    .note::before {
      content: "";
      position: absolute;
      left: 7px;
      right: 7px;
      top: 7px;
      bottom: 7px;
      border: 1px solid rgba(16, 33, 49, 0.22);
      border-radius: 5px;
      pointer-events: none;
    }

    .note::after {
      content: "";
      position: absolute;
      inset: 13px 20px;
      border-top: 1px solid rgba(16,33,49,0.18);
      border-bottom: 1px solid rgba(255,255,255,0.36);
      pointer-events: none;
    }

    .note-pattern {
      position: absolute;
      inset: 0;
      background:
        repeating-linear-gradient(135deg, rgba(255,255,255,0.18) 0 3px, transparent 3px 11px),
        repeating-linear-gradient(45deg, rgba(16,33,49,0.06) 0 2px, transparent 2px 12px);
      opacity: 0.75;
      pointer-events: none;
      z-index: 0;
    }

    .note-portrait {
      position: absolute;
      left: 12%;
      top: 18%;
      width: 24%;
      height: 64%;
      border: 2px solid rgba(16, 33, 49, 0.20);
      border-radius: 50%;
      background:
        radial-gradient(circle at 50% 34%, rgba(16,33,49,0.24) 0 13%, transparent 14%),
        radial-gradient(ellipse at 50% 68%, rgba(16,33,49,0.18) 0 24%, transparent 25%),
        rgba(255,255,255,0.22);
      z-index: 1;
    }

    .note-window {
      position: absolute;
      left: 57%;
      top: 18%;
      width: 14%;
      height: 64%;
      border: 2px solid rgba(255,255,255,0.70);
      border-radius: 999px;
      background: linear-gradient(135deg, rgba(255,255,255,0.62), rgba(255,255,255,0.16));
      box-shadow: inset 0 0 0 2px rgba(16,33,49,0.08);
      z-index: 2;
    }

    .note-motif {
      position: absolute;
      right: 14%;
      bottom: 14%;
      min-width: 22%;
      padding: 2px 5px;
      border: 1px solid rgba(16,33,49,0.18);
      border-radius: 999px;
      background: rgba(255,255,255,0.24);
      color: rgba(16,33,49,0.70);
      font-size: clamp(0.46rem, calc(var(--money-h, 72px) / 10), 0.75rem);
      font-weight: 900;
      text-align: center;
      z-index: 2;
    }

    .note.mini-note .note-motif,
    .note.mini-note .note-portrait,
    .note.mini-note .note-window,
    .note.mini-note .note-security {
      display: none;
    }

    .note-security {
      position: absolute;
      left: 62%;
      top: 0;
      width: 8px;
      height: 100%;
      background: linear-gradient(rgba(255,255,255,0.62), rgba(16,33,49,0.14), rgba(255,255,255,0.62));
      opacity: 0.78;
      z-index: 1;
    }

    .gbp-note .note-security {
      left: 70%;
      width: 10px;
      background: linear-gradient(90deg, rgba(255,255,255,0.20), rgba(245,245,245,0.84), rgba(16,33,49,0.12));
    }

    .usd-note .note-security {
      left: 69%;
      width: 6px;
      background: repeating-linear-gradient(180deg, rgba(10,80,48,0.46) 0 8px, rgba(255,255,255,0.64) 8px 13px);
    }

    .eur-note .note-security {
      left: 64%;
      width: 9px;
      background: linear-gradient(180deg, rgba(255,255,255,0.74), rgba(20,155,215,0.22), rgba(255,255,255,0.74));
    }

    .usd-note .note-portrait {
      left: 39%;
      width: 20%;
      background:
        radial-gradient(circle at 50% 34%, rgba(16,77,47,0.30) 0 13%, transparent 14%),
        radial-gradient(ellipse at 50% 68%, rgba(16,77,47,0.22) 0 26%, transparent 27%),
        rgba(255,255,255,0.26);
    }

    .usd-note .note-window {
      left: 13%;
      width: 16%;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(10,80,48,0.30) 0 42%, rgba(255,255,255,0.20) 43%);
    }

    .eur-note .note-portrait {
      left: 10%;
      width: 22%;
      border-radius: 6px;
      background:
        repeating-linear-gradient(180deg, rgba(16,33,49,0.20) 0 3px, transparent 3px 9px),
        rgba(255,255,255,0.22);
    }

    .eur-note .note-window {
      left: 72%;
      width: 16%;
      border-radius: 6px 999px 999px 6px;
    }

    .note-value {
      font-size: clamp(1.1rem, calc(var(--money-h, 72px) / 2.1), 2.3rem);
      line-height: 1;
      position: relative;
      z-index: 4;
      text-shadow: 0 1px 0 rgba(255,255,255,0.55);
    }

    .mini-money .coin {
      border-width: 3px;
      font-size: 0.72rem;
    }

    .mini-money .coin .coin-label {
      font-size: 0.68rem;
      border-width: 1px;
    }

    .mini-money .note {
      padding: 4px;
      border-width: 2px;
    }

    .mini-money .note::after { display: none; }
    .mini-money .note-value { font-size: 0.82rem; }

    .feedback {
      min-height: 52px;
      padding: 9px 12px;
      border: 2px solid var(--line);
      border-radius: var(--radius);
      background: #ffffff;
      color: var(--ink);
      font-weight: 800;
      line-height: 1.25;
    }

    .feedback.good {
      border-color: #76b947;
      background: #eef9e8;
      color: #22510f;
    }

    .feedback.try {
      border-color: #f2b84b;
      background: #fff8e6;
      color: #6a4300;
    }

    .instructions-dialog {
      width: min(860px, calc(100vw - 32px));
      max-height: min(780px, 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.25rem;
      line-height: 1.15;
    }

    .instructions-body {
      max-height: calc(min(780px, 100vh - 32px) - 76px);
      overflow: auto;
      padding: 16px 18px 20px;
      line-height: 1.45;
    }

    .instructions-body h3 {
      margin: 16px 0 8px;
      font-size: 1.05rem;
    }

    .instructions-body h3:first-child { margin-top: 0; }

    .instructions-body p,
    .instructions-body ul,
    .instructions-body ol { margin: 0 0 10px; }

    .instructions-body li { margin-bottom: 6px; }

    .print-logo,
    .print-copyright { display: none; }

    @media (max-width: 900px) {
      body { overflow: auto; }

      .app {
        height: auto;
        min-height: 100vh;
      }

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

      .denom-list {
        grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
        max-height: 220px;
      }

      .challenge-panel {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 620px) {
      .topbar { grid-template-columns: 1fr; }
      .top-actions { justify-content: start; }
      .toolbar { align-items: stretch; }
      .challenge-controls {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
      }
      .control-group { width: 100%; }
      .control-group select,
      .control-group .wide-button { flex: 1 1 auto; }
    }

    @media print {
      @page { size: landscape; }

      body,
      .workspace { background: #ffffff; overflow: visible; }

      .topbar,
      .toolbar,
      .denomination-panel,
      .question-actions,
      .instructions-dialog { display: none; }

      .workspace { padding: 0; }

      .tool-surface {
        width: 100%;
        transform: none;
        box-shadow: none;
      }

      .challenge-panel,
      .mat-panel {
        box-shadow: none;
        border-color: #000000;
      }

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

      .print-logo {
        display: block;
        width: 150px;
        margin-bottom: 12px;
      }

      .print-copyright {
        display: block;
        margin-top: 12px;
        color: #000000;
        font-size: 11pt;
        font-weight: 700;
        text-align: right;
      }
    }
