* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0c1727;
  --panel: rgba(13, 24, 40, 0.92);
  --panel-2: rgba(19, 33, 53, 0.88);
  --card: rgba(7, 12, 22, 0.72);
  --line: rgba(124, 168, 230, 0.24);
  --line-hot: rgba(72, 229, 255, 0.55);
  --text: #edf6ff;
  --muted: #9db0ca;
  --subtle: #66809e;
  --cyan: #48e5ff;
  --blue: #4f8cff;
  --green: #18d59b;
  --amber: #f4bb4a;
  --danger: #ff6b89;
  --galaxy-accent: #48e5ff;
  --galaxy-dim: rgba(124, 168, 230, 0.18);
  --galaxy-glow: rgba(72, 229, 255, 0.12);
}

:root[data-theme="nebula"] {
  --bg: #090e24;
  --bg-2: #111838;
  --panel: rgba(15, 23, 54, 0.92);
  --panel-2: rgba(24, 31, 68, 0.88);
  --card: rgba(8, 11, 29, 0.76);
  --line: rgba(151, 177, 255, 0.25);
  --line-hot: rgba(122, 167, 255, 0.55);
  --text: #f0f5ff;
  --muted: #b8c6de;
  --subtle: #7d8fad;
  --cyan: #7aa7ff;
  --blue: #b59cff;
  --green: #35d6b1;
  --amber: #e8c46a;
  --galaxy-accent: #7aa7ff;
  --galaxy-dim: rgba(196, 164, 255, 0.16);
  --galaxy-glow: rgba(122, 167, 255, 0.12);
}

:root[data-theme="aurora"] {
  --bg: #061512;
  --bg-2: #0c211d;
  --panel: rgba(10, 31, 27, 0.92);
  --panel-2: rgba(17, 43, 38, 0.88);
  --card: rgba(4, 17, 15, 0.74);
  --line: rgba(117, 231, 187, 0.24);
  --line-hot: rgba(33, 214, 160, 0.58);
  --text: #effcf7;
  --muted: #a9c9be;
  --subtle: #688d82;
  --cyan: #21d6a0;
  --blue: #58a6ff;
  --green: #28de9f;
  --amber: #e6c05c;
  --galaxy-accent: #21d6a0;
  --galaxy-dim: rgba(117, 231, 187, 0.16);
  --galaxy-glow: rgba(33, 214, 160, 0.12);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef5fb;
  --bg-2: #ffffff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-2: rgba(238, 245, 251, 0.92);
  --card: rgba(255, 255, 255, 0.82);
  --line: rgba(48, 83, 122, 0.18);
  --line-hot: rgba(37, 99, 235, 0.42);
  --text: #172033;
  --muted: #52657f;
  --subtle: #7890aa;
  --cyan: #2563eb;
  --blue: #1b74d6;
  --green: #07946b;
  --amber: #a46612;
  --galaxy-accent: #2563eb;
  --galaxy-dim: rgba(37, 99, 235, 0.12);
  --galaxy-glow: rgba(37, 99, 235, 0.06);
}

:root[data-theme="ember"] {
  color-scheme: light;
  --bg: #f7f1e8;
  --bg-2: #fffaf3;
  --panel: rgba(255, 250, 243, 0.9);
  --panel-2: rgba(240, 229, 214, 0.9);
  --card: rgba(255, 250, 243, 0.82);
  --line: rgba(92, 66, 36, 0.18);
  --line-hot: rgba(180, 95, 24, 0.42);
  --text: #241b12;
  --muted: #624f3b;
  --subtle: #8b765d;
  --cyan: #b45f18;
  --blue: #286fb8;
  --green: #168a6a;
  --amber: #b45f18;
  --galaxy-accent: #b45f18;
  --galaxy-dim: rgba(180, 95, 24, 0.13);
  --galaxy-glow: rgba(180, 95, 24, 0.055);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 18% 12%, color-mix(in srgb, var(--cyan) 24%, transparent), transparent 32%),
    radial-gradient(ellipse at 82% 18%, color-mix(in srgb, var(--blue) 22%, transparent), transparent 30%),
    radial-gradient(ellipse at 56% 72%, color-mix(in srgb, var(--green) 12%, transparent), transparent 34%),
    linear-gradient(90deg, rgba(72, 229, 255, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(72, 229, 255, 0.045) 0 1px, transparent 1px 100%),
    var(--bg);
  background-size: auto, auto, 36px 36px, 36px 36px, auto;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  background:
    linear-gradient(115deg, transparent 0 42%, color-mix(in srgb, var(--cyan) 10%, transparent) 47%, transparent 54%),
    radial-gradient(ellipse at 70% 38%, color-mix(in srgb, var(--cyan) 12%, transparent), transparent 36%);
  filter: blur(0.2px);
  opacity: 0.8;
}

