:root {
  --bg: #0b0f17;
  --surface: #131a26;
  --surface-2: #1a2435;
  --border: #263248;
  --text: #e6edf7;
  --muted: #93a4bd;
  --accent: #22d3ee;
  --accent-ink: #07131a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --safe: #10b981;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden { display: none !important; }

/* Header */
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 23, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  color: #07131a;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill-safe {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Hero */
.hero {
  padding: 36px 0 24px;
  max-width: 780px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.hero-lead {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* Cards & Buttons */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: #67e8f9; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Upload */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  background: rgba(26, 36, 53, 0.35);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
}
.drop-icon { color: var(--accent); margin-bottom: 10px; }
.drop-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.drop-hint { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.drop-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.controls-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.control-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.control-item select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
}

/* Progress */
.progress-wrap { margin-top: 16px; }
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
  transition: width 0.2s ease;
}
.alert-error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  font-size: 13px;
}

/* Workspace */
.workspace { margin-top: 24px; }
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-val { font-size: 22px; font-weight: 700; margin-top: 2px; }
.stat-warn { color: var(--warn); }
.stat-danger { color: #f87171; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.player-stage video,
.player-stage .demo-frame-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.timeline-bar {
  position: relative;
  height: 18px;
  margin-top: 12px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}
.timeline-marker {
  position: absolute;
  top: 2px;
  bottom: 2px;
  min-width: 6px;
  border-radius: 3px;
  background: var(--danger);
  cursor: pointer;
  opacity: 0.85;
}
.timeline-marker:hover { opacity: 1; }

.export-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.export-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.export-status { font-size: 13px; color: var(--muted); }
.export-markers-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.export-label { font-size: 12px; color: var(--muted); }

/* Findings list */
.findings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.findings-header h2 { margin: 0; font-size: 16px; }
.badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}
.finding-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
}
.finding-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.time-btn {
  background: rgba(34, 211, 238, 0.14);
  color: var(--accent);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.cat-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}
.cat-secret_key { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.cat-notification_popup { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.cat-pii_payment { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.cat-private_browser_ui { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

.box-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-top: 6px;
  cursor: pointer;
}
.box-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

/* Features & Footer */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0 40px;
}
.feature-item h3 { margin: 0 0 8px; font-size: 15px; }
.feature-item p { margin: 0; font-size: 13px; color: var(--muted); }

.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 32px;
  color: var(--muted);
  font-size: 13px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 960px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .controls-bar { grid-template-columns: 1fr; }
  .dropzone { padding: 22px 14px; }
}
