:root {
  --bg: #070c14;
  --panel: #0f1724;
  --panel2: #131e2d;
  --line: #243148;
  --text: #eef3ff;
  --muted: #8995aa;
  --purple: #9b6cff;
  --blue: #58a6ff;
  --green: #54d88a;
  --amber: #ffbd4a;
  --red: #ff6877;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 1280px;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel2);
  text-decoration: none;
  cursor: pointer;
}
button:hover, a:hover { border-color: var(--purple); }
.primary { border-color: #754de8; background: #6f42d8; }
.topbar {
  height: 62px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #08101d;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { color: var(--purple); font-size: 32px; line-height: 1; }
h1, h2, p { margin: 0; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
.brand p, label, .hint, .section-head span { color: var(--muted); font-size: 12px; }
nav { display: flex; align-items: center; gap: 10px; }
nav button, nav a { padding: 8px 12px; }
nav .active { border-color: var(--purple); background: #2a1f49; }

.entry-view {
  min-height: calc(100vh - 62px);
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #07101d, #101727);
}
.entry-panel {
  width: 380px;
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #0a111c;
}

.work-view {
  height: calc(100vh - 62px);
  display: grid;
  grid-template-columns: 360px minmax(560px, 1fr) 380px;
  gap: 12px;
  padding: 12px;
}
.case-panel, .video-panel, .score-panel, .admin-side, .admin-main section, .readonly-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.case-panel, .score-panel {
  min-height: 0;
  padding: 12px;
  overflow: auto;
}
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.summary-cards div, .admin-cards div {
  padding: 14px 10px;
  border-radius: 6px;
  text-align: center;
  background: var(--panel2);
}
.summary-cards b, .admin-cards b { display: block; color: var(--purple); font-size: 25px; }
.summary-cards span, .admin-cards span { color: var(--muted); font-size: 12px; }
.field { margin: 14px 0 10px; }
.field label { display: block; margin-bottom: 6px; }
.search-row, .add-tag-row, .action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}
.search-row button, .add-tag-row button, .action-row button { padding: 0 14px; }
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tabs button { flex: 1; padding: 8px; color: var(--muted); }
.tabs .active { color: var(--text); border-color: var(--purple); background: #2a1f49; }
.batch-row { margin-bottom: 10px; }
.batch-row button {
  width: 100%;
  padding: 8px;
  color: var(--amber);
  font-size: 12px;
}
.batch-row button:hover { border-color: var(--amber); }
.case-list {
  height: calc(100% - 262px);
  min-height: 340px;
  overflow: auto;
}
.case-item {
  width: 100%;
  display: grid;
  grid-template-columns: 62px 1fr 42px;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
  padding: 10px;
  text-align: left;
}
.case-item.active {
  border-color: var(--purple);
  background: #251b3f;
  box-shadow: inset 0 0 0 1px var(--purple), 0 0 0 2px #9b6cff22;
}
.case-item.done span { color: var(--green); }
.case-item.silence time { color: var(--amber); }
.case-item.silence p { color: #ffd98a; }
.case-item time { color: #c7d6f0; font-variant-numeric: tabular-nums; }
.case-item p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.case-item span { color: var(--muted); font-size: 12px; }

.video-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
}
.case-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.case-head button { padding: 5px 10px; }
.case-position {
  padding: 3px 9px;
  border-radius: 5px;
  color: var(--blue);
  background: #0a111c;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.case-head i { margin-left: auto; color: var(--muted); font-style: normal; }
.video-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
}
video {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: contain;
  background: #000;
  display: block;
}
.video-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.video-meta div { padding: 10px 14px; border-right: 1px solid var(--line); }
.video-meta div:last-child { border-right: 0; }
.video-meta span { display: block; color: var(--muted); font-size: 12px; }
.video-meta b { display: block; margin-top: 4px; font-size: 13px; }
.speech-card {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 52px;
  padding: 10px 14px;
  border: 1px solid #ffffff2b;
  border-radius: 6px;
  background: #030711d9;
  box-shadow: 0 10px 30px #0009;
  pointer-events: none;
}
.speech-card span { color: var(--blue); font-size: 11px; }
.speech-card p {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

.score-panel section, .readonly-card { margin-bottom: 12px; padding: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head button { padding: 5px 10px; }
.board-info {
  max-height: 250px;
  overflow: auto;
  color: #c5cfdf;
  font-size: 12px;
  line-height: 1.65;
}
.board-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.board-card, .board-block {
  border: 1px solid #253450;
  border-radius: 6px;
  background: #0a111c;
}
.board-card {
  padding: 9px 10px;
}
.board-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.board-card b {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}
.board-block {
  margin-top: 8px;
  padding: 10px;
}
.board-block h3 {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
}
.board-block p {
  margin: 0;
  white-space: pre-line;
}
.board-table {
  font-size: 11px;
}
.board-table th, .board-table td {
  padding: 6px;
  vertical-align: top;
}
.score-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.score-buttons button { padding: 12px 0; font-size: 16px; }
.score-group { margin-bottom: 10px; }
.score-group-title {
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}
.key-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.silence-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.silence-buttons button {
  padding: 12px 0;
  font-weight: 700;
}
.score-buttons .selected, .silence-buttons .selected, .tag-child.selected {
  border-color: var(--purple);
  background: #34205d;
  color: #fff;
}
.tag-buttons { display: grid; gap: 10px; }
.tag-column { margin-bottom: 14px; }
.tag-column:last-child { margin-bottom: 0; }
.tag-column-title {
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}
.tag-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #0a111c;
  font-size: 12px;
}
.tag-group {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0a111c;
}
.tag-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tag-group-title b {
  padding: 2px 7px;
  border-radius: 4px;
  color: #fff;
  background: #6f42d8;
  font-size: 11px;
}
.tag-group-title span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}
.tag-children {
  display: grid;
  gap: 7px;
}
.tag-child {
  width: 100%;
  padding: 8px 9px;
  text-align: left;
  color: #d9d2ff;
}
.tag-child b {
  display: block;
  margin-bottom: 3px;
  color: inherit;
  font-size: 13px;
}
.tag-child span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.tag-child.selected span { color: #d7cbff; }
.tag-child.compact {
  display: inline-block;
  width: auto;
}
textarea { min-height: 118px; resize: vertical; }
.checkline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.checkline input { width: auto; }
.action-row {
  position: sticky;
  top: 0;
  z-index: 5;
  grid-template-columns: 1fr 1fr;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.action-row button { padding: 12px; }
.hint {
  position: sticky;
  top: 58px;
  z-index: 4;
  min-height: 20px;
  margin: 0 0 8px;
  color: var(--green);
  background: var(--panel);
}
.hint.unsaved { color: var(--red); font-weight: 700; }

.admin-view {
  min-height: calc(100vh - 62px);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 12px;
  padding: 12px;
}
.admin-side { padding: 14px; }
.admin-side h2 { margin: 8px 0 10px; }
.admin-side input, .admin-side select, .admin-side button, .file-label { margin-bottom: 10px; }
.file-label {
  display: block;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
}
.file-label input { margin-top: 7px; padding: 0; border: 0; background: transparent; }
.admin-main { min-width: 0; display: grid; gap: 12px; }
.admin-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.admin-cards b { color: var(--text); }
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.admin-main section { padding: 14px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
th { color: var(--muted); font-weight: 500; }
td button { padding: 5px 10px; }
.tag-stats { display: grid; gap: 8px; }
.tag-stats div {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--panel2);
}
.tag-stats b { color: var(--purple); }
.empty { color: var(--muted); }
.fatal { padding: 24px; color: var(--red); }
