@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1b1f26;
  --line: #262b33;
  --text: #e8eaed;
  --text-dim: #8b93a1;
  --live: #ff3b3b;
  --live-dim: #4a1414;
  --accent: #ffb020;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.console {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------- header ---------- */
.console__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  font-weight: 600;
  font-size: 13px;
}

.brand__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  display: inline-block;
}

.brand__dot.live {
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.6);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(255, 59, 59, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0); }
}

#statusLabel.live { color: var(--live); }

.viewers {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}

#viewerCount { color: var(--text); font-weight: 600; }

/* ---------- main layout ---------- */
.console__main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 0;
}

/* ---------- stage / video ---------- */
.stage {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.stage__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  gap: 6px;
  pointer-events: none;
}

.stage__hint {
  font-size: 13px;
  color: #5a6270;
}

.unmute {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}

.unmute:hover { background: var(--line); }

/* ---------- chat ---------- */
.chat {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  min-height: 0;
}

.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat__msg {
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat__msg .who {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  margin-right: 6px;
}

.chat__msg .time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #4d5563;
  margin-right: 6px;
}

.chat__msg.system {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.chat__form {
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  position: relative;
}

.chat__row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.chat__row:last-of-type { margin-bottom: 0; }

.chat__name {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 2px;
}

.chat__name:focus { color: var(--text); outline: none; }

.chat__emojiToggle {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.chat__emojiToggle:hover { background: var(--line); }

.chat__input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}

.chat__input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat__send {
  background: var(--accent);
  color: #1a1200;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.chat__send:hover { filter: brightness(1.08); }
.chat__send:active { filter: brightness(0.95); }

/* ---------- emoji picker ---------- */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 12px;
  margin-bottom: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  width: 260px;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.emoji-picker button {
  background: none;
  border: none;
  font-size: 18px;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
}

.emoji-picker button:hover { background: var(--line); }

/* ---------- scrollbars ---------- */
.chat__log::-webkit-scrollbar,
.emoji-picker::-webkit-scrollbar { width: 8px; }
.chat__log::-webkit-scrollbar-thumb,
.emoji-picker::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* ---------- responsive ---------- */
@media (max-width: 800px) {
  .console__main {
    grid-template-columns: 1fr;
    grid-template-rows: 40vh 1fr;
  }
  .chat {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}