/*
 * Design rules, and the reasons for them:
 *
 *  - Body text starts at 20px. The primary users are a 75-year-old teacher and
 *    a child. Nothing here is smaller than 16px, ever.
 *  - One primary button per screen, and it is enormous. If a person has to
 *    choose which thing to click, the screen has already failed.
 *  - No icon means anything on its own. Every control is labelled in words.
 *  - Colour never carries information by itself; there is always text too.
 */

:root {
  --ink: #16202b;
  --ink-soft: #5a6b7c;
  --line: #dfe6ed;
  --page: #f6f8fa;
  --card: #ffffff;

  --go: #1a7f4b;
  --go-dark: #146b3f;
  --warn: #a5601a;
  --stop: #b3261e;

  --radius: 14px;
  --shadow: 0 1px 3px rgba(22, 32, 43, .08), 0 8px 24px rgba(22, 32, 43, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  font: 20px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ---------------------------------------------------------------- header */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.masthead h1 {
  font-size: 26px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -.01em;
}

.masthead .who {
  color: var(--ink-soft);
  font-size: 17px;
}

/* ------------------------------------------------------------ the big card */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 20px;
}

.card--hero { text-align: center; padding: 40px 32px; }

.card__label {
  font-size: 17px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin: 0 0 10px;
}

.card__headline {
  font-size: 30px;
  font-weight: 650;
  margin: 0 0 6px;
  letter-spacing: -.015em;
}

.card__when { font-size: 22px; color: var(--ink-soft); margin: 0 0 28px; }

/* The student's own clock, shown only when it differs from the reader's. */
.card__theirs {
  font-size: 18px;
  color: var(--warn);
  margin: -20px 0 26px;
}

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

.btn {
  display: block;
  width: 100%;
  padding: 26px 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--go);
  color: #fff;
  font-size: 26px;
  font-weight: 650;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}

.btn:hover { background: var(--go-dark); }
.btn:active { transform: translateY(1px); }

.btn:focus-visible {
  outline: 4px solid #7fb6ff;
  outline-offset: 3px;
}

/* A closed door explains itself rather than looking broken. */
.btn[aria-disabled='true'] {
  background: #e3e8ed;
  color: var(--ink-soft);
  cursor: default;
  pointer-events: none;
}

.btn--quiet {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
  font-size: 20px;
  padding: 16px 20px;
}

.btn--quiet:hover { background: #eef2f6; }

/* ------------------------------------------------------------ green tick */

.devicecheck {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  font-size: 18px;
  color: var(--ink-soft);
  min-height: 28px;
}

.devicecheck__dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #c6ced6;
  flex: none;
}

.devicecheck.is-ok    .devicecheck__dot { background: var(--go); }
.devicecheck.is-ok    { color: var(--go); }
.devicecheck.is-bad   .devicecheck__dot { background: var(--stop); }
.devicecheck.is-bad   { color: var(--stop); text-align: left; }

/* ------------------------------------------------------------- students */

.section-title {
  font-size: 17px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin: 36px 0 14px;
}

.student {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
}

.student__row {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* The parent's link, shown in full rather than copied invisibly. */
.student__panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.student__panel-help {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.student__url {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  color: var(--ink);
  background: var(--page);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

.student__panel-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.student__name { font-size: 22px; font-weight: 600; margin: 0; }
.student__when { font-size: 17px; color: var(--ink-soft); margin: 2px 0 0; }
.student__actions { margin-left: auto; display: flex; gap: 10px; flex: none; }

.linkbtn {
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.linkbtn:hover { background: #eef2f6; }

/* ---------------------------------------------------------- lesson room */

/*
 * The room is the one full-bleed screen. Video sits beside the whiteboard on a
 * laptop; on a narrow screen the whiteboard wins the space, because that is
 * where the teaching actually happens.
 */
body.room { height: 100vh; overflow: hidden; background: #0f1720; }

/*
 * The room gets its own slim bar rather than a floating button.
 *
 * Excalidraw claims all four corners of its canvas for tools, so anything of
 * ours that floats on top will sooner or later sit under the teacher's finger
 * when she means to pick up the pen. A reserved 52px strip costs almost no
 * drawing space and can never collide with anything.
 */
.room__bar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: #16202b;
  color: #fff;
  border-bottom: 1px solid #24313f;
}

.room__bar strong { font-size: 18px; font-weight: 600; }

/* Early, calm, and never a surprise -- it appears five minutes before the
   video switches itself off. */
.room__warning {
  margin-left: auto;
  color: #ffd28a;
  font-size: 17px;
}

.room__warning + .room__exit { margin-left: 16px; }

.room__exit {
  margin-left: auto;
  background: #2b3a4a;
  border: 0;
  border-radius: 9px;
  padding: 11px 20px;
  font-size: 17px;
  font-family: inherit;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.room__exit:hover { background: #3a4c5f; }

.room__grid {
  display: grid;
  grid-template-columns: minmax(280px, 30%) 1fr;
  height: calc(100vh - 52px);
}

.room__video { background: #0f1720; min-width: 0; position: relative; }

/* Sits over the video so a waiting child sees an explanation, not a black
   rectangle with their own face in it. */
.waiting {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #0f1720;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  gap: 10px;
}

.waiting[hidden] { display: none; }

.waiting__title { font-size: 24px; font-weight: 650; margin: 0; }

.waiting__body {
  font-size: 18px;
  line-height: 1.5;
  color: #b8c4d0;
  margin: 0;
  max-width: 34ch;
}

.waiting__body--quiet { color: #7e8c9a; margin-top: 6px; }
.room__board { background: #fff; border-left: 1px solid #24313f; min-width: 0; }
.room__board iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 900px) {
  .room__grid { grid-template-columns: 1fr; grid-template-rows: 34vh 1fr; }
  .room__board { border-left: 0; border-top: 1px solid #24313f; }
}

/* Whiteboard-only mode -- what the iPad opens, so the Pencil gets the
   entire screen and the teacher's face stays on the laptop. */
.room--board-only .room__grid { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.room--board-only .room__video { display: none; }

/* ---------------------------------------------------------------- help */

.help {
  margin-top: 40px;
  text-align: center;
  font-size: 17px;
  color: var(--ink-soft);
}

.help a { color: var(--ink-soft); }

.notice {
  background: #fff8e8;
  border: 1px solid #f0dcb0;
  border-radius: var(--radius);
  padding: 18px 22px;
  font-size: 17px;
  margin-bottom: 20px;
}
