:root {
  --bg-1: #f6f2ea;
  --bg-2: #e8f1ff;
  --card: #ffffff;
  --text: #1b1b1f;
  --muted: #5b6573;
  --accent: #1f6feb;
  --accent-strong: #0b4ec4;
  --accent-soft: #e1ecff;
  --border: #d8dee8;
  --shadow: 0 20px 45px rgba(17, 26, 43, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans KR", "Apple SD Gothic Neo", sans-serif;
  background: radial-gradient(circle at top left, #fff7df 0%, transparent 45%),
    radial-gradient(circle at bottom right, #d9e8ff 0%, transparent 50%),
    linear-gradient(130deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  min-height: 100vh;
  padding: 32px 18px 60px;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.hero {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.eyebrow {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 2.7vw, 2.6rem);
}

.subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

button {
  font: inherit;
  border-radius: 999px;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 20px rgba(31, 111, 235, 0.35);
}

.primary:hover:not(:disabled) {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.ghost {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.video-card,
.result-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.video-header,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-size: 1.1rem;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.webcam {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f4f6fb;
}

.webcam canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.labels {
  display: grid;
  gap: 10px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f9fbff;
}

.label-name {
  font-weight: 600;
}

.label-score {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.confidence {
  margin-top: 16px;
  height: 12px;
  background: #eef1f6;
  border-radius: 999px;
  overflow: hidden;
}

.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #37c6ff, #1f6feb);
  transition: width 0.2s ease;
}

.fineprint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 720px) {
  body {
    padding: 20px 14px 40px;
  }

  .hero,
  .video-card,
  .result-card {
    padding: 18px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }
}
