* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1b1d22;
  --bg2: #24272e;
  --bg3: #2e323a;
  --fg: #e6e8ec;
  --muted: #9aa0ab;
  --accent: #4f8cff;
  --danger: #e5534b;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---- Login ---- */
#login-screen {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 12px;
  padding: 36px 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box h1 { font-size: 22px; }
.login-box .sub { color: var(--muted); margin-bottom: 8px; }
.login-box input {
  background: var(--bg);
  border: 1px solid var(--bg3);
  border-radius: 8px;
  color: var(--fg);
  padding: 10px 12px;
  outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-box button {
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  padding: 10px;
}
.login-box .error { color: var(--danger); min-height: 18px; }

/* ---- Layout ---- */
#app { height: 100%; display: flex; flex-direction: column; }

#topbar {
  display: flex;
  align-items: flex-end;
  background: var(--bg);
  padding: 6px 8px 0;
  gap: 8px;
}

#tabs-strip {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  gap: 4px;
}

#tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: thin;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 7px 10px;
  max-width: 200px;
  min-width: 90px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.tab.active { background: var(--bg3); border-color: var(--accent); }
.tab .title {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  font-size: 13px;
}
.tab .viewers { font-size: 11px; color: var(--muted); }
.tab .close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  border-radius: 4px;
}
.tab .close:hover { color: var(--danger); background: rgba(229,83,75,.15); }

#new-tab {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 8px;
  color: var(--fg);
  cursor: pointer;
  font-size: 16px;
  padding: 5px 12px;
  margin-bottom: 2px;
}
#new-tab:hover { background: var(--bg3); }

/* ---- Presenca ---- */
#presence {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #1b1d22;
  cursor: default;
  border: 2px solid transparent;
}
.avatar.me { border-color: #fff; }

/* ---- Barra de navegacao ---- */
#navbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  padding: 6px 8px;
}
#navbar button {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 6px;
  color: var(--fg);
  cursor: pointer;
  padding: 5px 10px;
}
#navbar button:hover { background: var(--bg); }
#address {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--bg3);
  border-radius: 999px;
  color: var(--fg);
  outline: none;
  padding: 7px 14px;
}
#address:focus { border-color: var(--accent); }
#viewer-names { color: var(--muted); font-size: 12px; padding-right: 8px; }

/* ---- Palco ---- */
#stage-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #101114;
  padding: 12px;
}
#stage {
  position: relative;
  box-shadow: 0 4px 30px rgba(0,0,0,.5);
  outline: none;
}
#screen {
  display: block;
  background: #fff;
  cursor: crosshair;
}
#no-tab {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg2);
}

/* ---- Cursores remotos ---- */
#cursors { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rcursor {
  position: absolute;
  transform: translate(-2px, -2px);
  transition: left .06s linear, top .06s linear;
  z-index: 10;
}
.rcursor svg { display: block; }
.rcursor .label {
  position: absolute;
  left: 14px;
  top: 14px;
  color: #1b1d22;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
