:root {
  --bg: #06070b;
  --panel: #0e1118;
  --panel-2: #12161f;
  --line: #1d2230;
  --line-soft: #161a24;
  --text: #e9ecf4;
  --muted: #8b92a5;
  --faint: #5d6475;
  --gold: #f2c14e;
  --gold-2: #ffe19a;
  --green: #34d17c;
  --red: #ff6060;
  --btc: #f7931a;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(242, 193, 78, 0.10), transparent 62%),
    radial-gradient(760px 420px at 88% 0%, rgba(88, 112, 255, 0.08), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(52, 209, 124, 0.045), transparent 65%);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 78%);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 24px 56px;
}

/* ------------------------------- topbar -------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.seal {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #2a2415, #17130a);
  border: 1px solid rgba(242, 193, 78, 0.45);
  color: var(--gold);
  font-size: 20px;
  font-weight: 700;
  font-family: "Songti SC", "STSong", serif;
  box-shadow: 0 0 22px rgba(242, 193, 78, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: 0.02em; }
.brand-text small { font-size: 9.5px; letter-spacing: 0.24em; color: var(--faint); margin-top: 3px; }

.market {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(14, 17, 24, 0.7);
}

.market-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(247, 147, 26, 0.12);
  color: var(--btc);
  font-weight: 700;
  font-size: 15px;
}

.market-price { display: flex; flex-direction: column; line-height: 1.2; }
.market-price strong { font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.market-price span { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.market-spark { width: 104px; height: 32px; }
.market-spark polyline { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* -------------------------------- hero --------------------------------- */

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 42px 2px 30px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.13em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(14, 17, 24, 0.6);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 209, 124, 0.12);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

h1 {
  margin: 18px 0 12px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -0.015em;
}

