:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-alt: #263349;
  --border: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --pass: #10b981;
  --pass-bg: rgba(16, 185, 129, 0.12);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --fail: #ef4444;
  --fail-bg: rgba(239, 68, 68, 0.14);
  --accent: #3b82f6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.container { max-width: 1380px; margin: 0 auto; }
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
h1 { margin: 0 0 6px 0; font-size: 22px; font-weight: 700; }
.subtitle { color: var(--muted); font-size: 13px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.drop-zone {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--card-alt); }
.drop-zone h3 { margin: 0 0 6px 0; font-size: 16px; }
.drop-zone p { margin: 0; font-size: 13px; color: var(--muted); }
input[type="file"] { display: none; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-success { background: var(--pass); color: #052e16; }
.summary-bar { display: none; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-val { font-size: 24px; font-weight: 700; margin-top: 4px; }
.replace-plan-box {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.replace-plan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.replace-plan-header h2 { margin: 0; font-size: 17px; }
.plan-list { margin: 0; padding-left: 20px; font-size: 14px; }
.plan-list li { margin-bottom: 8px; }
.cmd-box {
  margin-top: 12px;
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #38bdf8;
  white-space: pre-wrap;
  word-break: break-all;
}
.mode-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.mode-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mode-title h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.pattern-pill { display: inline-flex; gap: 4px; background: #090d16; padding: 4px 8px; border-radius: 6px; }
.seg-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.seg-r { background: #ef4444; color: #fff; }
.seg-d { background: #334155; color: #cbd5e1; }
.rounds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.round-card {
  background: #151f32;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.round-card.pass { border-color: var(--pass); background: var(--pass-bg); }
.round-card.warn { border-color: var(--warn); background: var(--warn-bg); }
.round-card.fail { border-color: var(--fail); background: var(--fail-bg); }
.round-top { display: flex; justify-content: space-between; align-items: center; }
.round-name { font-weight: 700; font-size: 15px; }
.badge { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.pass { background: var(--pass); color: #052e16; }
.badge.warn { background: var(--warn); color: #451a03; }
.badge.fail { background: var(--fail); color: #fff; }
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.55);
  padding: 8px;
  border-radius: 6px;
}
.metric-item span { display: block; color: var(--muted); font-size: 11px; }
.metric-item strong { font-family: ui-monospace, monospace; font-size: 12px; }
.issues-list { margin: 0; padding-left: 18px; font-size: 12.5px; }
.issues-list li { margin-bottom: 4px; }
.issues-list li.err { color: #fca5a5; }
.issues-list li.wrn { color: #fcd34d; }
.issues-list li.ok { color: #6ee7b7; }
.frames-strip { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.frame-thumb {
  flex: 0 0 auto;
  width: 48px;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  background: #090d16;
  border-radius: 4px;
  padding: 2px;
  border: 1px solid transparent;
}
.frame-thumb.bad-frame { border-color: var(--fail); color: #fca5a5; }
.frame-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 3px; display: block; }
.status-log { margin-bottom: 16px; font-size: 13px; color: #38bdf8; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(9, 13, 22, 0.96);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.auth-icon { font-size: 36px; margin-bottom: 8px; }
.auth-card h2 { margin: 0 0 6px 0; font-size: 19px; }
.auth-card p { margin: 0 0 20px 0; font-size: 13px; color: var(--muted); }
.auth-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #090d16;
  color: var(--text);
  font-size: 15px;
  outline: none;
  text-align: center;
  letter-spacing: 2px;
}
.auth-input:focus { border-color: var(--accent); }
.auth-error {
  min-height: 20px;
  margin: 8px 0;
  font-size: 12.5px;
  color: #fca5a5;
}
.btn-primary { background: var(--accent); color: #fff; }
.auth-btn { width: 100%; justify-content: center; padding: 11px 18px; font-size: 15px; }