body::after {
  z-index: 0;
  background: linear-gradient(180deg, transparent 0 68%, rgba(0, 0, 0, 0.2) 100%);
  mix-blend-mode: multiply;
}

.system-galaxy-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
}

:root[data-theme="light"] .system-galaxy-canvas,
:root[data-theme="ember"] .system-galaxy-canvas {
  opacity: 0.42;
}

.theme-cycle {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
}

.theme-cycle-dots {
  display: inline-flex;
  gap: 3px;
}

.theme-cycle-dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.theme-cycle-dots i:nth-child(2) { opacity: 0.58; }
.theme-cycle-dots i:nth-child(3) { opacity: 0.32; }

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

.shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: end;
  min-height: 220px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(13, 24, 40, 0.82), rgba(10, 18, 32, 0.62));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow.small {
  margin-bottom: 8px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(44px, 6vw, 78px);
  line-height: 0.98;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
}

.health-card {
  border: 1px solid rgba(72, 229, 255, 0.35);
  border-radius: 14px;
  background: rgba(2, 8, 18, 0.62);
  padding: 18px;
  color: #d5e7fb;
  line-height: 1.75;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.health-card div::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

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

.entry {
  display: grid;
  min-height: 138px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
  background: rgba(13, 24, 40, 0.86);
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.entry::after {
  content: "";
  position: absolute;
  inset: auto 14px 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--cyan);
  opacity: 0.7;
}

.entry:hover {
  transform: translateY(-3px);
  border-color: var(--line-hot);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28), 0 0 26px rgba(72, 229, 255, 0.08);
}

.entry.refine::after {
  background: var(--blue);
}

.entry-kicker {
  display: none !important;
}

.entry strong {
  margin-top: 0;
  font-size: 22px;
}

.entry small {
  color: var(--muted);
  font-size: 14px;
}

.config-console {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(7, 15, 28, 0.72);
  overflow: hidden;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

.config-sidebar {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 20, 36, 0.95), rgba(7, 13, 25, 0.98));
}

.config-tab {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.config-tab:hover,
.config-tab.is-active {
  border-color: rgba(72, 229, 255, 0.3);
  background: rgba(72, 229, 255, 0.09);
  color: var(--text);
}

.config-tab.is-active {
  box-shadow: inset 3px 0 0 var(--cyan), 0 0 22px rgba(72, 229, 255, 0.08);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(72, 229, 255, 0.28);
  border-radius: 10px;
  color: var(--cyan);
  background: rgba(72, 229, 255, 0.06);
}

.config-tab strong,
.config-tab small {
  display: block;
}

.config-tab strong {
  font-size: 16px;
}

.config-tab small {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 12px;
}

.config-workbench {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 26px 28px;
  background:
    linear-gradient(180deg, rgba(19, 33, 53, 0.82), rgba(9, 15, 28, 0.9)),
    var(--bg-2);
}

.workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.workbench-head h2 {
  margin-bottom: 8px;
  font-size: 34px;
}

.workbench-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.config-page {
  display: none;
}

.config-page.is-active {
  display: block;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title h3 {
  margin-bottom: 0;
  font-size: 24px;
}

.section-title span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.param-card,
.toggle-card {
  min-width: 0;
  border: 1px solid rgba(124, 168, 230, 0.25);
  border-radius: 14px;
  background: var(--card);
  padding: 14px;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.param-card {
  display: grid;
  gap: 9px;
}

.param-card:focus-within,
.toggle-card:focus-within,
.param-card:hover,
.toggle-card:hover {
  border-color: var(--line-hot);
  background: rgba(9, 18, 32, 0.92);
  box-shadow: 0 0 0 1px rgba(72, 229, 255, 0.08), 0 0 28px rgba(72, 229, 255, 0.08);
}

.param-card span {
  color: #d7e7fb;
  font-size: 14px;
  font-weight: 800;
}

.param-card small {
  color: var(--subtle);
  font-size: 12px;
}

.span-2 {
  grid-column: span 2;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(124, 168, 230, 0.34);
  border-radius: 10px;
  background: rgba(3, 9, 18, 0.72);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(72, 229, 255, 0.12);
}

textarea {
  resize: vertical;
}

select {
  cursor: pointer;
}

.toggle-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  font-weight: 800;
}

.toggle-card input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--cyan);
}

