:root {
  color-scheme: light;
  --ink: #101716;
  --muted: #68736f;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --line: #dce4ef;
  --dark: #08235c;
  --lime: #dbeafe;
  --lime-dark: #0a56d8;
  --aqua: #38bdf8;
  --orange: #ffb660;
  --radius: 18px;
  --shadow: 0 20px 70px rgba(22, 38, 33, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }

.topbar { height: 72px; padding: 0 clamp(20px, 4vw, 68px); display: flex; align-items: center; gap: 46px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 21px; font-weight: 850; letter-spacing: -.05em; }
.brand > span:last-child { display: grid; line-height: .92; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: #0a56d8; color: #fff; font-family: Georgia, serif; font-size: 21px; font-style: italic; }
.topnav { display: flex; gap: 28px; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 650; }
.topnav a:first-child { color: #0a56d8; }
.header-controls { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.currency-select { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 11px; background: var(--surface); }
.currency-select select { border: 0; outline: none; background: transparent; color: var(--ink); font-size: 12px; font-weight: 700; }
.lang-button { width: 40px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 12px; font-weight: 800; }

main { width: 100%; }
.currency-hero { padding: 50px 20px 62px; background: radial-gradient(circle at 78% 8%, rgba(56,189,248,.28), transparent 27%), linear-gradient(135deg, #07338f 0%, #095fd7 56%, #1378e5 100%); color: #fff; }
.currency-hero-inner { width: min(1180px, 100%); margin: 0 auto; }
.currency-heading { max-width: 720px; margin: 0 auto 28px; text-align: center; }
.currency-heading > p { margin: 0 0 10px; color: #9fd6ff; font-size: 10px; font-weight: 850; letter-spacing: .18em; }
.currency-heading h1 { margin: 0; font-size: clamp(34px, 4.4vw, 56px); line-height: 1.08; letter-spacing: -.05em; }
.currency-heading > span { display: block; margin-top: 14px; color: #d4e8ff; font-size: 14px; line-height: 1.65; }
.converter-card { padding: 24px 26px 19px; border-radius: 20px; background: #fff; color: var(--ink); box-shadow: 0 28px 70px rgba(0,22,75,.28); }
.converter-titlebar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.converter-titlebar > div { display: flex; align-items: center; gap: 11px; }
.converter-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #e8f2ff; color: #0a56d8; font-size: 19px; font-weight: 800; }
.converter-titlebar h2 { margin: 0 0 3px; font-size: 17px; letter-spacing: -.02em; }
.converter-titlebar p { margin: 0; color: var(--muted); font-size: 10px; }
.rate-status { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 99px; background: #eaf7f1; color: #287054; font-size: 9px; font-weight: 750; }
.rate-status i { width: 7px; height: 7px; border-radius: 50%; background: #34a174; box-shadow: 0 0 0 4px rgba(52,161,116,.11); }
.rate-status.offline { background: #fff3df; color: #8c5b13; }
.rate-status.offline i { background: #e99c2f; box-shadow: 0 0 0 4px rgba(233,156,47,.11); }
.conversion-controls { margin-top: 20px; display: grid; grid-template-columns: 1.15fr 1fr 46px 1fr; align-items: end; gap: 12px; }
.conversion-controls label { display: grid; gap: 7px; color: #52605b; font-size: 10px; font-weight: 700; }
.conversion-controls select, .converter-input { width: 100%; height: 50px; border: 1px solid #ced9e7; border-radius: 11px; background: #fff; color: var(--ink); outline: none; }
.conversion-controls select { padding: 0 12px; font-size: 13px; font-weight: 750; }
.conversion-controls select:focus, .converter-input:focus-within { border-color: #0a65da; box-shadow: 0 0 0 3px rgba(10,101,218,.12); }
.converter-input { display: grid; grid-template-columns: auto 1fr; align-items: center; padding: 0 12px; }
.converter-input b { color: #0a56d8; font-size: 17px; }
.converter-input input { width: 100%; border: 0; outline: 0; padding-left: 9px; background: transparent; font-size: 16px; font-weight: 800; }
.swap-button { width: 42px; height: 42px; margin: 0 auto 4px; border: 1px solid #cbd9ea; border-radius: 50%; background: #f4f8fd; color: #0a56d8; font-size: 18px; transition: transform .2s ease, background .2s ease; }
.swap-button:hover { transform: rotate(180deg); background: #e7f1ff; }
.currency-result-grid { margin-top: 19px; display: grid; grid-template-columns: .9fr 1.1fr; gap: 22px; }
.conversion-result { padding: 19px 20px; border-radius: 14px; background: #f4f8fd; }
.conversion-result > span { color: var(--muted); font-size: 11px; }
.conversion-result > strong { display: block; margin: 7px 0 6px; color: #073a9a; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.conversion-result > p { margin: 0 0 7px; font-size: 12px; font-weight: 700; }
.conversion-result > small { color: #8a969e; font-size: 9px; }
.popular-pairs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.pair-chip { padding: 6px 8px; border: 1px solid #d2dfed; border-radius: 8px; background: #fff; color: #34516f; font-size: 9px; font-weight: 700; }
.pair-chip:hover { border-color: #0a65da; color: #0a56d8; }
.rate-chart-panel { min-width: 0; padding: 14px 16px 9px; border: 1px solid var(--line); border-radius: 14px; }
.rate-chart-panel > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.rate-chart-panel h3 { margin: 0; font-size: 11px; }
.rate-chart-panel > div:first-child span { color: #0a56d8; font-size: 10px; font-weight: 800; }
#currencyChart { width: 100%; height: 118px; display: block; margin-top: 7px; }
.rate-range { display: flex; justify-content: space-between; color: #89969f; font-size: 8px; }
.rate-range span:first-child, .rate-range span:last-child { color: #526575; font-weight: 700; }
.rate-source { margin: 13px 1px 0; color: #82909a; font-size: 9px; line-height: 1.5; }
.rate-source span:first-child { color: #0a56d8; }
.product-intro { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 58px 4px 28px; display: flex; align-items: end; justify-content: space-between; gap: 50px; }
.eyebrow { margin: 0 0 10px; color: var(--lime-dark); font-size: 10px; font-weight: 850; letter-spacing: .18em; }
.product-intro h2 { margin: 0; max-width: 780px; font-size: clamp(32px, 3.8vw, 50px); line-height: 1.08; letter-spacing: -.055em; }
.product-intro > p { max-width: 480px; margin: 0 0 5px; color: var(--muted); font-size: 14px; line-height: 1.75; }

.calculator-shell { width: min(1500px, calc(100% - 40px)); margin: 0 auto; min-height: 720px; display: grid; grid-template-columns: 242px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.tool-sidebar { padding: 24px 14px 18px; display: flex; flex-direction: column; background: var(--dark); color: #d8dfdc; }
.sidebar-label { padding: 0 12px 15px; color: #77827e; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
#toolNav { display: grid; gap: 5px; }
.tool-button { width: 100%; min-height: 54px; padding: 8px 11px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; border: 0; border-radius: 11px; background: transparent; color: #a9b3af; text-align: left; }
.tool-button:hover { background: rgba(255,255,255,.055); color: #fff; }
.tool-button.active { background: #dcecff; color: #073a9a; }
.tool-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; font-size: 15px; font-weight: 750; }
.tool-button.active .tool-icon { border-color: rgba(17,27,25,.15); background: rgba(255,255,255,.28); }
.tool-copy { display: grid; gap: 2px; }
.tool-copy b { font-size: 12px; font-weight: 700; }
.tool-copy small { opacity: .62; font-size: 9px; }
.tool-arrow { opacity: 0; font-size: 14px; }
.tool-button.active .tool-arrow { opacity: 1; }
.sidebar-note { margin-top: auto; padding: 14px 12px 4px; display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.pulse { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #65c8ff; box-shadow: 0 0 0 5px rgba(101,200,255,.1); }
.sidebar-note b, .sidebar-note small { display: block; }
.sidebar-note b { font-size: 11px; }
.sidebar-note small { margin-top: 3px; color: #7f8a86; font-size: 9px; }

.calculator-main { min-width: 0; padding: 28px clamp(22px, 3vw, 42px) 38px; }
.calculator-heading { display: flex; justify-content: space-between; gap: 24px; align-items: start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.tool-index { margin: 0 0 7px; color: var(--lime-dark); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.calculator-heading h2 { margin: 0 0 7px; font-size: 26px; letter-spacing: -.035em; }
.calculator-heading p:last-child { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.reset-button { border: 0; background: transparent; color: var(--muted); padding: 7px; font-size: 12px; }
.reset-button:hover { color: var(--ink); }
.calculator-grid { padding-top: 24px; display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 26px; align-items: start; }
.input-card { padding: 21px; border: 1px solid var(--line); border-radius: 16px; background: #fbfcfa; }
.card-label, .result-topline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-label > span, .result-topline > div > span { font-size: 12px; font-weight: 800; }
.card-label small, .result-topline small { color: var(--muted); font-size: 9px; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field-label { display: flex; align-items: center; justify-content: space-between; color: #46514d; font-size: 11px; font-weight: 650; }
.field-label em { color: #8c9692; font-size: 9px; font-style: normal; font-weight: 500; }
.input-wrap { position: relative; }
.input-wrap input, .input-wrap select { width: 100%; height: 43px; padding: 0 42px 0 12px; border: 1px solid #d8ded6; border-radius: 10px; outline: none; background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.input-wrap select { padding-right: 12px; }
.input-wrap input:focus, .input-wrap select:focus { border-color: #93bd50; box-shadow: 0 0 0 3px rgba(185,239,102,.22); }
.input-suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #89938f; font-size: 11px; pointer-events: none; }
.calculate-button { width: 100%; min-height: 48px; margin-top: 7px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 11px; background: var(--dark); color: #fff; font-size: 13px; font-weight: 750; }
.calculate-button b { color: #65c8ff; font-size: 19px; }
.calculate-button:hover { background: #20312d; }
.formula-note { min-height: 16px; margin: 13px 2px 0; color: #8a9490; font-size: 9px; line-height: 1.55; }

.result-card { min-width: 0; }
.result-topline { margin: 0 0 13px; }
.result-topline > div { display: grid; gap: 3px; }
.calculated-badge { padding: 6px 9px; display: flex; align-items: center; gap: 6px; border-radius: 99px; color: #155bb3; background: #eaf3ff; font-size: 9px; font-weight: 750; }
.calculated-badge i { width: 6px; height: 6px; border-radius: 50%; background: #0a65da; }
.hero-result { padding: 24px 26px; border-radius: 16px; background: var(--dark); color: #fff; position: relative; overflow: hidden; }
.hero-result::after { content:""; position:absolute; width: 190px; height:190px; right:-55px; top:-75px; border:36px solid rgba(185,239,102,.08); border-radius:50%; }
.hero-result span { color: #9eaaa6; font-size: 11px; }
.hero-result strong { display: block; margin: 9px 0 6px; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.hero-result p { margin: 0; color: #aeb8b4; font-size: 10px; }
.metrics-grid { margin: 12px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.metric span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; }
.metric strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-panel { padding: 16px 17px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.chart-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.chart-head h3 { margin: 0 0 4px; font-size: 12px; }
.chart-head p { margin: 0; color: var(--muted); font-size: 9px; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.legend-main { width: 8px; height: 8px; border-radius: 3px; background: #0a65da; }
.chart-wrap { height: 190px; margin-top: 8px; }
#resultChart { display: block; width: 100%; height: 100%; }
.insight { margin-top: 12px; padding: 11px 13px; display: flex; gap: 9px; border-radius: 10px; background: #f0f4ee; color: #53605b; }
.insight > span { color: #0a56d8; font-weight: 800; }
.insight p { margin: 0; font-size: 10px; line-height: 1.55; }

.guide-section { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 70px 4px 76px; display: grid; grid-template-columns: 1fr 2fr; gap: 70px; }
.guide-section h2 { margin: 0; max-width: 320px; font-size: 30px; line-height: 1.18; letter-spacing: -.04em; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.guide-grid article { padding-top: 14px; border-top: 1px solid #ccd3ca; }
.guide-grid article > span { color: var(--lime-dark); font-size: 10px; font-weight: 800; }
.guide-grid h3 { margin: 18px 0 8px; font-size: 14px; }
.guide-grid p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
footer { padding: 22px max(20px, calc((100vw - 1500px) / 2)); display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }

@media (max-width: 1040px) {
  .calculator-shell { grid-template-columns: 205px minmax(0,1fr); }
  .calculator-main { padding-inline: 24px; }
  .calculator-grid { grid-template-columns: 300px minmax(0,1fr); gap: 18px; }
  .topnav { display:none; }
}

@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .currency-select > span { display:none; }
  .currency-hero { padding: 36px 12px 42px; }
  .converter-card { padding: 20px 18px 16px; }
  .conversion-controls { grid-template-columns: 1fr 1fr; }
  .conversion-controls > label:first-child { grid-column: 1 / -1; }
  .swap-button { grid-column: 1 / -1; grid-row: 3; margin: -4px auto; transform: rotate(90deg); }
  .conversion-controls > label:last-child { grid-column: 1 / -1; }
  .conversion-controls > label:nth-child(2) { grid-column: 1 / -1; }
  .currency-result-grid { grid-template-columns: 1fr; }
  .product-intro, .calculator-shell, .guide-section { width: min(100% - 24px, 1500px); }
  .product-intro { padding-top: 34px; display:block; }
  .product-intro > p { margin-top:16px; }
  .calculator-shell { grid-template-columns: 1fr; }
  .tool-sidebar { padding: 10px; display:block; overflow-x:auto; }
  .sidebar-label, .sidebar-note { display:none; }
  #toolNav { display:flex; min-width:max-content; }
  .tool-button { width:auto; min-width:114px; grid-template-columns:28px 1fr; }
  .tool-icon { width:28px; height:28px; }
  .tool-arrow, .tool-copy small { display:none; }
  .calculator-grid { grid-template-columns:1fr; }
  .calculator-main { padding:22px 18px 26px; }
  .guide-section { grid-template-columns:1fr; gap:34px; }
}

@media (max-width: 520px) {
  .brand small { display:none; }
  .currency-select { padding-left:4px; }
  .header-controls { gap:6px; }
  .calculator-heading { display:block; }
  .converter-titlebar { align-items:flex-start; }
  .rate-status span { display:none; }
  .currency-result-grid { gap:12px; }
  .reset-button { margin-top:10px; padding-left:0; }
  .metrics-grid { grid-template-columns:1fr; }
  .metric { display:flex; align-items:center; justify-content:space-between; }
  .metric span { margin:0; }
  .chart-wrap { height:165px; }
  .guide-grid { grid-template-columns:1fr; }
  footer { flex-direction:column; gap:8px; }
}
