html[data-theme="cyber"] {
  --text: #e7fbff;
  --bg: #070b12;
  --panel: #101826;
  --rail: #05070d;
  --rail-text: #d7f7ff;
  --rail-muted: #7f9aaa;
  --rail-active: #102833;
  --accent: #3ef0ff;
  --accent-deep: #8af7ff;
  --on-accent: #041018;
  --muted: #8aa0b5;
  --line: #1d3c4d;
  --field: #0c1420;
  --danger: #ff5d7a;
  --glow: 0 0 16px rgba(62, 240, 255, 0.35);
  color-scheme: dark;
}
html[data-theme="showroom"] {
  --text: #1c2422;
  --bg: #f3f6f4;
  --panel: #fbfcfb;
  --rail: #1c2422;
  --rail-text: #d7dfdb;
  --rail-muted: #8ea099;
  --rail-active: #28312f;
  --accent: #c56a3c;
  --accent-deep: #9d4e2a;
  --on-accent: #ffffff;
  --muted: #5c6a64;
  --line: #c9d3ce;
  --field: #ffffff;
  --danger: #8d2f24;
  --glow: none;
  color-scheme: light;
}
html[data-theme="ember"] {
  --text: #f6efe6;
  --bg: #1a120e;
  --panel: #261910;
  --rail: #120c09;
  --rail-text: #f3e2d0;
  --rail-muted: #b59278;
  --rail-active: #3a2418;
  --accent: #e8783a;
  --accent-deep: #ffb07a;
  --on-accent: #1a100c;
  --muted: #c2a38c;
  --line: #4a3326;
  --field: #1c130f;
  --danger: #ff8d7a;
  --glow: none;
  color-scheme: dark;
}
html {
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(240px, 34%) 1fr;
}
.login {
  position: relative;
}
.login-tools {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}
.login-brand {
  background: var(--rail);
  color: var(--rail-text);
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 52px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.login-brand p { max-width: 16em; line-height: 1.7; color: var(--rail-muted); }
html[data-theme="cyber"] .login-brand h1,
html[data-theme="cyber"] .brand strong {
  text-shadow: 0 0 18px rgba(62, 240, 255, 0.35);
}
.login-form {
  display: flex;
  align-items: center;
  padding: 48px 8vw;
}
.login-form form { width: min(420px, 100%); }
.login-form h2 {
  margin: 0 0 8px;
  font-family: "Noto Serif SC", serif;
  font-size: 32px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field span { color: var(--muted); font-size: 14px; }
input, textarea, select {
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: 2px;
  padding: 10px 12px;
}
textarea { min-height: 88px; resize: vertical; }
.primary, .ghost, .text-button {
  border-radius: 2px;
  border: 1px solid transparent;
  padding: 10px 16px;
}
.primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.primary:hover { background: var(--accent-deep); }
.primary:disabled, .ghost:disabled { opacity: 0.55; cursor: wait; }
.ghost { background: transparent; border-color: var(--line); }
.text-button { background: transparent; border: 0; padding: 0; color: var(--accent-deep); }
.error { color: var(--danger); min-height: 1.4em; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  flex-direction: column;
  font-family: "Noto Serif SC", serif;
}
.brand strong { font-size: 22px; }
.brand small { color: var(--muted); font-family: "Noto Sans SC", sans-serif; }
.tabs, .top-actions { display: flex; gap: 8px; align-items: center; }
.tab {
  border: 0;
  background: transparent;
  padding: 8px 10px;
  color: var(--muted);
}
.tab.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.menu { position: relative; }
.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px;
  z-index: 6;
}
.menu-pop button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 10px;
}
.menu-pop button.active { color: var(--accent-deep); }
.mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 14, 0.62);
}
.dialog {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 22px 22px 8px;
}
.dialog h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 28px;
}
.account-card { padding: 8px 10px 4px; }
.account-card strong, .account-card span { display: block; }
.account-card span { color: var(--muted); margin: 4px 0 8px; }

.bench {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 74px);
}
.rail {
  background: var(--rail);
  color: var(--rail-text);
  padding: 18px 12px;
}
.rail p { margin: 0 12px 14px; color: var(--rail-muted); font-size: 13px; }
.track {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--rail-text);
  border: 0;
  border-left: 3px solid transparent;
  padding: 14px 12px;
}
.track small { display: block; color: var(--rail-muted); margin-top: 4px; }
.track.active { background: var(--rail-active); border-left-color: var(--accent); color: var(--rail-text); }
html[data-theme="cyber"] .track.active { border-left-color: #ff2bd6; }

.stage { padding: 22px; }
.composer {
  display: grid;
  gap: 12px;
  max-width: 760px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px 16px;
  min-height: 160px;
}
.pane h3 { margin: 0 0 8px; font-size: 16px; display: flex; justify-content: space-between; }
.pane pre, .shot {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.65;
  font-family: inherit;
}
.shot { padding: 8px 0; border-top: 1px solid var(--line); }
.shot b { display: block; font-weight: 500; }
.note { color: var(--muted); font-size: 14px; }
.media { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.media img, .media video { width: min(280px, 100%); background: var(--rail); }
.history { display: flex; flex-direction: column; gap: 8px; }
.history button {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px 14px;
}
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.list { list-style: none; padding: 0; margin: 12px 0 0; }
.list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.stats { display: flex; gap: 18px; margin-bottom: 16px; }
.stats div { background: var(--panel); border: 1px solid var(--line); padding: 12px 16px; min-width: 120px; }
.stats strong { display: block; font-family: "Noto Serif SC", serif; font-size: 28px; }

@media (max-width: 800px) {
  .login, .bench, .board, .admin-grid { grid-template-columns: 1fr; }
  .login-brand { min-height: 220px; }
  .login-brand h1 { font-size: 40px; }
  .composer .wide, .topbar { display: block; }
  .rail { display: flex; gap: 8px; overflow: auto; }
  .rail p { display: none; }
  .track { min-width: 148px; flex: 0 0 auto; }
  .tabs { margin-top: 10px; }
}
