:root {
  color-scheme: dark;
  --bg: #050a09;
  --surface: rgba(11, 21, 19, .83);
  --surface-2: rgba(15, 29, 25, .74);
  --line: rgba(122, 255, 204, .14);
  --line-strong: rgba(122, 255, 204, .34);
  --mint: #6bf5c2;
  --mint-soft: #b3ffe2;
  --amber: #ffbd59;
  --text: #edfdf6;
  --muted: #8fa69e;
  --danger: #ff7d84;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}

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

.backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.84' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.glow { position: absolute; width: 42vw; height: 42vw; border-radius: 50%; filter: blur(100px); opacity: .13; }
.glow-a { left: -10vw; top: -15vw; background: var(--mint); }
.glow-b { right: -12vw; bottom: -18vw; background: var(--amber); }
.grid {
  position: absolute;
  inset: 0;
  opacity: .26;
  background-image:
    linear-gradient(rgba(107, 245, 194, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 245, 194, .055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000, transparent 78%);
}

.app-shell { position: relative; z-index: 1; width: min(1180px, calc(100% - 36px)); min-height: 100vh; margin: auto; padding: 24px 0 20px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); color: var(--mint); font: 800 1rem ui-monospace, monospace;
  clip-path: polygon(18% 0, 100% 0, 100% 82%, 82% 100%, 0 100%, 0 18%);
  background: rgba(107, 245, 194, .06); box-shadow: inset 0 0 20px rgba(107,245,194,.06);
}
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font: 700 .9rem ui-monospace, monospace; letter-spacing: .18em; }
.brand small { color: var(--muted); font: .62rem ui-monospace, monospace; letter-spacing: .12em; }
.online { display: flex; align-items: center; gap: 8px; color: var(--muted); font: .68rem ui-monospace, monospace; letter-spacing: .12em; }
.online span { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 13px var(--mint); }

main { padding: clamp(44px, 7vw, 82px) 0 56px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 36px; margin-bottom: 34px; }
.intro > p { max-width: 430px; margin: 0 0 4px; color: var(--muted); font-size: .95rem; line-height: 1.8; }
.kicker { margin: 0 0 11px; color: var(--mint); font: .7rem ui-monospace, monospace; letter-spacing: .2em; }
h1 { margin: 0; font-size: clamp(2.35rem, 5vw, 4.7rem); line-height: 1; letter-spacing: -.055em; }
h1 span { color: transparent; -webkit-text-stroke: 1px rgba(107,245,194,.68); }

.tabs {
  display: inline-flex; padding: 5px; margin-bottom: 18px; border: 1px solid var(--line);
  background: rgba(5, 12, 10, .75); backdrop-filter: blur(12px);
}
.tab { min-width: 190px; padding: 13px 18px; border: 0; color: var(--muted); background: transparent; cursor: pointer; transition: .2s ease; }
.tab span { margin-right: 14px; color: #52685f; font: .68rem ui-monospace, monospace; }
.tab:hover { color: var(--text); }
.tab.active { color: #07110f; background: var(--mint); box-shadow: 0 0 25px rgba(107,245,194,.14); }
.tab.active span { color: rgba(7,17,15,.58); }

.tool-panel { display: none; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; align-items: stretch; }
.tool-panel.active { display: grid; animation: panel-in .45s ease both; }

.form-card, .result-card {
  border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(18px);
  box-shadow: 0 22px 70px rgba(0,0,0,.22); position: relative; overflow: hidden;
}
.form-card { padding: clamp(22px, 4vw, 36px); }
.form-card::before, .result-card::before {
  content: ""; position: absolute; left: 0; top: 0; width: 78px; height: 2px; background: var(--mint); box-shadow: 0 0 18px var(--mint);
}
.result-card::before { background: var(--amber); box-shadow: 0 0 18px var(--amber); }

.section-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 27px; }
.section-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--mint); border: 1px solid var(--line-strong); font: 1.2rem ui-monospace, monospace; }
.section-heading h2 { margin: 0 0 4px; font-size: 1rem; letter-spacing: .06em; }
.section-heading p { margin: 0; color: var(--muted); font-size: .78rem; }

