:root {
  color-scheme: light;
  --page: #f4f6f8;
  --surface: #ffffff;
  --text: #172033;
  --muted: #5f6b7b;
  --border: #d9dfe7;
  --blue: #1859d1;
  --blue-soft: #eaf1ff;
  --result-surface: #f0f3f7;
  --error: #b42318;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--page); color: var(--text); font: 16px/1.5 var(--sans); }
body { min-width: 320px; margin: 0; }
button, input, select { color: inherit; font: inherit; }
button, select, a, summary { cursor: pointer; }
a { color: inherit; }
h1, h2, p, dl { margin-top: 0; }

.skip-link {
  position: fixed;
  z-index: 10;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}
.skip-link:focus { transform: translateY(0); }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(24 89 209 / 30%);
  outline-offset: 3px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 max(24px, calc((100% - 1040px) / 2));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.wordmark { flex: 0 0 auto; font-size: 1rem; font-weight: 750; letter-spacing: -0.01em; text-decoration: none; }
.site-nav { display: flex; align-items: stretch; gap: 26px; min-height: 64px; }
.site-nav a { position: relative; display: flex; align-items: center; color: var(--muted); font-size: 0.875rem; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--blue); }
.site-nav a[aria-current="page"] { color: var(--blue); font-weight: 650; }
.site-nav a[aria-current="page"]::after { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: var(--blue); content: ""; }

main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; }
.intro { padding: 46px 0 25px; }
.intro h1 { margin-bottom: 8px; font-size: clamp(2.1rem, 4vw, 2.75rem); font-weight: 750; letter-spacing: -0.04em; line-height: 1.12; }
.intro p { margin-bottom: 0; color: var(--muted); font-size: 1.05rem; }

.converter-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px rgb(24 38 62 / 8%);
}

