.radix-shell { width: min(1180px, calc(100% - 40px)); margin: auto; padding-bottom: 64px; }
.radix-shell button, .radix-shell input, .radix-shell select { font: inherit; }
.radix-shell button { cursor: pointer; }
.radix-shell :is(button, input, select, summary, a):focus-visible { outline: 3px solid var(--blue-strong); outline-offset: 4px; }
.radix-shell [hidden] { display: none !important; }
.radix-hero { padding: 24px 0 28px; }
.radix-hero .eyebrow { color: var(--blue-strong); margin-bottom: 12px; }
.radix-hero h1 { margin: 0; font-size: clamp(2rem, 4.8vw, 3.4rem); line-height: 1.35; letter-spacing: -.04em; }
.radix-lead { margin: 16px 0 0; color: var(--ink-soft); font-size: .95rem; }
.input-panel { background: var(--white); border: 1px solid var(--line); border-radius: 22px; padding: 28px 32px; box-shadow: 0 8px 30px rgb(16 47 53 / 4%); }
.input-sentence { display: flex; align-items: end; gap: 14px; }
.input-sentence label { display: grid; gap: 7px; }
.input-sentence label > span { font-size: .74rem; font-weight: 700; color: var(--ink-soft); }
.base-field { flex: 0 0 145px; }
.number-field { flex: 0 1 260px; max-width: 260px; min-width: 0; }
.input-sentence input, .input-sentence select { width: 100%; height: 58px; min-width: 0; padding: 10px 14px; border: 1px solid #9daeb0; border-radius: 10px; color: var(--ink); background: #fff; }
.input-sentence input { font: 600 1.5rem ui-monospace, "SFMono-Regular", Consolas, monospace; }
.input-sentence input[aria-invalid="true"] { border-color: var(--coral-strong); }
.sentence-particle { display: grid; place-items: center; height: 58px; flex: 0 0 auto; }
.convert-button { display: flex; align-items: center; justify-content: center; gap: 24px; height: 58px; padding: 10px 24px; color: var(--white); background: var(--ink); border: 1px solid var(--ink); border-radius: 10px; font-weight: 700 !important; white-space: nowrap; }
.convert-button:hover { background: #224950; }
.input-error { margin: 12px 0; padding: 12px 16px; border-left: 3px solid var(--coral-strong); background: #fff0e9; color: #8c3020; font-weight: 700; font-size: .85rem; }
.examples { display: flex; gap: 16px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.examples > span { font-size: .75rem; font-weight: 700; white-space: nowrap; }
.examples > div { display: flex; flex-wrap: wrap; gap: 8px; }
.examples button { padding: 8px 12px; min-height: 40px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: var(--paper); font-size: .74rem; }
.examples button:hover { border-color: var(--blue-strong); color: var(--blue-strong); }
.result-panel { position: relative; margin: 24px 0 0; padding: 26px 32px 28px; border-radius: 22px; color: var(--white); background: var(--ink); }
.result-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-top h3 { margin: 0; font-size: .85rem; font-weight: 600; color: #d1e2e4; }
.result-kind { white-space: nowrap; padding: 3px 12px; border: 1px solid #709899; border-radius: 99px; color: #d8f7ea; font-size: .73rem; }
.equals-sign { color: #a8c3c6; font: 600 clamp(1.7rem, 3vw, 2.6rem)/1.8 ui-monospace, "SFMono-Regular", Consolas, monospace; flex: 0 0 auto; }
#result-number { min-width: 0; font: 600 clamp(1.7rem, 3vw, 2.6rem)/1.8 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .025em; overflow-wrap: anywhere; }
.repeat-digits { color: inherit; }
.repeat-digit { position: relative; display: inline-block; }
.cycle-dot::before { content: ""; position: absolute; top: .06em; left: 50%; width: .13em; height: .13em; border-radius: 50%; background: currentColor; transform: translateX(-50%); }
.result-equation { display: flex; align-items: flex-end; gap: 20px; margin: 20px 0 8px; }
.equation-side { flex: 0 1 auto; min-width: 0; }
.equation-side > small { display: block; margin-bottom: 2px; color: #d1e2e4; font-size: .74rem; }
.equation-side > span, .equation-side > div { display: block; font: 600 clamp(1.7rem, 3vw, 2.6rem)/1.8 ui-monospace, "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.result-equation sub { margin-left: 5px; font-size: .45em; color: #d1e2e4; }
.result-equation .integer-color, .result-equation .fractional-color { color: inherit; }
.result-equation .repeat-digits { color: #a4f0d5; }
.arrow-cell { position: relative; width: 18px; min-width: 18px; padding: 0 !important; color: var(--part-color); }
.column-arrow { position: absolute; top: 16px; bottom: 16px; left: 50%; width: 3px; transform: translateX(-50%); border-radius: 2px; background: currentColor; }
.column-arrow::before { content: ""; position: absolute; left: -4px; width: 11px; height: 11px; border-top: 3px solid currentColor; border-right: 3px solid currentColor; }
.column-arrow.up::before { top: 0; transform: rotate(-45deg); }
.column-arrow.down::before { bottom: 0; transform: rotate(135deg); }
.read-caption { margin: 12px 0 0; text-align: right; color: var(--part-color); font-size: .78rem; font-weight: 700; }
.sum-calculation { margin-top: 20px; border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; background: var(--white); overflow-wrap: anywhere; }
.sum-calculation h3 { margin: 0 0 8px; font-size: .9rem; }
.sum-calculation p { margin: 8px 0 0; font-size: .9rem; }
.grouping-visual { margin-bottom: 20px; padding: 22px 24px; background: var(--white); border: 1px solid var(--line); border-radius: 18px; }
.grouping-visual h3 { margin: 0; font-size: 1rem; }
.grouping-visual > p { margin: 8px 0 20px; font-size: .8rem; color: var(--ink-soft); }
.grouping-parts { display: flex; flex-wrap: wrap; align-items: start; justify-content: center; gap: 20px; }
.grouped-side { display: flex; flex-wrap: wrap; gap: 16px; max-width: 100%; }
.grouped-side.integer { color: var(--blue-strong); }
.grouped-side.fractional { color: var(--mint-strong); }
.bit-group { display: grid; gap: 8px; justify-items: center; padding: 10px 8px; border: 2px solid currentColor; border-radius: 10px; background: #f4f7fa; }
.fractional .bit-group { background: #edf6f0; }
.bit-group small { font-size: .67rem; }
.bit-quad { display: inline-flex; gap: .14em; font: 700 1.45rem ui-monospace, "SFMono-Regular", Consolas, monospace; }
.bit-digit { display: inline-grid; place-items: center; width: 1ch; }
.padding { color: #566a73; background: #e2e5e5; border-radius: 3px; }
.grouped-point { margin-top: 14px; font: 700 2rem ui-monospace, "SFMono-Regular", Consolas, monospace; }
.group-index { grid-column: 1 / -1; text-align: left; font-size: .7rem; color: var(--ink-soft); }
.result-note, .sign-note { margin: 8px 0 0; font-size: .8rem; color: #d1e2e4; overflow-wrap: anywhere; }
.result-note strong { color: #a4f0d5; }
.working-section { margin: 32px 0 12px; scroll-margin-top: 120px; }
.working-heading { margin-bottom: 22px; }
.working-heading h2 { margin: 0; font-size: 1.45rem; }
#method-description { max-width: 640px; margin: 10px 0 0; font-size: .85rem; color: var(--ink-soft); }
.calculation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.calculation-card { --part-color: var(--blue-strong); --part-paper: #eaf0f6; min-width: 0; border: 1px solid #c4d2de; border-radius: 18px; background: var(--white); overflow: hidden; display: flex; flex-direction: column; }
.calculation-card.fractional-part { --part-color: var(--mint-strong); --part-paper: #e6f2ed; border-color: #c1d7cb; }
.calculation-card > header { padding: 20px 22px 16px; background: var(--part-paper); }
.part-label { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 0 0 6px; color: var(--part-color); font-weight: 700; font-size: .95rem; }
.part-label span { font: 600 1.15rem ui-monospace, "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; min-width: 0; text-align: right; }
.calculation-card h3 { margin: 0; font-size: 1.08rem; }
.calculation-card header > p:last-child { margin: 6px 0 0; color: var(--ink-soft); font-size: .8rem; }
.calculation-body { padding: 20px 22px; flex: 1; }
.scroll-table { width: 100%; max-width: 100%; }
.scroll-table table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .84rem; }
.step-column { width: 2.5rem; }
.integer-part .work-column { width: clamp(5.25rem, 9vw, 6.25rem); }
.quotient-column { width: clamp(2.75rem, 4vw, 3.5rem); }
.fractional-part .work-column { width: clamp(6rem, 12vw, 9rem); }
.digit-column { width: 3.375rem; }
.arrow-column { width: 1.125rem; }
.scroll-table th { padding: 0 8px 10px; text-align: left; color: var(--ink-soft); font-size: .7rem; font-weight: 600; overflow-wrap: anywhere; }
.scroll-table td { padding: 12px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.scroll-table td:first-child { padding-left: 0; color: var(--ink-soft); font-size: .7rem; }
.scroll-table :is(.digit-heading, .digit-cell) { width: 54px; padding-inline: 4px; text-align: center; }
.scroll-table :is(.quotient-heading, .quotient-cell) { text-align: center; }
.scroll-table .arrow-heading { width: 18px; padding: 0; }
.scroll-table :is(.residual-heading, .residual-cell) { padding-left: clamp(10px, 4vw, 28px); }
.scroll-table .rule-fill { padding: 0; }
.integer-part .read-caption { width: calc(7rem + clamp(5.25rem, 9vw, 6.25rem) + clamp(2.75rem, 4vw, 3.5rem)); max-width: 100%; }
.fractional-part .read-caption { width: calc(7rem + clamp(6rem, 12vw, 9rem)); max-width: 100%; }
.picked-value { display: inline-grid; gap: 4px; justify-items: center; }
.picked-value small { font-size: .67rem; white-space: nowrap; color: var(--part-color); }
.arithmetic { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.picked-digit { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 2px 8px; border: 1px solid #bdced2; border-radius: 6px; color: var(--part-color); background: var(--part-paper); font: 700 1rem ui-monospace, "SFMono-Regular", Consolas, monospace; }
.cycle-row td { background: #edf7ee; }
.part-answer { margin: 14px 0 0; font-size: .85rem; overflow-wrap: anywhere; }
.part-answer b { font: 700 1.3rem ui-monospace, "SFMono-Regular", Consolas, monospace; color: var(--part-color); }
.part-note { margin: 12px 0 0; font-size: .8rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.cycle-note { padding: 12px 14px; border-left: 3px solid var(--mint-strong); background: #edf7ee; }
.empty-part { margin: 0; font-size: .85rem; color: var(--ink-soft); }
.position-list, .nibble-list { display: grid; gap: 10px; }
.position-term { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: .95rem ui-monospace, "SFMono-Regular", Consolas, monospace; }
.position-term > strong { color: var(--part-color); overflow-wrap: anywhere; min-width: 0; }
.position-term > span:not(.picked-digit) { overflow-wrap: anywhere; min-width: 0; }
.position-term sup { font-size: .75em; }
.position-term small { width: 100%; font: .73rem/1.6 "Hiragino Sans", "Yu Gothic", sans-serif; color: var(--ink-soft); overflow-wrap: anywhere; }
.expanded-sum { border-top: 1px solid var(--line); margin: 18px 0 0; padding-top: 14px; font-size: .8rem; overflow-wrap: anywhere; }
.expanded-sum p { margin: 6px 0; }
.expanded-sum strong { color: var(--part-color); }
.nibble { display: grid; grid-template-columns: 1fr 22px .8fr 22px 1fr; align-items: center; text-align: center; gap: 6px; padding: 14px 10px; border: 1px solid var(--line); border-radius: 10px; }
.nibble small { display: block; color: var(--ink-soft); font-size: .64rem; margin-bottom: 5px; }
.nibble b { font: 700 1.2rem ui-monospace, "SFMono-Regular", Consolas, monospace; color: var(--part-color); }
.nibble > i { color: var(--ink-soft); font-style: normal; }
.nibble .padding { color: #566a73; background: #e2e5e5; border-radius: 3px; }
.joined-groups { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.joined-groups span { padding: 4px 8px; color: var(--part-color); border: 1px solid var(--line); border-radius: 6px; font: 600 1rem ui-monospace, "SFMono-Regular", Consolas, monospace; }
.joined-groups small { font-size: .75rem; }
.identity-note { padding: 24px; border: 1px solid var(--line); background: var(--white); border-radius: 16px; }
.identity-note p { margin: 0; }
.lab-back { display: inline-block; padding: 12px 0; margin-top: 28px; font-size: .85rem; font-weight: 700; text-underline-offset: 4px; }
@media (max-width: 1050px) {
  .base-field { flex-basis: 125px; }
  .input-sentence { gap: 10px; }
  .convert-button { gap: 12px; padding: 10px 16px; }
}
@media (max-width: 760px) {
  .result-equation { gap: 12px; }
  .grouping-parts { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; }
  .grouping-parts:not(:has(.grouped-point)) { display: flex; }
  .grouped-side { gap: 10px; }
  .grouped-side.integer { justify-content: flex-end; }
  .grouped-point { margin-top: 10px; }

  .input-panel { padding: 22px; }
  .input-sentence { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto; gap: 14px 10px; }
  .input-sentence .base-field, .input-sentence .number-field { min-width: 0; }
  .input-sentence .number-field { max-width: none; }
  .input-sentence .base-field:nth-of-type(3) { grid-column: 1; grid-row: 2; }
  .input-sentence .sentence-particle:nth-of-type(2) { grid-column: 2; grid-row: 2; justify-self: start; }
  .convert-button { grid-column: 2 / 4; grid-row: 2; margin-left: 28px; }
  .calculation-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .equation-side > span, .equation-side > div, #result-number, .equals-sign { font-size: 1.25rem; }
  .result-equation { gap: 10px; }
  .grouping-visual { padding: 18px 14px; }
  .bit-group { padding: 8px 5px; }
  .bit-group .bit-quad { font-size: 1.25rem; }
  .arrow-cell { width: 18px; min-width: 18px; }
  .radix-shell { width: calc(100% - 28px); padding-bottom: 40px; }
  .radix-hero { padding-top: 20px; }
  .radix-hero h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); }
  .radix-hero .eyebrow { font-size: .65rem; }
  .input-panel { padding: 20px 16px; }
  .input-sentence input { font-size: 1.2rem; padding-inline: 10px; }
  .input-sentence select { padding-inline: 8px; }
  .input-sentence input, .input-sentence select, .sentence-particle, .convert-button { height: 52px; }
  .examples { flex-direction: column; align-items: start; gap: 10px; }
  .examples button { padding-inline: 10px; }
  .result-panel { padding: 22px 20px; }
  .calculation-card > header { padding: 18px; }
  .calculation-body { padding: 18px 14px; }
  .scroll-table table { font-size: .78rem; }
  .scroll-table td, .scroll-table th { padding-inline: 5px; }
  .nibble { gap: 4px; padding-inline: 8px; }
  .nibble b { font-size: 1.1rem; }
  .radix-shell .breadcrumb { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
