:root {
  --ink: #1B2123;
  --house: #26302F;
  --paper: #EDE4D3;
  --muted: #8E9A97;
  --beam: #9ED9E6;
  --alarm: #E0788A;
  --line: rgba(237, 228, 211, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 1rem/1.5 "Bricolage Grotesque", system-ui, sans-serif;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 1.5rem 16px 3rem; }

.top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-stretch: 75%; font-size: 1.5625rem; letter-spacing: 0.01em; color: var(--paper); text-decoration: none; }
.muted { color: var(--muted); }

h1 { font-weight: 700; font-stretch: 75%; font-size: 2rem; line-height: 1.1; margin: 0 0 1rem; }
p { max-width: 60ch; margin: 0 0 1rem; }

/* The screen: the one memorable element. Its glow follows playback state. */
.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--house);
  border-radius: 6px;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
  transition: box-shadow 0.6s ease;
  animation: light-up 0.6s ease-out both;
}
.screen.playing {
  box-shadow: 0 0 0 1px var(--beam), 0 0 64px -8px rgba(158, 217, 230, 0.4);
}
@keyframes light-up { from { opacity: 0; } to { opacity: 1; } }

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

.screen .inside { position: absolute; inset: 0; padding: clamp(1rem, 4vw, 2.5rem); display: flex; flex-direction: column; justify-content: flex-end; }

.clock {
  font-weight: 700;
  font-stretch: 75%;
  font-size: clamp(3rem, 14vw, 6rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

form.field { display: flex; flex-direction: column; gap: 0.75rem; max-width: 34rem; }
label { color: var(--muted); font-size: 0.875rem; }

input[type=text], input[type=url], select {
  min-height: 44px;
  padding: 0 0.75rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--muted);
  border-radius: 4px;
  font: inherit;
  min-width: 0;
  flex: 1;
}

.btn, button {
  min-height: 44px;
  padding: 0 1.1rem;
  background: var(--house);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 600 1rem/1 "Bricolage Grotesque", system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn:hover, button:hover { border-color: var(--paper); }
button.primary, .btn.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }

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

.error { color: var(--alarm); margin: 0 0 0.75rem; }

.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.controls input[type=text] { flex: 0 0 8rem; }

.notice { margin-top: 1rem; }

/* Invite and video: the ticket. A dashed edge marks it as the way in. */
.ticket { margin-top: 2rem; padding-top: 1.25rem; border-top: 2px dashed var(--line); display: grid; gap: 0.75rem; }
.ticket .row { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 0.75rem; align-items: center; }
.ticket form.row { margin: 0; }

@media (max-width: 560px) {
  .ticket .row { grid-template-columns: 1fr; }
  .ticket .row > label { margin-bottom: -0.4rem; }
}

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

/* Chat sits beside the screen on wide pages and below it on phones. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.5rem; align-items: start; }
.chat { display: flex; flex-direction: column; gap: 0.75rem; background: var(--house); border-radius: 6px; padding: 1rem; box-shadow: 0 0 0 1px var(--line); }
.chat-head { display: flex; justify-content: space-between; align-items: baseline; }
.chat-log { list-style: none; margin: 0; padding: 0; height: 20rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; }
.chat-msg { display: flex; flex-direction: column; max-width: 90%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-meta { font-size: 0.8125rem; }
.chat-text { overflow-wrap: anywhere; }
.chat-msg.mine .chat-text { color: var(--beam); }
.chat-form, .chat-name { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chat-form input, .chat-name input { flex: 1; min-width: 0; }
.chat-name label { flex: 0 0 100%; }
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .chat-log { height: 14rem; }
}

/* Camera tiles: one per person in the room. */
.tiles { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.tile { position: relative; width: 10rem; aspect-ratio: 4 / 3; background: var(--house); border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile.local video { transform: scaleX(-1); }
.tile .off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.875rem; }
.tile-name { position: absolute; left: 0.5rem; bottom: 0.4rem; font-size: 0.8125rem; text-shadow: 0 1px 3px #000; }
button[aria-pressed="true"] { border-color: var(--beam); color: var(--beam); }
@media (max-width: 560px) { .tile { width: calc(50% - 0.375rem); } }

/* Home page: videos you can start watching in one click. */
.library { margin-top: 1.75rem; }
.library h2 { font-weight: 700; font-stretch: 75%; font-size: 1.5625rem; line-height: 1.1; margin: 0 0 0.5rem; }
.library ul { list-style: none; margin: 0; padding: 0; }
.library li { border-top: 1px solid var(--line); }
.library li:last-child { border-bottom: 1px solid var(--line); }
.library form { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0; }
.library .lib-name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
