:root {
  --bg: #07121a;
  --panel: rgba(6, 18, 27, 0.84);
  --line: rgba(138, 178, 196, 0.18);
  --text: #e6f3f5;
  --muted: #8ba6b2;
  --accent: #63d8b1;
  --accent-2: #ffbf61;
  --danger: #ff6d67;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(99, 216, 177, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 191, 97, 0.15), transparent 28%),
    linear-gradient(135deg, #07121a 0%, #0d1923 48%, #0a141c 100%);
  font-family: "Bahnschrift", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1820px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(11, 31, 44, 0.98), rgba(8, 20, 29, 0.85)),
    linear-gradient(90deg, rgba(99, 216, 177, 0.12), transparent);
  box-shadow: var(--shadow);
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-tab {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mode-tab.is-active {
  background: linear-gradient(135deg, rgba(99, 216, 177, 0.22), rgba(255, 191, 97, 0.22));
  color: var(--text);
  border-color: rgba(99, 216, 177, 0.38);
}

.mode-tabs.is-hidden {
  display: none;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
}

.hero-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.stat-chip,
.model-card,
.job-item,
.movement-card,
.monitor-meta > div,
.score-summary > div,
.status-line,
.info-strip > div,
.timeline-box {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.stat-chip {
  padding: 16px;
}

.stat-chip span,
.meta-label,
.score-summary span,
.status-line span,
.info-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-chip strong {
  display: block;
  margin-top: 12px;
  font-size: 1.2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.control-panel,
.viewer-panel,
.score-panel,
.movements-panel {
  padding: 24px;
}

.control-panel {
  grid-column: 1;
}

.viewer-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.score-panel {
  grid-column: 1;
}

.movements-panel {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.panel-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(99, 216, 177, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eval-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.eval-form label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.eval-form input,
.eval-form select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(138, 178, 196, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.primary-btn {
  padding: 14px 16px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, #63d8b1, #ffbf61);
  color: #041017;
  font-weight: 800;
}

.divider {
  height: 1px;
  margin: 20px 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.subhead {
  margin-top: 4px;
}

.info-strip,
.status-stack,
.model-cards,
.job-list,
.movement-board {
  display: grid;
  gap: 12px;
}

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

.info-strip > div,
.status-line,
.model-card,
.job-item,
.movement-card {
  padding: 14px 16px;
}

.status-stack {
  margin-top: 14px;
}

.status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-track {
  height: 12px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.progress-text {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.model-card.is-missing {
  border-color: rgba(255, 109, 103, 0.35);
}

.model-card-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.model-id {
  color: var(--accent-2);
  font-weight: 700;
}

.model-state {
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.model-card p,
.model-card code {
  display: block;
  margin: 8px 0 0;
  color: var(--muted);
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.8rem;
}

.status-pill.is-running,
.status-pill.is-queued {
  background: rgba(255, 191, 97, 0.15);
  color: var(--accent-2);
}

.status-pill.is-completed {
  background: rgba(99, 216, 177, 0.15);
  color: var(--accent);
}

.status-pill.is-failed {
  background: rgba(255, 109, 103, 0.14);
  color: var(--danger);
}

.viewer-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 360px;
  gap: 18px;
  margin-top: 18px;
}

.video-stage {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  height: min(68vh, 760px);
}

.video-stage video,
.video-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.video-stage canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.processing-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 10, 16, 0.28);
  pointer-events: none;
}

.processing-overlay.is-hidden {
  display: none;
}

.processing-card,
.live-order-panel,
.live-order-item {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.processing-card {
  width: min(520px, 100%);
  padding: 20px 22px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.processing-top,
.live-order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.processing-top strong {
  font-size: 1.1rem;
}

.processing-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.processing-meta div {
  padding: 12px 14px;
}

.processing-meta span,
.processing-card p {
  color: var(--muted);
  font-size: 0.82rem;
}

.processing-meta span {
  display: block;
}

.processing-track {
  height: 12px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.processing-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.processing-card p {
  margin: 12px 0 0;
}

.live-order-panel {
  padding: 18px;
  height: min(68vh, 760px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.live-order-board {
  display: grid;
  flex: 1;
  min-height: 0;
  gap: 10px;
  margin-top: 16px;
  padding-right: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.live-order-board::-webkit-scrollbar {
  width: 10px;
}

.live-order-board::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.live-order-board::-webkit-scrollbar-thumb {
  background: rgba(99, 216, 177, 0.45);
  border-radius: 999px;
}

.live-order-board::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 216, 177, 0.7);
}

.live-order-item {
  padding: 12px 14px;
}

.live-order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.live-order-top strong {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 36px;
  padding: 0 10px;
  border-radius: 12px;
  background: rgba(255, 191, 97, 0.14);
  color: var(--accent-2);
  font-weight: 800;
}

.live-order-score {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
}

.live-order-name {
  margin-top: 10px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.live-order-item.is-active {
  border-color: rgba(255, 191, 97, 0.45);
  background: rgba(255, 191, 97, 0.12);
}

.live-order-item.is-perfect {
  border-color: rgba(99, 216, 177, 0.45);
}

.live-order-bar {
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.live-order-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.score-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  margin-top: 18px;
}

body.centroid-main #scoreSummary,
body.centroid-main #timelineHint,
body.centroid-main #centroidInfoBox,
body.centroid-main #dtwScoreView {
  display: none !important;
}

body.centroid-main #standardScoreView {
  display: block !important;
}

body.centroid-main .score-grid {
  grid-template-columns: 1fr;
}

body.centroid-main .score-orb {
  min-height: 240px;
}

.centroid-box {
  margin-top: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.centroid-head {
  margin-bottom: 12px;
}

.centroid-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.centroid-grid > div,
.centroid-top3 {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.centroid-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.centroid-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.centroid-top3 {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.score-orb {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top, rgba(99, 216, 177, 0.24), transparent 55%),
    rgba(255, 255, 255, 0.03);
}

.score-orb span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.score-orb strong {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
}

.score-grade {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score-grade.is-expert {
  background: rgba(99, 216, 177, 0.18);
  color: #7ff1cc;
}

.score-grade.is-skilled {
  background: rgba(255, 191, 97, 0.18);
  color: #ffd38c;
}

.score-grade.is-intermediate {
  background: rgba(138, 178, 196, 0.18);
  color: #c7e0eb;
}

.score-grade.is-beginner {
  background: rgba(255, 120, 120, 0.18);
  color: #ffb3b3;
}

.score-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.score-summary > div {
  padding: 14px;
}

.timeline-box {
  margin-top: 18px;
  padding: 16px;
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

.dtw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.dtw-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.dtw-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.dtw-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
}

.movement-board {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: 18px;
}

.movement-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.group-badge {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 191, 97, 0.14);
  color: var(--accent-2);
  font-weight: 700;
}

.movement-title {
  margin-top: 12px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.movement-score {
  color: var(--accent);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.movement-card.is-perfect {
  border-color: rgba(99, 216, 177, 0.45);
}

.table-wrap {
  margin-top: 20px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

thead {
  background: rgba(255, 255, 255, 0.05);
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(138, 178, 196, 0.08);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.row-perfect {
  background: rgba(99, 216, 177, 0.05);
}

.index-cell {
  color: var(--muted);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.82rem;
}

.empty-row,
.empty-jobs {
  padding: 18px;
  color: var(--muted);
}

.is-bad {
  color: var(--danger);
}

@media (max-width: 1380px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .viewer-panel,
  .score-panel,
  .movements-panel {
    grid-column: auto;
  }

  .viewer-panel {
    grid-row: auto;
  }

  .video-stage {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .viewer-shell {
    grid-template-columns: 1fr;
  }

  .live-order-panel {
    height: auto;
    min-height: 320px;
  }

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

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 12px;
  }

  .hero,
  .control-panel,
  .viewer-panel,
  .score-panel,
  .movements-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-stats,
  .info-strip,
  .score-summary,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .movement-board {
    grid-template-columns: 1fr;
  }

  .centroid-grid {
    grid-template-columns: 1fr;
  }
}