h1 em {
  font-style: normal;
  background: linear-gradient(105deg, var(--gold-2) 0%, var(--gold) 48%, #b9822b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0;
  max-width: 470px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
}

.hero-capital {
  text-align: right;
  padding-bottom: 6px;
  flex-shrink: 0;
}

.hero-capital > span:first-child {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hero-capital strong {
  display: block;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff, #c9cede);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-capital .hero-sub {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

/* --------------------------------- kpis -------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  position: relative;
  padding: 16px 18px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(18, 22, 31, 0.92), rgba(11, 14, 20, 0.92));
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
}

.kpi-label { display: block; font-size: 11px; color: var(--faint); letter-spacing: 0.08em; }

.kpi strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 25px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.kpi-sub { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.pos { color: var(--green); }
.neg { color: var(--red); }
.neutral { color: var(--text); }

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

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 20, 28, 0.96), rgba(9, 12, 17, 0.96));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.chart-panel { display: flex; flex-direction: column; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 6px;
}

.panel-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.panel-head p { margin: 5px 0 0; font-size: 11.5px; color: var(--faint); }

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(6, 8, 12, 0.6);
  flex-shrink: 0;
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.seg button:hover { color: var(--text); }

.seg button.active {
  color: #171308;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  font-weight: 600;
}

.chart-wrap {
  position: relative;
  padding: 4px 10px 8px;
  min-height: 328px;
}

#chart { display: block; width: 100%; height: 312px; }

.chart-empty {
  position: absolute;
  inset: 20px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(8, 10, 15, 0.72);
  color: var(--muted);
  font-size: 12.5px;
}

.chart-empty strong { color: var(--text); font-size: 14px; font-weight: 600; }
.chart-empty a { color: var(--gold); text-decoration: none; }
.chart-empty a:hover { text-decoration: underline; }

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 132px;
  padding: 9px 11px;
  border: 1px solid #2a3040;
  border-radius: 10px;
  background: rgba(9, 11, 16, 0.96);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  font-size: 11.5px;
  color: var(--muted);
  pointer-events: none;
  backdrop-filter: blur(8px);
  transform: translate(-50%, -112%);
  white-space: nowrap;
}

.tooltip strong { color: var(--text); font-size: 12.5px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; margin-top: 5px; }
.tooltip .tt-row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* -------------------------------- feed --------------------------------- */

.feed-panel { display: flex; flex-direction: column; }

.pill-count {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-variant-numeric: tabular-nums;
}

.feed {
  flex: 1;
  max-height: 356px;
  overflow-y: auto;
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
  scrollbar-color: #2a3040 transparent;
}

.feed::-webkit-scrollbar { width: 6px; }
.feed::-webkit-scrollbar-thumb { background: #2a3040; border-radius: 99px; }
.feed::-webkit-scrollbar-track { background: transparent; }

.report {
  position: relative;
  padding: 11px 13px 11px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(8, 10, 15, 0.55);
  animation: rise 0.35s ease both;
}

.report::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 99px;
}

.report.win::before { background: var(--green); }
.report.loss::before { background: var(--red); }

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.report-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--faint);
}

.report-top .round { color: var(--text); font-size: 11.5px; font-weight: 600; }

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.badge.win { color: var(--green); background: rgba(52, 209, 124, 0.11); }
.badge.loss { color: var(--red); background: rgba(255, 96, 96, 0.11); }
.report-top .time { margin-left: auto; font-variant-numeric: tabular-nums; }

.report-money {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 7px 0 4px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.report-money .now { font-size: 16px; color: var(--text); font-weight: 600; }
.report-money .delta { margin-left: auto; font-size: 11.5px; font-weight: 600; }

.report-sub { font-size: 10.8px; color: var(--faint); line-height: 1.55; font-variant-numeric: tabular-nums; }
.report-note { margin-top: 5px; font-size: 11px; color: var(--muted); line-height: 1.55; }

.feed-empty {
  margin: 12px 6px;
  padding: 30px 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.feed-empty a { color: var(--gold); text-decoration: none; }

/* -------------------------------- footer ------------------------------- */

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

footer .disclaimer { color: #454b5c; }

/* -------------------------------- admin -------------------------------- */

.admin-shell { max-width: 760px; margin: 0 auto; padding: 40px 22px 70px; position: relative; z-index: 1; }

.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 20, 28, 0.97), rgba(9, 12, 17, 0.97));
  padding: 26px;
  margin-top: 26px;
}

.admin-card h1 { font-size: 22px; margin: 0 0 8px; }
.admin-card p.hint { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 0 0 20px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; color: var(--faint); letter-spacing: 0.07em; margin-bottom: 6px; text-transform: uppercase; }

.field input, .field textarea {
  width: 100%;
  background: #080a0f;
  border: 1px solid #222837;
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea { min-height: 190px; resize: vertical; line-height: 1.7; }

.field input:focus, .field textarea:focus {
  border-color: rgba(242, 193, 78, 0.55);
  box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.08);
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #171308;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 10px 18px;
  cursor: pointer;
}

.btn:disabled { opacity: 0.55; cursor: wait; }

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  font-size: 12px;
}

.result {
  margin-top: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #080a0f;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  display: none;
}

.result.show { display: block; }
.result.ok { border-color: rgba(52, 209, 124, 0.35); color: #b6f0ce; }
.result.bad { border-color: rgba(255, 96, 96, 0.35); color: #ffc1c1; }

.recent { margin-top: 28px; }
.recent h2 { font-size: 13px; margin: 0 0 12px; color: var(--muted); font-weight: 500; }

.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.recent-row .grow { flex: 1; }
.recent-row .del {
  background: none;
  border: 1px solid var(--line);
  color: var(--faint);
  border-radius: 7px;
  font-size: 11px;
  padding: 4px 9px;
  cursor: pointer;
}
.recent-row .del:hover { color: var(--red); border-color: rgba(255, 96, 96, 0.4); }

/* ------------------------------ responsive ----------------------------- */

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .feed { max-height: 320px; }
}

@media (max-width: 720px) {
  .shell { padding: 18px 14px 40px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 30px 2px 24px; gap: 22px; }
  .hero-capital { text-align: left; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-spark { display: none; }
  .market { padding: 6px 10px; }
  .topbar { flex-wrap: wrap; }
  footer { flex-direction: column; align-items: flex-start; gap: 6px; }
  .chart-wrap { min-height: 280px; }
  #chart { height: 264px; }
}
