@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --teal: #0f5c56;
  --gold: #c6a35a;
  --cream: #f6f1e8;
  --bg: #f6f1e8;
  --text: #0f5c56;
  --text-soft: #245e58;
  --field: #fffcf6;
  --line: rgba(15, 92, 86, 0.28);
  --instrument: #0f5c56;
  --on-instrument: #f6f1e8;
  --on-instrument-soft: #e3efea;
  --header: rgba(246, 241, 232, 0.92);
  --shadow: 0 18px 40px rgba(15, 92, 86, 0.14);
  --danger: #f6f1e8;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121614;
  --text: #f6f1e8;
  --text-soft: #d5ddd6;
  --field: #1c2421;
  --line: rgba(198, 163, 90, 0.45);
  --header: rgba(18, 22, 20, 0.94);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: "Poppins", "Avenir Next", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

button, input, select { font: inherit; color: inherit; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--teal);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
}

.skip:focus { top: 12px; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { margin: 0; min-width: 0; flex: 1; }

.brand a { display: flex; align-items: center; min-width: 0; }

.wordmark {
  display: block;
  height: auto;
  width: auto;
  max-height: 46px;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.header-mark {
  width: 32px;
  height: 32px;
  flex: none;
  margin-right: 8px;
}

.wordmark {
  max-height: 26px;
  flex: 1 1 auto;
  min-width: 0;
}

.only-dark { display: none; }

:root[data-theme="dark"] .wordmark.only-light { display: none; }

:root[data-theme="dark"] .wordmark.only-dark { display: block; }

.settings-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 44px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: var(--teal);
  color: var(--cream);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.settings-button svg {
  width: 20px;
  height: 20px;
  color: var(--gold);
}

.wrap {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.tagline {
  margin: 0 0 18px;
  color: var(--text-soft);
  font-size: 15px;
}

.layout { display: grid; gap: 18px; }

.converter, .result { min-width: 0; }

.field { display: grid; gap: 6px; }

.label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.amount-control,
select,
input[type="date"] {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--field);
  border-radius: 16px;
}

.amount-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 0 16px;
}

.amount-code {
  flex: none;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.amount-input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.amount-input:focus { outline: none; }

.currency-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.currency-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--field);
  color: var(--text);
  text-align: left;
  font-size: 16px;
  cursor: pointer;
}

.flag {
  width: 28px;
  height: 20px;
  flex: none;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(15, 92, 86, 0.18);
}

.amount-control .flag { width: 24px; height: 17px; }

.picker-card {
  display: flex;
  flex-direction: column;
  max-height: min(80vh, 640px);
  padding: 16px 12px 12px;
}

.currency-options { overflow: auto; margin-top: 8px; }

.picker-group {
  margin: 12px 8px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.currency-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 16px;
  cursor: pointer;
}

.currency-label { flex: 1; min-width: 0; }

.currency-row[aria-selected="true"] {
  background: var(--teal);
  color: var(--cream);
}

