:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #1d4ed8;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
}

* {
  box-sizing: border-box;
}

/* Several things here are hidden by the `hidden` attribute and laid out with
   flex, and a `display` rule beats the attribute. Settle it once. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.5rem 0.9rem;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

button.primary:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
  cursor: not-allowed;
}

button.big {
  padding: 0.9rem 1.2rem;
  font-size: 1.1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="text"],
input:not([type]) {
  font: inherit;
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* --- student ------------------------------------------------------------ */

body.student {
  background: #f8fafc;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.card {
  width: min(28rem, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.6rem;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.06);
}

.card h1 {
  margin: 0 0 1.2rem;
  font-size: 1.4rem;
}

.card input {
  font: inherit;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.lead {
  margin: -0.6rem 0 1.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.who {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  margin: 1rem 0 0;
  min-height: 1.5em;
  font-size: 0.95rem;
  color: var(--muted);
}

.status.live {
  color: var(--ok);
  font-weight: 600;
}

.status.wait {
  color: var(--warn);
}

.status.bad {
  color: var(--bad);
}

.help {
  margin-top: 1.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.help summary {
  cursor: pointer;
}

.help ul {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
}

.help li + li {
  margin-top: 0.4rem;
}

/* --- display ------------------------------------------------------------ */

body.display {
  background: #0f172a;
  color: #e2e8f0;
  height: 100vh;
  overflow: hidden;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 20rem;
  height: 100vh;
}

.stage {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: none;
}

.stage.live #video {
  display: block;
}

.stage.live .join {
  display: none;
}

.join {
  text-align: center;
  padding: 2rem;
}

.join-lead {
  margin: 0;
  color: #94a3b8;
  font-size: clamp(1rem, 2vw, 1.5rem);
}

.join-url {
  margin: 0.4rem 0 1.6rem;
  font-size: clamp(1.4rem, 3.4vw, 3rem);
  font-weight: 700;
  color: #fff;
  word-break: break-all;
}

.join-code {
  margin: 0.4rem 0 1.4rem;
  font-size: clamp(3rem, 9vw, 8rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fbbf24;
  line-height: 1;
}

.join-qr {
  width: 9rem;
  height: 9rem;
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem;
}

.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.75));
  opacity: 0;
  transition: opacity 0.2s;
}

.stage:hover .overlay {
  opacity: 1;
}

.live-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

.path {
  color: #94a3b8;
  font-size: 0.85rem;
  margin-right: auto;
}

button.ghost {
  background: rgb(255 255 255 / 0.1);
  border-color: rgb(255 255 255 / 0.25);
  color: #e2e8f0;
}

button.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.side {
  background: #111c34;
  border-left: 1px solid #1e293b;
  padding: 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.side h1 {
  margin: 0;
  font-size: 1.1rem;
}

.side h2 {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.code-line {
  margin: 0.2rem 0 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

.code-line strong {
  color: #fbbf24;
  letter-spacing: 0.1em;
}

.side .check {
  color: #cbd5e1;
  font-size: 0.85rem;
}

.peers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.peers li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #1e293b;
  border-radius: 9px;
  background: #0f172a;
}

.peers li.empty {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
  border-style: dashed;
}

/* A student's name gets the whole first line -- it is what the instructor is
   reading -- and the state and the button sit under it. */
.peers .name {
  flex: 1 1 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.peers .tag {
  margin-right: auto;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.peers li.ready .tag {
  color: #fbbf24;
}

.peers li.live {
  border-color: #15803d;
}

.peers li.live .tag {
  color: #4ade80;
}

.side footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: #64748b;
}

.net,
.hint,
.warn {
  margin: 0.4rem 0 0;
}

.warn {
  color: #fbbf24;
}