button {
  border: 1px solid rgba(72, 229, 255, 0.34);
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(72, 229, 255, 0.22), rgba(79, 140, 255, 0.3));
  color: var(--text);
  padding: 11px 16px;
  font-weight: 900;
}

button.secondary {
  background: linear-gradient(135deg, rgba(24, 213, 155, 0.24), rgba(72, 229, 255, 0.16));
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.actions button {
  min-width: 180px;
  cursor: pointer;
}

#saveState {
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 1060px) {
  .hero,
  .entry-strip,
  .config-console,
  .param-grid {
    grid-template-columns: 1fr;
  }

  .config-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .span-2 {
    grid-column: auto;
  }

  .workbench-head {
    flex-direction: column;
  }
}

/* Product UI v2: one platform, multiple workspaces */
:root {
  --bg: #07090d;
  --bg-2: #0b0f15;
  --panel: #10161f;
  --panel-2: #151d28;
  --card: #0b0f15;
  --line: #25303d;
  --line-hot: #3d5268;
  --text: #eef3f8;
  --muted: #94a1b2;
  --subtle: #637184;
  --cyan: #32d6b0;
  --blue: #718cff;
  --green: #32d6b0;
}

body {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--cyan) 4%, transparent) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--cyan) 3%, transparent) 0 1px, transparent 1px 100%),
    var(--bg);
  background-size: 48px 48px, 48px 48px, auto;
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

.system-galaxy-canvas { opacity: .42; }

.theme-cycle {
  top: 12px;
  right: 16px;
  height: 32px;
  border-radius: 7px;
  background: var(--panel);
  box-shadow: none;
}

.shell {
  width: min(1540px, calc(100% - 32px));
  padding: 56px 0 40px;
}

.hero {
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 158px;
  align-items: center;
  gap: 22px;
  padding: 24px 26px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: none;
}

.hero-copy .eyebrow {
  margin-bottom: 8px;
  font: 700 11px/1.2 "Cascadia Code", Consolas, monospace;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(38px, 4.4vw, 64px);
  line-height: 1;
  font-weight: 780;
}

.subtitle {
  max-width: 860px;
  font-size: 15px;
  line-height: 1.6;
}

.health-card {
  border-color: var(--line);
  border-radius: 7px;
  background: var(--bg-2);
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  box-shadow: none;
}

.entry-strip {
  gap: 1px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}

.entry {
  min-height: 106px;
  border: 0;
  border-radius: 0;
  padding: 18px 20px;
  background: var(--bg-2);
}

.entry::after {
  inset: auto 20px 0;
  height: 2px;
  border-radius: 0;
}

.entry:hover {
  transform: none;
  background: var(--panel);
  box-shadow: none;
}

.entry strong { font-size: 19px; }
.entry small { color: var(--muted); font-size: 12px; }

.config-console {
  min-height: 680px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

.config-sidebar {
  padding: 14px;
  background: var(--bg-2);
}

.config-tab {
  border-radius: 6px;
  min-height: 68px;
}

.config-tab.is-active {
  background: color-mix(in srgb, var(--cyan) 9%, var(--panel));
  box-shadow: inset 3px 0 0 var(--cyan);
}

.config-workbench { padding: 24px 28px 34px; }

.workbench-head {
  padding-bottom: 18px;
  border-bottom-color: var(--line);
}

.workbench-head h2 {
  margin-bottom: 6px;
  font-size: 30px;
}

.panel-actions button,
button[type="submit"],
.secondary {
  border-radius: 6px !important;
  box-shadow: none !important;
}

.param-card,
.toggle-card {
  border-radius: 7px;
  border-color: var(--line);
  background: var(--bg-2);
  box-shadow: none;
}

.param-card input,
.param-card select,
.param-card textarea {
  border-radius: 5px;
}

@media (max-width: 800px) {
  .shell { width: calc(100% - 20px); }
  .hero { grid-template-columns: 1fr; }
  .entry-strip { grid-template-columns: 1fr 1fr; }
}
