:root {
  color-scheme: dark;
  --bg: #07111c;
  --bg-2: #0b1526;
  --panel: rgba(11, 23, 39, 0.9);
  --panel-soft: rgba(18, 33, 55, 0.82);
  --line: rgba(148, 163, 184, 0.2);
  --line-strong: rgba(96, 165, 250, 0.32);
  --text: #e8f1ff;
  --muted: #95a8c7;
  --cyan: #22d3ee;
  --blue: #2563eb;
  --amber: #fbbf24;
  --green: #34d399;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 12%, rgba(34,211,238,.16), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(59,130,246,.15), transparent 24%),
    linear-gradient(135deg, #030814, var(--bg) 48%, var(--bg-2));
}
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 388px) 1fr;
  gap: 18px;
  padding: 18px;
}
.panel, .glass {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(20px);
}
.panel {
  padding: 22px;
  overflow: auto;
  max-height: calc(100vh - 36px);
}
.brand-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}
.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(34,211,238,.28), rgba(37,99,235,.42));
  border: 1px solid rgba(125,211,252,.28);
}
h1 { margin: 0; font-size: 31px; letter-spacing: -.03em; }
.lead { margin: 8px 0 0; color: var(--muted); line-height: 1.65; font-size: 13px; }
.card {
  padding: 16px;
  margin: 14px 0;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}
.card-head, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}
.card h2, .section-head h2, .section-head h3 { margin: 0; }
.card h2 { font-size: 16px; }
.chip, .mini-chip {
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  color: #cde7ff;
  border: 1px solid rgba(96,165,250,.24);
  background: rgba(37,99,235,.14);
}
.mini-chip.accent {
  border-color: rgba(251,191,36,.28);
  background: rgba(251,191,36,.14);
  color: #fde68a;
}
label { display: grid; gap: 7px; margin: 12px 0; color: var(--muted); font-size: 13px; }
select, input[type="range"] { width: 100%; }
select {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 16, 28, 0.88);
  color: var(--text);
}
button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 17, 31, 0.94);
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
button:hover { transform: translateY(-1px); border-color: rgba(34,211,238,.7); }
button.primary {
  background: linear-gradient(135deg, #0891b2, #2563eb);
  border: 0;
}
button.ghost { background: rgba(15, 23, 42, 0.76); }
.preset-grid, .actions { display: grid; gap: 10px; }
.preset-grid { grid-template-columns: repeat(2, 1fr); }
.actions { grid-template-columns: repeat(2, 1fr); }
.actions .wide { grid-column: 1 / -1; }
.value-row { display: flex; justify-content: space-between; gap: 10px; }
.value-row output { color: var(--text); font-variant-numeric: tabular-nums; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.stats-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.stat {
  padding: 14px;
  border-radius: 14px;
  background: rgba(7, 15, 27, 0.68);
  border: 1px solid var(--line);
}
.stat span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat strong { font-size: 16px; line-height: 1.35; }
.stage {
  display: grid;
  grid-template-rows: minmax(400px, 56vh) minmax(220px, 30vh);
  gap: 18px;
  min-width: 0;
}
.hero-panel, .gather-panel, .profile-panel { padding: 18px; }
.section-head { margin-bottom: 12px; }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.grid-row {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  min-height: 0;
  align-items: stretch;
}
.profile-panel {
  display: grid;
  grid-template-rows: auto 1fr 1fr;
  gap: 12px;
  min-height: 0;
}
.gather-panel { min-height: 0; }
canvas {
  width: 100%;
  display: block;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(4,10,20,.98), rgba(8,16,28,.9));
}
#waveCanvas { height: calc(100% - 60px); min-height: 340px; cursor: crosshair; image-rendering: auto; }
#gatherCanvas { height: clamp(180px, 26vh, 280px); min-height: 180px; }
#profileCanvas, #dispersionCanvas { height: clamp(110px, 12.5vh, 160px); min-height: 110px; }
@media (max-width: 1120px) {
  .shell { grid-template-columns: 1fr; }
  .panel { max-height: none; }
  .stage { grid-template-rows: auto auto; }
  .grid-row { grid-template-columns: 1fr; }
  #waveCanvas { height: 400px; }
  #gatherCanvas { height: 260px; }
  #profileCanvas, #dispersionCanvas { height: 180px; }
}
