:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #5f6670;
  --line: #d8d8d2;
  --rail-red: #d51224;
  --rail-red-dark: #a80f1b;
  --rail-red-soft: #fff1f2;
  --rail-black: #111111;
  --focus: #ffbf47;
  --soft: #efefeb;
  --shadow: 0 10px 28px rgba(17, 17, 17, .07);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(180deg, rgba(213, 18, 36, .045), rgba(247, 247, 245, 0) 18rem), var(--bg); color: var(--ink); line-height: 1.55; }
html, body { overflow-x: clip; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.site-header { display: grid; grid-template-columns: auto minmax(16rem, 32rem) auto; align-items: center; gap: 1rem; padding: .55rem clamp(1rem, 4vw, 2.5rem); background: var(--panel); border-bottom: 4px solid var(--rail-red); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 720; text-decoration: none; letter-spacing: 0; white-space: nowrap; }
.brand img { display: block; width: 34px; height: 34px; }
.global-search { position: relative; width: 100%; }
.global-search label { gap: .2rem; }
.global-search label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.global-search input { min-height: 40px; padding-block: .5rem; }
.global-search-results { position: absolute; top: calc(100% + .35rem); left: 0; right: 0; z-index: 20; max-height: min(70vh, 34rem); overflow-y: auto; padding: .45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: var(--shadow); mask-image: linear-gradient(to bottom, #000 calc(100% - 1.15rem), rgba(0, 0, 0, .25)); }
.global-search-results .search-result-grid, .global-search-results .search-suggestions { grid-template-columns: 1fr; }
.footer-nav { display: flex; align-items: center; gap: .12rem; flex-wrap: wrap; }
.nav-menu { position: relative; justify-self: end; }
.nav-menu summary { min-height: 40px; display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .7rem; border: 1px solid rgba(213, 18, 36, .45); border-radius: 4px; background: #fff; color: var(--rail-red); cursor: pointer; font-weight: 800; list-style: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: ""; width: .48rem; height: .48rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-.12rem); transition: transform .15s ease; }
.nav-menu[open] summary::after { transform: rotate(225deg) translateY(-.05rem); }
.nav-panel { position: absolute; top: calc(100% + .45rem); right: 0; z-index: 30; width: min(28rem, calc(100vw - 2rem)); max-height: min(70vh, 30rem); overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; padding: .6rem; border: 1px solid rgba(213, 18, 36, .24); border-top: 4px solid var(--rail-red); border-radius: 6px; background: var(--panel); box-shadow: var(--shadow); mask-image: linear-gradient(to bottom, #000 calc(100% - 1.25rem), rgba(0, 0, 0, .25)); }
.nav-panel a, .footer-nav a { padding: .48rem .55rem; text-decoration: none; border-radius: 4px; color: var(--muted); font-weight: 650; }
.nav-panel .nav-primary { grid-column: 1 / -1; color: var(--rail-red); background: var(--rail-red-soft); font-weight: 850; }
.nav-panel a:hover, .footer-nav a:hover { background: var(--rail-red-soft); color: var(--rail-red-dark); }
.page-shell { width: min(1180px, 100%); margin: 0 auto; padding-inline: 1rem; }
.home-top { padding: clamp(1rem, 4vw, 2.4rem) 0 1.5rem; }
.home-layout { display: grid; grid-template-columns: minmax(280px, .74fr) minmax(360px, 1fr); gap: clamp(1rem, 4vw, 2rem); align-items: start; }
.home-layout > *, .converter-box, .tool-card, .category-card, .converter-link { min-width: 0; }
.home-copy { padding-top: .35rem; }
h1, h2 { line-height: 1.08; letter-spacing: 0; margin: 0 0 .85rem; }
h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.tool-page h1, .prose h1, .page-intro h1 { font-size: clamp(1.9rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.25rem, 3vw, 2rem); }
h3 { margin: 0 0 .7rem; font-size: 1rem; }
p { margin: 0 0 1rem; }
.eyebrow { margin-bottom: .55rem; color: var(--rail-red); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 750; }
.page-intro { padding: 1.35rem 0 .9rem; max-width: 760px; }
.page-intro p, .home-copy p { color: var(--muted); font-size: 1.08rem; }
.breadcrumbs { display: flex; gap: .45rem; flex-wrap: wrap; margin: 1.2rem 0 0; color: var(--muted); font-size: .9rem; }
.converter-box { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--rail-red); border-radius: 8px; padding: clamp(.9rem, 3vw, 1.25rem); box-shadow: var(--shadow); }
.tool-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.tool-head h2 { margin: 0; }
.converter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: .8rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; font-weight: 650; min-width: 0; }
input, select, button { min-width: 0; min-height: 48px; width: 100%; border: 1px solid var(--line); border-radius: 4px; padding: .72rem .78rem; font: inherit; color: var(--ink); background: #fff; }
.value-field { color: var(--ink); font-weight: 800; }
.value-field input { border: 2px solid var(--focus); background: #fffdf5; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255, 191, 71, .35); }
.value-field input:focus { box-shadow: 0 0 0 4px rgba(255, 191, 71, .3); }
button { cursor: pointer; background: var(--rail-red); color: white; border-color: var(--rail-red); font-weight: 760; }
button:hover { background: var(--rail-red-dark); border-color: var(--rail-red-dark); }
.ghost-button { width: auto; min-width: 6.5rem; background: #fff; color: var(--rail-red); border-color: rgba(213, 18, 36, .45); }
.preset-row { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.preset-row > span { color: var(--muted); font-size: .78rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.preset-chip { width: auto; min-width: 0; min-height: 34px; padding: .34rem .55rem; border-radius: 999px; background: #fff; color: var(--rail-red-dark); border-color: rgba(213, 18, 36, .22); font-size: .86rem; font-weight: 800; }
.preset-chip:hover { background: var(--rail-red-soft); color: var(--rail-red-dark); border-color: rgba(213, 18, 36, .48); }
.tool-actions { display: flex; align-items: end; flex-wrap: wrap; gap: .75rem; margin-top: .8rem; }
.tool-actions button { max-width: 12rem; }
.precision-control { width: min(12rem, 100%); }
.precision-control span { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.precision-control select { min-height: 44px; padding-block: .56rem; }
.readout { display: grid; gap: .25rem; margin-top: 1rem; padding: .9rem 1rem; background: var(--rail-black); color: #ffffff; border-left: .48rem solid var(--rail-red); border-radius: 5px; overflow-wrap: anywhere; }
.result-value { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 820; line-height: 1; font-variant-numeric: tabular-nums; }
.result-value span { font-size: .55em; color: #e6e6e6; }
.result-equation { color: #d8dde5; font-size: .95rem; font-weight: 600; }
.all-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: .45rem; margin-top: .85rem; }
.all-results span { display: grid; gap: .08rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 5px; background: #fbfbfa; }
.all-results small { color: var(--muted); font-size: .72rem; }
.all-results b { font-variant-numeric: tabular-nums; font-size: .92rem; }
.tool-note { color: var(--muted); margin-top: .8rem; }
.answer-panel { display: grid; gap: .2rem; margin-top: .85rem; padding: .85rem 1rem; border: 1px solid var(--line); border-left: .48rem solid var(--rail-red); border-radius: 6px; background: #fffdf5; }
.answer-panel span { color: var(--rail-red); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.answer-panel strong { font-size: clamp(1.35rem, 4vw, 2rem); line-height: 1.12; }
.answer-panel small { color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.note-panel { margin-top: .8rem; padding: .75rem .9rem; border: 1px solid var(--line); border-left: 4px solid var(--rail-red); border-radius: 5px; background: #fbfbfa; color: var(--muted); }
.note-panel strong { color: var(--ink); }
.compact-section { margin-top: clamp(1.25rem, 4vw, 2.35rem); }
.compact-section > h2 { display: flex; align-items: center; gap: .55rem; }
.compact-section > h2::before { content: ""; flex: 0 0 auto; width: .55rem; height: 1.15em; border-radius: 999px; background: var(--rail-red); }
.guidance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: .65rem; }
.guidance-card { min-width: 0; padding: .75rem .8rem; border: 1px solid var(--line); border-left: 4px solid var(--rail-red); border-radius: 6px; background: #fff; }
.guidance-card span { display: block; color: var(--rail-red); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 850; }
.guidance-card p { margin: .22rem 0 0; color: var(--muted); line-height: 1.42; }
.step-list { display: grid; gap: .45rem; margin: 0; padding-left: 1.25rem; }
.step-list li { padding-left: .15rem; }
.question-list { display: grid; gap: .55rem; }
.question-list details { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.question-list summary { min-height: 48px; display: flex; align-items: center; padding: .72rem .85rem; cursor: pointer; font-weight: 760; }
.question-list p { margin: 0; padding: 0 .85rem .85rem; color: var(--muted); }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.split > div, .prose, .tool-card, .category-card, .task-group, .converter-drawer { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; }
.split > div, .prose, .tool-card, .category-card { padding: 1rem; }
code { background: var(--soft); padding: .12rem .28rem; border-radius: 3px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 26rem; }
th, td { text-align: left; padding: .72rem .85rem; border-bottom: 1px solid var(--line); }
th { background: var(--soft); font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.tool-grid, .hub-grid, .category-grid, .task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.tool-grid.small { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tool-card { display: grid; gap: .45rem; text-decoration: none; border-top: 3px solid transparent; transition: border-color .15s ease, transform .15s ease, background-color .15s ease; }
.tool-card:hover, .category-card:hover, .converter-link:hover { border-color: var(--rail-red); background: #fffafa; }
.tool-card strong { line-height: 1.2; font-weight: 680; }
.tool-card span { color: var(--muted); font-size: .92rem; }
.category-card { display: grid; gap: .35rem; text-decoration: none; border-top: 3px solid rgba(213, 18, 36, .2); }
.category-card span { color: var(--rail-red); font-weight: 700; font-size: .86rem; }
.category-card small { color: var(--muted); line-height: 1.4; }
.link-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .45rem; }
.converter-link { display: grid; gap: .08rem; padding: .55rem .65rem; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 5px; text-decoration: none; }
.converter-link span { font-weight: 680; line-height: 1.2; }
.converter-link small { color: var(--muted); line-height: 1.35; }
.task-group, .converter-drawer { position: relative; overflow: hidden; }
.task-group summary, .converter-drawer summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(8.2rem, max-content) 1rem; align-items: center; gap: .85rem; min-height: 48px; padding: .75rem .9rem; cursor: pointer; list-style: none; font-weight: 750; border-left: 4px solid transparent; }
.task-group[open] summary, .converter-drawer[open] summary { border-left-color: var(--rail-red); color: var(--rail-red-dark); background: linear-gradient(90deg, var(--rail-red-soft), #fff 58%); }
.task-group summary::-webkit-details-marker, .converter-drawer summary::-webkit-details-marker { display: none; }
.task-group summary span, .converter-drawer summary span { min-width: 0; overflow-wrap: anywhere; }
.task-group summary::after, .converter-drawer summary::after { content: ""; justify-self: center; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-.12rem); transition: transform .15s ease; }
.task-group[open] summary::after, .converter-drawer[open] summary::after { transform: rotate(225deg) translateY(-.05rem); }
.task-group summary small, .converter-drawer summary small { justify-self: stretch; text-align: center; color: var(--rail-red-dark); background: var(--rail-red-soft); border: 1px solid rgba(213, 18, 36, .18); border-radius: 999px; padding: .18rem .55rem; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.dropdown-list, .converter-drawer .link-list { max-height: 20rem; overflow-y: auto; padding: 0 .75rem .8rem; mask-image: linear-gradient(to bottom, #000 calc(100% - 1.1rem), rgba(0, 0, 0, .25)); }
.dropdown-list { display: grid; gap: .35rem; }
.task-group .converter-link, .converter-drawer .converter-link { background: #fbfbfa; }
.converter-drawer-list { display: grid; gap: .55rem; }
.quick-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .85rem; }
.quick-links a { padding: .42rem .55rem; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: .88rem; }
.quick-links a:hover { border-color: var(--rail-red); background: var(--rail-red-soft); color: var(--rail-red-dark); }
.search-box { max-width: 42rem; margin-top: 1rem; }
.search-results { margin-top: .55rem; max-width: 42rem; }
.search-results[hidden] { display: none; }
.search-summary { margin: 0 0 .45rem; color: var(--muted); font-size: .88rem; }
.search-result-grid, .search-suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .45rem; }
.search-hit, .search-suggestions a { display: grid; gap: .12rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); text-decoration: none; min-width: 0; }
.search-hit:hover, .search-hit[data-active="true"], .search-suggestions a:hover { border-color: var(--rail-red); background: var(--rail-red-soft); }
.search-hit strong { line-height: 1.2; }
.search-hit span { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.search-hit small { color: var(--muted); line-height: 1.32; }
.search-hit em { color: var(--rail-red); font-style: normal; font-size: .92rem; font-weight: 800; }
.search-empty { margin: 0 0 .55rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--muted); }
.prose { max-width: 820px; margin-top: 1.5rem; }
.prose h2 { margin-top: 2rem; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 3rem; padding: 1.5rem clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--line); color: var(--muted); background: var(--panel); }
.footer-link { width: auto; min-width: 0; min-height: 0; padding: .42rem .5rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-weight: 650; cursor: pointer; }
.footer-link:hover { background: var(--soft); color: var(--ink); }
.cookie-banner[hidden] { display: none; }
.cookie-banner { position: fixed; right: clamp(.75rem, 3vw, 1.5rem); bottom: clamp(.75rem, 3vw, 1.5rem); z-index: 40; width: min(26rem, calc(100vw - 1.5rem)); display: grid; gap: .75rem; padding: .85rem; border: 1px solid var(--line); border-left: 4px solid var(--rail-red); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.cookie-banner p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.cookie-banner a { color: var(--ink); font-weight: 700; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.cookie-actions button { width: auto; min-height: 40px; padding: .55rem .75rem; }
.cookie-actions [data-cookie-reject] { background: #fff; color: var(--rail-black); border-color: var(--line); }
@media (max-width: 860px) {
  .home-layout, .split { grid-template-columns: 1fr; }
  .converter-grid { grid-template-columns: 1fr 1fr; }
  .site-header { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .global-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .global-search-results { max-height: min(50vh, 26rem); }
  .nav-panel { grid-template-columns: 1fr; }
  .home-copy { order: 1; }
  .home-layout .converter-box { order: 2; }
}
@media (max-width: 560px) {
  .page-shell { max-width: 100vw; padding-inline: .85rem; overflow-x: clip; }
  .home-layout { grid-template-columns: minmax(0, 1fr); justify-items: stretch; }
  .home-layout .converter-box, .home-copy { width: 100%; max-width: 100%; }
  .tool-page, .prose, .converter-box, .note-panel, .table-wrap, .split > div, .task-group, .converter-drawer, .tool-card, .category-card { max-width: 100%; min-width: 0; }
  .converter-box, .note-panel, .table-wrap { width: 100%; }
  .converter-box { padding: .85rem; }
  .note-panel, .tool-note, .search-hit, .converter-link, td, th { overflow-wrap: anywhere; }
  .task-group summary, .converter-drawer summary { grid-template-columns: minmax(0, 1fr) minmax(6.9rem, max-content) .9rem; gap: .55rem; padding-inline: .75rem; }
  .task-group summary small, .converter-drawer summary small { font-size: .78rem; padding-inline: .4rem; }
  .all-results { grid-template-columns: 1fr; }
  .converter-grid { grid-template-columns: 1fr; }
  .tool-actions button, .ghost-button { max-width: none; width: 100%; }
  .tool-head { align-items: stretch; flex-direction: column; }
  h1 { font-size: clamp(2rem, 12vw, 3rem); }
  .tool-page h1, .prose h1, .page-intro h1 { font-size: clamp(1.65rem, 8.5vw, 2.25rem); overflow-wrap: anywhere; }
  .page-intro p, .home-copy p { font-size: 1rem; }
  .readout { padding: .8rem .85rem; }
  .result-value { font-size: clamp(1.5rem, 7.5vw, 2rem); line-height: 1.05; }
  table { min-width: 100%; table-layout: fixed; }
  th, td { padding: .6rem .55rem; font-size: .88rem; }
  .link-list { grid-template-columns: 1fr; }
  .site-header { padding-inline: .85rem; gap: .6rem; }
  .brand span { display: none; }
  .nav-panel { right: 0; width: calc(100vw - 1.7rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
