/* ==========================================================================
   Rate Desk — Apple-inspired light / dark theme
   System fonts only. No external assets or CDN dependencies.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #f5f5f7;
  --bg-soft: #fbfbfd;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #ffffff;
  --surface-muted: #f2f2f4;
  --surface-strong: #e8e8ed;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --glass: rgba(245, 245, 247, 0.72);

  --ink: #1d1d1f;
  --ink-soft: #424245;
  --muted: #6e6e73;
  --muted-2: #86868b;

  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.16);

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-ink: #ffffff;
  --cyan: #5ac8fa;
  --violet: #5e5ce6;
  --success: #248a3d;
  --success-soft: rgba(52, 199, 89, 0.12);
  --warning: #a45100;
  --warning-soft: rgba(255, 159, 10, 0.13);
  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, 0.1);

  --active-bg: #1d1d1f;
  --active-ink: #ffffff;
  --active-mark-bg: #5ac8fa;
  --active-mark-ink: #003b52;
  --brand-bg: #1d1d1f;
  --brand-ink: #ffffff;
  --switch-active: #ffffff;
  --switch-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);

  --board-bg:
    radial-gradient(460px 300px at 108% -25%, rgba(90, 200, 250, 0.34), transparent 66%),
    radial-gradient(340px 260px at 5% 120%, rgba(94, 92, 230, 0.2), transparent 70%),
    linear-gradient(145deg, #09090b 0%, #1c1c1e 55%, #082b43 100%);
  --board-ink: #f5f5f7;
  --board-muted: rgba(245, 245, 247, 0.55);
  --board-line: rgba(255, 255, 255, 0.12);
  --board-accent: #5ac8fa;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.035), 0 14px 36px -28px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 2px 7px rgba(0, 0, 0, 0.035), 0 32px 80px -46px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 18px 44px -32px rgba(0, 0, 0, 0.25);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 32px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", ui-monospace, Menlo, "Cascadia Code",
    "Roboto Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #000000;
  --bg-soft: #0a0a0c;
  --surface: rgba(28, 28, 30, 0.72);
  --surface-solid: #1c1c1e;
  --surface-muted: #242426;
  --surface-strong: #2c2c2e;
  --panel: rgba(28, 28, 30, 0.68);
  --panel-strong: rgba(28, 28, 30, 0.94);
  --glass: rgba(0, 0, 0, 0.62);

  --ink: #f5f5f7;
  --ink-soft: #d2d2d7;
  --muted: #98989d;
  --muted-2: #8e8e93;

  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);

  --accent: #2997ff;
  --accent-hover: #55adff;
  --accent-soft: rgba(41, 151, 255, 0.14);
  --accent-ink: #ffffff;
  --cyan: #64d2ff;
  --violet: #bf5af2;
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.13);
  --warning: #ffd60a;
  --warning-soft: rgba(255, 214, 10, 0.1);
  --danger: #ff6961;
  --danger-soft: rgba(255, 105, 97, 0.1);

  --active-bg: #f5f5f7;
  --active-ink: #1d1d1f;
  --active-mark-bg: #0071e3;
  --active-mark-ink: #ffffff;
  --brand-bg: #f5f5f7;
  --brand-ink: #000000;
  --switch-active: #3a3a3c;
  --switch-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);

  --board-bg:
    radial-gradient(480px 320px at 110% -20%, rgba(41, 151, 255, 0.34), transparent 66%),
    radial-gradient(340px 260px at 0% 120%, rgba(191, 90, 242, 0.18), transparent 70%),
    linear-gradient(145deg, #050506 0%, #161618 55%, #041b2c 100%);
  --board-ink: #f5f5f7;
  --board-muted: rgba(245, 245, 247, 0.56);
  --board-line: rgba(255, 255, 255, 0.14);
  --board-accent: #64d2ff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 18px 50px -32px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.3), 0 38px 90px -50px rgba(0, 0, 0, 0.95);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25), 0 22px 50px -34px rgba(0, 0, 0, 0.9);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 88% -12%, rgba(0, 113, 227, 0.13), transparent 62%),
    radial-gradient(900px 600px at -10% 18%, rgba(94, 92, 230, 0.08), transparent 60%),
    var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(1000px 600px at 90% -10%, rgba(41, 151, 255, 0.12), transparent 62%),
    radial-gradient(820px 560px at -10% 20%, rgba(191, 90, 242, 0.07), transparent 60%),
    var(--bg);
}

::selection {
  color: #fff;
  background: var(--accent);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Dynamic theme change should feel soft, never animated on every paint. */
