:root {
  color-scheme: light;
  --ink: #102a25;
  --muted: #6c7e78;
  --paper: #f3f5ee;
  --card: rgba(255, 255, 252, 0.88);
  --line: rgba(16, 57, 47, 0.12);
  --green: #0a4a3b;
  --green-2: #116451;
  --lime: #d9ff68;
  --mint: #bdebd2;
  --danger: #b83a43;
  --warning: #a76b16;
  --shadow: 0 24px 60px rgba(22, 59, 49, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 0%, rgba(204, 240, 213, 0.75), transparent 30rem),
    radial-gradient(circle at 5% 32%, rgba(231, 255, 165, 0.36), transparent 25rem),
    var(--paper);
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--green);
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand b { color: #43a57c; }

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: var(--lime);
  background: var(--green);
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(10, 74, 59, 0.22);
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--green);
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
  transition: transform 0.2s ease, background 0.2s ease;
}

.download-button:hover { background: #0d5d4a; transform: translateY(-1px); }
.download-button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
.download-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #48b983;
  box-shadow: 0 0 0 5px rgba(72, 185, 131, 0.12);
}

.status-pill.is-loading .status-dot { animation: pulse 1.25s infinite; }
.status-pill.is-error { color: var(--danger); border-color: rgba(184, 58, 67, 0.25); }
.status-pill.is-error .status-dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(184, 58, 67, 0.1); }
.status-pill.is-stale { color: var(--warning); border-color: rgba(167, 107, 22, 0.24); }
.status-pill.is-stale .status-dot { background: #dda642; box-shadow: 0 0 0 5px rgba(221, 166, 66, 0.12); }

@keyframes pulse {
  50% { opacity: 0.38; transform: scale(0.84); }
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green);
  background: rgba(255, 255, 255, 0.7);
}

.icon-button svg, .search-box svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover { transform: rotate(20deg); background: #fff; }
.icon-button.is-spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(340px, 0.68fr);
  gap: clamp(34px, 7vw, 92px);
  align-items: center;
  padding-block: 58px 64px;
}

.eyebrow, .kicker {
  margin: 0 0 14px;
  color: #34705f;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 8px; }
.eyebrow span { width: 20px; height: 1px; background: #4ca585; }

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 6.8vw, 86px);
  font-weight: 500;
  letter-spacing: -0.058em;
  line-height: 0.98;
}