.choice-dot {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.currency-row[aria-selected="true"] .choice-dot {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 4px var(--teal);
}

.amount-control:focus-within,
select:focus-visible,
input[type="date"]:focus-visible,
.today:focus-visible,
.swap:focus-visible,
.currency-trigger:focus-visible,
.currency-row:focus-visible,
.retry:focus-visible,
.done:focus-visible,
.settings-button:focus-visible,
.choice:has(input:focus-visible) {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(198, 163, 90, 0.55);
}

:root[data-theme="dark"] .amount-control:focus-within,
:root[data-theme="dark"] select:focus-visible,
:root[data-theme="dark"] input[type="date"]:focus-visible,
:root[data-theme="dark"] .today:focus-visible,
:root[data-theme="dark"] .swap:focus-visible,
:root[data-theme="dark"] .currency-trigger:focus-visible,
:root[data-theme="dark"] .currency-row:focus-visible,
:root[data-theme="dark"] .retry:focus-visible,
:root[data-theme="dark"] .done:focus-visible,
:root[data-theme="dark"] .settings-button:focus-visible,
:root[data-theme="dark"] .choice:has(input:focus-visible) {
  outline-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(15, 92, 86, 0.9);
}

.pair {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  justify-items: center;
}

.pair .field { width: 100%; }

select,
input[type="date"] {
  min-height: 52px;
  padding: 0 42px 0 14px;
  font-size: 16px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5' fill='none' stroke='%230F5C56' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

:root[data-theme="dark"] select,
:root[data-theme="dark"] input[type="date"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5' fill='none' stroke='%23F6F1E8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[type="date"] {
  background-image: none;
  padding-right: 14px;
}

.swap {
  width: 48px;
  height: 48px;
  margin: -2px 0;
  border-radius: 999px;
  border: 1.5px solid var(--teal);
  background: var(--field);
  color: var(--teal);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
}

:root[data-theme="dark"] .swap {
  border-color: var(--gold);
  color: var(--gold);
}

.swap svg { width: 22px; height: 22px; }

.date-row {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}

.date-row .field { flex: 1; }

.date-hint {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.today,
.done,
.retry {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid var(--teal);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

:root[data-theme="dark"] .today,
:root[data-theme="dark"] .done {
  border-color: var(--gold);
}

.result {
  background: var(--instrument);
  color: var(--on-instrument);
  border-radius: 24px;
  padding: 22px 20px 20px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--gold);
  min-height: 220px;
}

.kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-instrument-soft);
}

.hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 8px 0 4px;
}

.hero-amount {
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.hero-code {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.rate, .inverse, .fixing, .compare-label, .compare-meta, .error p {
  margin: 0;
}

.rate {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.inverse, .fixing, .compare-meta {
  color: var(--on-instrument-soft);
  font-variant-numeric: tabular-nums;
}

.inverse { margin-top: 2px; }

.fixing { margin-top: 14px; font-size: 14px; }

.freshness {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.fixing-note {
  margin: 10px 0 0;
  padding-left: 12px;
  border-left: 3px solid var(--gold);
}

.compare { margin-top: 16px; }

.compare-label {
  font-size: 18px;
  font-weight: 600;
}

.compare-meta { margin-top: 2px; font-size: 14px; }

.nowrap { white-space: nowrap; }

.loading { display: grid; gap: 10px; }

.skeleton {
  display: block;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(246, 241, 232, 0.18), rgba(246, 241, 232, 0.42), rgba(246, 241, 232, 0.18));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-lg { height: 48px; width: 78%; margin-top: 8px; }
.skeleton-sm { width: 46%; }

.error p { font-size: 17px; max-width: 36ch; }

.retry {
  margin-top: 16px;
  background: var(--cream);
  color: var(--teal);
  border-color: var(--gold);
}

.disclaimer, .footer, .noscript {
  color: var(--text-soft);
  font-size: 13px;
}

.disclaimer { margin: 18px 0 0; max-width: 62ch; }

.footer {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
}

.footer p { margin: 0; font-weight: 600; color: var(--text); }

.noscript {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto 24px;
}

dialog {
  width: min(460px, calc(100vw - 24px));
  max-height: min(92vh, 680px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(18, 22, 20, 0.52); }

.settings-card { padding: 18px 18px 22px; }

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-head h2, .settings-section h3 { margin: 0; }

.settings-head h2 { font-size: 28px; letter-spacing: -0.03em; }

.done { min-height: 44px; }

.settings-section { margin-top: 18px; }

.settings-section h3 { font-size: 18px; }

.settings-intro { margin: 6px 0 14px; color: var(--text-soft); font-size: 14px; }

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.choices { display: grid; gap: 8px; }

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--field);
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.choice-mark {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.choice-copy { display: grid; }

.choice-title { font-weight: 600; }

.choice-help { color: var(--text-soft); font-size: 13px; }

.choice:has(input:checked) {
  background: var(--teal);
  color: var(--cream);
  border-color: var(--gold);
}

.choice:has(input:checked) .choice-help { color: var(--on-instrument-soft); }

.choice:has(input:checked) .choice-mark {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 4px var(--teal);
}

@media (min-width: 900px) {
  .wordmark { max-height: 54px; }
  .wrap { padding-top: 32px; }
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.92fr);
    gap: 28px;
    align-items: start;
  }
  .result { position: sticky; top: 96px; }
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  margin: 0;
  background: #fff;
  transition: opacity 400ms ease;
}

.splash img {
  width: 60vw;
  max-width: 560px;
  height: auto;
  object-fit: contain;
}

.splash.is-done {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .splash { transition: none; }
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