.field-grid { display: grid; gap: 14px; margin-bottom: 15px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field { display: grid; gap: 8px; min-width: 0; }
.field > span { color: #aabdb6; font-size: .78rem; letter-spacing: .05em; }
.field em { color: #61766e; font-size: .65rem; font-style: normal; }
input, select, textarea {
  width: 100%; min-height: 46px; border: 1px solid rgba(140, 207, 183, .16); border-radius: 0;
  padding: 0 13px; color: var(--text); background: rgba(3, 9, 8, .72); outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
textarea { min-height: 190px; padding: 13px; resize: vertical; font: .78rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
input::placeholder, textarea::placeholder { color: #53665f; }
input:focus, select:focus, textarea:focus { border-color: rgba(107,245,194,.6); background: rgba(7,16,13,.94); box-shadow: 0 0 0 3px rgba(107,245,194,.07); }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--mint) 50%), linear-gradient(135deg, var(--mint) 50%, transparent 50%); background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px; background-size: 5px 5px; background-repeat: no-repeat; }

.primary-btn {
  width: 100%; min-height: 50px; padding: 0 18px; border: 0; display: flex; align-items: center; justify-content: space-between;
  color: #05100d; background: var(--mint); font-weight: 750; letter-spacing: .08em; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 0 100%);
  transition: filter .2s ease, transform .2s ease, box-shadow .2s ease;
}
.primary-btn:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(107,245,194,.14); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { cursor: wait; opacity: .68; transform: none; }
.primary-btn b { font-size: 1.25rem; font-weight: 400; }
.form-error { min-height: 20px; margin: 9px 0 -12px; color: var(--danger); font-size: .76rem; }

.result-card { padding: 25px; display: flex; flex-direction: column; }
.result-topline { display: flex; justify-content: space-between; gap: 15px; color: #647970; font: .65rem ui-monospace, monospace; letter-spacing: .13em; }
.result-status { color: var(--mint); }
.result-visual { position: relative; width: 170px; height: 170px; margin: 25px auto 13px; }
.result-visual svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track, .ring-value { fill: none; stroke-width: 5; }
.ring-track { stroke: rgba(255,255,255,.055); }
.ring-value { stroke: var(--amber); stroke-linecap: square; stroke-dasharray: 439.82; stroke-dashoffset: 439.82; filter: drop-shadow(0 0 8px rgba(255,189,89,.55)); transition: stroke-dashoffset .7s cubic-bezier(.16,1,.3,1); }
.result-visual > div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.result-visual small { color: var(--muted); font-size: .7rem; }
.result-visual strong { margin-top: 4px; color: var(--amber); font: 700 1.7rem ui-monospace, monospace; }
.value-block { margin-bottom: 22px; text-align: center; }
.value-block span { display: block; color: var(--muted); font-size: .74rem; }
.value-block strong { display: block; margin: 7px 0 5px; font: 750 clamp(2rem,4vw,2.7rem) ui-monospace, monospace; letter-spacing: -.04em; }
.value-block small { color: #687d74; font-size: .68rem; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: auto 0 0; background: var(--line); border: 1px solid var(--line); }
.metrics div { padding: 13px; background: rgba(5,12,10,.9); }
.metrics dt { margin-bottom: 6px; color: #687c74; font-size: .66rem; }
.metrics dd { margin: 0; color: #d6eae2; font: .78rem ui-monospace, monospace; }
.spec-line { margin-top: 13px; min-height: 18px; color: #64776f; font-size: .68rem; text-align: center; }

.amount-field input { height: 76px; font: 700 2rem ui-monospace, monospace; }
.currency-row { display: grid; grid-template-columns: 1fr 46px 1fr; align-items: end; gap: 12px; margin: 17px 0 26px; }
.swap-btn { width: 46px; height: 46px; border: 1px solid var(--line-strong); color: var(--mint); background: rgba(107,245,194,.06); cursor: pointer; transition: .2s ease; }
.swap-btn:hover { color: #07110f; background: var(--mint); transform: rotate(180deg); }
.fx-form-card { min-height: 488px; }
.fx-result { justify-content: flex-start; }
.fx-main { margin: 67px 0 42px; }
.fx-main span { display: block; margin-bottom: 8px; color: var(--muted); font: .85rem ui-monospace, monospace; }
.fx-main strong { display: block; color: var(--amber); font: 700 clamp(2.15rem,4vw,3.2rem) ui-monospace, monospace; letter-spacing: -.055em; overflow-wrap: anywhere; }
.rate-line { display: flex; justify-content: space-between; gap: 15px; padding: 13px 0; border-top: 1px solid var(--line); }
.rate-line span { color: var(--muted); font-size: .72rem; }
.rate-line strong { font: 500 .75rem ui-monospace, monospace; text-align: right; }
.rate-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 17px; background: var(--line); }
.rate-meta div { display: grid; gap: 5px; padding: 13px; background: rgba(5,12,10,.9); }
.rate-meta span { color: var(--muted); font-size: .66rem; }
.rate-meta b { font: 500 .75rem ui-monospace, monospace; }
.rate-disclaimer { margin: auto 0 0; padding-top: 20px; color: #60736b; font-size: .67rem; line-height: 1.7; }

footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: #5f746b; font: .66rem ui-monospace, monospace; letter-spacing: .12em; }
footer a { color: #91aaa0; text-decoration: none; }
footer a:hover { color: var(--mint); }

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

@media (max-width: 900px) {
  .tool-panel { grid-template-columns: 1fr; }
  .result-card { min-height: 460px; }
  .result-visual { margin-top: 20px; }
  .fx-result { min-height: 430px; }
}

@media (max-width: 680px) {
  .app-shell { width: min(100% - 24px, 1180px); padding-top: 17px; }
  .online { display: none; }
  main { padding-top: 40px; }
  .intro { display: block; margin-bottom: 27px; }
  .intro > p { margin-top: 16px; font-size: .86rem; }
  .tabs { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
  .tab { min-width: 0; padding: 12px 8px; font-size: .76rem; }
  .tab span { display: none; }
  .field-grid.three { grid-template-columns: 1fr; }
  .form-card, .result-card { padding: 20px; }
  .currency-row { grid-template-columns: 1fr 40px 1fr; gap: 8px; }
  .swap-btn { width: 40px; }
  footer span { display: none; }
  footer { justify-content: flex-end; }
}

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