/* ── Reset / base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0a;
  --surface:   #141414;
  --surface2:  #1e1e1e;
  --border:    #2a2a2a;
  --text:      #e4e4e4;
  --muted:     #6b6b6b;
  --accent:    #c8a96e;
  --danger:    #e05252;
  --green:     #4caf73;
  --sidebar-w: 220px;
  --topbar-h:  48px;
  --radius:    6px;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input, select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }
select option { background: var(--surface2); }

/* ── Pre-join ──────────────────────────────────────────────────────────── */
#prejoin {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.prejoin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}

.prejoin-logo {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.prejoin-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.prejoin-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius);
  transition: opacity .15s;
  margin-top: 8px;
}
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .4; cursor: default; }

/* ── Room shell ─────────────────────────────────────────────────────────── */
#room {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.room-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.room-brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

#my-name-label {
  font-size: 12px;
  color: var(--muted);
}

/* ── Room body: sidebar + main ──────────────────────────────────────────── */
.room-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Left sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 14px 16px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Participant rows */
.peer-entry {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .1s;
}
.peer-entry:hover { background: var(--surface2); }

.peer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  position: relative;
}

/* Speaking ring */
.peer-avatar.speaking {
  box-shadow: 0 0 0 2px var(--green);
}

.peer-info {
  flex: 1;
  min-width: 0;
}

.peer-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-status {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.mic-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mic-indicator.active   { background: var(--green); }
.mic-indicator.speaking { background: var(--green); box-shadow: 0 0 0 2px rgba(76,175,115,.3); }
.mic-indicator.muted    { background: var(--border); }

/* ── Video column ───────────────────────────────────────────────────────── */
.video-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background: var(--bg);
  padding: 20px;
  gap: 0;
}

.video-stage {
  width: 100%;
  max-width: 1060px;
}

#player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

#video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#waiting-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.waiting-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .3; transform: scale(1); }
  50%       { opacity: 1;  transform: scale(1.4); }
}

.waiting-label { font-size: 13px; letter-spacing: .04em; }

/* ── Control bar ────────────────────────────────────────────────────────── */
.control-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  width: 100%;
  max-width: 1060px;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  height: 40px;
}

.ctrl-divider { flex: 1; }

#stream-vol {
  -webkit-appearance: none;
  width: 80px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  border: none;
  padding: 0;
  cursor: pointer;
}
#stream-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
#stream-vol:focus { outline: none; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  font-size: 15px;
  transition: background .1s, color .1s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface2); }
.icon-btn.muted { color: var(--danger); }

.ctrl-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: .04em;
}

/* ── Notes panel ───────────────────────────────────────────────────────── */
.notes-panel {
  width: 100%;
  max-width: 1060px;
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.notes-header button {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  transition: color .1s, border-color .1s;
}
.notes-header button:hover { color: var(--danger); border-color: var(--danger); }

.notes-input-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.notes-input-row input {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  width: auto;
}
.notes-input-row input:focus { outline: none; background: rgba(255,255,255,.03); }

#note-spot  { width: 200px; flex-shrink: 0; }

.note-time-wrap {
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.note-time-colon {
  padding: 0 4px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
#note-time {
  width: 44px;
  border-right: none;
  padding-left: 2px;
}

#note-text {
  flex: 1;
  border-right: none;
}

#note-add-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 700;
  font-size: 12px;
  border-radius: 5px;
  margin-left: 8px;
  transition: opacity .15s;
}
#note-add-btn:hover { opacity: .85; }

/* Notes list */
#notes-list {
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 0;
}

.note-row {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding: 5px 14px;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  line-height: 1.4;
}
.note-row:last-child { border-bottom: none; }

.note-spot {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  margin-right: 10px;
}
.note-pipe   { color: var(--border); margin: 0 6px; }
.note-tc     { color: var(--muted); font-weight: 600; white-space: nowrap; }
.note-body   { color: var(--text); flex: 1; }
.note-author { color: var(--muted); font-size: 11px; margin-left: 10px; white-space: nowrap; }

/* ── Draw canvas ────────────────────────────────────────────────────────── */
#draw-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* off by default — enabled when draw mode active */
  z-index: 5;
}

#draw-canvas.active {
  pointer-events: all;
  cursor: crosshair;
}

.icon-btn.draw-active {
  color: #e05252;
  background: rgba(224, 82, 82, .15);
}

/* ── Fullscreen ─────────────────────────────────────────────────────────── */
#player-wrap:fullscreen,
#player-wrap:-webkit-full-screen {
  border-radius: 0;
  max-width: unset;
  aspect-ratio: unset;
  width: 100vw;
  height: 100vh;
}
