:root {
    --bg: #e8e5df;
    --panel: #f6f4f0;
    --ink: #22211e;
    --muted: #615e57;
    --line: #d3cec5;
    --accent: #a8501d;
    --accent-ink: #ffffff;
    --head: #2d2c29;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body { overflow-x: hidden; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
  header { background: var(--head); color: #f2efe9; padding: 14px 20px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
  header .brand { font-weight: 700; font-size: 18px; letter-spacing: .01em; }
  header .tag { color: #c9c3b8; font-size: 14px; }
  main { max-width: 1200px; margin: 0 auto; padding: 20px; }
  h1 { font-size: clamp(24px, 3.2vw, 34px); line-height: 1.15; margin: 6px 0 6px; }
  .lede { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }
  .layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
  .layout > * { min-width: 0; }
  @media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .viewer { height: 260px; min-height: 0; } main { padding: 14px; } }
  .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
  fieldset { border: 0; padding: 0; margin: 0 0 16px; }
  legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; padding: 0; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .seg label { display: block; cursor: pointer; }
  .seg input { position: absolute; opacity: 0; pointer-events: none; }
  .seg span { display: block; text-align: center; padding: 9px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
  .seg input:checked + span { background: var(--head); color: #fff; border-color: var(--head); font-weight: 600; }
  .seg input:checked + span::before { content: "\2713\00a0"; }
  .seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
  .row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
  .row > label { font-size: 14px; }
  .dim { display: flex; gap: 4px; align-items: center; }
  .dim input { width: 64px; }
  .dim small { color: var(--muted); font-size: 12px; width: 14px; }
  input[inputmode] { font: inherit; font-size: 15px; padding: 6px 8px; border: 1px solid #bdb7ac; border-radius: 6px; background: #fff; color: var(--ink); width: 80px; }
  input[inputmode]:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
  .hide { display: none !important; }
  .check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-bottom: 8px; }
  .check input { width: 18px; height: 18px; }
  .note { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
  .viewer { position: relative; background: #d9d5cd; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 400px; min-height: 260px; }
  #scene { width: 100%; height: 100%; display: block; touch-action: none; }
  .viewer .hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: #3f3d38; background: rgba(246,244,240,.85); padding: 4px 8px; border-radius: 6px; }
  .viewer .layers { position: absolute; right: 10px; top: 10px; background: rgba(246,244,240,.92); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
  .viewer .layers label { display: flex; gap: 6px; align-items: center; }
  .results { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
  .card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
  .card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
  .big { font-size: 28px; font-weight: 700; line-height: 1.1; }
  .sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
  .card ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
  .explain { margin-top: 26px; max-width: 75ch; }
  .explain h2 { font-size: 20px; margin: 22px 0 6px; }
  .explain p { margin: 0 0 10px; }
  footer { max-width: 1200px; margin: 30px auto 0; padding: 18px 20px 30px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
  #err { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--ink); }
header a { color: inherit; text-decoration: none; }
header a.tag:hover, header a.brand:hover { text-decoration: underline; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.tools a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; color: var(--ink); text-decoration: none; }
.tools a:hover, .tools a:focus-visible { border-color: var(--head); outline: none; box-shadow: 0 0 0 2px var(--head) inset; }
.tools b { display: block; font-size: 17px; margin-bottom: 4px; }
.tools span { color: var(--muted); font-size: 14px; }
.related { margin-top: 26px; }
.related h2 { font-size: 18px; margin: 0 0 8px; }
.seg.three { grid-template-columns: 1fr 1fr 1fr; }
.copybtn { font: inherit; font-size: 14px; font-weight: 600; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--head); background: var(--head); color: #fff; cursor: pointer; }
.copybtn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.answer { margin-bottom: 12px; padding: 18px 20px; }
.answer h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; }
.answer .big { font-size: 40px; }
.answer .sub { font-size: 16px; }
.dim input[id$="_in"] { width: 52px; }
.letter { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 50%; background: var(--head); color: #fff; font-weight: 700; font-size: 14px; vertical-align: middle; }
.letter:empty { display: none; }
.tags3d { position: absolute; inset: 0; pointer-events: none; }
.tag3d { display: inline-flex; align-items: center; gap: 6px; background: rgba(246,244,240,.96); border: 2px solid var(--head); border-radius: 999px; padding: 2px 10px 2px 2px; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.tag3d b { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--head); color: #fff; font-size: 13px; }
.details { margin-top: 12px; }
/* Big boxes for gloves and phones: 48px tall, 18px text (no iOS zoom). */
input[inputmode] { height: 48px; font-size: 18px; font-weight: 600; padding: 6px 10px; width: 84px; }
.dim input { width: 84px; }
.dim input[id$="_in"] { width: 60px; }
.dim small { font-size: 14px; width: auto; min-width: 16px; }
.row { margin-bottom: 10px; }
.row > label { font-size: 16px; display: flex; align-items: center; }
.letter { width: 30px; height: 30px; font-size: 16px; flex: 0 0 auto; }
.seg span { padding: 12px 6px; font-size: 15px; }
.tag3d { font-size: 15px; }
.tag3d b { width: 24px; height: 24px; font-size: 14px; }
/* Picture menu of every calculator, at the top of each page. */
.toolnav { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px; margin-bottom: 4px; scrollbar-width: thin; }
.toolnav a { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 78px; padding: 8px 8px 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.toolnav a svg { display: block; }
.toolnav a[aria-current="page"] { background: var(--head); border-color: var(--head); color: #fff; }
.toolnav a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tools a svg { display: block; margin-bottom: 6px; color: var(--head); }
@media (max-width: 900px) { .dim input { width: 76px; } .dim input[id$="_in"] { width: 56px; } }
