/* ───────── Reset & Base ───────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --red: #f85149;
  --orange: #d29922;
  --radius: 8px;
}

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ───────── Layout ───────── */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ───────── Player Box ───────── */
.player-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.video-wrapper {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Loader overlay */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(13,17,23,0.85);
  color: var(--text-dim);
  font-size: 0.9rem;
  z-index: 5;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Error overlay */
.error {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(248,81,73,0.92);
  color: #fff;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  z-index: 6;
}

/* ───────── Controls ───────── */
.controls {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.input-row input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.input-row input:focus {
  border-color: var(--accent);
}

.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

/* ───────── Detection info ───────── */
.detect-info {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.badge.active { color: var(--accent); border-color: var(--accent); }

/* ───────── Info Section ───────── */
.info-box, .examples-box {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.info-box h3, .examples-box h3 {
  font-size: 1rem;
  margin-bottom: 0.8rem;
  color: var(--text-dim);
}

.info-box table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.info-box td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.info-box td:first-child {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  color: var(--orange);
  width: 140px;
}

.info-box td:last-child {
  color: var(--text-dim);
}

.info-box tr:last-child td {
  border-bottom: none;
}

.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.example-btn {
  padding: 0.4rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.example-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ───────── Responsive ───────── */
@media (max-width: 640px) {
  .container { padding: 1rem; }
  .input-row { flex-wrap: wrap; }
  .input-row input { min-width: 100%; }
  .btn { flex: 1; text-align: center; }
}
