:root {
  --good: #2ecc71;
  --bad: #e74c3c;
  --idle: #95a5a6;
  --bg: #10141a;
  --panel: #1b212b;
  --text: #e8edf2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Pretendard, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.footer {
  text-align: center;
  padding: 12px 20px 24px;
  font-size: 0.78rem;
  color: #5c6773;
}

.topbar {
  position: relative;
  padding: 24px 20px 8px;
  text-align: center;
}
.topbar h1 { margin: 0 0 6px; font-size: 1.6rem; }
.tagline { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.subtitle { margin: 0 auto; max-width: 560px; color: #9aa7b4; font-size: 0.9rem; }

.lang-select {
  position: absolute;
  top: 16px;
  right: 20px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid #2c3644;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.82rem;
}

main {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.panel {
  background: var(--panel);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}

.mini-box {
  width: 100%;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 4px solid var(--idle);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  background: #000;
}

.video-wrap.good { border-color: var(--good); }
.video-wrap.bad {
  border-color: var(--bad);
  box-shadow: 0 0 24px rgba(231, 76, 60, 0.65);
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(231, 76, 60, 0.5); }
  50% { box-shadow: 0 0 32px rgba(231, 76, 60, 0.9); }
}

video, canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror, feels natural like a mirror */
}

.status-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
.status-idle { background: rgba(149,165,166,0.85); }
.status-good { background: rgba(46,204,113,0.9); }
.status-bad { background: rgba(231,76,60,0.9); }

.mute-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transform: none; /* video/canvas 미러링의 영향을 받지 않도록 */
}
.mute-btn:hover { background: rgba(0,0,0,0.75); }
.mute-btn.muted { opacity: 0.55; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: #2c3644;
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
button:hover:not(:disabled) { background: #384454; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
#btn-start { background: #3d6bd1; }
#btn-start:hover { background: #4a78e0; }


.sensitivity {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: #b7c0ca;
}
.sensitivity input { width: 100%; }

.hint {
  margin-top: 14px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #8b97a4;
}

/* Document Picture-in-Picture window styling (loaded via injected stylesheet copy) */
.pip-mode .panel { max-width: none; padding: 8px; border-radius: 0; }
.pip-mode .controls, .pip-mode .sensitivity, .pip-mode .hint { display: none; }