.hero h1 em { color: #318664; font-weight: 500; }

.hero-lead {
  max-width: 640px;
  margin: 26px 0 32px;
  color: var(--muted);
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 1.65;
}

.hero-meta { display: flex; gap: 44px; }
.hero-meta div { display: grid; gap: 6px; }
.hero-meta span { color: var(--muted); font-size: 12px; }
.hero-meta strong { font-size: 14px; }

.converter-card {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 28px;
  color: #f6fff9;
  background:
    radial-gradient(circle at 100% 0%, rgba(217, 255, 104, 0.2), transparent 15rem),
    linear-gradient(145deg, #0f5a47, #073b31);
  box-shadow: 0 32px 70px rgba(9, 65, 52, 0.22);
}

.converter-card::after {
  content: "";
  position: absolute;
  right: -45px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(217, 255, 104, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(217, 255, 104, 0.04), 0 0 0 56px rgba(217, 255, 104, 0.03);
}

.card-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.card-heading .kicker { color: #a9d8c6; }
.card-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.live-tag { padding: 5px 8px; border-radius: 7px; color: #123b2f; background: var(--lime); font-size: 9px; font-weight: 900; letter-spacing: 0.12em; }

.field-label { display: block; margin: 15px 0 8px; color: #b9d7cc; font-size: 11px; font-weight: 700; }
.amount-field { display: grid; grid-template-columns: 1fr 100px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 13px; background: rgba(255, 255, 255, 0.08); }
.amount-field input, .amount-field select, .mode-select { min-width: 0; border: 0; outline: 0; color: #fff; background: transparent; }
.amount-field input { width: 100%; padding: 14px 15px; font-size: 22px; font-weight: 700; }
.amount-field select { padding: 0 12px; border-left: 1px solid rgba(255, 255, 255, 0.14); font-weight: 800; }
.amount-field option, .mode-select option { color: var(--ink); background: #fff; }
.mode-select { width: 100%; padding: 13px 14px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 13px; background: rgba(255, 255, 255, 0.08); font-size: 13px; }

.conversion-result { display: grid; position: relative; z-index: 1; gap: 5px; margin-top: 22px; padding-top: 19px; border-top: 1px solid rgba(255, 255, 255, 0.15); }
.conversion-result span { color: #a9cbbf; font-size: 11px; }
.conversion-result strong { color: var(--lime); font-family: Georgia, serif; font-size: clamp(29px, 3vw, 38px); font-weight: 500; letter-spacing: -0.04em; }
.conversion-result small { color: #b7d3ca; }
.conversion-note { position: relative; z-index: 1; margin: 18px 0 0; color: #8fb8aa; font-size: 10px; line-height: 1.45; }

.overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-bottom: 90px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 94px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 252, 0.57);
  backdrop-filter: blur(12px);
}

.metric-icon { display: grid; flex: 0 0 42px; height: 42px; place-items: center; border-radius: 12px; font-size: 18px; font-weight: 700; }
.metric-icon.mint { background: #d9f2e4; }
.metric-icon.lime { background: #edffc1; }
.metric-icon.sand { background: #f4e8ce; }
.metric-icon.sky { background: #dbeff1; }
.metric-card div { display: grid; gap: 5px; }
.metric-card span:not(.metric-icon) { color: var(--muted); font-size: 11px; }
.metric-card strong { font-size: 15px; }

.rates-section { padding-bottom: 96px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2, .history-copy h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(32px, 4vw, 46px); font-weight: 500; letter-spacing: -0.04em; }

.search-box { display: flex; align-items: center; gap: 9px; min-width: 260px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; color: #789087; background: rgba(255, 255, 255, 0.62); }
.search-box input { width: 100%; padding: 12px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }

.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 16px 22px; color: #7b8c86; background: rgba(227, 235, 227, 0.54); font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-align: right; text-transform: uppercase; }
th:first-child { text-align: left; }
td { padding: 17px 22px; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
tbody tr { transition: background 0.2s ease; }
tbody tr:hover { background: rgba(224, 244, 230, 0.46); }
td:first-child { text-align: left; }
.currency-cell { display: flex; align-items: center; gap: 12px; }
.currency-badge { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; color: var(--green); background: #edf3e8; font-size: 11px; font-weight: 900; }
.currency-name { display: grid; gap: 3px; }
.currency-name strong { font-size: 14px; }
.currency-name span { max-width: 210px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rate-value { font-weight: 680; }
.muted-rate { color: #9ba8a3; }
.chart-button { display: grid; width: 33px; height: 33px; margin-left: auto; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--green); background: #fff; }
.chart-button:hover { color: var(--lime); background: var(--green); }
.chart-button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.loading-row td, .empty-row td { height: 130px; color: var(--muted); text-align: center; }
.loader { display: inline-block; width: 16px; height: 16px; margin-right: 8px; border: 2px solid #d9e5df; border-top-color: var(--green); border-radius: 50%; vertical-align: -3px; animation: spin 0.8s linear infinite; }
.table-footer { display: flex; justify-content: space-between; padding: 13px 22px; border-top: 1px solid var(--line); color: var(--muted); background: rgba(244, 247, 241, 0.65); font-size: 10px; }

.history-section { display: grid; grid-template-columns: 0.58fr 1.42fr; gap: 48px; align-items: center; padding-bottom: 110px; }
.history-copy > p:not(.kicker) { max-width: 360px; color: var(--muted); line-height: 1.65; }
.history-copy h2 span { color: #318664; }
.history-value { display: grid; gap: 4px; margin-top: 30px; }
.history-value span { color: var(--muted); font-size: 11px; }
.history-value strong { font-size: 27px; }
.chart-card { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.chart-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.chart-legend { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 16px; height: 2px; border-radius: 2px; background: #28a577; }
.chart-wrap { position: relative; min-height: 260px; margin-top: 15px; }
#history-chart { display: block; width: 100%; min-height: 240px; overflow: visible; }
.chart-line { fill: none; stroke: #25986e; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#area-gradient); }
.chart-grid { stroke: rgba(16, 57, 47, 0.09); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-dot { fill: var(--lime); stroke: #177657; stroke-width: 2; }
.chart-label { fill: #82938d; font-size: 10px; }
.chart-empty { position: absolute; inset: 0; display: none; place-items: center; margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.chart-empty.is-visible { display: grid; }

.site-footer { display: grid; grid-template-columns: 1fr 1.7fr 1fr; gap: 24px; align-items: center; padding-block: 28px 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer p { text-align: center; }
.site-footer > a { justify-self: end; color: var(--green); font-weight: 700; text-decoration: none; }
.footer-brand { font-size: 14px; }
.footer-brand .brand-mark { width: 28px; height: 28px; border-radius: 9px; font-size: 13px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: min(360px, calc(100% - 44px)); padding: 13px 16px; border-radius: 12px; color: #fff; background: #153e33; box-shadow: 0 16px 45px rgba(15, 55, 45, 0.24); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: 0.25s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #8f3038; }

@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .eyebrow, .hero-meta { justify-content: center; }
  .hero-lead { margin-inline: auto; }
  .converter-card { width: min(520px, 100%); margin-inline: auto; }
  .overview { grid-template-columns: repeat(2, 1fr); }
  .history-section { grid-template-columns: 1fr; }
  .history-copy { text-align: center; }
  .history-copy > p:not(.kicker) { margin-inline: auto; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1180px); }
  .site-header { min-height: 72px; }
  .download-button { width: 38px; padding: 0; }
  #download-label { display: none; }
  .status-pill { padding-inline: 11px; }
  .hero { padding-block: 38px 48px; gap: 36px; }
  .hero h1 { font-size: clamp(42px, 14vw, 64px); }
  .hero-meta { gap: 22px; text-align: left; }
  .overview { grid-template-columns: 1fr 1fr; padding-bottom: 68px; }
  .metric-card { align-items: flex-start; min-height: 116px; flex-direction: column; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .search-box { min-width: 0; }
  th, td { padding-inline: 15px; white-space: nowrap; }
  .currency-name span { max-width: 120px; }
  .history-section { gap: 28px; padding-bottom: 72px; }
  .chart-card { padding: 16px; }
  .site-footer { grid-template-columns: 1fr; text-align: center; }
  .site-footer p { margin: 0; }
  .site-footer > a, .footer-brand { justify-self: center; }
}

@media (max-width: 480px) {
  .status-pill { width: 38px; padding: 0; justify-content: center; }
  #status-label { display: none; }
  .hero h1 { font-size: clamp(40px, 12vw, 50px); }
  .hero-meta { flex-wrap: wrap; }
  .converter-card { padding: 22px; }
  .amount-field { grid-template-columns: minmax(0, 1fr) 82px; }
  .amount-field select { padding-inline: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
