:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #172033;
  background: #f5f6f8;
  --red: #d62e0a;
  --red-dark: #b92708;
  --red-soft: #fff2ed;
  --red-line: #f4b4a4;
  --chart-blue: #1d8cf8;
  --line: #e5e7eb;
  --muted: #64748b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 50% -20%, #fff 0, #f7f8fa 40%, #f1f3f6 100%); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(214, 46, 10, .2); outline-offset: 2px; }

.site-header { height: 64px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.brand span { display: flex; align-items: baseline; gap: 8px; }
.brand b { color: var(--red); font-size: 20px; }
.brand small { color: #475569; font-weight: 700; }
.site-header nav { display: flex; gap: 22px; }
.site-header nav a { color: #64748b; text-decoration: none; font-size: 14px; font-weight: 600; }
.site-header nav a:hover { color: var(--red); }

.fx-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 56px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.page-heading h1 { margin: 5px 0 7px; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.04em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--red); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.usage-status { display: none !important; }

.top-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr); gap: 18px; }
.card { background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 16px 45px rgba(15, 23, 42, .055); }
.converter-card { position: relative; overflow: hidden; border-color: #e3e7ee; background: linear-gradient(145deg, #fff 0%, #fff 58%, #fff9f7 100%); }
.converter-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(var(--red), #ef6b4d); }
.section-title, .trend-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-title > div { display: flex; align-items: center; gap: 8px; }
.section-title h2, .trend-header h2 { margin: 0; font-size: 18px; }
.section-title > span { color: #94a3b8; font-size: 12px; }
.live-dot { width: 7px; height: 7px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 0 4px #dcfce7; }

.converter { display: grid; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); align-items: center; gap: 14px; margin-top: 22px; }
.currency-box { min-width: 0; min-height: 174px; display: grid; grid-template-rows: auto auto 1fr; gap: 10px; padding: 18px 20px; border: 1px solid #dde3ec; border-radius: 16px; background: #f8fafc; box-shadow: inset 0 1px 0 rgba(255,255,255,.8); transition: border-color .18s, box-shadow .18s, transform .18s; }
.currency-box:focus-within { border-color: var(--red-line); box-shadow: 0 0 0 4px rgba(214,46,10,.08); transform: translateY(-1px); }
.currency-box > .currency-box-label { color: #94a3b8; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.currency-select-wrap { position: relative; display: block; min-width: 0; }
.currency-select-wrap::after { content: "⌄"; position: absolute; right: 2px; top: 50%; transform: translateY(-56%); color: #64748b; font-size: 18px; pointer-events: none; }
.currency-box select { appearance: none; width: 100%; min-width: 0; height: 38px; padding: 0 34px 0 0; border: 0; background: transparent; color: #334155; font-size: 16px; font-weight: 800; outline: 0; }
.currency-box input, .currency-box output { align-self: end; min-width: 0; width: 100%; min-height: 55px; padding: 12px 0 0; border: 0; border-top: 1px solid #e6eaf0; background: transparent; text-align: left; color: #111827; font-size: 32px; line-height: 1.25; font-weight: 850; font-variant-numeric: tabular-nums; outline: 0; }
.currency-box input { -moz-appearance: textfield; }
.currency-box input::-webkit-inner-spin-button { appearance: none; }
.result-box { background: linear-gradient(145deg, #fff9f7, var(--red-soft)); border-color: var(--red-line); }
.result-box input, .result-box output { border-top-color: var(--red-line); }
.result-box output { color: var(--red-dark); }
.swap-button { width: 50px; height: 50px; border: 1px solid var(--red-line); border-radius: 50%; color: var(--red); background: white; font-size: 23px; font-weight: 800; box-shadow: 0 8px 22px rgba(214,46,10,.1); transition: transform .18s, background .18s; }
.swap-button:hover { transform: rotate(180deg); background: var(--red-soft); }
.primary-button { width: 100%; border: 0; border-radius: 11px; padding: 12px 18px; background: var(--red); color: white; font-weight: 800; box-shadow: 0 8px 18px rgba(214,46,10,.18); }
.primary-button:hover { background: var(--red-dark); }
.reference-tip { margin: 13px 0 0; color: #64748b; font-size: 13px; text-align: center; }

.alert-button { border: 1px solid var(--red-line); color: var(--red-dark); background: var(--red-soft); border-radius: 9px; padding: 8px 11px; font-size: 13px; font-weight: 700; }
.current-rate-row { margin: 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.current-rate-row > strong { font-size: 22px; line-height: 1.35; }
.switch { display: flex; align-items: center; gap: 7px; color: #64748b; font-size: 12px; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 34px; height: 19px; padding: 2px; border-radius: 99px; background: #cbd5e1; transition: .18s; }
.switch span::after { content: ""; display: block; width: 15px; height: 15px; border-radius: 50%; background: white; transition: .18s; box-shadow: 0 1px 3px #64748b; }
.switch input:checked + span { background: var(--red); }
.switch input:checked + span::after { transform: translateX(15px); }
.metric-grid { display: grid; gap: 10px; }
.metric-grid-three { grid-template-columns: repeat(3, 1fr); }
.metric-grid-four { grid-template-columns: repeat(4, 1fr); margin: 22px 0 12px; }
.metric { padding: 13px 14px; border-radius: 11px; background: #f8fafc; border: 1px solid #eef2f7; }
.metric span { display: block; margin-bottom: 7px; color: #94a3b8; font-size: 11px; font-weight: 700; }
.metric strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric strong.positive { color: #16a34a; }
.metric strong.negative { color: var(--red-dark); }
.active-alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 11px 12px; border: 1px solid #bbf7d0; border-radius: 11px; background: #f0fdf4; }
.active-alert[hidden] { display: none; }
.active-alert > span { display: grid; gap: 3px; min-width: 0; }
.active-alert b { color: #15803d; font-size: 12px; }
.active-alert small { color: #4b5563; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-alert button { flex: 0 0 auto; border: 0; background: transparent; color: #64748b; font-size: 12px; font-weight: 700; }

.trend-card { margin-top: 18px; }
.trend-header .eyebrow { display: block; margin-bottom: 4px; }
.trend-tabs { display: flex; padding: 3px; border-radius: 10px; background: #f1f5f9; }
.trend-tabs button, .alert-tabs button, .condition-buttons button { border: 0; border-radius: 8px; padding: 8px 14px; color: #64748b; background: transparent; font-size: 13px; font-weight: 700; }
.trend-tabs button[aria-pressed="true"], .alert-tabs button[aria-pressed="true"], .condition-buttons button[aria-pressed="true"] { color: var(--red-dark); background: white; box-shadow: 0 1px 4px rgba(15,23,42,.09); }
.chart { position: relative; min-height: 285px; padding: 10px 8px 0; overflow: hidden; }
.chart svg { width: 100%; height: 255px; overflow: visible; }
.chart-grid line { stroke: #e9edf3; stroke-width: 1; stroke-dasharray: 4 6; }
.chart polyline { stroke: var(--chart-blue); stroke-width: 3; vector-effect: non-scaling-stroke; }
.chart circle { vector-effect: non-scaling-stroke; }
.high-point { fill: #16a34a; stroke: white; stroke-width: 3; }
.low-point { fill: var(--red); stroke: white; stroke-width: 3; }
.chart-dates { display: flex; justify-content: space-between; color: #94a3b8; font-size: 11px; }
.chart-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; font-size: 13px; background: rgba(255,255,255,.7); z-index: 2; }
.data-note { margin: 15px 0 0; padding-top: 14px; border-top: 1px solid #eef2f7; color: #94a3b8; font-size: 12px; text-align: center; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(15,23,42,.52); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(540px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 28px; border-radius: 18px; background: white; box-shadow: 0 28px 90px rgba(15,23,42,.28); }
.modal h2 { margin: 7px 30px 10px 0; }
.modal p { color: #64748b; line-height: 1.7; }
.modal-close { position: absolute; top: 15px; right: 15px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f1f5f9; color: #475569; font-size: 22px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0 12px; }
.secondary-button { border: 1px solid #cbd5e1; border-radius: 11px; padding: 12px 18px; color: #334155; background: white; font-weight: 800; }
.auth-modal > small { color: #94a3b8; }
.alert-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; background: #f1f5f9; border-radius: 11px; }
.alert-tip { padding: 10px 12px; border-radius: 9px; background: #fff7ed; color: #9a3412 !important; font-size: 13px; }
.form-field { display: grid; gap: 8px; margin: 16px 0; color: #475569; font-size: 13px; font-weight: 700; }
.form-field select, .form-field input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #dbe0e8; border-radius: 9px; background: white; outline: 0; }
.alert-currencies { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-height: 190px; overflow-y: auto; padding: 2px; }
.alert-currencies button { display: grid; gap: 3px; min-width: 0; padding: 9px 6px; border: 1px solid #e2e8f0; border-radius: 9px; background: white; color: #475569; text-align: center; }
.alert-currencies button:hover { border-color: var(--red-line); }
.alert-currencies button[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); box-shadow: 0 0 0 2px rgba(214,46,10,.08); }
.alert-currencies button b { font-size: 13px; }
.alert-currencies button small { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.condition-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 10px; background: #f1f5f9; }
.daily-field { display: flex; align-items: center; justify-content: space-between; margin: 20px 0; padding: 16px; border-radius: 11px; background: #f8fafc; }
.daily-field span { display: grid; gap: 4px; }
.daily-field small { color: #94a3b8; }
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.alert-actions .primary-button, .alert-actions .secondary-button { min-height: 44px; }
.alert-actions button:disabled { cursor: not-allowed; opacity: .5; }
.alert-status { min-height: 19px; margin: 10px 0 0 !important; color: #64748b !important; font-size: 12px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 9px; color: white; background: #172033; box-shadow: 0 12px 30px rgba(15,23,42,.25); transition: .2s; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .top-grid { grid-template-columns: 1fr; }
  .current-card { order: 2; }
}
@media (max-width: 640px) {
  .site-header { height: 58px; padding: 0 14px; }
  .brand img { width: 34px; height: 34px; }
  .brand small, .site-header nav a:first-child { display: none; }
  .fx-shell { width: min(100% - 24px, 1240px); padding-top: 24px; }
  .page-heading { align-items: start; gap: 16px; }
  .card { padding: 17px; border-radius: 15px; }
  .converter { grid-template-columns: 1fr; }
  .swap-button { margin: -2px auto; transform: rotate(90deg); }
  .swap-button:hover { transform: rotate(270deg); }
  .current-rate-row { align-items: start; flex-direction: column; }
  .metric-grid-three, .metric-grid-four { grid-template-columns: repeat(2, 1fr); }
  .trend-header { align-items: start; flex-direction: column; }
  .trend-tabs { width: 100%; }
  .trend-tabs button { flex: 1; }
  .chart { min-height: 235px; }
  .chart svg { height: 205px; }
  .modal-actions { grid-template-columns: 1fr; }
  .alert-currencies { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .alert-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
