:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #66727f;
  --line: #d9e0e7;
  --accent: #b21f2d;
  --accent-2: #0f7a63;
  --warn: #c47a12;
  --shadow: 0 10px 30px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: #151b22;
  color: #fff;
}

.topbar strong {
  display: block;
  font-size: 18px;
}

.topbar span {
  color: #b7c0ca;
  font-size: 13px;
}

.topbar nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.topbar nav a {
  padding: 9px 12px;
  border-radius: 6px;
  color: #d9e1e8;
}

.topbar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero > div:first-child,
.metrics,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero > div:first-child {
  padding: 30px;
}

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

h1 {
  font-size: 28px;
  line-height: 1.25;
  margin-bottom: 14px;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.metrics div {
  display: grid;
  place-content: center;
  text-align: center;
  border-left: 1px solid var(--line);
}

.metrics div:first-child {
  border-left: 0;
}

.metrics span {
  font-size: 34px;
  font-weight: 700;
  color: var(--accent);
}

.metrics small {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 20px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
}

.admin-layout {
  grid-template-columns: 320px 1fr;
}

.panel {
  padding: 22px;
}

.panel.compact {
  padding: 16px;
  box-shadow: none;
}

.steps {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.9;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.notice.ok {
  background: #e7f6f1;
  color: #0f6c57;
}

.notice.error {
  background: #fff1ec;
  color: #9e341e;
}

.movement-list {
  display: grid;
  gap: 8px;
}

.movement-list a {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.movement-list a.active {
  border-color: var(--accent);
  background: #fff6f6;
}

.movement-list span {
  color: var(--muted);
  font-size: 12px;
}

.form {
  display: grid;
  gap: 16px;
}

.fields {
  display: grid;
  gap: 14px;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
  font-family: Consolas, "Microsoft YaHei", monospace;
}

.judge-page {
  width: min(1440px, calc(100% - 28px));
  margin: 20px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.camera-shell,
.score-panel {
  min-width: 0;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0e141a;
  border-radius: 8px;
  border: 1px solid #1e2a35;
  box-shadow: var(--shadow);
}

#video,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video {
  object-fit: cover;
  transform: scaleX(-1);
}

#overlay {
  transform: scaleX(-1);
}

.loading {
  position: absolute;
  left: 16px;
  top: 16px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  padding: 9px 12px;
  border-radius: 6px;
}

.judge-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  margin-top: 12px;
}

.score-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.score-card {
  background: #151b22;
  color: #fff;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.score-card span {
  display: block;
  color: #b7c0ca;
}

.score-card strong {
  display: block;
  font-size: 56px;
  line-height: 1.1;
}

.score-bars {
  display: grid;
  gap: 10px;
}

.rule-bar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.rule-bar header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 8px;
}

.bar {
  height: 8px;
  background: #edf1f4;
  border-radius: 999px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

.bar i.warn {
  background: var(--warn);
}

.bar i.bad {
  background: var(--accent);
}

.advice {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 900px) {
  .topbar,
  .hero,
  .two,
  .admin-layout,
  .judge-page,
  .judge-toolbar {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    padding: 16px;
  }

  .topbar,
  .judge-toolbar {
    display: grid;
  }

  .metrics {
    min-height: 130px;
  }

  .two-cols {
    grid-template-columns: 1fr;
  }
}
