:root {
  --bg: #0a0c10;
  --panel: #141821;
  --line: #262c39;
  --text: #e6e9f0;
  --muted: #838ea3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.hidden { display: none !important; }

/* ---------- join screen ---------- */

#join {
  text-align: center;
  padding-top: clamp(24px, 6vh, 56px);
  max-width: 560px;
}

/* Additive mixing, shown rather than explained: screen blending on a dark
   ground turns the three overlaps into yellow, magenta and cyan. */
.venn {
  position: relative;
  width: 200px;
  height: 176px;
  margin: 0 auto 28px;
  isolation: isolate;
}

.blob {
  position: absolute;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: drift 9s ease-in-out infinite;
}
.blob.r { background: #ff2020; top: 0; left: 42px; }
.blob.g { background: #18e03c; top: 60px; left: 0; animation-delay: -3s; }
.blob.b { background: #2b5bff; top: 60px; left: 84px; animation-delay: -6s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(6px, -5px); }
}

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

#join h1 {
  font-size: clamp(30px, 7vw, 50px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}

.tagline {
  color: var(--muted);
  margin: 0 auto 34px;
  max-width: 380px;
  line-height: 1.6;
}

#join-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(330px, 100%);
  margin: 0 auto;
}

.actions { display: flex; gap: 10px; }
.actions button[type="submit"] { flex: 1; }

.icon {
  font-size: 19px;
  line-height: 1;
  padding: 13px 15px;
  color: var(--text);
}

#join-form label {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

#room {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 30px;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 10px 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  user-select: text;
}
#room:focus { outline: 2px solid #4c6ef5; outline-offset: 2px; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 13px 18px;
  background: #4c6ef5;
  color: #fff;
  font-weight: 600;
}
button:hover { filter: brightness(1.1); }

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  font-weight: 500;
}
.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

.error { color: #ff7a7a; min-height: 22px; margin: 14px 0 0; }

/* Doubles as the cheat sheet for the code you're designing. */
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 9px 14px;
  list-style: none;
  max-width: 400px;
  margin: 30px auto 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
}

.legend b {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 600;
  color: var(--text);
}

.chip {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  flex: none;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  max-width: 400px;
  margin: 26px auto 0;
}

/* ---------- lightbox screen ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.room-tag { color: var(--muted); letter-spacing: 0.14em; }
.room-tag strong {
  color: var(--text);
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.2em;
  user-select: text;
}

.status { margin-left: auto; }
.status.waiting { color: #ffc65c; }
.status.ready { color: #55d98a; }
.status.lost { color: #ff7a7a; }

.lamps {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(20px, 6vw, 64px);
  padding: 30px 0 26px;
}

.lamp-wrap { text-align: center; }

.lamp-wrap h2 {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 14px;
}

.lamp {
  width: clamp(160px, 38vw, 240px);
  height: clamp(160px, 38vw, 240px);
  border-radius: 50%;
  background: #14171e;
  border: 1px solid var(--line);
}
.lamp.small {
  width: clamp(80px, 18vw, 110px);
  height: clamp(80px, 18vw, 110px);
}

.lamp-name {
  margin-top: 12px;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 18px;
}

.keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 540px;
  margin: 0 auto;
}

.key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 60ms linear, color 60ms linear, border-color 60ms linear;
}
.key span {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.key.red.on   { background: #e02020; border-color: #ff6b6b; color: #fff; }
.key.green.on { background: #12b431; border-color: #5ef08a; color: #04240c; }
.key.blue.on  { background: #2352f0; border-color: #7d9bff; color: #fff; }
.key.on span { color: inherit; }