.converter-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 62px; padding: 0 22px; border-bottom: 1px solid var(--border); }
.converter-panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 272px; }
.converter-pane { min-width: 0; padding: 25px 26px; }
.input-pane { border-right: 1px solid var(--border); background: var(--surface); }
.output-pane { background: var(--result-surface); }
.pane-heading { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-bottom: 13px; }
.pane-heading label, .pane-heading > span { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.input-pane .pane-heading label { color: var(--text); font-size: 0.9rem; }
.quiet-button { padding: 5px 0; border: 0; background: transparent; color: var(--muted); font-size: 0.8rem; }
.quiet-button:hover { color: var(--blue); }

#amount {
  width: 100%;
  min-height: 112px;
  padding: 4px 0 42px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 2.65rem);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.2;
}
#amount::placeholder { color: #8a94a3; font-size: 0.72em; font-weight: 450; letter-spacing: -0.01em; }
#amount:focus { outline: 0; }
.input-pane:focus-within { box-shadow: inset 0 0 0 2px var(--blue); }
.input-pane:has(#amount[aria-invalid="true"]) { box-shadow: inset 0 0 0 2px var(--error); }
.field-help, .error-message { margin: 9px 0 0; color: var(--muted); font-size: 0.82rem; }
.error-message { color: var(--error); }

.examples { display: none; }

.mode-tabs {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 22px;
  min-width: 0;
}
.mode-tabs button { position: relative; align-self: stretch; min-height: 60px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.mode-tabs button:hover { color: var(--blue); }
.mode-tabs button[aria-pressed="true"] { color: var(--blue); }
.mode-tabs button[aria-pressed="true"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--blue); content: ""; }

.currency-control { flex: 0 0 auto; }
.currency-control[hidden] { display: none; }
.currency-field { display: flex; align-items: center; gap: 9px; }
.currency-field > span { color: var(--muted); font-size: 0.78rem; font-weight: 650; }
.settings-row select {
  width: 100%;
  min-height: 38px;
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  color-scheme: light;
  font-size: 0.85rem;
}
.currency-combobox { position: relative; width: 242px; }
.currency-combobox input {
  width: 100%;
  min-height: 40px;
  padding: 7px 38px 7px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.84rem;
}
.currency-combobox input:hover { border-color: #aeb7c4; }
.currency-combobox input:focus { border-color: var(--blue); outline: 3px solid rgb(24 89 209 / 18%); outline-offset: 0; }
.currency-toggle { position: absolute; top: 1px; right: 1px; width: 36px; height: 38px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; }
.currency-toggle:hover { color: var(--blue); }
.currency-listbox {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: min(310px, calc(100vw - 34px));
  max-height: 290px;
  margin: 0;
  padding: 5px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgb(24 38 62 / 16%);
  list-style: none;
}
.currency-listbox [role="option"], .currency-no-results { padding: 9px 10px; border-radius: 5px; font-size: 0.84rem; }
.currency-listbox [role="option"] { cursor: pointer; }
.currency-listbox [role="option"]:hover, .currency-listbox [role="option"].active { background: var(--blue-soft); color: var(--blue); }
.currency-no-results { color: var(--muted); }

.copy-button { min-width: 66px; min-height: 38px; padding: 0 13px; border: 1px solid #aeb7c4; border-radius: 6px; background: var(--surface); color: var(--text); font-size: 0.8rem; font-weight: 650; }
.copy-button:not(:disabled):hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.copy-button:disabled { cursor: default; opacity: 0.42; }
.result { max-width: 900px; margin: 25px 0 13px; color: var(--text); font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 550; letter-spacing: -0.035em; line-height: 1.3; overflow-wrap: anywhere; }
.result.empty { color: #8a94a3; font-weight: 450; }
.result.error { color: var(--error); font-size: 1.4rem; }
.interpretation { margin-bottom: 0; color: var(--muted); font-size: 0.82rem; }

.advanced-options { border-top: 1px solid var(--border); background: var(--surface); }
.advanced-options summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 54px; padding: 10px 22px; color: var(--text); font-size: 0.85rem; font-weight: 650; list-style: none; }
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary::after { content: "+"; color: var(--muted); font-size: 1.1rem; font-weight: 400; }
.advanced-options[open] summary::after { content: "−"; }
.advanced-options summary small { margin-left: auto; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.advanced-options summary:hover { color: var(--blue); }
.settings-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 4px 22px 23px; }
.settings-row label { display: grid; gap: 7px; min-width: 0; }
.settings-row label > span { color: var(--muted); font-size: 0.78rem; font-weight: 650; }

.content-section { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: clamp(46px, 8vw, 110px); padding: 74px 0; border-bottom: 1px solid var(--border); }
.section-label { margin-bottom: 9px; color: var(--blue); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
h2 { margin-bottom: 16px; font-size: clamp(1.55rem, 2.8vw, 2.15rem); font-weight: 720; letter-spacing: -0.035em; line-height: 1.2; }
.content-copy p, .content-copy li { color: var(--muted); line-height: 1.7; }
.content-copy p:last-child { margin-bottom: 0; }
.content-copy ol { margin: 0; padding-left: 1.2rem; }
.content-copy li { padding: 4px 0 4px 7px; }
.reference-list { margin-bottom: 0; }
.reference-list > div { display: grid; grid-template-columns: minmax(115px, 0.35fr) 1fr; gap: 24px; padding: 18px 0; border-top: 1px solid var(--border); }
.reference-list > div:first-child { padding-top: 0; border-top: 0; }
.reference-list dt { font-weight: 700; font-variant-numeric: tabular-nums; }
.reference-list dd { margin: 0; color: var(--muted); }

.related-tools { padding: 74px 0; }
.related-tools h2 { margin-bottom: 24px; }
.tool-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 15px; }
.tool-links a { display: grid; align-content: start; gap: 8px; min-height: 126px; padding: 20px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); text-decoration: none; }
.tool-links a:hover { border-color: var(--blue); box-shadow: 0 5px 18px rgb(24 38 62 / 7%); }
.tool-links strong { font-size: 1rem; }
.tool-links span { color: var(--muted); font-size: 0.875rem; line-height: 1.5; }

.prose-page, .not-found-page { max-width: 760px; min-height: 60vh; padding: 70px 0 90px; }
.prose-page h1, .not-found-page h1 { margin-bottom: 20px; font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -0.045em; line-height: 1.08; }
.prose-page h2 { margin-top: 42px; font-size: 1.35rem; }
.prose-page p, .not-found-page > p { color: var(--muted); line-height: 1.75; }
.prose-page .prose-lead { color: var(--text); font-size: 1.2rem; }
.primary-link { display: inline-block; margin-top: 16px; padding: 12px 17px; border-radius: 7px; background: var(--blue); color: white; font-weight: 700; text-decoration: none; }
.primary-link:hover { background: #1049b5; }

.site-footer { display: flex; justify-content: space-between; width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 44px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.78rem; }
.site-footer a { color: var(--text); font-weight: 700; text-decoration: none; }
.site-footer nav { margin-left: auto; padding: 0 24px; }
.site-footer nav a { color: var(--muted); font-weight: 500; }
.site-footer nav a:hover { color: var(--blue); }
.site-footer p { margin-bottom: 0; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .site-header { align-items: flex-start; flex-wrap: wrap; padding: 15px 16px 12px; }
  .wordmark { min-height: 32px; line-height: 32px; }
  .site-nav { order: 2; flex: 1 0 100%; flex-wrap: wrap; gap: 4px 18px; min-height: 0; padding-top: 8px; }
  .site-nav a { min-height: 34px; font-size: 0.82rem; }
  .site-nav a[aria-current="page"]::after { height: 2px; }
  main, .site-footer { width: min(100% - 28px, 1040px); }
  .intro { padding: 34px 0 21px; }
  .intro h1 { font-size: 2rem; }
  .intro p { font-size: 0.95rem; }
  .converter-toolbar { flex-wrap: wrap; gap: 0 16px; padding: 0 18px 13px; }
  .mode-tabs { width: 100%; gap: 20px; overflow-x: auto; }
  .mode-tabs button { min-height: 56px; }
  .currency-control { width: 100%; padding-top: 11px; border-top: 1px solid var(--border); }
  .currency-field { justify-content: space-between; }
  .currency-combobox { width: min(68%, 260px); }
  .converter-panes { grid-template-columns: 1fr; min-height: 0; }
  .converter-pane { padding-right: 18px; padding-left: 18px; }
  .input-pane { min-height: 210px; border-right: 0; border-bottom: 1px solid var(--border); }
  .output-pane { min-height: 190px; }
  #amount { min-height: 90px; font-size: 2rem; }
  .result { font-size: 1.7rem; }
  .advanced-options summary { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding-right: 18px; padding-left: 18px; }
  .advanced-options summary small { grid-column: 1; grid-row: 2; margin: 0; }
  .advanced-options summary::after { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .settings-row { grid-template-columns: 1fr; gap: 16px; padding: 8px 18px 22px; }
  .content-section { grid-template-columns: 1fr; gap: 25px; padding: 58px 0; }
  .reference-list > div { grid-template-columns: 1fr; gap: 5px; }
  .related-tools { padding: 58px 0; }
  .site-footer { display: grid; gap: 10px; }
  .site-footer nav { margin: 0; padding: 0; }
  .prose-page, .not-found-page { padding: 52px 0 70px; }
}

@media (max-width: 430px) {
  .mode-tabs { gap: 16px; }
  .mode-tabs button { font-size: 0.82rem; }
  .tool-links { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .copy-button, .mode-tabs button, .tool-links a { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease; }
}
