:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --surface: #ffffff;
  --ink: #13241c;
  --muted: #5d6f66;
  --label: #3e5248;
  --line: #d9e3dc;
  --green: #d23c3c;
  --green-dark: #a82828;
  --green-soft: #fdecec;
  --sell: #b42318;
  --sand: #fff6dc;
  --sand-ink: #6a5314;
  --shadow: 0 10px 30px rgba(19, 36, 28, 0.06);
  --btn: 44px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; background: var(--bg); color: var(--ink); }

body {
  font-family: "Manrope", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}

html[lang="zh-Hans"] body { font-family: "Noto Sans SC", "Manrope", sans-serif; }

button, input, a { font: inherit; }

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.brand-mark { height: 36px; width: 36px; display: block; flex: none; object-fit: contain; }

.brand:hover .word { color: var(--green); }

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

.nav-link {
  height: var(--btn);
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.nav-link:hover { background: var(--green-soft); }

.nav-link[aria-current="page"] { color: var(--green-dark); }

.header-end { margin-left: auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0; }

.account-pair {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
  max-width: min(460px, 100%);
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.account-kicker {
  flex: none;
  width: 7.25rem;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: var(--label);
  line-height: 1.2;
}

.account-pair .chip {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.account-note {
  margin: 0;
  max-width: 36ch;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.account-pending {
  max-width: 28ch;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--sand-ink);
  background: var(--sand);
  border-radius: 8px;
  padding: 4px 8px;
}

.chip {
  height: var(--btn);
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chip-balance { background: var(--green-soft); border-color: #f3c4c4; color: var(--green-dark); }

.btn {
  height: var(--btn);
  min-height: var(--btn);
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.btn:hover { background: var(--green-soft); }

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn:focus-visible, .nav-link:focus-visible, .brand:focus-visible, .back:focus-visible, .coin:focus-visible, .footer a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.btn:disabled {
  background: #f3e8e8;
  color: #a08c8c;
  border-color: transparent;
  cursor: not-allowed;
  transform: none;
}

.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }

.btn-primary:hover { background: var(--green-dark); color: #fff; }

.btn-primary:active:not(:disabled) { background: #8c2222; }

.btn-line { background: #fff; color: var(--ink); border-color: #e4cccc; }

.btn-line:hover { background: var(--green-soft); border-color: var(--green); color: var(--ink); }

.btn-ghost { background: transparent; border-color: transparent; }

.btn-ghost:hover { background: var(--green-soft); }

.btn-sell { background: var(--sell); color: #fff; border-color: var(--sell); }

.btn-sell:hover { background: #8e1b12; color: #fff; }

.btn-sell:active:not(:disabled) { background: #74160f; }

.btn-block { width: 100%; }

.status {
  margin: 0;
  padding: 8px 16px;
  text-align: center;
  background: var(--sand);
  color: var(--sand-ink);
  font-size: 14px;
  font-weight: 700;
}

.status.is-pulse { animation: status-pulse 700ms ease; }

@keyframes status-pulse {
  0% { background: var(--sand); }
  40% { background: #ffe08a; }
  100% { background: var(--sand); }
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.view.is-on { animation: page-in 220ms ease; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

h2 { margin: 22px 0 8px; font-size: 18px; }

.lead { margin: 6px 0 0; max-width: 46ch; color: var(--label); font-size: 17px; }

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.search { position: relative; }

.search input { width: 240px; }

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

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.coin {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(19, 36, 28, 0.03);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.coin:hover {
  transform: translateY(-3px);
  border-color: #e8bcbc;
  box-shadow: var(--shadow);
}

.coin:active { transform: translateY(-1px) scale(0.995); }

.coin-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }

.coin-symbol { display: block; font-weight: 800; font-size: 16px; }

.coin-name {
  display: block;
  max-width: 150px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coin-price { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }

.coin-progress { color: var(--muted); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.spark { display: block; height: 72px; }

.spark svg, .chart-lg svg { width: 100%; height: 100%; display: block; }

.meter {
  display: block;
  height: 8px;
  background: #f6e4e4;
  border-radius: 999px;
  overflow: hidden;
}

.meter-lg { height: 12px; }

.meter-fill {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: var(--green);
  transform-origin: left center;
  animation: meter-grow 680ms cubic-bezier(0.16, 0.84, 0.32, 1);
}

@keyframes meter-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.chart-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: chart-draw 720ms ease forwards;
}

.chart-fill { opacity: 0; animation: chart-fade 720ms ease forwards; }

@keyframes chart-draw { to { stroke-dashoffset: 0; } }

@keyframes chart-fade { to { opacity: 1; } }

.empty {
  grid-column: 1 / -1;
  max-width: 460px;
  margin: 12px auto;
  padding: 28px 24px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.empty-title { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }

.empty p { color: var(--label); margin: 8px 0 18px; }

.back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-bottom: 8px;
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
}

.back:hover { text-decoration: underline; }

.coin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.coin-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ticker {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
  font-size: 13px;
}

.kicker {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.price {
  margin: 2px 0 12px;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.note { margin: 12px 0; color: var(--label); font-size: 15px; line-height: 1.5; }

.chart-lg {
  height: 300px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
}

.trade-card {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.trade-card.is-success { animation: success-flash 600ms ease; }

@keyframes success-flash {
  0% { box-shadow: 0 0 0 0 rgba(210, 60, 60, 0); }
  40% { box-shadow: 0 0 0 4px rgba(210, 60, 60, 0.28); }
  100% { box-shadow: var(--shadow); }
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #f7eeee;
  border-radius: 12px;
}

.segment .btn { background: transparent; color: var(--label); border-color: transparent; }

.segment .btn:hover { background: #fff; color: var(--ink); }

.segment .btn.is-on { background: var(--green); color: #fff; }

.segment .btn.is-on.is-sell { background: var(--sell); color: #fff; }

label {
  display: block;
  margin: 14px 0 6px;
  color: var(--label);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  height: var(--btn);
  padding: 0 12px;
  border: 1px solid #e6d4d4;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
}

input:hover { border-color: #e09a9a; }

input:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }

.amount { position: relative; }

.amount input { padding-right: 68px; }

.amount span {
  position: absolute;
  right: 12px;
  top: 0;
  height: var(--btn);
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
  pointer-events: none;
}

.chips { display: flex; gap: 8px; margin-top: 8px; }

.chips .btn {
  flex: 1;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
}

.chips .btn:hover { background: var(--green-soft); border-color: var(--green); }

.quote { min-height: 20px; margin: 12px 0; font-weight: 700; }

.quote p { margin: 0; }

.quote .fine { margin-top: 4px; font-weight: 600; }

.balance { margin: 4px 0 8px; font-weight: 800; font-variant-numeric: tabular-nums; }

.fine { margin: 6px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.fee-once { margin: 16px 0 6px; font-weight: 800; }

.form-error { margin: 8px 0 0; color: var(--sell); font-size: 14px; font-weight: 700; }

.form-error:empty { display: none; }

input[type="file"].logo-file {
  height: auto;
  min-height: var(--btn);
  padding: 8px;
  cursor: pointer;
}

.logo-preview {
  display: block;
  width: 96px;
  height: 96px;
  margin-top: 10px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.panel {
  max-width: 460px;
  margin: 8px auto;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.split { display: flex; gap: 8px; margin-top: 16px; }

.split .btn { flex: 1; }

.footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.footer p { margin: 0; }

.footer a { color: var(--green-dark); font-weight: 700; text-decoration: none; }

.footer a:hover { text-decoration: underline; }

.coin-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}




.guide { max-width: 680px; }

.guide .lead { max-width: 58ch; }

.steps {
  margin: 18px 0 0;
  padding: 0 0 0 1.35rem;
  display: grid;
  gap: 12px;
}

.steps li {
  padding-left: 6px;
  font-weight: 600;
  line-height: 1.5;
}

.steps li::marker { color: var(--green-dark); font-weight: 800; }

.guide-actions { margin: 18px 0 0; }

.fee-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.fee-list li {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
}

.fee-list li:last-child { border-bottom: 0; }

.how-aside {
  margin: 18px 0 0;
  max-width: 58ch;
  color: var(--label);
  font-size: 14px;
  line-height: 1.5;
}

.how-aside a {
  display: inline-block;
  margin: 0 0 4px;
  color: var(--green-dark);
  font-weight: 800;
}

.how-aside a:hover { text-decoration: underline; }

.status.is-live { background: var(--green-soft); color: var(--green-dark); }

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  opacity: 0;
  max-width: 100%;
}

.toast.is-on { opacity: 1; animation: toast-in 200ms ease; }

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

@media (max-width: 800px) {
  .coin-layout { grid-template-columns: 1fr; }
  .trade-card { position: static; }
  .price { font-size: 32px; }
}

@media (max-width: 1100px) {
  .header { flex-wrap: wrap; }
  .header-end { width: 100%; margin-left: 0; }
}

@media (max-width: 720px) {
  .header { flex-wrap: wrap; padding: 10px 12px; }
  .header-end { width: 100%; margin-left: 0; justify-content: flex-start; align-items: stretch; }
  #lang-toggle { order: 1; }
  #connect { order: 2; }
  .account-pair { order: 3; align-items: stretch; max-width: none; width: 100%; }
  .account-row { justify-content: flex-start; }
  .account-kicker { text-align: left; }
  .account-note { text-align: left; max-width: none; }
  .view-head { flex-direction: column; align-items: stretch; }
  .search input { width: 100%; }
  h1 { font-size: 28px; }
  main { width: min(1120px, calc(100% - 20px)); }
  .split { flex-direction: column; }
  .footer { width: min(1120px, calc(100% - 20px)); flex-direction: column; }
  .coin-banner { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .chart-line { stroke-dashoffset: 0; }
  .chart-fill { opacity: 1; }
  .meter-fill { transform: none; }
}

body:has(#view-trade:not([hidden])) main {
  width: min(1280px, calc(100% - 24px));
}

.segment-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 420px);
}

.trade-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}

.tape-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
  max-height: calc(100vh - 180px);
}

.tape {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 14px;
}

.tape caption { caption-side: bottom; }

.tape th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.tape td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.tape tbody tr { cursor: pointer; }

.tape tbody tr:hover { background: var(--green-soft); }

.tape tbody tr.is-selected {
  background: var(--green-soft);
  box-shadow: inset 3px 0 0 var(--green);
}

.tape tbody tr:focus-visible,
.tape a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.tape a {
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.tape a:hover { color: var(--green-dark); text-decoration: underline; }

.tape-num { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tape-progress { min-width: 140px; }

.tape-progress .meter { margin-top: 6px; }

.tape-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tape-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--label);
  font-weight: 700;
}

.spark-sm { height: 36px; width: 108px; }

.activity { margin-top: 8px; }

.activity-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.activity-list li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.activity-list li:last-child { border-bottom: 0; }

.activity-buy { color: var(--green-dark); }

.activity-sell { color: var(--sell); }

.coin-id { display: flex; align-items: center; gap: 10px; min-width: 0; }

.coin-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  background: #f6e4e4;
  flex: none;
}

.coin-logo-lg { width: 56px; height: 56px; border-radius: 14px; }

.tape-logo { width: 28px; height: 28px; border-radius: 8px; }

.tape a[data-field="name"] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.coin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 8px;
}

.coin-links a {
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.coin-links a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .trade-screen { grid-template-columns: 1fr; }
  .segment-3 { width: 100%; }
  .tape-wrap { max-height: none; }
}
