/* balatat.com — Calculator. Loads after shared/theme.css.
   Reading order (phone and desktop): 1 · Choose → 2 · What you get → 3 · The cut balata.
   Phone: one column with a slim sticky result bar during step 1. From 700 px: step 1 on one side, steps 2 + 3 sticky on the other.
   Maroon is used for the shahid strip, dimension marks and "does not fit" messages only. Drawings never mirror in RTL. */
:root { --c-avg: #8d9099; --c-dark: #5d6068; --c-line: #fff; --tam: #b0822e; --r-in: 14px; }
svg { direction: ltr; }
.defs { position: absolute; pointer-events: none; }
.nums { font-variant-numeric: tabular-nums; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
.it { unicode-bidi: isolate; white-space: nowrap; }
.warn-t { color: var(--maroon); font-weight: 600; }
/* a small factual mark in maroon: "adjusted", "varies by design" */
.mark { display: inline-block; font-size: 10.5px; line-height: 1; font-style: normal; font-weight: 500; white-space: nowrap; color: var(--maroon); padding: 4px 7px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(138, 21, 56, .45); }

.calc { padding-block-end: 56px; }
.calc-head { padding-block-end: 18px; }
.calc-head .pills { margin-block-start: 2px; }

/* ───────── segmented control: one pill holding its options (same language as the EN / ع switch) ───────── */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { position: relative; display: grid; justify-items: center; align-content: center; min-height: 38px; padding: 2px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--ink); white-space: nowrap; transition: background-color .25s, color .25s, transform .12s; }
.seg button::after { content: ""; position: absolute; inset: -3px 0; }                 /* 44 px touch target */
.seg button:active { transform: scale(.97); }
.seg button.on { background: var(--ink); color: #fff; }
:lang(ar) .seg button { line-height: 1.5; }
.seg-s { display: inline-grid; grid-auto-columns: auto; flex: none; }
.seg-s button { min-height: 32px; min-width: 44px; padding-inline: 13px; font-size: 12.5px; }
.seg-s button::after { inset: -6px 0; }

/* ───────── page grid ───────── */
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-block-start: 0; }
.calc-in, .calc-out, .stepc { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; min-width: 0; }
.calc-in, .stepc { gap: 10px; }
.calc-out { gap: 28px; margin-block-start: 12px; }
.calc[data-m="sets"] [data-mode="list"], .calc[data-m="list"] [data-mode="sets"] { display: none !important; }

/* numbered step heading */
.step-h { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; row-gap: 2px; padding-block: 6px 4px; scroll-margin-top: 70px; }
.step-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 500; line-height: 1; }
.step-t { font-size: 22px; line-height: 1.2; font-weight: 500; letter-spacing: -.02em; }
.step-s { grid-column: 2; font-size: var(--fs-s); line-height: 1.45; color: var(--ink-2); }
:lang(ar) .step-t { line-height: 1.5; }

/* phone: the headline result follows the visitor through step 1 */
.peek { position: sticky; top: calc(8px + env(safe-area-inset-top, 0px)); z-index: 12; display: flex; align-items: center; gap: 9px; width: 100%; min-height: 48px; padding-block: 6px; padding-inline: 8px 14px; border-radius: 999px; text-align: start;
  background: rgba(255, 255, 255, .94); box-shadow: inset 0 0 0 1px var(--line), 0 8px 22px rgba(21, 23, 28, .12); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  font-size: 13.5px; transition: opacity .25s, transform .4s var(--ease), visibility 0s; }
.peek.is-off { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-10px); transition: opacity .2s, transform .3s, visibility 0s .3s; }
.peek-mini { flex: none; width: 32px; height: 32px; }
.peek-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.peek-t b { font-size: 16px; font-weight: 600; color: var(--ink); }
.peek-t i { font-style: normal; color: var(--ink-3); }
.peek-go { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--ink); }
.peek-go svg { flex: none; }

