:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-border: rgba(148, 163, 184, 0.18);
  --surface: #0b1220;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --violet: #a78bfa;
  --emerald: #34d399;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #1e1b4b 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-strong), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.pill {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill-ready {
  background: rgba(52, 211, 153, 0.14);
  color: var(--emerald);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 20px 45px rgba(2, 6, 23, 0.45);
}

.teacher-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.teacher-name {
  margin: 4px 0 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.teacher-dept {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.pin-box {
  background: var(--surface);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 20px;
  padding: 22px 16px;
  text-align: center;
}

.pin-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--violet);
}

.pin-digits {
  margin: 14px 0 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 3.4rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  padding-left: 0.24em;
  color: #ffffff;
  text-shadow: 0 0 28px rgba(99, 102, 241, 0.45);
  user-select: all;
}

.pin-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.meta-chip {
  font-size: 0.74rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  padding: 5px 10px;
  border-radius: 999px;
}

.progress-wrap {
  margin-top: 14px;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width 0.5s ease;
}

.hint {
  margin: 14px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-strong), #7c3aed);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: var(--danger);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.btn-ghost:hover {
  background: rgba(251, 113, 133, 0.1);
}

.install-banner {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
}

.btn-small {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.setup-header h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 800;
}

.setup-header p {
  margin: 0 0 18px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

#input-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.error-text {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger);
}

.security-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--card-border);
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
}

.toast {
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #a7f3d0;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.footer {
  margin-top: auto;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding-top: 8px;
}
