/* client/css/join.css — Agent 7 (parent/learner entry flow).
   Self-contained styles for index.html + join.html.
   base.css belongs to Agent 8 and MUST NOT be assumed: this file carries its
   own token block. color-fix 2026-09-14 (r2-patch): tokens moved to the
   ecosystem light canon v2 (#f6f8fc / #1a56db) — mirrors the deployed
   academy-canonical-r1 layer; rounded friendly buttons kept (16px cards). */

:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #eef2f9;
  --text: #0f172a;
  --muted: #475569;
  --line: #e6ebf3;
  --accent: #1a56db;
  --accent-hover: #1649c0;
  --accent-soft: #e7eefb;
  --mint: #e7f8f0;
  --mint-text: #0e7a4f;
  --yellow: #e7eefb;
  --yellow-text: #143a8f;
  --red-text: #a3281f;
  --red-soft: #fdecea;
  --focus: #1a56db;
  --shadow: 0 10px 28px rgba(23, 43, 99, 0.1);
  --radius: 16px;
  --radius-s: 14px;
  --video-bg: #10131d;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

.wrap {
  max-width: 540px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.wrap-narrow {
  max-width: 460px;
}

/* --- brand / headings ---------------------------------------------------- */

.brand-name {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-title {
  margin: 0;
  font-size: clamp(24px, 6vw, 30px);
  line-height: 1.2;
}

.page-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
}

/* --- cards --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 14px;
}

.card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.card-sub {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* --- step indicator ------------------------------------------------------ */

.form {
  display: grid;
  gap: 14px;
}

.steps-row {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.steps {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  font-size: 15px;
}

.steps-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.dot-on {
  background: var(--accent);
}

/* --- fields --------------------------------------------------------------- */

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 600;
  font-size: 16px;
}

input[type="text"] {
  font: inherit;
  min-height: 50px;
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
}

input[type="text"]::placeholder {
  color: var(--muted);
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  text-align: center;
  font-size: 20px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

.check label {
  font-size: 16px;
}

/* --- buttons -------------------------------------------------------------- */

.btn {
  font: inherit;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: var(--radius-s);
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-row .btn {
  flex: 1 1 140px;
}

/* --- messages ------------------------------------------------------------- */

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

.error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red-text);
  font-weight: 600;
  font-size: 15px;
}

/* --- step 2: camera preview + mic ------------------------------------------ */

.preview {
  position: relative;
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--video-bg);
}

.preview video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--video-bg);
  transform: scaleX(-1); /* mirror: friendlier self-view */
}

.preview-off {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--video-bg);
  color: #ffffff;
  font-weight: 600;
  font-size: 17px;
}

.preview-off p {
  margin: 0;
}

.mic-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  min-height: 24px;
}

.dot-mic {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c2413a;
  flex: none;
}

.dot-mic.on {
  background: #2f9e44;
}

/* --- step 3: waiting ------------------------------------------------------- */

.card-waiting {
  text-align: center;
  gap: 18px;
}

.waiting-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
}

.card-waiting .btn-row {
  justify-content: center;
}

.dots-anim span {
  display: inline-block;
  animation: dot-blink 1.2s infinite;
}

.dots-anim span:nth-child(2) {
  animation-delay: 0.2s;
}

.dots-anim span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-blink {
  0%,
  60%,
  100% {
    opacity: 0.15;
  }
  30% {
    opacity: 1;
  }
}

/* --- misc ------------------------------------------------------------------- */

.noscript {
  margin: 16px auto;
  max-width: 540px;
  padding: 12px 16px;
  border-radius: var(--radius-s);
  background: var(--yellow);
  color: var(--yellow-text);
  font-weight: 600;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 379px) {
  body {
    padding: 10px;
  }

  .card {
    padding: 16px;
    border-radius: 18px;
  }

  .btn-row .btn {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
