:root {
  --bg: #070b14;
  --card: #0f1629;
  --card-border: rgba(255,255,255,0.07);
  --muted: #8b9ab5;
  --accent: #06b6a4;
  --accent2: #0891b2;
  --accent-glow: rgba(6,182,164,0.2);
  --white: #eaf0f8;
  --red: #ef4444;
  --green: #22c55e;
  --yellow: #f59e0b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'SF Pro Display', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(6,182,164,0.06) 0%, transparent 60%);
  color: var(--white);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.container { width: 820px; max-width: 96%; padding: 40px 0; }

header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}
.logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #022;
  flex-shrink: 0;
  box-shadow: 0 4px 20px var(--accent-glow);
}
header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.3px; }
header p { margin-top: 4px; }
.muted { color: var(--muted); font-size: 0.88rem; }
.small { font-size: 0.82rem; }

.stage {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  margin-bottom: 24px;
}
.video-wrap {
  position: relative;
  flex-shrink: 0;
}
video {
  width: 320px; height: 240px;
  background: #000;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid var(--card-border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.video-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 1.2px;
  display: none;
}
.video-badge.active { display: block; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.status-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.status {
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  font-size: 1rem;
  min-height: 56px;
  line-height: 1.6;
}
.ws-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.ws-dot.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }
.ws-dot.disconnected { background: var(--red); box-shadow: 0 0 8px var(--red); }

.controls { margin-bottom: 24px; display: flex; gap: 12px; }
.btn-primary, .btn-secondary {
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #022;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 24px var(--accent-glow); transform: translateY(-2px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary {
  background: rgba(255,255,255,0.04);
  color: var(--white);
  border: 1px solid var(--card-border);
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.08); }
.btn-secondary:disabled { opacity: .35; cursor: not-allowed; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}
.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.hidden { display: none !important; }

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  margin-bottom: 20px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
  transition: width .5s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

.oath-line {
  font-size: 1.15rem;
  padding: 18px 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  line-height: 1.7;
  min-height: 60px;
  font-weight: 500;
}

.match-info {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  border-left: 3px solid transparent;
}
.match-info.success { border-left-color: var(--green); color: var(--green); }
.match-info.fail { border-left-color: var(--red); color: var(--red); }

#result video {
  border-radius: 12px;
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

footer { margin-top: 28px; text-align: center; }
footer small { color: var(--muted); font-size: 0.78rem; opacity: 0.7; }

@media(max-width:700px) {
  .stage { flex-direction: column; }
  video { width: 100%; height: auto; }
  .container { padding: 20px 12px; }
  header h1 { font-size: 1.15rem; }
}