/* ───────── groups (cards) ───────── */
.group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; padding: 14px 14px 16px; border-radius: var(--r-card); background: var(--surface); box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .06); }
.group-t, .block-t { font-size: var(--fs-xs); line-height: 1.4; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
:lang(ar) .group-t, :lang(ar) .block-t { font-size: 13px; }
.block-t { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-end: 2px; }
.block-t .mark { text-transform: none; letter-spacing: 0; }
.fnote { font-size: var(--fs-xs); line-height: 1.45; color: var(--ink-2); max-width: 52ch; }
:lang(ar) .fnote { line-height: 1.7; }
.sub { font-size: 12px; color: var(--ink-2); }

/* shapes */
.shapes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.shape, .sizecard { display: grid; justify-items: center; align-content: start; gap: 1px; min-width: 0; padding: 8px 2px 9px; border-radius: var(--r-in); background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, background-color .2s, transform .12s; }
.shape { min-height: 96px; }
.shape svg { width: 100%; max-width: 72px; height: auto; margin-block-end: 2px; }
.shape path, .sizecard path { stroke: var(--ink); stroke-width: .28; }
.axis { stroke: var(--maroon); stroke-width: .18; stroke-dasharray: 1.6 .5 .3 .5; }
.shape-n, .size-n { font-size: 12.5px; font-weight: 500; line-height: 1.25; }
.shape small { font-size: 10.5px; color: var(--ink-2); line-height: 1.25; }
:lang(ar) .shape-n, :lang(ar) .size-n { line-height: 1.6; }
.shape.on, .sizecard.on { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink); }
.shape:active, .sizecard:active { transform: scale(.97); }

/* suggested sizes: the bead drawn to one scale, with its real dimensions */
.sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sizecard { padding: 6px 4px 10px; min-height: 104px; }
.sizecard svg { width: 100%; max-width: 104px; height: auto; }
.sizecard small { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.own { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.rule-hint b { font-weight: 500; color: var(--ink); }

.bead-view { border-radius: var(--r-in); background: #fff; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.bead-view svg { width: 100%; height: auto; }
.bead-view text { font-family: var(--font); }
.plate { stroke: var(--ink-2); stroke-width: .14; stroke-dasharray: .8 .8; fill: none; }
.blank { fill: none; stroke: var(--ink); stroke-width: .14; stroke-dasharray: .9 .6; }
.blank.bad { stroke: var(--maroon); stroke-width: .22; fill: rgba(138, 21, 56, .06); }
.bead { stroke: var(--ink); stroke-width: .16; }
.bv-dim { fill: none; stroke: var(--maroon); stroke-width: .14; }
.bv-m { font-size: 2.7px; font-weight: 500; fill: var(--ink); font-variant-numeric: tabular-nums; }
.bv-s { font-size: 2.15px; font-weight: 400; fill: var(--ink-2); }
.bv-s.bad { fill: var(--maroon); }

/* fields: label, stepper, slider */
.field { display: grid; gap: 0; min-width: 0; }
.f-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.f-top label { font-size: var(--fs-body); display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-width: 0; }
.f-top label small { font-size: var(--fs-xs); color: var(--ink-2); }
.stp { display: inline-flex; align-items: center; direction: ltr; flex: none; }
.stp output { min-width: 66px; text-align: center; font-size: 16px; font-weight: 500; white-space: nowrap; direction: ltr; }
.stp output small { font-size: 11px; color: var(--ink-2); font-weight: 400; }
.st { display: grid; place-items: center; width: 44px; height: 44px; }
.st svg { width: 30px; height: 30px; padding: 7px; border-radius: 50%; background: rgba(255, 255, 255, .8); box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .22); transition: background-color .15s, box-shadow .15s, transform .12s; }
.st:active svg { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink); transform: scale(.94); }
.st:disabled { opacity: .3; cursor: default; }
input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; --p: 50%; direction: ltr; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p)); border-radius: 3px; }
input[type="range"]::-moz-range-track { height: 3px; background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p)); border-radius: 3px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10.5px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); box-shadow: 0 2px 6px rgba(21, 23, 28, .16); }
input[type="range"]::-moz-range-thumb { width: 21px; height: 21px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); }
input[type="range"]:focus-visible { outline-offset: -4px; }

.divrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.divrow-l { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; min-width: 0; font-size: var(--fs-body); }
.divrow-l output { font-size: 13px; color: var(--ink-2); direction: ltr; white-space: nowrap; }
.divrow-l output small { font-size: 11px; }
.shnote { margin-block: -2px 6px; }
.tamrow { margin-block-start: 4px; padding-block-start: 10px; border-block-start: 1px solid var(--line); }
.tamrow output { white-space: normal; direction: inherit; font-size: 12px; }

/* advanced drawer */
.adv { display: block; padding-block: 0; }
.adv summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.adv summary svg { flex: none; transition: transform .35s var(--ease); }
.adv[open] summary svg { transform: rotate(180deg); }
.adv-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding-block-end: 16px; }
.adv-in .reset { justify-self: start; margin-block: 8px 2px; }
.tamsizes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin-block-start: 14px; padding-block-start: 14px; border-block-start: 1px solid var(--line); }
.tamread { display: grid; margin-block-end: 4px; }
.tamread li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 30px; font-size: 14px; }
.tamread li b { font-size: 13px; font-weight: 400; color: var(--ink-2); direction: ltr; }
.tamread li.off { opacity: .45; }

/* cutting list rows */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.lrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; padding: 8px 12px 10px; border-radius: var(--r-in); background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.lrow.is-warn { box-shadow: inset 0 0 0 1.5px var(--maroon); }
.lrow-h { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; min-height: 44px; }
.lrow-h > b { display: inline-block; font-size: 16px; font-weight: 500; }
.lrow-h > b::first-letter { text-transform: uppercase; }
.lrow-size, .lrow-max { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.lrow-max { padding: 2px 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.fillbtn { margin-inline-start: auto; margin-block: 8px; }                     /* keeps its 44 px touch area inside the row, also when the row wraps */
.lrow.is-fill .lrow-qty { display: none; }
.lrow-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); min-height: 28px; }
.undo { position: relative; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; min-width: 44px; padding-inline: 4px; }
.undo::after { content: ""; position: absolute; inset: -6px 0; }
.lrow-msg, .issue { display: grid; gap: 10px; padding: 10px 12px 12px; border-radius: 12px; background: rgba(138, 21, 56, .05); box-shadow: inset 0 0 0 1px rgba(138, 21, 56, .22); font-size: 13px; line-height: 1.45; color: var(--ink); }
.lrow-msg { margin-block: 2px 4px; }
.lrow-msg p, .issue p { text-wrap: pretty; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.acts .btn { height: 44px; padding-inline: 16px; font-size: 13.5px; }
.acts .act { background: var(--ink); color: #fff; }
.lrow-tam { box-shadow: inset 0 0 0 1px rgba(176, 130, 46, .5); }
.calc:not(.tam-on) .lrow-tam, .calc:not(.cap-on) .lrow-tam[data-row="cap"] { display: none; }

/* ───────── 2 · What you get ───────── */
.result-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px 16px 16px; border-radius: var(--r-card); background: #fff; box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .06); }
.result-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.result-main > b { font-size: 72px; line-height: .95; font-weight: 300; letter-spacing: -.04em; min-width: 1ch; }
.result-label { font-size: 16px; font-weight: 500; }
.result-list { font-size: 16px; font-weight: 500; line-height: 1.5; }
.result-list b { font-size: 32px; font-weight: 300; letter-spacing: -.03em; }
.result-list i { color: var(--ink-3); font-style: normal; }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-block-start: 1px solid var(--line); }
.result-stats > div { min-width: 0; padding-block: 10px 9px; padding-inline: 12px 4px; border-block-end: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.result-stats > div:nth-child(3n + 1) { padding-inline-start: 0; border-inline-start: 0; }
.result-stats dd { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 400; letter-spacing: -.01em; }
.result-stats dt { font-size: var(--fs-xs); line-height: 1.35; color: var(--ink-2); }
.result-stats .is-hi dd { color: var(--maroon); font-weight: 500; }
.result-card.is-bad .result-main > b, .result-card.is-bad .result-stats { opacity: .25; }
.result-extra { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.result-extra .extra-t { display: inline-block; margin-inline-end: 4px; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--tam); filter: brightness(.78); }
.result-extra b { color: var(--ink); font-weight: 500; }
.result-extra i { font-style: normal; color: var(--ink-3); }
.result-hint { color: var(--ink); text-wrap: pretty; padding: 10px 12px; border-radius: 12px; background: var(--wash); }
.result-warn { font-size: 13px; line-height: 1.45; color: var(--ink); padding: 10px 12px; border-radius: 12px; background: rgba(138, 21, 56, .05); box-shadow: inset 0 0 0 1px rgba(138, 21, 56, .4); }
.issues { display: grid; gap: 8px; }
.issue p > .warn-t { display: block; margin-block-end: 2px; font-size: 14px; }
.issue-adj { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding-block: 4px; background: none; box-shadow: inset 0 0 0 1px var(--line); }

/* ───────── 3 · The cut balata ───────── */
.diagram { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 12px 14px; border-radius: var(--r-card); background: var(--surface); box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .06); }
.diagram-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; justify-items: center; }
.diagram-bar .colour { justify-self: stretch; }
.diagram-stage { position: relative; width: 100%; max-width: 440px; margin-inline: auto; }
.diagram-svg svg { width: 100%; height: auto; }
.diagram-stage.is-3d .diagram-svg { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
#cut3d { display: block; width: 100%; aspect-ratio: 1 / .8; touch-action: pan-y; cursor: grab; -webkit-user-select: none; user-select: none; }
#cut3d[hidden] { display: none; }
#cut3d:active { cursor: grabbing; }
.ln { fill: none; stroke: var(--ink); stroke-width: .5; }
.cut-veil { opacity: .3; }
.cs { fill: none; stroke: var(--ink); stroke-opacity: .28; stroke-width: .3; }
.cs-wide { stroke: var(--maroon); stroke-opacity: .9; stroke-width: .45; stroke-dasharray: 2 1.2; }
.cb { fill: none; stroke: var(--c-line); stroke-opacity: .55; stroke-width: .3; transition: opacity .25s; }
.cb-spare { fill: #fff; fill-opacity: .46; stroke: var(--ink); stroke-opacity: .5; stroke-dasharray: 1.2 .9; }
.cb-imame { fill: var(--maroon); fill-opacity: .86; stroke: #fff; stroke-opacity: .9; }
.cb-divider { fill: var(--ink); fill-opacity: .84; stroke: #fff; stroke-opacity: .9; }
.cb-ziwana, .cb-tawkih, .cb-tbead, .cb-crown, .cb-cap { fill: var(--tam); fill-opacity: .9; stroke: #fff; stroke-opacity: .9; }
#cut.is-bad #cutOutline { stroke: var(--maroon); stroke-dasharray: 3 2; }
#cut[data-hi="bead"] .cb:not(.cb-bead):not(.cb-spare), #cut[data-hi="spare"] .cb:not(.cb-spare), #cut[data-hi="imame"] .cb:not(.cb-imame), #cut[data-hi="divider"] .cb:not(.cb-divider),
#cut[data-hi="tam"] .cb:not(.cb-ziwana):not(.cb-tawkih):not(.cb-tbead):not(.cb-crown):not(.cb-cap) { opacity: .18; }
.view-hint { text-align: center; margin: -2px auto 0; }
.diagram figcaption { display: grid; gap: 8px; justify-items: center; }
.diagram-cap { font-size: 12px; line-height: 1.5; color: var(--ink-2); text-align: center; }
.diagram-cap span { unicode-bidi: isolate; white-space: nowrap; }
.cap-note { text-align: center; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 0; font-size: 12px; color: var(--ink-2); }
.legend li { display: inline-flex; }
.legend button, .lg-static { position: relative; display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding-inline: 7px; border-radius: 999px; color: inherit; transition: background-color .2s, color .2s, box-shadow .2s; }
.legend button::after { content: ""; position: absolute; inset: -7px -1px; }
.legend button.on { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .3); }
.k { flex: none; width: 14px; height: 10px; border-radius: 2px; background: var(--c-avg); box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .25); }
.k-spare { background: #fff; box-shadow: none; outline: 1px dashed rgba(21, 23, 28, .6); outline-offset: -1px; }
.k-imame { background: var(--maroon); box-shadow: none; }
.k-divider { background: var(--ink); box-shadow: none; }
.k-tam { background: var(--tam); box-shadow: none; }
.k-waste { background: #fff; box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .25); opacity: .9; }
@supports (background: color-mix(in srgb, red 50%, blue)) {
  .k-spare { background: color-mix(in srgb, var(--c-avg) 54%, #fff); }
  .k-waste { background: color-mix(in srgb, var(--c-avg) 30%, #fff); box-shadow: none; }
}

/* colour: one compact control, real disc photos */
.colourbox { min-width: 0; }
.colourbox > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding-block: 6px; padding-inline: 8px 14px; border-radius: 26px; background: #fff; box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .16); }
.colourbox > summary .chev { flex: none; margin-inline-start: auto; transition: transform .35s var(--ease); }
.colourbox[open] > summary .chev { transform: rotate(180deg); }
.cdisc { flex: none; width: 38px; height: 38px; border-radius: 50%; filter: drop-shadow(0 1px 2px rgba(21, 23, 28, .2)); }
.colour-name { display: grid; gap: 1px; min-width: 0; }
.cn-1 { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; font-size: 11px; line-height: 15px; color: var(--ink-2); }
.cn-1 b { font-weight: 500; letter-spacing: .04em; color: var(--ink); }
.cn-1 .ast { font-size: 1em; line-height: inherit; vertical-align: baseline; }
.cn-2 { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; font-size: 14.5px; line-height: 1.3; }
.cn-a { font-weight: 500; }
.cn-b { color: var(--ink-2); }
.colour-panel { display: grid; gap: 8px; padding: 10px 2px 2px; }
.chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.chip { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-height: 44px; }
.chip img { width: 76%; max-width: 40px; height: auto; border-radius: 50%; filter: drop-shadow(0 1px 2px rgba(21, 23, 28, .2)); transition: transform .12s ease-out; }
.chip::before { content: ""; position: absolute; inset: 50% auto auto 50%; width: min(96%, 50px); aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink); opacity: 0; transform: translate(-50%, -50%) scale(.85); transition: opacity .2s, transform .3s var(--ease); }
.chip.on::before { opacity: 1; transform: translate(-50%, -50%); }
.chip:active img { transform: scale(.92); }
.chip.is-limited::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--lim); box-shadow: 0 0 0 1.5px #fff; }
.colour-meta { display: flex; justify-content: flex-end; }

.calc-note { text-align: center; margin-inline: auto; }
.send { display: grid; gap: 10px; }
.send .btn { width: 100%; }
.pre { display: flex; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.pre b { font-weight: 500; color: var(--ink); }
.pre b::after { content: "·"; margin-inline-start: 6px; font-weight: 400; color: var(--ink-3); }
.back { justify-self: center; display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; color: var(--ink-2); }

@media (max-width: 374px) {
  .seg button { padding-inline: 8px; font-size: 12.5px; }
  .seg-s button { padding-inline: 11px; }
  .result-main > b { font-size: 64px; }
}

/* ───────── tablet: the phone flow in one centred column ───────── */
@media (min-width: 700px) {
  .calc { padding-block-end: 88px; }
  .calc-head { padding-block-end: 24px; }
  .calc-grid, .calc-head { max-width: 620px; margin-inline: auto; }
  .calc-grid { gap: 18px; }
  .shapes { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .chips { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .group { padding: 18px 18px 20px; }
  .step-t { font-size: 24px; }
  .result-card { padding: 20px 20px 18px; }
  .diagram { padding: 14px 14px 16px; }
}
/* ───────── desktop: step 1 on one side; steps 2 and 3 stay in view on the other ───────── */
@media (min-width: 900px) {
  .peek { display: none; }
  .calc-head { max-width: none; }
  .calc-grid { max-width: none; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); column-gap: 40px; row-gap: 0; align-items: start; margin-block-start: 8px; }
  .calc-out { position: sticky; top: 16px; gap: 20px; margin-block-start: 0; }
  .calc-out .step-s { display: none; }
  .calc-out .step-h { padding-block: 0 2px; }
  .calc-out .stepc { gap: 8px; }
  .calc-out .cap-note { display: none; }
  .shapes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .diagram-stage { max-width: min(100%, max(220px, calc(100vh - 696px))); max-width: min(100%, max(220px, calc(100svh - 696px))); }
  .result-main > b { font-size: 68px; }
  .result-card { gap: 10px; padding-block: 14px; }
  .result-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .result-stats > div { padding-block: 8px 7px; padding-inline: 10px 2px; }
  .result-stats > div:nth-child(3n + 1) { padding-inline-start: 10px; border-inline-start: 1px solid var(--line); }
  .result-stats > div:nth-child(5n + 1) { padding-inline-start: 0; border-inline-start: 0; }
  .result-stats dd { font-size: 20px; }
  .send { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 16px; }
  .send .btn { width: auto; }
  .pre { display: grid; justify-content: start; gap: 0; font-size: 13px; }
  .pre b { font-size: 15px; } .pre b::after { display: none; }
  .pre b, .pre span { white-space: nowrap; }
  .back { grid-column: 1 / -1; justify-self: start; min-height: 28px; }
  .calc-note { text-align: start; margin-inline: 0; }
}
@media (min-width: 1180px) {
  .calc-grid { grid-template-columns: minmax(0, 480px) minmax(0, 1fr); column-gap: 56px; }
  .diagram-bar { grid-template-columns: minmax(0, 1fr) auto; align-items: start; justify-items: stretch; }
  .diagram-bar .viewmode { margin-block-start: 7px; }
  .send { grid-template-columns: auto minmax(0, 1fr) auto; }
  .back { grid-column: auto; justify-self: end; }
  .diagram-stage { max-width: min(520px, max(220px, calc(100vh - 580px))); max-width: min(520px, max(220px, calc(100svh - 580px))); }
}

/* ───────── static fallback: reduced motion or ?static=1 ───────── */
html.static { scroll-behavior: auto !important; }
.static *, .static *::before, .static *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }

#layerNote { margin-block-end: 12px; }

/* founder's suggestions: ready combinations that load into the cutting list */
.sugs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.sug { display: grid; gap: 2px; min-height: 56px; padding: 10px 14px; border-radius: var(--r-in); text-align: start; background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, background .2s; }
.sug b { font-size: 15px; font-weight: 500; }
.sug small { font-size: var(--fs-xs); line-height: 1.45; color: var(--ink-2); }
.sug.on { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink); }
@media (hover: hover) { .sug:hover { background: #fff; } }
@media (min-width: 700px) { .sugs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.b2shapes { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 8px 4px; }
.b2shapes .fpill { height: 32px; line-height: 32px; }
.b2shapes .fpill.on { background: var(--ink); color: #fff; }
.lrow-x { justify-self: start; min-height: 44px; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

/* rule notes: what a value follows, and a one-tap way back to the rule */
.rulenote { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.rulenote:empty { display: none; }
.rulenote button { min-height: 32px; padding-inline: 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.rulenote.is-off { color: var(--ink); }
.sug .sug-y { color: var(--ink); font-weight: 500; }
.sug[disabled] { opacity: .5; }
#nmode button { min-width: 0; padding-inline: 6px; }

.sugs.is-stale .sug { opacity: .55; }
.sug[hidden] { display: none; }
#sugMore { justify-self: start; }

/* founder's suggestions: a highlighted drop-down, closed until asked for */
.sugbox { border-radius: var(--r-card, 22px); background: var(--ink); color: #fff; }
.sugbox > summary { display: flex; align-items: center; gap: 10px; min-height: 56px; padding-inline: 18px; font-size: 15px; font-weight: 500; border-radius: inherit; }
.sugbox > summary .chev { flex: none; margin-inline-start: auto; transition: transform .35s var(--ease); }
.sugbox[open] > summary .chev { transform: rotate(180deg); }
.sug-star { color: #e7c873; font-size: 14px; line-height: 1; }
.sugbox-in { display: grid; gap: 12px; padding: 2px 14px 14px; }
.sugbox .fnote { color: rgba(255, 255, 255, .78); }
.sugbox .sug { color: var(--ink); background: #fff; box-shadow: none; }
.sugbox .sug.on { box-shadow: inset 0 0 0 2px #e7c873; }
