/* ---------------------------------------------------------------
   Tokens
   ---------------------------------------------------------------
   Palette:
     --bg        #0B0A0D  near-black, the "house lights down" backdrop
     --bg-raised #151222  deep violet-black, panels/cards
     --line      #2A2433  hairline borders on --bg-raised
     --ink       #EDEAE6  primary text, warm off-white
     --ink-dim   #9C97A3  secondary text
     --amber     #E8A33D  projector-light accent: host controls, play state
     --teal      #4FD1C5  signal accent: live sync / watcher presence
     --danger    #E2596B  errors, disconnects
   Type:
     Display : "Fraunces" (marquee/ticket feel, used sparingly, headlines only)
     Body    : "Inter" (UI chrome, everything readable)
     Mono    : "JetBrains Mono" (room codes, timestamps — ticket-stub feel)
   Signature: a film-strip perforation rule (--filmstrip) framing the video
   stage and major panel edges, standing in for a literal border.
------------------------------------------------------------------ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --bg: #0B0A0D;
  --bg-raised: #151222;
  --bg-raised-2: #1B1726;
  --line: #2A2433;
  --ink: #EDEAE6;
  --ink-dim: #9C97A3;
  --amber: #E8A33D;
  --amber-dim: #4A3A20;
  --teal: #4FD1C5;
  --danger: #E2596B;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: inherit; }

.mono {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

/* Film-strip perforation rule — the signature element.
   A repeating pair of notches above/below a panel, standing in for
   sprocket holes on a reel of film. */
.filmstrip-edge {
  position: relative;
  height: 14px;
  background:
    radial-gradient(circle at 10px 7px, var(--bg) 4px, transparent 4.5px) repeat-x;
  background-size: 24px 14px;
  background-color: var(--bg-raised-2);
}

::selection {
  background: var(--amber-dim);
  color: var(--ink);
}

button {
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
}

input, textarea {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

/* ---------------- Home / landing page ---------------- */

.home-wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 20px 40px;
}

.marquee {
  text-align: center;
  max-width: 640px;
  margin-bottom: 40px;
}

.marquee .eyebrow {
  color: var(--amber);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 14px;
}

.marquee h1 {
  font-size: clamp(32px, 5vw, 52px);
  margin: 0 0 12px;
  line-height: 1.05;
}

.marquee p {
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 780px;
}

@media (max-width: 640px) {
  .panels { grid-template-columns: 1fr; }
}

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-body {
  padding: 22px;
}

.panel h2 {
  font-size: 18px;
  margin: 0 0 6px;
}

.panel .sub {
  color: var(--ink-dim);
  font-size: 13px;
  margin: 0 0 18px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

.field input, .field select {
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn-amber {
  background: var(--amber);
  color: #1A1206;
}

.btn-amber:hover { background: #F0AE49; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

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

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

.error-text.show { display: block; }

/* ---------------- Room page ---------------- */

.room-wrap {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  gap: 16px;
  flex-wrap: wrap;
}

.room-title {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-dim);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-dim);
}

.dot.live { background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.dot.host { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

.room-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 860px) {
  .room-body { grid-template-columns: 1fr; }
  .chat-panel { border-top: 1px solid var(--line); }
}

.stage-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.stage {
  background: #000;
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
}

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

.controls-bar {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

.controls-bar.disabled {
  opacity: 0.55;
}

.controls-bar .note {
  font-size: 12px;
  color: var(--ink-dim);
}

.icon-btn {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.seek-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.seek-row input[type="range"] {
  flex: 1;
  accent-color: var(--amber);
}

.time-label {
  font-size: 12px;
  color: var(--ink-dim);
  min-width: 44px;
}

.change-video-row {
  padding: 0 20px 16px;
  display: flex;
  gap: 10px;
}

.change-video-row input { flex: 1; }
.change-video-row button { width: auto; padding: 0 16px; }

.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  min-height: 0;
}

.watchers-bar {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  font-size: 13px;
  line-height: 1.4;
}

.chat-msg .from {
  font-weight: 600;
  margin-right: 6px;
}

.chat-msg .from.host { color: var(--amber); }
.chat-msg .from.watcher { color: var(--teal); }

.chat-msg.system {
  color: var(--ink-dim);
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat-input-row input { flex: 1; }

.chat-input-row button {
  width: 44px;
  border-radius: 6px;
  background: var(--teal);
  color: #06201D;
  font-weight: 600;
}
