* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  background: #14171c;
  color: #e6e9ef;
  min-height: 100vh;
}
.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: #1b2027;
  border-bottom: 1px solid #262c35;
}
.brand { font-weight: 700; font-size: 19px; letter-spacing: 0.3px; }
.brand span { color: #4f8cff; }
.status { font-size: 13px; padding: 4px 12px; border-radius: 12px; }
.status.online { background: #14351f; color: #4fd67a; }
.status.offline { background: #3a2a14; color: #ffb35c; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 18px;
  padding: 22px;
  max-width: 1100px;
  margin: 0 auto;
}
.card {
  background: #1b2027;
  border: 1px solid #262c35;
  border-radius: 12px;
  padding: 20px 22px;
}
.info-card { max-width: 1100px; margin: 0 auto 28px; }
h2 { margin: 0 0 6px; font-size: 14px; color: #9aa4b2; text-transform: uppercase; letter-spacing: 0.6px; }
h3 { margin: 0 0 10px; font-size: 13px; color: #9aa4b2; }
.hint { font-size: 13px; color: #7a8394; margin: 0 0 16px; }
.note { font-size: 12px; color: #7a8394; margin: 12px 0 0; min-height: 16px; }
.note.error { color: #ff8e8e; }

.pin-box { display: flex; align-items: center; gap: 12px; }
.pin {
  flex: 1;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 9px;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "SF Mono", monospace;
  background: #10141a;
  border: 1px solid #2c333f;
  border-radius: 10px;
  padding: 10px 6px 10px 15px;
  text-align: center;
  cursor: pointer;
  user-select: all;
}
.pin.copied { border-color: #1f9d55; color: #6ee7a0; }
.copy-btn { background: #2a313c; padding: 12px 16px; }
.copy-btn:hover { background: #343c49; }

.countdown { height: 4px; background: #10141a; border-radius: 3px; overflow: hidden; margin-top: 14px; }
.countdown-bar { height: 100%; width: 100%; background: #2a5bd7; transition: width 1s linear; }
.pin-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: #7a8394; }
.link-btn { background: none; color: #6f9bff; padding: 2px 0; font-size: 12px; }
.link-btn:hover { background: none; text-decoration: underline; }

.pin-input {
  width: 100%;
  background: #10141a;
  border: 1px solid #2c333f;
  color: #e6e9ef;
  border-radius: 10px;
  padding: 14px;
  font-size: 30px;
  letter-spacing: 8px;
  text-align: center;
  font-family: Consolas, "SF Mono", monospace;
  margin-bottom: 14px;
}
.pin-input:focus { outline: none; border-color: #2a5bd7; }

button {
  background: #2a5bd7;
  color: #fff;
  border: none;
  padding: 9px 15px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  white-space: nowrap;
}
button:hover { background: #3568e6; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: default; }
button.big { width: 100%; padding: 13px; font-size: 15px; font-weight: 600; }
button.primary { background: #1f9d55; }
button.primary:hover { background: #23b562; }
button.secondary { background: #2a313c; }
button.secondary:hover { background: #343c49; }
button.danger { background: #b93838; }
button.danger:hover { background: #cf4242; }

ul { margin: 0; padding-left: 20px; font-size: 13px; color: #c3cad6; line-height: 1.8; }
.log {
  margin-top: 14px;
  font-size: 12px;
  color: #8b94a3;
  max-height: 120px;
  overflow-y: auto;
  font-family: Consolas, monospace;
  line-height: 1.6;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 16px;
}
.modal-box {
  background: #1b2027;
  border: 1px solid #2f3a52;
  border-radius: 12px;
  padding: 26px 28px;
  max-width: 420px;
  text-align: center;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.modal-actions button { min-width: 130px; padding: 11px; }

.host-bar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #1b2027;
  border: 1px solid #2f3a52;
  border-radius: 30px;
  padding: 9px 11px 9px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  z-index: 20;
  font-size: 13px;
}
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff5252; box-shadow: 0 0 8px #ff5252; }

.screen.viewer { display: flex; flex-direction: column; height: 100vh; }
.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  background: #1b2027;
  border-bottom: 1px solid #262c35;
}
.viewer-toolbar .spacer { flex: 1; }
#viewer-peer-name { font-size: 13px; color: #9aa4b2; }
.badge { font-size: 11px; background: #14351f; color: #4fd67a; padding: 3px 9px; border-radius: 10px; }
.quality-readout { font-size: 12px; color: #7a8394; font-variant-numeric: tabular-nums; }

.viewer-body { flex: 1; display: flex; min-height: 0; background: #000; }
.video-wrap { flex: 1; position: relative; min-width: 0; }
#remote-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; outline: none; }
.video-wrap.actual-size { overflow: auto; }
.video-wrap.actual-size #remote-video { width: var(--video-w); height: var(--video-h); max-width: none; object-fit: fill; margin: auto; }
.video-wait {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7a8394;
  pointer-events: none;
}
