:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --text: #e7e9ee;
  --muted: #9aa0ad;
  --accent: #4f7cff;
  --error: #ff6b6b;
  --border: #262a33;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.muted { color: var(--muted); }

/* ---- login page ---- */

.center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.card .muted { margin: 0 0 1.5rem; font-size: 0.95rem; }

form { display: flex; flex-direction: column; gap: 1rem; }

input[type="text"],
input[type="password"] {
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

button {
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover { filter: brightness(1.1); }

.turnstile { min-height: 65px; }
.error { color: var(--error); margin: 0; font-size: 0.9rem; }

/* ---- watch page ---- */

.watch {
  display: flex;
  height: 100vh;
}

.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: black;
  min-width: 0;
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.offline {
  position: absolute;
  text-align: center;
  padding: 2rem;
}
.offline p { margin: 0.25rem 0; }

.unmute {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  padding: 0.6rem 1.25rem;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
}

.chat {
  width: 320px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--panel);
}

.chat-head {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.chat-head button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  padding: 0.5rem;
}

.viewer-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  max-height: 30vh;
  overflow-y: auto;
}
.viewer-list li { padding: 0.2rem 0; color: var(--muted); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.msg { font-size: 0.95rem; line-height: 1.35; word-wrap: break-word; }
.msg .name { font-weight: 600; color: var(--accent); }
.msg .name.admin { color: #ffcc66; }
.msg .name.admin::after { content: " (admin)"; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.msg.system { color: var(--muted); font-style: italic; font-size: 0.85rem; }

.chat-form {
  flex-direction: row;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.chat-form button { width: auto; padding: 0.6rem 1rem; }

/* On narrow screens, stack the video on top and the chat below it. */
@media (max-width: 720px) {
  .watch { flex-direction: column; }
  .stage { flex: none; height: 40vh; }
  .chat { width: 100%; flex: 1; border-left: none; border-top: 1px solid var(--border); }
}
