/* Dedicated calculator skin. All selectors remain inside the page boundary. */
#bangunRuangPage { color: var(--ink, #0f172a); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#bangunRuangPage *, #bangunRuangPage *::before, #bangunRuangPage *::after { box-sizing: border-box; }
#bangunRuangPage [hidden] { display: none !important; }
#bangunRuangPage .layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; gap: 20px; }
#bangunRuangPage .layout > *, #bangunRuangPage .card, #bangunRuangPage .field { min-width: 0; }
#bangunRuangPage .card { padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--line, #e2e8f0); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
#bangunRuangPage h2 { font-size: 1.05rem; line-height: 1.3; margin-bottom: 6px; }
#bangunRuangPage h3 { font-size: .85rem; margin: 6px 0 4px; }
#bangunRuangPage p, #bangunRuangPage li { line-height: 1.6; }
#bangunRuangPage #brStatus { font-size: .78rem; line-height: 1.35; color: #475569; margin: 2px 0 0; }
#bangunRuangPage fieldset { min-width: 0; margin: 0 0 8px; padding: 0; border: 0; }
#bangunRuangPage legend { font-weight: 700; margin-bottom: 4px; font-size: .84rem; }
#bangunRuangPage .chip-row { gap: 6px; }
#bangunRuangPage #brPresets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#bangunRuangPage button, #bangunRuangPage select, #bangunRuangPage input:not([type="radio"]):not([type="checkbox"]) { min-height: 44px; max-width: 100%; font: inherit; font-size: 1rem; }
#bangunRuangPage button { cursor: pointer; white-space: normal; }
#bangunRuangPage button:disabled, #bangunRuangPage fieldset:disabled { cursor: not-allowed; opacity: .65; }
#bangunRuangPage :is(button, input, select, a, summary, [tabindex]):focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; }
#bangunRuangPage .chip { border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 8px; padding: 6px 8px; line-height: 1.25; font-size: .78rem; }
#bangunRuangPage .preset:hover { border-color: #1d4ed8; background: #eff6ff; }
#bangunRuangPage #brShapeTabs.br-shape-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#bangunRuangPage .br-shape-tab { display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 5px; min-height: 44px; text-align: center; font-weight: 600; font-size: .76rem; padding: 6px 6px; }
#bangunRuangPage .br-shape-tab svg { flex-shrink: 0; width: 16px; height: 16px; }
#bangunRuangPage .br-shape-tab[aria-selected="true"] { background: #eff6ff; border: 2px solid #1d4ed8; padding: 5px 5px; color: #1e40af; box-shadow: inset 0 -2px #1d4ed8; }
#bangunRuangPage #brShapePanel { margin-top: 8px; display: flex; flex-direction: column; }
#bangunRuangPage #brShapePanel > #brInputs { order: -2; }
#bangunRuangPage #brShapePanel > .field { order: -1; }
#bangunRuangPage .br-segmented { display: flex; flex-wrap: wrap; gap: 6px; }
#bangunRuangPage .br-segmented label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; padding: 6px 8px; font-size: .78rem; }
#bangunRuangPage .br-segmented input { width: 16px; height: 16px; margin: 0; accent-color: #1d4ed8; flex-shrink: 0; }
#bangunRuangPage .br-segmented label:has(input:checked), #bangunRuangPage .br-segmented [aria-pressed="true"] { color: #1e40af; border-color: #1d4ed8; background: #eff6ff; font-weight: 700; }
#bangunRuangPage .br-segmented label:focus-within { outline: 2px solid #1d4ed8; outline-offset: 2px; }
#bangunRuangPage #brInputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#bangunRuangPage .field { margin: 6px 0; }
#bangunRuangPage .field label, #bangunRuangPage #brInputs label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 4px; color: #334155; }
#bangunRuangPage input:not([type="radio"]):not([type="checkbox"]), #bangunRuangPage select { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid #94a3b8; border-radius: 8px; background: #fff; color: #0f172a; font-size: 1rem; font-variant-numeric: tabular-nums; }
#bangunRuangPage [aria-invalid="true"] { border-color: #b91c1c !important; background: #fef2f2 !important; }
#bangunRuangPage [id^="br-error-"], #bangunRuangPage #formError { color: #b91c1c; font-size: .84rem; line-height: 1.5; }
#bangunRuangPage #formError:not(:empty) { margin-top: 10px; padding: 10px; border-left: 3px solid #b91c1c; background: #fef2f2; }
#bangunRuangPage .hint, #bangunRuangPage #brPreviewCaption { color: #475569; font-size: .78rem; line-height: 1.45; margin: 4px 0; }
#bangunRuangPage .calc-action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#bangunRuangPage .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
#bangunRuangPage math { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 12px 2px; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
/* Keep nested MathML rows intrinsic inside the existing keyboard scrollport. */
#bangunRuangPage math mrow { min-width: max-content; }
#bangunRuangPage .formula, #bangunRuangPage .result-hero { min-width: 0; max-width: 100%; }
#bangunRuangPage .result-hero { padding: 16px; background: #eff6ff; border-radius: 10px; color: #1e40af; margin: 16px 0; }
#bangunRuangPage .result-hero math { font-size: 1.5rem; }
#bangunRuangPage #brSteps { padding-left: 24px; }
#bangunRuangPage #brSteps li { margin-bottom: 10px; }
#bangunRuangPage #brPreview { margin: 0; }
#bangunRuangPage #brPreviewSvg { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto 12px; }
#bangunRuangPage .br-variable-legend { display: grid; grid-template-columns: minmax(32px, auto) minmax(0, 1fr); gap: 8px 12px; font-size: .875rem; margin: 20px 0 0; }
#bangunRuangPage .br-variable-legend dt { font-weight: 800; }
#bangunRuangPage .br-variable-legend dd { margin: 0; color: #475569; }
#bangunRuangPage .br-variable-legend .is-active { color: #1e40af; background: #eff6ff; text-decoration: underline; text-underline-offset: 3px; }
#bangunRuangPage .br-dimension { color: #475569; }
#bangunRuangPage .br-dimension.is-active { color: #1d4ed8; }
#bangunRuangPage .br-dimension.is-active path { stroke-width: 3; }
#bangunRuangPage .br-dimension.is-active text { font-weight: 800; text-decoration: underline; }
#bangunRuangPage summary { min-height: 44px; padding: 12px 4px; cursor: pointer; }
@media (max-width: 800px) {
  #bangunRuangPage .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #bangunRuangPage .card { padding: 12px 14px; }
}
@media (max-width: 480px) {
  #bangunRuangPage .card { padding: 12px 14px; margin-bottom: 12px; }
  #bangunRuangPage #brShapeTabs.br-shape-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  #bangunRuangPage .br-shape-tab { padding: 4px; font-size: .72rem; gap: 3px; }
  #bangunRuangPage .br-shape-tab svg { width: 14px; height: 14px; }
  #bangunRuangPage #brTargets.br-segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  #bangunRuangPage .br-segmented label { padding: 4px 6px; font-size: .74rem; gap: 4px; }
  #bangunRuangPage #brInputs { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  #bangunRuangPage .calc-action-row { display: grid; grid-template-columns: minmax(0, 1fr); }
  #bangunRuangPage .calc-action-row .btn { width: 100%; }
}
@media print {
  #bangunRuangPage { max-width: none; width: 100%; color: #000; padding: 0; }
  #bangunRuangPage .no-print, #bangunRuangPage #brPresets, #bangunRuangPage #brShapeTabs, #bangunRuangPage #brStatus, #bangunRuangPage #copyStatus { display: none !important; }
  #bangunRuangPage .layout { display: block; }
  #bangunRuangPage .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; padding: 12pt; margin-bottom: 12pt; }
  #bangunRuangPage math { overflow: visible; font-size: 12pt; }
  #bangunRuangPage #brPreviewSvg { max-width: 260px; }
  #bangunRuangPage fieldset:disabled { opacity: 1; }
}
