:root {
  --accent: #c2410c;
  --accent-soft: #ffedd5;
  --text: #1c1917;
  --muted: #78716c;
  --bg: #fffdf9;
  --surface: #ffffff;
  --border: #e7e1d8;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #fb923c;
    --accent-soft: #3b2414;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --bg: #161412;
    --surface: #1f1c19;
    --border: #36312c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.logo { font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch button, .chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 14px; cursor: pointer;
}
.lang-switch button[aria-pressed="true"], .chip.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }

.intro { padding: 28px 0 8px; }
h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 32px 0 12px; }
.lead { color: var(--muted); font-size: 18px; max-width: 720px; margin: 0; }

.converter {
  display: grid; gap: 16px; margin: 16px 0;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .converter { grid-template-columns: 1fr 1fr; }
  .converter .options { grid-column: 1 / -1; grid-row: 2; }
}
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-title { font-weight: 700; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
textarea {
  width: 100%; min-height: 260px; resize: vertical; padding: 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
  font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.output {
  min-height: 260px; padding: 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border);
  font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.output .line { min-height: 1.6em; }
/* Converted amounts: quiet accent colour with a dotted underline instead of a bright highlight. */
.output mark {
  background: none; color: var(--accent); font-weight: 600;
  text-decoration: underline dotted; text-decoration-color: var(--border); text-underline-offset: 3px;
  cursor: help;
}
.output .empty { color: var(--muted); font-family: inherit; }

.options { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
legend { float: left; font-weight: 600; margin-right: 6px; }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented label {
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 15px;
}
.segmented label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.segmented input { accent-color: var(--accent); }
.factor-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.factor-custom { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.factor-custom input { width: 72px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; }

.btn {
  border: 0; border-radius: 8px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff;
}
@media (prefers-color-scheme: dark) { .btn { color: #1c1917; } }
.btn.secondary { background: var(--accent-soft); color: var(--text); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
button:focus-visible, textarea:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Ad slots: fixed minimum height so the page doesn't jump when ads load. */
.ad-slot { margin: 16px 0; min-height: 0; }
.ad-slot.is-active { min-height: 100px; }
.ad-slot.is-preview {
  min-height: 100px; border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px;
}

.content { max-width: 760px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; max-width: 520px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 14px; }
td:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
details { border-bottom: 1px solid var(--border); padding: 12px 0; }
summary { cursor: pointer; font-weight: 600; }

.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 20px 0 32px; font-size: 14px; }
.footer-row { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* Legal pages */
.legal { max-width: 760px; padding: 24px 0; }
.legal h1 { font-size: 28px; }
.legal h2 { font-size: 19px; margin-top: 24px; }
