/* NDED Interpreting Remainders — additions on top of word-problems.css.
   Colours: full groups blue, the leftover orange (same orange as the "?" in bar models).
   The three ways to use a remainder keep one colour each: quotient blue, +1 purple, remainder orange. */
.ir-tool { --left: #c2410c; --left-soft: #fff1e6; --left-line: #f2a36b; }

/* Settings row */
.ir-modes { display: inline-flex; gap: .35rem; }
.ir-modes[hidden] { display: none; }
.ir-mode { font-size: .9rem; }
.ir-solve-toggle { display: inline-flex; align-items: center; gap: .4rem; color: #3b4f69; font-weight: 800; cursor: pointer; }
.ir-solve-toggle input { width: 18px; height: 18px; accent-color: #3f73c9; }
.ir-solve-toggle small { color: #6b7c93; font-weight: 600; }

/* Start screen */
.ir-intro { text-align: center; }
.ir-intro-title { margin: 0 0 12px; color: #22324a; font-size: 1.35rem; font-weight: 900; }
.ir-intro-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px 28px; }
.ir-guide { max-width: 500px; margin: 0; padding-left: 1.4rem; text-align: left; color: #34465e; font-size: 1rem; line-height: 1.55; }
.ir-guide li { margin: 0 0 .5rem; padding-left: .2rem; }
.ir-guide b { color: #22324a; }
.ir-example { flex: 0 0 240px; padding: 14px 16px; border: 1px solid #dbe6f4; border-radius: 14px; background: #f7faff; text-align: left; }
.ir-example ul { margin: 8px 0 6px; padding: 0; list-style: none; }
.ir-example li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed #d6e1ef; color: #34465e; font-weight: 700; }
.ir-example li b { color: #22324a; font-size: 1.1rem; }
.ir-example p { margin: 6px 0 0; color: #3d7b5d; font-size: .86rem; font-weight: 800; }
.ir-example-div { color: #22324a; font-size: 1.45rem; font-weight: 900; text-align: center; }
.r { color: var(--left, #c2410c); }
.ir-start-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.ir-start { display: inline-flex; flex-direction: column; justify-content: center; min-width: 190px; min-height: 58px; font-size: 1.08rem; }
.ir-start span { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }

/* Story: the question is the part to read twice */
.ir-tool .ir-story, .ir-tool .ir-prompt, .ir-tool .ir-caption { max-width: none; }
.ir-tool .ir-caption { margin: 8px 0 0; }
.ir-tool .ir-why { max-width: 680px; margin: .35rem auto .8rem; }
.ir-story .ir-q { display: block; margin-top: 6px; color: #1d3f72; border-radius: 6px; transition: background .2s, box-shadow .2s; }
.ir-story .ir-q.hinted { background: #fff2c9; box-shadow: 0 0 0 4px #fff2c9; }

/* Learn mode: answered questions stay on screen */
.ir-done { display: grid; gap: 6px; margin: -6px 0 14px; padding: 0; list-style: none; }
.ir-done[hidden] { display: none; }
.ir-done li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid #dbe6f4; border-radius: 11px; background: #fbfdff; color: #4e5d70; font-size: .93rem; }
.ir-done .a { color: #22324a; font-weight: 900; white-space: nowrap; }

/* "What we did" tags, one colour per way */
.how { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.how-down { background: #e8f0fd; color: #2d5fae; }
.how-up { background: #efe9fb; color: #5b3fa8; }
.how-rem { background: #fff1e6; color: #a3410f; }

/* The division */
.ir-division { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin: 0 0 14px; }
.ir-div-label { color: #6d86ad; font-size: .72rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.ir-div-eq { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; color: #22324a; font-size: 1.7rem; font-weight: 900; }
.ir-division.shown .ir-div-eq { padding: 4px 16px; border-radius: 12px; background: #f7faff; border: 1px solid #dbe6f4; }
.ir-div-eq input {
  width: 70px; height: 52px; border: 2px solid #b8c8dc; border-radius: 12px; text-align: center;
  font-family: inherit; font-size: 1.5rem; font-weight: 800; color: #22324a; background: #fff;
}
.ir-div-eq input:focus, .ir-answer input:focus { outline: none; border-color: #3f73c9; box-shadow: 0 0 0 3px rgba(63, 115, 201, .18); }

/* The picture */
.ir-picture { margin: 0 auto 6px; padding: 12px; border: 1px solid #e1e8f1; border-radius: 14px; background: #fcfdff; }
.ir-picture[hidden] { display: none; }
.ir-groups { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ir-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ir-group > span { color: #6b7c93; font-size: .7rem; font-weight: 800; }
.ir-dots {
  display: grid; grid-template-columns: repeat(3, 12px); gap: 4px; justify-content: center; align-content: center;
  min-width: 58px; min-height: 58px; padding: 7px; border: 2px solid #9db8e6; border-radius: 10px; background: #edf4ff;
}
.ir-dots i { display: block; width: 12px; height: 12px; border-radius: 50%; background: #3f73c9; }
.ir-group.left .ir-dots { border: 2px dashed var(--left-line); background: var(--left-soft); }
.ir-group.left .ir-dots i { background: var(--left); }
.ir-group.left > span { color: var(--left); }
.ir-group.left.hinted .ir-dots { box-shadow: 0 0 0 4px #ffd8b8; }
.ir-caption { margin: 8px 0 0; color: #4e5d70; font-size: .92rem; font-weight: 700; text-align: center; }

.ir-prompt { margin-top: 12px; }

/* Three choice cards */
.ir-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 760px; margin: 0 auto; }
.ir-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 14px 10px;
  border: 2px solid #cfdcef; border-radius: 14px; background: #fff; color: #2d4d79; cursor: pointer;
  font: inherit; text-align: center; transition: transform .15s, border-color .15s, background .15s;
}
.ir-card b { font-size: 1.05rem; font-weight: 900; }
.ir-card small { color: #5b6b80; font-size: .84rem; font-weight: 700; }
.ir-card:hover:not(:disabled) { border-color: #8fb0e0; transform: translateY(-1px); }
.ir-card:focus-visible { outline: 3px solid #3f73c9; outline-offset: 2px; }
.ir-card.tried { opacity: .45; cursor: default; }
.ir-card.chosen { background: #eef9f3; border-color: #7cc29f; color: #3d7b5d; }
.ir-chosen { width: fit-content; margin: 0 auto 10px; padding: 4px 12px; border-radius: 999px; font-weight: 800; }
.ir-chosen.how-down { background: #e8f0fd; color: #2d5fae; }
.ir-chosen.how-up { background: #efe9fb; color: #5b3fa8; }
.ir-chosen.how-rem { background: #fff1e6; color: #a3410f; }
.ir-answer { font-size: 1.3rem; }
.ir-answer label { color: #4e5d70; font-size: 1.05rem; }

.ir-why { max-width: 680px; margin: .35rem auto .8rem; color: #34465e; font-size: 1rem; font-weight: 600; line-height: 1.55; }

/* Learn summary */
.ir-learn-summary { text-align: center; }
.ir-big { color: #22324a; font-size: 1.3rem; font-weight: 900; }
.ir-learn-summary .ir-example-div { margin: 8px 0 2px; }
.ir-learn-setup { margin: 0 auto 10px; max-width: 680px; color: #4e5d70; font-weight: 600; }
.ir-learn-table { width: 100%; max-width: 760px; margin: 0 auto; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; font-size: .94rem; text-align: left; }
.ir-learn-table th, .ir-learn-table td { padding: 8px 10px; border-bottom: 1px solid #e4eaf2; color: #34465e; vertical-align: middle; }
.ir-learn-table th { color: #2d4d79; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.ir-learn-table td.a { color: #22324a; font-weight: 900; white-space: nowrap; }

.ir-howto { max-width: 720px; margin: 10px auto 0; text-align: center; }
.ir-howto summary { display: inline-block; cursor: pointer; color: #2f62b1; font-weight: 800; font-size: .92rem; text-decoration: underline dotted; }
.ir-howto[open] summary { margin-bottom: 8px; }
.ir-howto .ir-guide { margin: 0 auto; padding: 12px 14px 4px 2rem; border-radius: 12px; background: #f7faff; border: 1px solid #dbe6f4; font-size: .95rem; }

.ir-next-step { margin: 12px 0 0; text-align: center; color: #4e5d70; font-size: .92rem; }
.ir-next-step a { color: #2f66b4; font-weight: 800; text-decoration: none; border-bottom: 1px dashed rgba(47, 102, 180, .45); }

/* The tool decides its layout from its own width (side columns take part of the window). */
.ir-tool { container-type: inline-size; }
@container (max-width: 620px) {
  .ir-cards { grid-template-columns: 1fr; }
  .ir-card { align-items: flex-start; text-align: left; padding: 11px 14px; }
  .ir-done li { grid-template-columns: 1fr auto; }
  .ir-done li .how { grid-column: 1 / -1; justify-self: start; }
  .ir-div-eq { font-size: 1.4rem; }
  .ir-div-eq input { width: 58px; height: 46px; font-size: 1.3rem; }
  .ir-learn-table th:nth-child(3), .ir-learn-table td:nth-child(3) { display: none; }
  .ir-example { flex-basis: 100%; }
}
@media (max-width: 700px) {
  .ir-dots { grid-template-columns: repeat(3, 9px); gap: 3px; min-width: 44px; min-height: 44px; padding: 5px; }
  .ir-dots i { width: 9px; height: 9px; }
  .ir-groups { gap: 6px; }
}
