/* ─── Reset & base ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-deep:      #050b18;
  --bg-panel:     #0b1526;
  --bg-card:      #0f1e35;
  --bg-input:     #0a1525;
  --accent:       #4BC3FF;
  --accent-hover: #2aaee8;
  --accent-dim:   rgba(75, 195, 255, 0.12);
  --text-primary: #e8f0fe;
  --text-muted:   #6e89b4;
  --border:       rgba(75, 195, 255, 0.18);
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    22px;
  --font:         'Inter', system-ui, sans-serif;
  --transition:   0.2s ease;
}

html, body {
  height: 100%;
  width: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  /* subtle star-field texture */
  background-image:
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(12, 38, 80, 0.7) 0%, transparent 70%),
    radial-gradient(1px 1px at 20%  15%, rgba(255,255,255,0.55) 0%, transparent 100%),
    radial-gradient(1px 1px at 75%  80%, rgba(255,255,255,0.45) 0%, transparent 100%),
    radial-gradient(1px 1px at 45%  55%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 88% 25%, rgba(255,255,255,0.6)  0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 10% 70%, rgba(255,255,255,0.5)  0%, transparent 100%),
    radial-gradient(1px 1px at 55%  10%, rgba(255,255,255,0.4)  0%, transparent 100%),
    radial-gradient(1px 1px at 35%  90%, rgba(255,255,255,0.3)  0%, transparent 100%);
}

/* ─── Layout ───────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ─── Left: illustration panel ─────────────────────────── */
.illustration-panel {
  flex: 1 1 55%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  gap: 40px;
  position: relative;
  overflow: hidden;
}

.illustration-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(75,195,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.illustration {
  width: 100%;
  max-width: 540px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 40px rgba(75, 195, 255, 0.25));
}

/* Placeholder shown when SVG is missing */
.illustration[src="Login-Screen.svg"]:not([complete]) {
  min-height: 340px;
  border-radius: var(--radius-lg);
  background: var(--accent-dim);
}

.illustration-caption {
  text-align: center;
  max-width: 440px;
}

.illustration-caption h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.illustration-caption p {
  margin-top: 14px;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── Right: login panel ───────────────────────────────── */
.login-panel {
  flex: 0 0 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
}

/* ─── Card ─────────────────────────────────────────────── */
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ─── Brand ─────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #1a6fcf 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(75, 195, 255, 0.45);
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

/* ─── Headings ─────────────────────────────────────────── */
.card-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 32px;
}

/* ─── Forms ─────────────────────────────────────────────── */
.teacher-form,
.student-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: -6px;
}

.text-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.97rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  caret-color: var(--accent);
}

.text-input::placeholder {
  color: #3a567a;
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(75, 195, 255, 0.18);
}

.code-input {
  letter-spacing: 0.12em;
  font-size: 1rem;
  text-align: center;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  letter-spacing: 0.01em;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #1a85d6 100%);
  color: #001833;
  box-shadow: 0 4px 22px rgba(75, 195, 255, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #1570ba 100%);
  box-shadow: 0 6px 28px rgba(75, 195, 255, 0.50);
}

.btn-secondary {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(75, 195, 255, 0.2);
  border-color: var(--accent);
}

/* ─── Divider ───────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ─── Student section ──────────────────────────────────── */
.student-section {
  background: rgba(75, 195, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
}

.student-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

/* ─── Footer note ───────────────────────────────────────── */
.footer-note {
  margin-top: 32px;
  font-size: 0.75rem;
  color: #2e4a6e;
  text-align: center;
}

.footer-note a {
  color: #3d6b99;
  text-decoration: none;
}

.footer-note a:hover {
  color: var(--accent);
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 860px) {
  .page-wrapper {
    flex-direction: column;
  }

  .illustration-panel {
    flex: none;
    padding: 40px 24px 24px;
    gap: 20px;
  }

  .illustration {
    max-width: 300px;
  }

  .illustration-caption h2 {
    font-size: 1.4rem;
  }

  .illustration-caption p {
    font-size: 0.875rem;
  }

  .login-panel {
    flex: none;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 40px 20px 48px;
  }
}

@media (max-width: 480px) {
  .card-title {
    font-size: 1.35rem;
  }

  .illustration-panel {
    padding: 28px 16px 16px;
  }

  .illustration {
    max-width: 220px;
  }
}

/* ─── Utility ───────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ─── Room screen ───────────────────────────────────────── */
#room-screen {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.room-code-block,
.room-url-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.room-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  flex: 0 0 auto;
  min-width: 62px;
}

.room-code {
  flex: 1;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.room-url {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  word-break: break-all;
  transition: color var(--transition);
}

.room-url:hover {
  color: var(--accent);
}

.copy-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.copy-btn:hover {
  background: rgba(75, 195, 255, 0.22);
}

.copy-btn.copied {
  background: rgba(75, 255, 160, 0.15);
  color: #4bffaa;
  border-color: rgba(75, 255, 160, 0.3);
}

#new-mission-btn {
  margin-top: 10px;
}

/* ─── QR code ───────────────────────────────────────────── */
.room-qr-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.room-qr-wrapper canvas,
.room-qr-wrapper img {
  display: block;
  border-radius: 6px;
}
