@font-face {
  font-family: Manrope;
  src: url('./assets/manrope.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --background: #f6f8f7;
  --surface: #fff;
  --surface-muted: #f5f8f7;
  --surface-accent: #eff8f3;
  --foreground: #182922;
  --secondary: #50645c;
  --muted: #5f7169;
  --border: #e5ebe7;
  --accent: #176a4e;
  --accent-dark: #12573f;
  --success: #167051;
  --danger: #a53742;
  --negative-bg: #fbf0f1;
  --radius: 20px;
  --shadow: 0 2px 4px #153b2604, 0 10px 28px #153b2606;
  --cursor-interactive: pointer;
  font-family: Manrope, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  background: var(--background);
  color: var(--foreground);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: var(--cursor-interactive); }
button:disabled { cursor: default; }
button, input { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: transparent; }
:focus-visible { outline: 2px solid #258764; outline-offset: 3px; }
[hidden] { display: none !important; }
.icons { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 5; background: white; padding: 12px 16px; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.topbar { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid #e9eeeb; }
.header-inner { min-height: 69px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; font-weight: 800; letter-spacing: -.06em; font-size: 23px; }
.brand img { border-radius: 10px; }
nav { display: flex; align-items: center; gap: 6px; }
.nav-link { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 5px 13px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--secondary); white-space: nowrap; }
.nav-link .icon { width: 16px; height: 16px; }
.nav-link:hover { background: var(--surface-muted); }
.nav-link.active { color: var(--accent-dark); background: #eaf4ee; }
.source-link { display: flex; align-items: center; justify-self: end; gap: 7px; min-height: 40px; color: var(--secondary); font-weight: 700; font-size: 12px; white-space: nowrap; }
.source-link:hover, .footer a:hover { color: var(--accent); }
.source-link .icon, .footer .icon { width: 14px; height: 14px; }

.hero {
  background: radial-gradient(ellipse at 76% 48%, #d9eee2 0%, transparent 54%), linear-gradient(110deg, #edf6f1 14%, #e5f2eb 76%, #edf5f1);
  overflow: hidden;
}
.hero-inner { position: relative; min-height: 255px; }
.hero-content { position: relative; z-index: 1; padding-block: 37px 70px; }
.hero-kicker { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .10em; color: var(--accent-dark); }
.hero-kicker .icon { width: 15px; height: 15px; }
.hero h1 { margin-top: 12px; font-size: clamp(36px, 4.2vw, 59px); line-height: 1.16; font-weight: 800; letter-spacing: -.065em; }
.hero h1 span { color: var(--accent); }
.hero p { margin-top: 15px; color: var(--secondary); line-height: 1.75; font-size: 15px; }
.hero-art { position: absolute; top: -26px; right: 0; width: min(53%, 576px); aspect-ratio: 648 / 438; pointer-events: none; }
.hero-art img { display: block; width: 100%; height: auto; }
.coin { position: absolute; display: grid; place-items: center; width: 48px; aspect-ratio: 1; border-radius: 15px; font-size: 28px; font-weight: 700; color: #317759; background: linear-gradient(155deg, #f9fffc 10%, #dcefe3 92%); border: 1px solid #f8fffa; box-shadow: 0 8px 18px #37755320; }
.coin-dollar { top: 25%; left: 24%; transform: rotate(-13deg); }
.coin-euro { top: 20%; right: 19%; transform: rotate(12deg); width: 42px; font-size: 24px; color: #4b8b70; }
.coin-yen { top: 50%; right: 10%; transform: rotate(12deg); width: 37px; font-size: 20px; color: #4d8a73; }

.dashboard { position: relative; margin-top: -38px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.converter { padding: 22px 26px 0; }
.section-heading { display: flex; align-items: center; gap: 10px; min-height: 38px; }
.section-heading h2 { font-size: 17px; letter-spacing: -.025em; font-weight: 800; white-space: nowrap; }
.section-icon { width: 35px; height: 35px; display: inline-grid; place-items: center; flex: none; border-radius: 11px; background: #eaf5ee; color: var(--accent); }
.section-icon .icon { width: 18px; height: 18px; }
.icon-button { position: relative; display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 11px; color: var(--secondary); }
.icon-button:not(:disabled):hover { background: #edf3ef; color: var(--accent); }
.icon-button:disabled { opacity: .45; }
.icon-button[data-tip]::after { content: attr(data-tip); display: none; position: absolute; z-index: 4; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%); padding: 5px 9px; border-radius: 6px; background: #23392e; color: #fff; font-size: 11px; white-space: nowrap; pointer-events: none; }
.icon-button[data-tip]:not(:disabled):is(:hover, :focus-visible)::after { display: block; }
.copy-button { margin-left: auto; border: 1px solid var(--border); }

.conversion-grid { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); align-items: end; gap: 18px; margin-top: 21px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 9px; color: var(--secondary); font-weight: 700; font-size: 12px; }
.money-box { display: flex; align-items: center; gap: 9px; min-height: 75px; padding: 9px 12px 9px 16px; background: var(--surface-muted); border: 1px solid #e3eae6; border-radius: 13px; }
.money-box:focus-within { border-color: #82ad96; }
.money-box:has([aria-invalid="true"]) { border-color: #c25c63; }
.money-box input, .money-box output { min-width: 0; width: 100%; padding: 0; border: 0; font-size: clamp(23px, 3.5vw, 37px); line-height: 1.25; letter-spacing: -.055em; font-weight: 800; font-variant-numeric: tabular-nums; background: transparent; }
.money-box input:focus { outline: 0; }
.money-box output { display: block; overflow-wrap: anywhere; }
.result-box { background: #edf7f0; border-color: #dcece2; color: var(--accent-dark); }
.currency-button { display: flex; align-items: center; gap: 8px; flex: none; min-height: 42px; padding: 5px 9px; color: var(--foreground); border: 1px solid #e6ebe8; background: white; border-radius: 10px; }
.currency-button:hover, .market-base:hover { border-color: #b4cdbd; background: #fbfdfb; }
.currency-button strong { font-weight: 800; font-size: 13px; }
.currency-button .icon, .market-base .icon { width: 15px; height: 15px; color: var(--muted); }
.flag { display: inline-grid; place-items: center; width: 23px; height: 23px; flex: none; overflow: hidden; border-radius: 50%; background: #eaf2ed; color: var(--accent); box-shadow: inset 0 0 0 1px #213e2624; font-size: 8px; font-weight: 800; line-height: 1; }
.flag img { width: 100%; height: 100%; object-fit: cover; }
.swap-button { width: 44px; height: 44px; border-radius: 50%; margin-bottom: 15px; color: var(--accent); border: 1px solid #dfe9e2; background: #f6f9f7; }
.swap-button .icon { width: 20px; height: 20px; }
.conversion-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; min-height: 57px; margin-top: 16px; padding-block: 9px; border-top: 1px solid #edf0ee; }
.unit-rate, .rate-date { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.unit-rate { color: var(--accent-dark); }
.unit-rate.is-error { color: var(--danger); }
.status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #4c9a77; box-shadow: 0 0 0 3px #e6f3e9; }
.is-error .status-dot { background: #bc5560; box-shadow: 0 0 0 3px #faedf0; }
.rate-date { color: var(--muted); flex: none; }
.rate-date .icon { width: 15px; height: 15px; }
.amount-message { flex: 1 1 auto; font-size: 12px; color: var(--danger); }
.amount-message:empty { display: none; }

.analytics { display: grid; grid-template-columns: minmax(0, 1.52fr) minmax(0, 1fr); align-items: start; gap: 18px; margin-top: 18px; }
.history, .market { padding: 19px 22px 14px; }
.periods { display: flex; align-items: center; gap: 2px; margin-left: auto; padding: 3px; background: var(--surface-muted); border-radius: 9px; }
.periods button { min-height: 32px; min-width: 41px; padding: 4px 7px; color: var(--secondary); border: 1px solid transparent; border-radius: 7px; white-space: nowrap; font-size: 11px; font-weight: 800; }
.periods button:hover { color: var(--accent); }
.periods button[aria-pressed="true"] { color: var(--accent-dark); background: #fff; border-color: #e9eeeb; box-shadow: 0 1px 2px #152d1d0a; }
.history-summary { min-height: 90px; padding-top: 17px; }
.history-pair { display: flex; align-items: center; gap: 8px; color: var(--secondary); font-weight: 800; font-size: 12px; }
.pair-flags { display: flex; padding-right: 1px; }
.pair-flags .flag { width: 19px; height: 19px; border: 1px solid white; }
.pair-flags .flag + .flag { margin-left: -5px; }
.history-values { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.history-values strong { font-size: 32px; font-weight: 800; line-height: 1.2; letter-spacing: -.055em; }
.change { display: inline-flex; align-items: center; justify-content: center; width: fit-content; border-radius: 6px; font-size: 11px; font-weight: 800; white-space: nowrap; line-height: 1.4; }
.change.up { color: var(--success); }
.change.down { color: var(--danger); }
.change.flat { color: var(--muted); }
.history-values .change:not(:empty) { padding: 4px 7px; background: var(--surface-muted); }
.history-values .change.up { background: #eaf6ef; }
.history-values .change.down { background: var(--negative-bg); }

.chart { position: relative; height: 217px; }
.chart canvas { display: block; width: 100%; height: 100%; }
.chart canvas:focus-visible { border-radius: 8px; outline-offset: 0; }
.chart-tooltip { pointer-events: none; display: grid; gap: 3px; position: absolute; z-index: 1; min-width: 91px; padding: 8px 10px; border: 1px solid #e4eae6; border-radius: 9px; background: white; box-shadow: var(--shadow); font-size: 11px; }
.chart-tooltip span { color: var(--secondary); }
.chart-tooltip strong { color: var(--accent-dark); font-size: 13px; }
.chart-message { position: absolute; inset: 0; display: grid; place-content: center; padding: 10px; text-align: center; color: var(--muted); font-size: 13px; }
.chart-message .text-button { justify-self: center; }
.market-base { display: flex; align-items: center; gap: 6px; min-height: 35px; margin-left: auto; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; color: var(--secondary); font-weight: 800; font-size: 12px; }
.market table { width: 100%; border-spacing: 0; margin-top: 11px; }
.market th { color: var(--muted); min-height: 31px; padding: 7px 0; text-align: left; font-size: 11px; font-weight: 700; }
.market th:not(:first-child), .market td:not(:first-child) { text-align: right; }
.market td { border-top: 1px solid #edf1ee; padding: 0 0 0 8px; white-space: nowrap; height: 47px; font-size: 12px; font-weight: 800; }
.market td:first-child { padding: 0; width: 48%; }
.market-currency { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 41px; padding: 4px 4px 4px 0; text-align: left; border-radius: 7px; }
.market-currency:hover { color: var(--accent); }
.market-currency .flag { width: 25px; height: 25px; }
.market-currency span:last-child { min-width: 0; display: grid; gap: 1px; line-height: 1.15; }
.market-currency small { overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 600; font-size: 10px; }
.market-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 37px; border-top: 1px solid #edf1ee; }
#market-status { color: var(--muted); font-size: 10px; }
.text-button { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 5px 0; min-height: 28px; color: var(--accent-dark); font-size: 11px; font-weight: 800; }
.text-button:hover { text-decoration: underline; }
.text-button .icon { width: 13px; height: 13px; }
#market-toggle[aria-expanded="true"] .icon { transform: rotate(-90deg); }

.footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 67px; color: var(--muted); font-size: 11px; }
.footer > span { font-size: 14px; font-weight: 800; letter-spacing: -.05em; }
.footer a { display: flex; align-items: center; gap: 5px; }

dialog { width: min(410px, calc(100% - 28px)); max-height: min(535px, calc(100dvh - 28px)); padding: 16px; border: 1px solid var(--border); border-radius: 17px; color: var(--foreground); background: white; box-shadow: 0 20px 80px #102c2340; overflow: auto; }
dialog::backdrop { background: #122d2652; backdrop-filter: blur(3px); }
.picker-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.picker-heading h2 { font-size: 17px; font-weight: 800; }
.search-box { display: flex; align-items: center; gap: 8px; padding-inline: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-muted); }
.search-box:focus-within { border-color: #82ad96; }
.search-box .icon { color: var(--muted); }
.search-box input { width: 100%; min-height: 42px; padding: 0; border: 0; background: transparent; }
.search-box input:focus { outline: 0; }
.picker-label { margin: 12px 5px 5px; color: var(--muted); font-size: 11px; }
.currency-list { margin: 0; padding: 0 3px; max-height: min(340px, calc(100dvh - 185px)); overflow-y: auto; list-style: none; }
.currency-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 9px; min-height: 44px; text-align: left; border-radius: 8px; }
.currency-option:hover, .currency-option[aria-current="true"] { background: var(--surface-accent); }
.currency-option:focus-visible { outline-offset: -2px; }
.currency-option strong { flex: 0 0 42px; }
.currency-option .currency-name { color: var(--secondary); flex: 1; font-size: 13px; }
.currency-option .icon { color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 5; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; max-width: calc(100% - 24px); padding: 10px 15px; border-radius: 12px; color: white; background: #1d4736; box-shadow: 0 5px 18px #163d292e; font-weight: 700; font-size: 12px; }
.toast .icon { width: 16px; height: 16px; }

@media (max-width: 840px) {
  .shell { width: calc(100% - 36px); }
  .header-inner { gap: 9px; }
  .hero-art { top: 2px; right: -8%; width: min(60%, 470px); opacity: .84; }
  .analytics { gap: 12px; }
  .history, .market { padding-inline: 15px; }
  .periods button { min-width: 32px; padding-inline: 4px; }
}
@media (max-width: 680px) {
  html { scroll-padding-top: 106px; }
  .shell { width: calc(100% - 28px); }
  .header-inner { grid-template-columns: 1fr 1fr; gap: 1px 8px; padding-top: 8px; }
  .brand { font-size: 20px; gap: 7px; }
  .brand img { width: 28px; height: 28px; border-radius: 8px; }
  .source-link { min-height: 32px; }
  nav { grid-row: 2; grid-column: 1 / -1; margin: 3px 0 7px; justify-content: center; gap: 3px; }
  .nav-link { flex: 1; padding-inline: 6px; min-height: 36px; font-size: 12px; }
  .nav-link .icon { width: 14px; height: 14px; }
  .hero-inner { min-height: 210px; }
  .hero-content { padding: 29px 0 56px; }
  .hero p { font-size: 13px; margin-top: 10px; max-width: 92%; text-wrap: pretty; }
  .hero-art { top: 15px; right: -19%; width: 69%; opacity: .58; }
  .coin { width: 32px; border-radius: 9px; font-size: 18px; }
  .coin-euro { width: 27px; font-size: 15px; }
  .coin-yen { display: none; }
  .dashboard { margin-top: -28px; }
  .converter { padding: 15px 15px 0; }
  .conversion-grid { gap: 6px 10px; grid-template-columns: minmax(0, 1fr) 42px; margin-top: 13px; }
  .conversion-grid .field { grid-column: 1 / -1; }
  .conversion-grid .field:last-child { grid-row: 2; }
  .conversion-grid .field:last-child label { min-height: 20px; margin-bottom: 3px; }
  .conversion-grid .swap-button { grid-column: 2; grid-row: 2; align-self: start; justify-self: end; z-index: 1; width: 36px; height: 36px; margin: -13px 7px 0 0; background: white; }
  .swap-button .icon { transform: rotate(90deg); width: 17px; height: 17px; }
  .money-box { min-height: 59px; padding: 6px 8px 6px 12px; }
  .money-box input, .money-box output { font-size: 29px; }
  .currency-button { min-height: 39px; }
  .conversion-meta { min-height: 47px; margin-top: 11px; flex-wrap: wrap; gap: 6px 12px; }
  .amount-message { flex: 0 0 100%; order: 2; }
  .rate-date, .unit-rate { font-size: 10px; }
  .analytics { grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
  .history-summary { min-height: 82px; }
  .market th { font-size: 12px; }
  .chart { height: 204px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
