/* Ratio, percent & double-number-line lab: Look B + .calm, >=3.5rem touch targets, A4/JIS B5/Letter print. */

.dr-stage { display: grid; justify-items: center; gap: .75rem; width: 100%; max-width: 44rem; min-width: 0; }
.rp-prompt { margin: 0; max-width: 40rem; font: 700 clamp(1.0625rem, 4.2vw, 1.375rem)/1.5 var(--f-b), var(--cjk); text-align: left; }
.rp-deal-tag { display: inline-block; padding: .125rem .625rem; border-radius: 62.4375rem; border: .125rem solid var(--ink); background: var(--sun); font: 800 .9375rem/1.3 var(--f-d), var(--cjk); vertical-align: baseline; }
.rp-ans { margin: 0; font: 700 1.375rem/1.4 var(--f-d), var(--cjk); text-align: center; }
.rp-ans .ans { display: inline-block; min-width: 3ch; padding: 0 .375rem; border-bottom: .1875rem solid var(--ink); font-family: var(--f-m); }
.rp-ans .ans.empty::after { content: "?"; color: var(--edge); }
.rp-shade-count { margin: 0; font: 700 1.0625rem/1.3 var(--f-m); padding: .25rem .75rem; border-radius: 62.4375rem; background: var(--chip); border: .125rem solid var(--edge); }
.rp-fig { width: 100%; display: grid; place-items: center; min-width: 0; }
.rp-fig-tap { touch-action: none; cursor: pointer; }
.rp-grid-svg { display: block; width: min(100%, 16.5rem); height: auto; border-radius: .5rem; background: #fff; }
.rp-cell { fill: #fff; }
.rp-cell.on { fill: var(--sky); }
.rp-cell.miss { fill: #FFF1BF; }
.rp-cell.over { fill: var(--pink); }
.rp-gline { stroke: #C9D7EC; stroke-width: .8; pointer-events: none; }
.rp-gline.maj { stroke: var(--ink); stroke-width: 1.8; }

.rp-dnl-svg, .rp-tape-svg, .rp-ratio-svg, .rp-guide-svg { display: block; width: min(100%, 30rem); height: auto; overflow: visible; }
.rp-dnl-axis { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.rp-dnl-arr { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.rp-dnl-tick { stroke: var(--ink); stroke-width: 2.5; }
.rp-dnl-join { stroke: #94A8C7; stroke-width: 1.75; stroke-dasharray: 4 4; }
.rp-dnl-join.base { stroke: var(--tom); stroke-width: 2.25; stroke-dasharray: none; }
.rp-dnl-pill { fill: var(--sun); stroke: var(--ink); stroke-width: 2; }
.rp-dnl-slot { fill: #FFF6D8; stroke: var(--tom); stroke-width: 2; stroke-dasharray: 4 3; }
.rp-dnl-v, .rp-vtxt { fill: var(--ink); font: 700 14px var(--f-m); }
.rp-dnl-q, .rp-qtxt { fill: var(--tom); font: 800 16px var(--f-m); }

.rp-brace { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.rp-tape-pay { fill: #CDEFC9; stroke: var(--ink); stroke-width: 2; }
.rp-tape-off { fill: #FCE8EE; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 3; }
.rp-sub { fill: var(--ink2); font: 600 12px var(--f-b), var(--cjk); }

.rp-unit { stroke: var(--ink); stroke-width: 2; }
.rp-unit.u-sky { fill: #D9ECFC; }
.rp-unit.u-sun { fill: #FFF1BF; }
.rp-utxt { fill: var(--ink); font: 700 13px var(--f-m); }
.rp-rname { fill: var(--ink); font: 700 13px var(--f-b), var(--cjk); }

.rp-base-choices { display: flex; flex-wrap: wrap; gap: .625rem; justify-content: center; width: 100%; }
.rp-choice { min-width: 5.5rem; min-height: 3.5rem; font-family: var(--f-m); }
.rp-choice.yes { border-color: var(--mint); box-shadow: 0 0 0 .1875rem var(--mint); }
.rp-choice.no { opacity: .55; }
.rp-grid-ctrls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; width: min(100%, 24rem); }
.rp-gbtn { min-width: 3.5rem; min-height: 3.5rem; padding: .5rem; font-size: 1rem; }
.rp-next { min-width: 9rem; min-height: 3.5rem; }
.bl-msg { margin: 0; min-height: 1.75rem; font-size: 1rem; text-align: center; color: var(--ink); }
.sm-why { margin: 0; max-width: 34rem; font-size: 1rem; line-height: 1.5; text-align: center; }
.sm-eq { display: inline-block; margin-bottom: .25rem; font: 800 1.1875rem/1.3 var(--f-m); }

/* Pre-start interactive sandbox */
.rp-preview { display: grid; gap: .625rem; padding: .875rem; border: .125rem solid var(--edge); border-radius: 1rem; background: #fff; min-width: 0; }
.rp-pv-vis { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .75rem 1rem; align-items: center; }
.rp-mini-grid { width: 6.75rem; height: auto; }
.rp-mini-dnl { width: 100%; max-width: 24rem; }
.rp-pv-eq { margin: 0; font: 700 1.0625rem/1.3 var(--f-m); text-align: center; color: var(--ink); }
.rp-pv-ctrls { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.rp-pv-ctrls button { min-width: 3.5rem; min-height: 3.5rem; }
@media (max-width: 560px) {
  .rp-pv-vis { grid-template-columns: 1fr; justify-items: center; }
}

/* Parent method explainer drawer (aligned with kit.js methodGuide & site.css) */
.method-guide { margin: 1rem 0 .25rem; border: .125rem solid var(--edge); border-radius: 1.125rem; background: #fff; }
.method-guide > summary { display: flex; align-items: center; gap: .5rem; min-height: 3.5rem; padding: .625rem 1rem; font: 700 .9375rem/1.3 var(--f-d), var(--cjk); cursor: pointer; list-style: none; }
.method-guide > summary::-webkit-details-marker { display: none; }
.method-guide > summary::before { content: "▸"; font-size: .875rem; color: var(--ink2); transition: transform .15s; }
.method-guide[open] > summary::before { transform: rotate(90deg); }
.mg-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; padding: 0 1rem .75rem; }
.mg-step { display: grid; gap: .375rem; align-content: start; padding: .625rem .75rem; border: .09375rem solid var(--edge); border-radius: .875rem; background: var(--chip); position: relative; }
.mg-n { display: inline-grid; place-items: center; width: 1.625rem; height: 1.625rem; border-radius: 50%; border: .125rem solid var(--ink); background: var(--sun); font: 800 .8125rem/1 var(--f-d); }
.mg-svg svg { display: block; width: 100%; height: auto; max-height: 4.5rem; background: #fff; border-radius: .5rem; border: .09375rem solid var(--edge); }
.mg-step p { margin: 0; font-size: .8438rem; line-height: 1.45; color: var(--ink); }
html:not(.calm) .method-guide { border: var(--line); box-shadow: .25rem .25rem 0 var(--sky); }
html:not(.calm) .mg-step { background: var(--sb-sun); border: .125rem solid var(--ink); }
html:not(.calm) .mg-step:nth-child(2) { background: var(--sb-sky); }
html:not(.calm) .mg-step:nth-child(3) { background: var(--sb-mint); }
@media (max-width: 720px) { .mg-steps { grid-template-columns: 1fr; } }

/* Look B vs .calm overrides */
html:not(.calm) .rp-preview { border: .1875rem solid var(--ink); border-radius: 1.25rem; box-shadow: .3125rem .3125rem 0 var(--sky); }
html:not(.calm) .rp-grid-svg { border: .125rem solid var(--ink); box-shadow: .25rem .25rem 0 var(--sun); }
html.calm .rp-deal-tag { background: var(--chip); border-color: var(--edge); border-width: 1.5px; }
html.calm .rp-dnl-pill { fill: var(--chip); }
html.calm .rp-dnl-join.base { stroke: var(--ink); }
html.calm .rp-dnl-q, html.calm .rp-qtxt { fill: var(--ink); }
html.calm .rp-tape-pay { fill: #DCEFE7; }
html.calm .rp-tape-off { fill: #F1F4FA; }
html.calm .rp-unit.u-sky { fill: #E7EEF8; }
html.calm .rp-unit.u-sun { fill: #F4F5F7; }

@media (prefers-reduced-motion: reduce) {
  .rp-choice, .rp-gbtn { transition: none !important; animation: none !important; }
  .method-guide > summary::before { transition: none; }
}

/* Printable A4 / JIS B5 (182x257mm) / Letter sheets */
.rp-sheet { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4mm 6mm; align-items: start; font-size: 9.5pt; line-height: 1.35; }
.rp-sheet li { break-inside: avoid; display: grid; gap: 1.5mm; min-width: 0; }
.rp-sheet-grid li { grid-template-columns: minmax(0, 1fr) auto; gap: 2mm 3mm; align-items: center; border-bottom: .2mm solid #D5DBE8; padding-bottom: 2.5mm; }
.rp-sh-txt { display: grid; gap: 1.5mm; min-width: 0; }
.rp-sh-txt p, .rp-sh-q, .rp-sh-ans { margin: 0; }
.rp-sh-q { font-size: 9.2pt; line-height: 1.32; }
.rp-sh-pic { display: flex; justify-content: flex-start; }
.rp-print-grid { width: 25mm; height: 25mm; }
.rp-print-svg { width: 100%; max-width: 68mm; max-height: 22mm; height: auto; }
.rp-sh-ans { font-weight: 700; font-size: 9.5pt; }
.rp-sh-eq { font-weight: 500; font-size: 8.2pt; color: #444; }
.rp-blank { display: inline-block; width: 18mm; border-bottom: .3mm solid #000; vertical-align: baseline; }
@media print {
  .rp-cell.on { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rp-tape-pay, .rp-tape-off, .rp-unit, .rp-dnl-pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