body,
.site-header,
.panel,
.rate-card,
.sync-pill,
.refresh-button,
.icon-button,
.lang-switch,
.base-option,
.amount-control,
.select-shell select,
.result-card,
.alert,
.source-chip,
.example-chip,
.footer-inner {
  transition:
    background-color 260ms ease,
    border-color 260ms ease,
    color 260ms ease,
    box-shadow 260ms ease;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 12px 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: var(--brand-ink);
  background: var(--brand-bg);
  border-radius: 12px;
  box-shadow: 0 8px 20px -14px rgba(0, 0, 0, 0.55);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-copy {
  display: grid;
  gap: 0;
}

.brand-copy strong {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-copy span {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.18em;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang-option {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.lang-option:hover {
  color: var(--ink);
}

.lang-option[aria-pressed="true"] {
  color: var(--ink);
  background: var(--switch-active);
  box-shadow: var(--switch-shadow);
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-solid);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(0) scale(0.95);
}

.theme-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: block;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.sync-pill[data-state="loading"] .sync-dot {
  animation: pulse-dot 1.5s ease-out infinite;
}

.sync-pill[data-state="ok"] .sync-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.sync-pill[data-state="warn"] .sync-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.sync-pill[data-state="offline"] .sync-dot {
  background: var(--muted);
  box-shadow: 0 0 0 3px var(--line);
}

.sync-pill[data-state="error"] .sync-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.refresh-button:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 8px 22px -14px rgba(0, 113, 227, 0.7);
  transform: translateY(-1px);
}

.refresh-button:active:not(:disabled) {
  transform: translateY(0);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.refresh-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh-button.is-loading .refresh-icon {
  animation: spin 900ms linear infinite;
}

/* --------------------------------------------------------------------------
   Layout / typography
   -------------------------------------------------------------------------- */

.page {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 0 32px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow-mark {
  width: 18px;
  height: 1px;
  background: currentColor;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, 0.72fr);
  gap: clamp(34px, 5.8vw, 76px);
  align-items: center;
  padding: 82px 0 54px;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(44px, 5vw, 68px);
  font-weight: 650;
  letter-spacing: -0.052em;
  line-height: 1.04;
}

.hero h1 em {
  color: transparent;
  background: linear-gradient(100deg, var(--accent) 15%, var(--violet) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  font-style: normal;
}

html[lang="en"] .hero h1 {
  font-size: clamp(42px, 4.7vw, 60px);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px 18px;
  margin-top: 28px;
}

.hero-meta-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
}

.hero-meta-item strong,
.hero-meta-item time {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.hero-meta-item time {
  font-variant-numeric: tabular-nums;
}

.meta-divider {
  width: 1px;
  height: 12px;
  background: var(--line-strong);
}

/* --------------------------------------------------------------------------
   Hero market board
   -------------------------------------------------------------------------- */

.hero-board {
  position: relative;
  isolation: isolate;
  min-width: 0;
  overflow: hidden;
  padding: 22px 23px 19px;
  color: var(--board-ink);
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  box-shadow:
    0 38px 80px -48px rgba(0, 0, 0, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.hero-board::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -80px;
  right: -55px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgba(255, 255, 255, 0.026),
    0 0 0 58px rgba(255, 255, 255, 0.018);
}

.hero-board::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 100% 34px;
  mask-image: linear-gradient(to bottom, transparent 8%, #000 100%);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--board-muted);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.15em;
}

.board-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.board-label i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--board-accent);
  box-shadow: 0 0 0 4px rgba(100, 210, 255, 0.13);
  animation: pulse-dot 2s ease-out infinite;
}

.board-cache {
  font-weight: 500;
  letter-spacing: 0.06em;
}

.board-main {
  padding: 26px 0 21px;
}

.board-pair {
  color: var(--board-muted);
  font-size: 9px;
  font-weight: 550;
  letter-spacing: 0.08em;
}

.board-quote {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}

.board-symbol {
  align-self: center;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  margin-right: 2px;
  color: #002c3d;
  background: var(--board-accent);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}

.board-quote strong {
  min-width: 0;
  color: var(--board-ink);
  font-family: var(--font-sans);
  font-size: clamp(36px, 3.5vw, 47px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.board-unit {
  color: var(--board-muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.board-main p {
  margin: 9px 0 0;
  color: var(--board-muted);
  font-size: 11px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--board-line);
}

.board-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.board-grid span {
  color: var(--board-muted);
  font-size: 8px;
  font-weight: 550;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.board-grid b {
  color: rgba(245, 245, 247, 0.94);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.board-spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
  margin-top: 16px;
  opacity: 0.44;
}

.board-spark i {
  flex: 1 1 0;
  min-width: 2px;
  height: 30%;
  background: var(--board-accent);
  border-radius: 2px 2px 0 0;
}

.board-spark i:nth-child(3n) {
  height: 52%;
}
.board-spark i:nth-child(4n) {
  height: 76%;
}
.board-spark i:nth-child(5n) {
  height: 42%;
}
.board-spark i:nth-child(7n) {
  height: 92%;
}
.board-spark i:nth-child(8n) {
  height: 62%;
}
.board-spark i:nth-child(11n) {
  height: 84%;
}
.board-spark i:nth-child(13n) {
  height: 36%;
}
.board-spark i:nth-child(17n) {
  height: 100%;
}

/* --------------------------------------------------------------------------
   Alert
   -------------------------------------------------------------------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 0 0 20px;
  padding: 12px 13px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 24%, transparent);
  border-radius: 16px;
}

.alert[data-kind="error"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
}

.alert-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: color-mix(in srgb, var(--surface-solid) 48%, transparent);
  border-radius: 8px;
}

.alert-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.alert-copy {
  min-width: 0;
  flex: 1;
}

.alert-copy strong {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
}

.alert-copy p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.55;
}

.alert-retry {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
  color: currentColor;
  background: color-mix(in srgb, var(--surface-solid) 58%, transparent);
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
}

.alert-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: currentColor;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.65;
}

.alert-close:hover {
  background: color-mix(in srgb, var(--surface-solid) 58%, transparent);
  opacity: 1;
}

.alert-close svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* --------------------------------------------------------------------------
   Dashboard / panels
   -------------------------------------------------------------------------- */

.dashboard {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 27px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading .eyebrow {
  margin-bottom: 5px;
}

.panel h2,
.section-heading h2 {
  margin: 0;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.14;
}

.panel-lede {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.count-chip,
.soft-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 26px;
  padding: 5px 9px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}

.soft-badge svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Base currency ------------------------------------------------------------ */

.base-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 19px;
}

.base-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 9px;
  text-align: left;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    transform 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.base-option:hover {
  background: var(--surface-solid);
  border-color: var(--line);
  transform: translateY(-1px);
}

.base-option:active {
  transform: translateY(0) scale(0.985);
}

.base-option-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  color: var(--ink-soft);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.base-option-symbol.is-wide {
  font-size: 8px;
  letter-spacing: -0.03em;
}

html[lang="en"] .base-option-copy strong {
  overflow: visible;
  font-size: 10.5px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.base-option-symbol[lang="ar"],
.currency-mark[lang="ar"],
.amount-symbol[lang="ar"],
.select-mark[lang="ar"],
.result-symbol[lang="ar"],
.base-current-symbol[lang="ar"] {
  font-family: "Geeza Pro", "Arial", sans-serif;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  white-space: nowrap;
}

.base-option-symbol[lang="ar"] {
  font-size: 17px;
}

.currency-mark[lang="ar"] {
  font-size: 17px;
}

.amount-symbol[lang="ar"] {
  font-size: 24px;
}

.select-mark[lang="ar"] {
  font-size: 12px;
}

.result-symbol[lang="ar"] {
  font-size: 22px;
}

.base-current-symbol[lang="ar"] {
  font-size: 20px;
}

.base-option-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.base-option-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.base-option-copy span {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 550;
  letter-spacing: 0.04em;
}

.base-option-check {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  color: var(--active-mark-ink);
  background: var(--active-mark-bg);
  border-radius: 50%;
  font-size: 8.5px;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.base-option[aria-pressed="true"] {
  color: var(--active-ink);
  background: var(--active-bg);
  border-color: var(--active-bg);
  box-shadow: 0 8px 20px -16px rgba(0, 0, 0, 0.65);
}

.base-option[aria-pressed="true"] .base-option-symbol {
  color: var(--active-mark-ink);
  background: var(--active-mark-bg);
  border-color: transparent;
}

.base-option[aria-pressed="true"] .base-option-copy span {
  color: color-mix(in srgb, var(--active-ink) 58%, transparent);
}

.base-option[aria-pressed="true"] .base-option-check {
  opacity: 1;
  transform: scale(1);
}

.base-foot {
  margin-top: 21px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.base-current {
  display: flex;
  align-items: center;
  gap: 10px;
}

.base-current-symbol {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--active-mark-ink);
  background: var(--active-mark-bg);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 750;
  line-height: 1;
}

.base-current-copy {
  display: grid;
  gap: 1px;
}

.base-current-copy > span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.base-current-copy strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 650;
}

.base-current-copy em {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.05em;
}

.stat-list {
  display: grid;
  gap: 0;
  margin: 15px 0 0;
}

.stat-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.stat-list div:last-child {
  border-bottom: 0;
}

.stat-list dt {
  color: var(--muted);
  font-size: 10px;
}

.stat-list dd {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 550;
  text-align: right;
}

.source-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 13px;
}

.source-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 750;
}

.source-chip > span:last-child {
  display: grid;
  gap: 0;
  min-width: 0;
}

.source-chip strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-chip small {
  color: var(--muted);
  font-size: 8.5px;
}

/* Converter ---------------------------------------------------------------- */

.converter {
  padding: 28px;
}

.amount-field {
  margin-top: 21px;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field-head label,
.field > label {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
}

.field-hint {
  color: var(--muted);
  font-size: 9.5px;
  text-align: right;
}

.field-hint.is-error {
  color: var(--danger);
  font-weight: 600;
}

.amount-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 80px;
  padding: 10px 16px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 18px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.amount-control:focus-within {
  background: var(--surface-solid);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.amount-field.has-error .amount-control {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 7%, transparent);
}

.amount-symbol {
  flex: 0 0 auto;
  min-width: 22px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

.amount-symbol.is-wide-symbol,
.base-current-symbol.is-wide-symbol,
.select-mark.is-wide-symbol {
  font-size: 10px;
  letter-spacing: -0.04em;
}

.result-symbol.is-wide-symbol {
  font-size: 16px;
  letter-spacing: -0.04em;
}

.amount-control input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--font-sans);
  font-size: clamp(32px, 4.2vw, 44px);
  font-weight: 600;
  letter-spacing: -0.052em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.amount-control input::placeholder {
  color: var(--muted-2);
}

.amount-code {
  flex: 0 0 auto;
  padding: 4px 7px;
  color: var(--muted);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.currency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  gap: 11px;
  align-items: end;
  margin-top: 17px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.select-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.select-mark {
  position: absolute;
  z-index: 1;
  left: 10px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--muted);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.select-shell select {
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 0 34px 0 44px;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 13px;
  outline: 0;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.select-shell select:hover {
  background: var(--surface-solid);
}

.select-shell select:focus {
  background: var(--surface-solid);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.select-chevron {
  position: absolute;
  right: 11px;
  width: 13px;
  height: 13px;
  color: var(--muted);
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.swap-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 2px 4px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.swap-button:hover {
  background: var(--accent-hover);
  transform: rotate(180deg);
  box-shadow: 0 8px 18px -12px rgba(0, 113, 227, 0.8);
}

.swap-button:active {
  transform: rotate(180deg) scale(0.93);
}

.swap-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swap-button.is-swapping svg {
  animation: swap-pop 280ms ease;
}

/* Result ------------------------------------------------------------------- */

.result-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 21px;
  padding: 19px 20px 17px;
  color: var(--board-ink);
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 24px 50px -40px rgba(0, 0, 0, 0.9);
}

.result-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -72px;
  right: -34px;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(255, 255, 255, 0.022);
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--board-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-tag {
  padding: 4px 7px;
  color: var(--board-accent);
  background: rgba(100, 210, 255, 0.1);
  border: 1px solid rgba(100, 210, 255, 0.17);
  border-radius: 999px;
  font-size: 8px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.result-tag.is-warn {
  color: #ffd60a;
  background: rgba(255, 214, 10, 0.1);
  border-color: rgba(255, 214, 10, 0.2);
}

.result-tag.is-error {
  color: #ff8a80;
  background: rgba(255, 105, 97, 0.1);
  border-color: rgba(255, 105, 97, 0.2);
}

.result-amount {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  margin-top: 14px;
}

.result-symbol {
  flex: 0 0 auto;
  color: var(--board-accent);
  font-family: var(--font-sans);
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 500;
  line-height: 1;
}

.result-amount strong {
  min-width: 0;
  font-family: var(--font-sans);
  font-size: clamp(42px, 6.4vw, 68px);
  font-weight: 600;
  letter-spacing: -0.07em;
  line-height: 1.02;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-amount strong.is-long {
  font-size: clamp(25px, 4.2vw, 43px);
  letter-spacing: -0.05em;
}

.result-amount strong.is-loading {
  color: rgba(245, 245, 247, 0.35);
}

.result-equation {
  margin: 9px 0 0;
  color: rgba(245, 245, 247, 0.79);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.result-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
  margin-top: 15px;
  padding-top: 12px;
  color: var(--board-muted);
  border-top: 1px solid var(--board-line);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
}

.result-footer #result-rate {
  color: color-mix(in srgb, var(--board-accent) 82%, transparent);
  font-family: var(--font-mono);
}

.result-dot {
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
}

.result-footer time {
  white-space: nowrap;
}

/* Quick examples ----------------------------------------------------------- */

.examples {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.examples-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.examples-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.example-chip {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 550;
  cursor: pointer;
  transition:
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.example-chip span {
  color: var(--accent);
}

.example-chip:hover {
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.example-chip:active {
  transform: translateY(0);
}

.example-chip.is-active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}

.example-chip.is-active span {
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   Rate board
   -------------------------------------------------------------------------- */

.rates-section {
  margin-top: 50px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 17px;
}

.section-heading h2 {
  font-size: clamp(27px, 3.2vw, 36px);
}

.section-heading h2 span:first-child {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.74em;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.rates-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 16px;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
}

.rates-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.rates-count i {
  width: 5px;
  height: 5px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--success-soft);
}

.rates-update {
  white-space: nowrap;
}

.rates-update time {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.rates-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.rate-card {
  position: relative;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: var(--shadow-card);
  transition:
    transform 170ms ease,
    border-color 170ms ease,
    box-shadow 170ms ease,
    background-color 170ms ease;
  animation: card-in 420ms both;
}

.rate-card:nth-child(2) {
  animation-delay: 20ms;
}
.rate-card:nth-child(3) {
  animation-delay: 40ms;
}
.rate-card:nth-child(4) {
  animation-delay: 60ms;
}
.rate-card:nth-child(5) {
  animation-delay: 80ms;
}
.rate-card:nth-child(6) {
  animation-delay: 100ms;
}
.rate-card:nth-child(7) {
  animation-delay: 120ms;
}
.rate-card:nth-child(8) {
  animation-delay: 140ms;
}
.rate-card:nth-child(9) {
  animation-delay: 160ms;
}
.rate-card:nth-child(10) {
  animation-delay: 180ms;
}
.rate-card:nth-child(11) {
  animation-delay: 200ms;
}
.rate-card:nth-child(12) {
  animation-delay: 220ms;
}
.rate-card:nth-child(13) {
  animation-delay: 240ms;
}
.rate-card:nth-child(14) {
  animation-delay: 260ms;
}

.rate-card:hover {
  z-index: 1;
  background: var(--surface-solid);
  border-color: var(--line-strong);
  box-shadow: 0 24px 44px -34px rgba(0, 0, 0, 0.45);
  transform: translateY(-2px);
}

.rate-card.is-base {
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
  background:
    linear-gradient(145deg, var(--accent-soft), transparent 78%),
    var(--panel-strong);
}

.rate-card.is-base::after {
  content: "BASE";
  position: absolute;
  top: 10px;
  right: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.rate-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding-right: 30px;
}

.currency-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--ink-soft);
  background: var(--surface-strong);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.tone-blue {
  color: #0066cc;
  background: #e8f1ff;
}
.tone-red {
  color: #c22955;
  background: #ffeef2;
}
.tone-sand {
  color: #9a5a00;
  background: #fff4df;
}
.tone-indigo {
  color: #4b48c9;
  background: #efefff;
}
.tone-teal {
  color: #007c73;
  background: #e5f7f4;
}
.tone-violet {
  color: #7d4bd8;
  background: #f3ecff;
}
.tone-rose {
  color: #b32955;
  background: #ffedf2;
}
.tone-slate {
  color: #526069;
  background: #eef1f3;
}

html[data-theme="dark"] .tone-blue {
  color: #64b5ff;
  background: rgba(10, 132, 255, 0.16);
}
html[data-theme="dark"] .tone-red {
  color: #ff8095;
  background: rgba(255, 69, 105, 0.14);
}
html[data-theme="dark"] .tone-sand {
  color: #ffd27a;
  background: rgba(255, 179, 64, 0.13);
}
html[data-theme="dark"] .tone-indigo {
  color: #a5a3ff;
  background: rgba(94, 92, 230, 0.18);
}
html[data-theme="dark"] .tone-teal {
  color: #6ee7db;
  background: rgba(48, 209, 180, 0.13);
}
html[data-theme="dark"] .tone-violet {
  color: #d0a6ff;
  background: rgba(191, 90, 242, 0.15);
}
html[data-theme="dark"] .tone-rose {
  color: #ff9bb5;
  background: rgba(255, 105, 140, 0.13);
}
html[data-theme="dark"] .tone-slate {
  color: #b6c2c9;
  background: rgba(142, 142, 147, 0.18);
}

.rate-card-name {
  display: grid;
  min-width: 0;
  gap: 0;
}

.rate-card-name strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rate-card-name span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 550;
  letter-spacing: 0.06em;
}

.rate-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 15px;
}

.rate-number {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(19px, 1.8vw, 24px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rate-number.is-flashing {
  animation: value-flash 380ms ease;
}

.rate-unit {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 550;
  letter-spacing: 0.04em;
}

.rate-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 8px;
}

.rate-foot code {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 7.5px;
}

.rates-grid[aria-busy="true"] .rate-number {
  position: relative;
  width: 82px;
  height: 18px;
  margin-top: 2px;
  color: transparent;
  background: var(--surface-strong);
  border-radius: 5px;
  overflow: hidden;
}

.rates-grid[aria-busy="true"] .rate-number::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s infinite;
}

.rates-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.65;
}

.rates-note svg {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 1px;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
}

/* --------------------------------------------------------------------------
   Watchlist
   -------------------------------------------------------------------------- */

.manage-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    color 150ms ease,
    opacity 150ms ease,
    transform 150ms ease;
}

.manage-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  transform: translateY(-1px);
}

.manage-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.manage-button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.watchlist-panel {
  overflow: hidden;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
}

.watchlist {
  display: grid;
}

.watch-row {
  position: relative;
  display: grid;
  grid-template-columns: 28px 36px minmax(0, 1fr) minmax(100px, auto) 32px;
  gap: 11px;
  align-items: center;
  min-height: 64px;
  padding: 11px 17px;
  border-bottom: 1px solid var(--line);
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.watch-row:last-child {
  border-bottom: 0;
}

.watch-row:hover {
  background: var(--surface-muted);
}

.watch-row.is-base {
  background:
    linear-gradient(90deg, var(--accent-soft), transparent 55%),
    var(--panel-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

.watch-row.is-base:hover {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    var(--panel-strong);
}

.watch-index {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.watch-row .currency-mark {
  width: 36px;
  height: 36px;
}

.watch-name {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.watch-name strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 550;
  letter-spacing: 0.05em;
}

.watch-badge {
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  padding: 1px 5px;
  color: var(--muted);
  background: var(--surface-muted);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 7.5px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}

.watch-row.is-base .watch-badge {
  color: var(--accent);
  background: var(--accent-soft);
}

.watch-rate {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.watch-rate strong {
  color: var(--ink);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.15;
  white-space: nowrap;
}

.watch-rate span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 550;
  letter-spacing: 0.04em;
}

.watch-edit {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.watch-edit:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 16%, transparent);
}

.watch-edit:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

.watch-edit svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.watchlist[aria-busy="true"] .watch-rate strong {
  position: relative;
  width: 76px;
  height: 16px;
  color: transparent;
  background: var(--surface-strong);
  border-radius: 5px;
  overflow: hidden;
}

.watchlist[aria-busy="true"] .watch-rate strong::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s infinite;
}

/* --------------------------------------------------------------------------
   Watchlist editor dialog
   -------------------------------------------------------------------------- */

body.dialog-open {
  overflow: hidden;
}

.watchlist-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  padding: 0;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.watchlist-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.watchlist-form {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  min-height: 0;
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 23px 24px 17px;
  border-bottom: 1px solid var(--line);
}

.sheet-header .eyebrow {
  margin-bottom: 5px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.sheet-header p:last-child {
  max-width: 440px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.sheet-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

.sheet-close:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.sheet-close svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.watchlist-editor {
  display: grid;
  gap: 7px;
  padding: 16px 24px;
  overflow-y: auto;
  min-height: 0;
}

.editor-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.editor-index {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: center;
}

.editor-row select {
  width: 100%;
  height: 42px;
  padding: 0 32px 0 11px;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 11px;
  outline: 0;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 18px,
    calc(100% - 11px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.editor-row select:hover {
  background-color: var(--surface-solid);
}

.editor-row select:focus {
  background-color: var(--surface-solid);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.watchlist-error {
  margin: 0 24px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 550;
}

.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 24px 20px;
  border-top: 1px solid var(--line);
}

.sheet-reset {
  min-height: 34px;
  padding: 6px 3px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
}

.sheet-reset:hover {
  color: var(--ink);
}

.sheet-primary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-cancel,
.sheet-save {
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.sheet-cancel {
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid transparent;
}

.sheet-cancel:hover {
  background: var(--surface-strong);
}

.sheet-save {
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
}

.sheet-save:hover {
  background: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   Footer / toast / noscript
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 22px 32px 28px;
  color: var(--muted);
  font-size: 9.5px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark-small {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.brand-mark-small svg {
  width: 17px;
  height: 17px;
}

.footer-inner p {
  margin: 0;
  text-align: right;
}

.footer-inner a {
  color: var(--ink-soft);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 2px;
}

.footer-inner a:hover {
  color: var(--accent);
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 22px;
  left: 50%;
  max-width: min(90vw, 420px);
  padding: 10px 15px;
  color: #f5f5f7;
  background: rgba(29, 29, 31, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  box-shadow: 0 20px 45px -24px rgba(0, 0, 0, 0.65);
  font-size: 11px;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-in 180ms ease both;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html[data-theme="dark"] .toast {
  color: #1d1d1f;
  background: rgba(245, 245, 247, 0.94);
  border-color: rgba(0, 0, 0, 0.08);
}

.noscript-warning {
  position: fixed;
  z-index: 100;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 12px 16px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  border-radius: 13px;
  font-size: 12px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(100, 210, 255, 0.3);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(100, 210, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(100, 210, 255, 0);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes swap-pop {
  0% {
    transform: rotate(0) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(0.8);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes value-flash {
  0% {
    opacity: 0.18;
    transform: translateY(3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (min-width: 1280px) {
  .rates-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .dashboard {
    grid-template-columns: 370px minmax(0, 1fr);
  }

  .rates-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 54px;
  }

  .hero-board {
    max-width: none;
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .base-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .base-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 8px 28px;
    align-items: start;
  }

  .stat-list {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
  }

  .source-chip {
    margin-top: 0;
  }
}

@media (max-width: 820px) {
  .sync-pill {
    display: none;
  }
}

@media (max-width: 760px) {
  .header-inner,
  .page,
  .footer-inner {
    padding-right: 20px;
    padding-left: 20px;
  }

  .hero {
    padding: 42px 0 37px;
  }

  .hero h1 {
    font-size: clamp(38px, 8.4vw, 54px);
  }

  html[lang="en"] .hero h1 {
    font-size: clamp(37px, 8vw, 52px);
  }

  .hero-meta {
    gap: 9px 14px;
    margin-top: 23px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .rates-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    padding: 22px;
    border-radius: 24px;
  }

  .converter {
    padding: 22px;
  }

  .converter-heading {
    align-items: center;
  }

  .base-foot {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .stat-list {
    grid-column: auto;
    grid-row: auto;
    margin-top: 15px;
  }

  .source-chip {
    margin-top: 15px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .footer-inner p {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .header-inner {
    gap: 10px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .brand-copy span {
    font-size: 7.5px;
  }

  .header-actions {
    gap: 6px;
  }

  .lang-option {
    min-width: 27px;
    height: 27px;
    padding: 0 6px;
    font-size: 10px;
  }

  .icon-button {
    width: 35px;
    height: 35px;
  }

  .refresh-button {
    width: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 50%;
  }

  .refresh-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* Keep the reference selector and converter close to the first screen. */
  .hero-board {
    display: none;
  }

  .base-foot {
    display: none;
  }

  .hero {
    padding-top: 33px;
  }

  .hero h1 {
    font-size: clamp(35px, 10.2vw, 46px);
    letter-spacing: -0.055em;
  }

  html[lang="en"] .hero h1 {
    font-size: clamp(34px, 9.8vw, 44px);
  }

  .hero-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .meta-divider {
    display: none;
  }

  .hero-meta-item {
    justify-content: space-between;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }

  .hero-meta-item:last-child {
    border-bottom: 0;
  }

  .dashboard {
    gap: 13px;
  }

  .panel h2,
  .section-heading h2 {
    font-size: 24px;
  }

  .base-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .base-option {
    min-height: 55px;
  }

  .amount-control {
    min-height: 74px;
    padding: 9px 13px;
    border-radius: 16px;
  }

  .amount-control input {
    font-size: 33px;
  }

  .amount-symbol {
    font-size: 20px;
  }

  .currency-row {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
  }

  .swap-button {
    width: 44px;
    height: 44px;
    margin: -1px auto;
    transform: rotate(90deg);
  }

  .swap-button:hover {
    transform: rotate(270deg);
  }

  .swap-button:active {
    transform: rotate(270deg) scale(0.93);
  }

  .select-shell select {
    height: 50px;
    font-size: 16px;
  }

  .result-card {
    padding: 17px;
  }

  .result-amount strong {
    font-size: clamp(35px, 11vw, 51px);
  }

  .result-amount strong.is-long {
    font-size: clamp(22px, 7.3vw, 34px);
  }

  .result-equation {
    font-size: 11.5px;
  }

  .result-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .result-dot {
    display: none;
  }

  .examples {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .example-chip {
    min-height: 40px;
    padding: 9px 11px;
    font-size: 9px;
  }

  .alert-retry {
    min-height: 34px;
  }

  .alert-close {
    width: 30px;
    height: 30px;
  }

  .rates-grid {
    grid-template-columns: 1fr;
  }

  .rate-card {
    padding: 15px;
  }

  .rate-value {
    margin-top: 13px;
  }

  .rate-number {
    font-size: 23px;
  }

  .alert {
    align-items: center;
    flex-wrap: wrap;
  }

  .alert-copy {
    flex-basis: calc(100% - 46px);
  }

  .alert-retry {
    margin-left: 37px;
  }

  .toast {
    bottom: 14px;
  }
}

@media (max-width: 390px) {
  .header-inner,
  .page,
  .footer-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .brand-copy span {
    display: none;
  }

  .brand-copy strong {
    font-size: 13.5px;
  }

  .hero h1 {
    font-size: 34px;
  }

  html[lang="en"] .hero h1 {
    font-size: 33px;
  }

  .panel,
  .converter {
    padding: 18px;
  }

  .board-quote strong {
    font-size: 33px;
  }

  .board-grid b {
    font-size: 10.5px;
  }

  .rate-card-name strong {
    font-size: 11.5px;
  }
}

@media (max-width: 760px) {
  .rates-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .manage-button {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .dashboard {
    margin-top: 14px;
  }

  .watch-row {
    grid-template-columns: 36px minmax(0, 1fr) auto 30px;
    gap: 9px;
    min-height: 62px;
    padding: 10px 14px;
  }

  .watch-index {
    display: none;
  }

  .watch-row .currency-mark {
    width: 34px;
    height: 34px;
  }

  .watch-name strong {
    font-size: 12.5px;
  }

  .watch-rate strong {
    font-size: 19px;
  }

  .watchlist-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
  }

  .sheet-header {
    padding: 20px 18px 14px;
  }

  .sheet-header h2 {
    font-size: 21px;
  }

  .watchlist-editor {
    padding: 14px 18px;
  }

  .watchlist-error {
    margin: 0 18px;
  }

  .editor-row select {
    height: 46px;
    font-size: 16px;
  }

  .sheet-actions {
    padding: 13px 18px calc(14px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .watch-row {
    grid-template-columns: 36px minmax(0, 1fr) 30px;
    grid-template-areas:
      "mark name edit"
      "mark rate edit";
    row-gap: 2px;
    align-items: center;
  }

  .watch-row .currency-mark {
    grid-area: mark;
    align-self: center;
  }

  .watch-name {
    grid-area: name;
  }

  .watch-rate {
    grid-area: rate;
    justify-content: flex-start;
    gap: 6px;
    text-align: left;
  }

  .watch-edit {
    grid-area: edit;
    align-self: center;
  }

  .sheet-primary-actions {
    gap: 6px;
  }

  .sheet-cancel,
  .sheet-save {
    padding-right: 12px;
    padding-left: 12px;
  }
}

/* --------------------------------------------------------------------------
   Historical rate chart
   -------------------------------------------------------------------------- */

.chart-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 26px;
  padding: 26px;
  color: var(--board-ink);
  background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  box-shadow:
    0 38px 80px -50px rgba(0, 0, 0, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.chart-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -150px;
  right: -60px;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  box-shadow:
    0 0 0 45px rgba(255, 255, 255, 0.02),
    0 0 0 95px rgba(255, 255, 255, 0.012);
}

.chart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.chart-card .eyebrow {
  color: var(--board-muted);
}

.chart-card h2 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin: 0;
  color: var(--board-ink);
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.chart-card h2 #chart-pair {
  color: var(--board-ink);
}

.chart-card h2 span:last-child {
  color: var(--board-muted);
  font-size: 0.52em;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.chart-range-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 3px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.chart-range-switch button {
  min-width: 42px;
  height: 30px;
  padding: 0 10px;
  color: var(--board-muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.chart-range-switch button:hover {
  color: var(--board-ink);
}

.chart-range-switch button[aria-pressed="true"] {
  color: var(--board-ink);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.chart-card-body {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  margin-top: 18px;
}

.chart-summary {
  min-width: 0;
  padding: 8px 0;
}

.chart-amount-label {
  margin: 0 0 3px;
  color: var(--board-muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.chart-result {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.chart-symbol {
  flex: 0 0 auto;
  color: var(--board-accent);
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.chart-result strong {
  min-width: 0;
  color: var(--board-ink);
  font-size: clamp(44px, 5.2vw, 66px);
  font-weight: 600;
  letter-spacing: -0.065em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-symbol.is-wide-symbol {
  font-size: 16px;
}

.chart-symbol[lang="ar"] {
  font-family: "Geeza Pro", "Arial", sans-serif;
  font-size: 22px;
  font-weight: 600;
}

.chart-equation {
  margin: 9px 0 0;
  color: rgba(245, 245, 247, 0.76);
  font-size: 11.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.chart-rate {
  margin: 3px 0 0;
  color: var(--board-muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 19px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--board-line);
}

.chart-stats div {
  min-width: 0;
}

.chart-stats dt {
  color: var(--board-muted);
  font-size: 8px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.chart-stats dd {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--board-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chart-stats dd.is-up {
  color: #73e6a4;
}

.chart-stats dd.is-down {
  color: #ff9a91;
}

.chart-visual {
  position: relative;
  min-width: 0;
  align-self: stretch;
}

.chart-canvas {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  border-radius: 16px;
}

.chart-svg-layer {
  position: absolute;
  inset: 0;
}

.chart-svg-layer svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.085);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-y-label {
  fill: rgba(245, 245, 247, 0.4);
  font-family: var(--font-mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.chart-x-label {
  fill: rgba(245, 245, 247, 0.4);
  font-family: var(--font-sans);
  font-size: 9px;
}

.chart-line {
  stroke: var(--board-accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(100, 210, 255, 0.26));
}

.chart-area-start {
  stop-color: #5ac8fa;
  stop-opacity: 0.28;
}

.chart-area-end {
  stop-color: #5ac8fa;
  stop-opacity: 0;
}

.chart-crosshair {
  stroke: rgba(245, 245, 247, 0.34);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-dot {
  fill: var(--board-accent);
  stroke: #062b3a;
  stroke-width: 2;
}

.chart-tip,
.chart-hover {
  pointer-events: none;
}

.chart-tip-bg {
  fill: rgba(245, 245, 247, 0.98);
  stroke: rgba(255, 255, 255, 0.34);
  filter: drop-shadow(0 7px 18px rgba(0, 0, 0, 0.32));
}

.chart-tip-value {
  fill: #1d1d1f;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.chart-tip-date {
  fill: #6e6e73;
  font-family: var(--font-sans);
  font-size: 9px;
}

.chart-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px;
  color: var(--board-muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.12);
}

.chart-state[data-state="error"] {
  color: var(--board-ink);
}

.chart-state strong {
  color: var(--board-ink);
  font-size: 12px;
  font-weight: 600;
}

.chart-state p {
  max-width: 330px;
  margin: 0;
  color: var(--board-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.chart-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--board-accent);
  box-shadow: 0 0 0 4px rgba(100, 210, 255, 0.12);
  animation: pulse-dot 1.5s ease-out infinite;
}

.chart-retry {
  min-height: 30px;
  margin-top: 3px;
  padding: 5px 11px;
  color: var(--board-ink);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.chart-retry:hover {
  background: rgba(255, 255, 255, 0.17);
}

.chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 13px;
  padding-top: 11px;
  color: var(--board-muted);
  border-top: 1px solid var(--board-line);
  font-size: 8.5px;
  line-height: 1.5;
}

.chart-foot time {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 8px;
}

/* --------------------------------------------------------------------------
   Full-width converter with a compact base toolbar
   -------------------------------------------------------------------------- */

.dashboard {
  display: block;
  margin-top: 22px;
}

.converter-wide {
  width: 100%;
}

.base-toolbar {
  display: grid;
  gap: 10px;
  margin-top: 19px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.base-toolbar-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.base-toolbar-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.base-toolbar-hint {
  color: var(--muted);
  font-size: 9.5px;
}

.base-toolbar .base-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  margin-top: 0;
}

.base-toolbar .base-option {
  min-height: 50px;
  padding: 8px 9px;
  gap: 8px;
  border-radius: 14px;
}

.base-toolbar .base-option-symbol {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 12px;
}

.base-toolbar .base-option-copy strong {
  font-size: 11.5px;
}

.base-toolbar .base-option-copy span {
  font-size: 8px;
}

.base-toolbar .base-option-check {
  top: 5px;
  right: 5px;
  width: 13px;
  height: 13px;
  font-size: 7.5px;
}

.converter-main {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 25px;
  align-items: stretch;
  margin-top: 21px;
}

.converter-form {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.converter-form .amount-field {
  margin-top: 0;
}

.converter-result {
  display: flex;
  min-width: 0;
}

.converter-result .result-card {
  width: 100%;
  height: 100%;
  margin-top: 0;
}

@media (max-width: 1120px) {
  .base-toolbar .base-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .converter-main {
    grid-template-columns: 1fr;
    gap: 17px;
  }

  .converter-result .result-card {
    height: auto;
  }
}

@media (max-width: 560px) {
  .base-toolbar {
    margin-top: 17px;
    padding-top: 14px;
  }

  .base-toolbar .base-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .base-toolbar .base-option {
    min-height: 54px;
  }

  .converter-main {
    margin-top: 17px;
  }
}

@media (max-width: 980px) {
  .chart-card-body {
    grid-template-columns: 1fr;
    gap: 15px;
    align-items: stretch;
  }

  .chart-summary {
    padding: 2px 0 0;
  }

  .chart-canvas {
    height: 280px;
  }
}

@media (max-width: 760px) {
  .chart-card {
    margin-top: 18px;
    padding: 21px;
    border-radius: 25px;
  }

  .chart-card h2 {
    font-size: 28px;
  }

  .chart-card-body {
    margin-top: 15px;
  }

  .chart-result strong {
    font-size: clamp(43px, 10vw, 58px);
  }

  .chart-canvas {
    height: 250px;
  }

  .chart-foot {
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .chart-card {
    margin-top: 15px;
    padding: 18px;
    border-radius: 23px;
  }

  .chart-card-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .chart-card h2 {
    font-size: 25px;
  }

  .chart-range-switch {
    align-self: flex-start;
  }

  .chart-range-switch button {
    min-width: 48px;
    height: 38px;
    font-size: 11px;
  }

  .chart-card-body {
    gap: 13px;
    margin-top: 14px;
  }

  .chart-summary {
    padding-top: 0;
  }

  .chart-result strong {
    font-size: clamp(40px, 11.5vw, 52px);
  }

  .chart-equation {
    font-size: 10.5px;
  }

  .chart-stats {
    margin-top: 15px;
    padding-top: 12px;
  }

  .chart-canvas {
    height: 225px;
  }

  .chart-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 390px) {
  .chart-card {
    padding: 16px;
  }

  .chart-card h2 {
    font-size: 23px;
  }

  .chart-result strong {
    font-size: 43px;
  }

  .chart-canvas {
    height: 210px;
  }
}

/* --------------------------------------------------------------------------
   Common currencies, date conversion, share actions and history data
   -------------------------------------------------------------------------- */

.common-currency-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.common-currency-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.common-currency-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.common-currency-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.common-currency-hint,
.common-currency-action {
  color: var(--muted);
  font-size: 9.5px;
}

.common-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.common-card {
  --common-tone: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 116px;
  padding: 10px 11px 8px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.common-card.tone-blue {
  --common-tone: #0a84ff;
}
.common-card.tone-red {
  --common-tone: #ff4569;
}
.common-card.tone-sand {
  --common-tone: #ff9f0a;
}
.common-card.tone-indigo {
  --common-tone: #5e5ce6;
}
.common-card.tone-teal {
  --common-tone: #30d1b4;
}
.common-card.tone-violet {
  --common-tone: #bf5af2;
}
.common-card.tone-rose {
  --common-tone: #ff698c;
}
.common-card.tone-slate {
  --common-tone: #8e8e93;
}

.common-card:hover {
  background: var(--surface-strong);
  border-color: var(--line-strong);
}

.common-card:active {
  transform: scale(0.985);
}

.common-card.is-active {
  color: var(--active-ink);
  background: var(--active-bg);
  border-color: var(--active-bg);
  box-shadow: 0 10px 25px -18px rgba(0, 0, 0, 0.75);
}

.common-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
}

.common-code {
  color: var(--common-tone);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.common-card.is-active .common-code {
  color: var(--active-mark-bg);
}

.common-change {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.common-change.is-up {
  color: var(--success);
}

.common-change.is-down {
  color: var(--danger);
}

.common-card.is-active .common-change {
  color: var(--active-mark-bg);
}

.common-name {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.common-card.is-active .common-name {
  color: var(--active-ink);
  opacity: 0.62;
}

.common-value {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.common-value em {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 7.5px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0;
}

.common-card.is-active .common-value {
  color: var(--active-ink);
}

.common-card.is-active .common-value em {
  color: var(--active-ink);
  opacity: 0.48;
}

.common-spark {
  display: block;
  width: 100%;
  height: 26px;
  margin-top: auto;
  padding-top: 5px;
  color: var(--common-tone);
}

.common-spark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.common-spark-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.common-spark-area {
  fill: currentColor;
  opacity: 0.1;
}

.common-spark-empty {
  stroke: currentColor;
  stroke-dasharray: 2 4;
  stroke-width: 1;
  opacity: 0.55;
}

.common-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  color: var(--active-mark-ink);
  background: var(--active-mark-bg);
  border-radius: 50%;
  font-size: 7.5px;
  font-weight: 800;
  line-height: 1;
}

.common-card.is-active .common-check {
  display: flex;
}

.common-card.is-active .common-change {
  padding-right: 14px;
}

.common-date-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

/* Date conversion */

.date-field {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.date-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.date-control input[type="date"] {
  min-height: 31px;
  max-width: 180px;
  padding: 5px 9px;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  color-scheme: light;
}

html[data-theme="dark"] .date-control input[type="date"] {
  color-scheme: dark;
}

.date-control input[type="date"]:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}

.date-note {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.date-clear {
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
}

.date-clear:hover {
  text-decoration: underline;
}

/* Result actions */

.result-actions {
  display: flex;
  gap: 6px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid var(--board-line);
}

.result-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 29px;
  padding: 5px 9px;
  color: var(--board-muted);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.result-actions button:hover {
  color: var(--board-ink);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.result-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.result-actions svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-card:has(.result-actions) {
  display: flex;
  flex-direction: column;
}

.result-card:has(.result-actions) .result-actions {
  margin-top: auto;
}

/* Converter footer */

.converter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 8.5px;
  line-height: 1.5;
}

.converter-foot time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

/* Chart footer actions and data table */

.chart-foot-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chart-actions button {
  min-height: 22px;
  padding: 2px 7px;
  color: var(--board-muted);
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 8px;
  font-weight: 500;
  cursor: pointer;
}

.chart-actions button:hover {
  color: var(--board-ink);
  background: rgba(255, 255, 255, 0.12);
}

.data-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.data-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.data-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: min(780px, calc(100vh - 28px));
  padding: 22px;
}

.data-dialog .sheet-header {
  flex: 0 0 auto;
}

.chart-table-wrap {
  flex: 1 1 auto;
  min-height: 120px;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.chart-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10px;
}

.chart-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-solid);
}

.chart-table th {
  padding: 8px 12px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  text-align: left;
}

.chart-table th:last-child,
.chart-table td:last-child {
  text-align: right;
}

.chart-table td {
  padding: 6px 12px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.chart-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.018);
}

html[data-theme="dark"] .chart-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

.chart-table-count {
  margin-right: auto;
  color: var(--muted);
  font-size: 9px;
}

.data-dialog .sheet-actions {
  flex: 0 0 auto;
  margin-top: 14px;
}

/* Install */

.clipboard-helper {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.install-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 4px 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
  cursor: pointer;
}

.install-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.install-button svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The generic tone utilities set background/color for currency marks. Cards
   use the tone only as an accent, so higher-specificity overrides are needed
   for dark mode where those utilities are scoped to html[data-theme]. */
html[data-theme] .common-card {
  color: var(--ink);
  background: var(--surface-muted);
}

html[data-theme] .common-card:hover {
  background: var(--surface-strong);
  border-color: var(--line-strong);
}

html[data-theme] .common-card.is-active {
  color: var(--active-ink);
  background: var(--active-bg);
  border-color: var(--active-bg);
}

@media (max-width: 1120px) {
  .common-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .common-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .common-card {
    min-height: 107px;
  }

  .common-currency-action {
    display: none;
  }

  .converter-foot {
    flex-wrap: wrap;
  }

  .result-actions {
    margin-top: 13px;
  }
}

@media (max-width: 560px) {
  .common-currency-section {
    margin-top: 15px;
    padding-top: 13px;
  }

  .common-grid {
    gap: 6px;
  }

  .common-card {
    min-height: 103px;
    padding: 9px 9px 7px;
    border-radius: 14px;
  }

  .common-value {
    font-size: 13px;
  }

  .common-name {
    font-size: 9px;
  }

  .common-spark {
    height: 23px;
  }

  .date-control {
    gap: 7px;
  }

  .date-control input[type="date"] {
    flex: 1 1 150px;
    max-width: none;
  }

  .result-actions {
    gap: 5px;
  }

  .result-actions button {
    flex: 1 1 auto;
  }

  .converter-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .chart-foot-side {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .data-dialog-inner {
    padding: 17px;
  }

  .data-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 20px;
  }

  .data-dialog-inner {
    max-height: calc(100vh - 20px);
  }
}

@media (max-width: 390px) {
  .common-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .common-card {
    min-height: 98px;
  }

  .common-value {
    font-size: 12px;
  }

  .chart-range-switch button {
    min-width: 42px;
    padding: 0 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
