:root {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #22c55e;
  --border: rgba(255,255,255,.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.22), transparent 35%),
    radial-gradient(circle at bottom right, rgba(34,197,94,.16), transparent 35%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.header h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -.04em;
  margin-bottom: 12px;
}

.header p { font-size: 1.1em; color: var(--muted); }

.version-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.04);
  font-size: .85em;
  font-weight: 600;
}

.main-content { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.section {
  background: rgba(17,24,39,.72);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.section h2 { font-size: 1.5em; margin-bottom: 15px; display: flex; align-items: center; }
.step-number {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #031019; width: 30px; height: 30px; border-radius: 50%; margin-right: 10px; font-weight: 700;
}

.btn { padding: 12px 20px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,.06); color: var(--text); cursor: pointer; font-weight: 700; }
.btn-primary, .btn-success { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #031019; border: none; }
.btn-secondary { color: var(--muted); }
.btn-danger { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.4); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.hidden { display: none; }

.class-container, .webcam-container, .results-container {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
  background: rgba(255,255,255,.03);
}
.class-header { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.class-name { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1em; background: rgba(15,23,42,.5); color: var(--text); }
.image-count, #training-info { color: var(--muted); }
.upload-area { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.image-preview { display: flex; flex-wrap: wrap; gap: 10px; }
.preview-img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.progress-bar { width: 100%; height: 20px; background: rgba(255,255,255,.12); border-radius: 10px; overflow: hidden; margin: 15px 0; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s ease; }

.test-section { grid-column: 1/-1; }
.test-content { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
#webcam { width: 100%; max-width: 400px; height: 300px; border-radius: 10px; background: #000; }
.result-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.result-label { font-weight: bold; flex: 1; }
.result-bar { flex: 3; height: 20px; background: rgba(255,255,255,.12); border-radius: 10px; overflow: hidden; position: relative; }
.result-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .5s ease; }
.result-percentage { flex: 1; text-align: right; font-weight: bold; }

.status-message { margin: 15px 0; padding: 12px; border-radius: 8px; font-weight: bold; border: 1px solid transparent; }
.status-success { background: rgba(34,197,94,.2); color: #86efac; border-color: rgba(34,197,94,.4); }
.status-error { background: rgba(239,68,68,.2); color: #fca5a5; border-color: rgba(239,68,68,.4); }
.status-info { background: rgba(56,189,248,.2); color: #7dd3fc; border-color: rgba(56,189,248,.4); }

@media (max-width: 800px) {
  .main-content, .test-content { grid-template-columns: 1fr; }
  .container { width: min(1100px, calc(100% - 24px)); }
}

.muted-result { color: var(--muted); }
