:root {
  color-scheme: light;
  --ink: #19162d;
  --muted: #615d76;
  --line: #e8e5f2;
  --accent: #6240d5;
  --accent-dark: #4e2fb7;
  --soft: #f1edff;
  --paper: #fff;
  --mono: 'Cascadia Code', ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: #f7f7fc;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 85% 10%, #efebff, transparent 36rem); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
code { font-family: var(--mono); }
.shell { width: min(100% - 48px, 1032px); margin-inline: auto; }
.sprite { position: absolute; width: 0; height: 0; pointer-events: none; }
.icon { width: 20px; height: 20px; display: inline-block; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; fill: none; flex: none; }
.site-header { border-bottom: 1px solid var(--line); background: #fff9; }
.header-inner { min-height: 71px; display: flex; align-items: center; }
.brand { display: flex; align-items: center; font-size: 22px; font-weight: 750; letter-spacing: -.055em; white-space: nowrap; }
.brand img { margin-right: 10px; }
.brand span { color: var(--accent); }
.footer .icon { width: 15px; height: 15px; }

.hero { padding: 35px 0 23px; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: -.055em; font-weight: 780; }
.intro { margin: 9px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.surface { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 3px 6px #25175305, 0 12px 35px #33216708; }
.calculator { padding: 23px 26px; }
#calculator-fields { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
#startup-message { margin: 0 0 14px; }
label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 13px; }
.family-switch { display: inline-flex; gap: 3px; padding: 3px; margin-bottom: 17px; border: 1px solid var(--line); border-radius: 9px; background: #f7f5fc; }
.family-switch button { min-height: 34px; padding: 0 15px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: 650 13px var(--mono); }
.family-switch button:hover { color: var(--accent-dark); }
.family-switch button[aria-pressed='true'] { background: var(--accent); color: white; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) 225px; gap: 12px; }
.input-wrap { position: relative; min-width: 0; color: var(--accent); }
.input-wrap .icon { position: absolute; top: 50%; left: 15px; transform: translateY(-50%); pointer-events: none; }
input[type='text'] { min-width: 0; width: 100%; height: 49px; padding: 0 12px 0 44px; border: 1px solid #dbd4ec; border-radius: 10px; background: #fbfaff; color: var(--ink); font: 650 16px var(--mono); }
#prefix { padding-left: 12px; }
input[aria-invalid='true'] { border-color: #be3659; }
.prefix-control { display: flex; align-items: center; gap: 12px; margin-top: 11px; color: var(--muted); font: 12px var(--mono); }
.prefix-control input { flex: 1; min-width: 0; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.prefix-current { min-width: 5ch; padding: 4px 7px; border-radius: 6px; background: var(--soft); color: var(--accent-dark); font-weight: 700; text-align: center; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 11px; color: var(--muted); font-size: 12px; }
.examples span { margin-right: 3px; }
.examples button { min-height: 28px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; background: #f8f7fc; color: #514470; font: 11px var(--mono); }
.examples button:hover { background: var(--soft); border-color: #d4c9fa; }
.error { margin: 10px 0 0; color: #982746; font-size: 13px; }

.result { margin-top: 18px; padding: 24px 26px 0; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.result-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.result-title > div:last-child { min-width: 0; }
.tile-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: none; border-radius: 12px; color: var(--accent); background: var(--soft); }
h2 { margin: 0 0 3px; font-size: 19px; letter-spacing: -.025em; }
.result-title code { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.share-button { align-self: flex-start; display: flex; align-items: center; gap: 6px; flex: none; padding: 7px 10px; border: 1px solid #e4dbff; border-radius: 8px; color: var(--accent-dark); background: var(--soft); font-size: 12px; font-weight: 650; }
.share-button .icon { width: 16px; height: 16px; }
.share-button:hover { background: #e9e0ff; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; margin: 20px 0 0; }
.endpoint { display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 100%; padding: 13px 15px; border: 1px solid #e9e1ff; border-radius: 12px; background: #f8f5ff; }
.endpoint > div { min-width: 0; }
.metric-label, dt { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 640; }
.endpoint code { display: block; color: #40278b; font-size: clamp(14px, 2.25vw, 21px); font-weight: 700; letter-spacing: -.035em; overflow-wrap: anywhere; }
.range-arrow { color: #7b61bc; }
.icon-button { display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border-radius: 8px; border: 1px solid #e5dcfa; background: var(--paper); color: var(--accent); }
.icon-button .icon { width: 16px; height: 16px; }
.icon-button:hover { background: #eee7ff; }
.metrics { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); margin: 17px 0; padding: 0; }
.metrics:has(#usable-metric[hidden]) { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.ipv4-metrics { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr); padding-top: 16px; border-top: 1px solid var(--line); }
.metrics > div { padding: 0 14px; border-right: 1px solid var(--line); }
.metrics > div:first-child { padding-left: 0; }
.metrics > div:last-child { padding-right: 0; border: 0; }
dd { margin: 0; color: var(--ink); font: 650 13px/1.5 var(--mono); overflow-wrap: anywhere; }
details { border-top: 1px solid var(--line); }
summary { display: flex; align-items: center; gap: 9px; padding: 13px 0; color: #4f397f; font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary .icon { width: 17px; height: 17px; }
summary:hover { color: var(--accent); }
.disclosure-arrow { margin-left: auto; transition: transform .15s; }
details[open] .disclosure-arrow { transform: rotate(90deg); }
.address-panel { padding: 0 0 20px; }
.address-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.address-tools p { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pagination { display: flex; gap: 4px; }
.pagination button { width: 32px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #faf8ff; color: var(--accent-dark); font-size: 18px; line-height: 1; }
.pagination button:hover:enabled { background: var(--soft); }
.address-list { margin: 9px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 5px; list-style: none; }
.address-list li { min-width: 0; padding: 6px 9px; border-radius: 6px; background: #f7f5fc; font-size: 12px; overflow-wrap: anywhere; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 23px 0; color: var(--muted); font-size: 12px; }
.footer span { display: flex; align-items: center; gap: 6px; }
.footer span:first-child { font-weight: 750; }
.toast { position: fixed; z-index: 1; right: 18px; bottom: 18px; max-width: calc(100% - 36px); padding: 10px 15px; border-radius: 9px; background: #271943; color: white; font-size: 13px; box-shadow: 0 6px 20px #25175330; pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
  .shell { width: calc(100% - 32px); }
  .hero { padding: 26px 0 18px; }
  .calculator, .result { padding-left: 16px; padding-right: 16px; }
  .range { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .range-arrow { display: none; }
  .metrics, .metrics:has(#usable-metric[hidden]) { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .metrics > div { padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics > div:last-child { padding-bottom: 0; }
}

@media (max-width: 460px) {
  .header-inner { min-height: 62px; }
  .brand { font-size: 20px; }
  .brand img { width: 30px; height: 30px; margin-right: 6px; }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .input-wrap .icon { display: none; }
  #cidr { padding-left: 10px; }
  .result-title .tile-icon { display: none; }
  .footer { align-items: flex-start; }
  .footer span:last-child { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  .disclosure-arrow { transition: none; }
}
