:root {
  --bg: #080d0f;
  --panel: rgba(19, 29, 32, 0.92);
  --panel-2: #172326;
  --line: rgba(185, 204, 198, 0.14);
  --text: #edf2ed;
  --muted: #91a09d;
  --jade: #58b7a4;
  --gold: #c9a85e;
  --danger: #d96861;
  --success: #73bd84;
  --font: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0, rgba(56, 127, 112, .15), transparent 32rem),
    linear-gradient(rgba(255,255,255,.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 38px 38px, 38px 38px, auto;
  font-family: var(--font);
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 15, .9);
  backdrop-filter: blur(18px);
}
.brand, .connection { display: flex; align-items: center; gap: 11px; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .12em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .18em; }
.seal {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(201,168,94,.55);
  border-radius: 11px;
  color: #f1d995;
  background: rgba(201,168,94,.12);
  font-family: KaiTi, STKaiti, serif;
  font-size: 23px;
}
.connection { color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--success); box-shadow: 0 0 12px rgba(115,189,132,.55); }
.dot.error { background: var(--danger); box-shadow: 0 0 12px rgba(217,104,97,.5); }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 71px;
  display: flex;
  height: calc(100vh - 71px);
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 18px;
  border-right: 1px solid var(--line);
}
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav a {
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
}
.sidebar nav a:hover, .sidebar nav a:focus-visible {
  border-color: rgba(88,183,164,.22);
  color: #c1e8df;
  background: rgba(88,183,164,.09);
}
.warning {
  padding: 14px;
  border: 1px solid rgba(201,168,94,.2);
  border-radius: 12px;
  background: rgba(201,168,94,.055);
}
.warning strong { color: #dec67f; font-size: 12px; }
.warning p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }

.content { width: 100%; max-width: 1540px; padding: 38px clamp(20px, 4vw, 60px) 90px; }
.section { scroll-margin-top: 92px; margin-bottom: 72px; }
.section-head, .panel-head, .dialog-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.section-head { margin-bottom: 26px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(27px, 3vw, 38px); }
h2 { margin-bottom: 4px; font-size: 17px; }
.section-head p, .panel-head small, .hint { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.eyebrow { color: var(--gold); font-size: 9px; font-weight: 700; letter-spacing: .2em; }

.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.reward-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.reward-status { align-items: start; }
.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.panel-head { margin-bottom: 16px; }
.search { display: flex; gap: 7px; }

input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--text);
  background: #0d1517;
}
textarea { resize: vertical; line-height: 1.55; }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .5; }
input:focus, select:focus, textarea:focus { border-color: rgba(88,183,164,.65); box-shadow: 0 0 0 3px rgba(88,183,164,.08); }
.button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: transparent;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { border-color: rgba(88,183,164,.34); color: #d6f4ed; background: rgba(88,183,164,.16); }
.button.danger { border-color: rgba(217,104,97,.35); color: #ffd7d3; background: rgba(217,104,97,.13); }
.button:disabled { cursor: not-allowed; opacity: .45; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; }
td:last-child, th:last-child { text-align: right; }
.empty { padding: 28px; color: var(--muted); text-align: center !important; }
.link {
  padding: 4px 0;
  border: 0;
  color: #91d7c8;
  background: none;
}
.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  color: #bde8de;
  background: rgba(88,183,164,.12);
}
.badge.gold { color: #edd696; background: rgba(201,168,94,.12); }
.badge.danger { color: #f7aaa5; background: rgba(217,104,97,.12); }

.detail-section { min-height: 500px; }
.empty-state {
  display: grid;
  min-height: 330px;
  place-items: center;
  align-content: center;
  border: 1px dashed rgba(145,160,157,.24);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}
.empty-state span { color: var(--gold); font: 50px KaiTi, serif; opacity: .65; }
.empty-state h2 { margin: 12px 0 6px; color: var(--text); }
.empty-state p { margin: 0; font-size: 12px; }
.hidden { display: none !important; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin: 7px 0 3px; font-size: 19px; }

.currency-grid { display: grid; gap: 12px; }
.currency-card { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); }
.currency-card header { display: flex; justify-content: space-between; margin-bottom: 11px; }
.currency-card header strong { color: #e8d18e; }
.currency-card .controls { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }
.progression-panel { grid-column: 1 / -1; }
.progression-summary {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.progression-summary > div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.018);
}
.progression-summary span,
.progression-summary strong { display: block; }
.progression-summary span { color: var(--muted); font-size: 10px; }
.progression-summary strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: #d6f4ed;
  font-size: 14px;
}
.progression-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}
.progression-form .form-row { min-width: 0; }
.progression-form small { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 12px; }
.form-stack label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-stack small { color: var(--muted); line-height: 1.55; }
.field-check {
  min-height: 64px;
  align-self: end;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0d1517;
}

.state-list { display: grid; gap: 10px; }
.state-card { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); }
.state-card header { display: flex; justify-content: space-between; gap: 10px; }
.state-card p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.state-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

dialog {
  width: min(520px, calc(100vw - 30px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: #111b1e;
  box-shadow: 0 30px 100px rgba(0,0,0,.58);
}
dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(5px); }
.dialog-card { display: grid; gap: 14px; padding: 22px; }
.dialog-card > label:not(.check) { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.dialog-head { align-items: center; }
.close { border: 0; color: var(--muted); background: transparent; font-size: 25px; }
.check { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.check input { width: auto; min-height: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

.loading, .toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #172326;
  box-shadow: 0 15px 45px rgba(0,0,0,.35);
  font-size: 12px;
}
.toast.error { border-color: rgba(217,104,97,.4); color: #ffc4bf; }

@media (max-width: 1050px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reward-grid { grid-template-columns: 1fr; }
  .progression-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 15px; }
  .connection > span:not(.dot) { display: none; }
  .content { padding: 28px 14px 70px; }
  .columns { grid-template-columns: 1fr; }
  .section-head, .panel-head { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .currency-card .controls { grid-template-columns: 1fr; }
  .progression-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progression-form { grid-template-columns: 1fr; }
  .progression-form small { grid-column: auto; }
  .search { width: 100%; }
}
