/* Self-contained: no external font fetch (the viewer is also bundled offline in
   the app). Uses the platform UI font, with Outfit/Inter honored if installed. */
:root {
  --bg: #090a0f;
  --panel: #131520;
  --panel-border: rgba(255, 255, 255, 0.08);
  --primary: #6366f1; /* Indigo matching the logo */
  --primary-hover: #4f46e5;
  --secondary: #06b6d4; /* Teal matching the logo */
  --ok: #10b981;
  --bad: #ef4444;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.title {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #a5b4fc, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.badge.off {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.on {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.wait {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

input, select, button {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

select option {
  background-color: #131520;
  color: #f3f4f6;
}

button {
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

button:active {
  transform: translateY(1px);
}

#connectBtn, #joinBtn {
  padding-left: 24px;
  padding-right: 24px;
}

.hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 12px;
  line-height: 1.6;
}

details {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  margin-top: 16px;
}

details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  outline: none;
}

.hidden {
  display: none !important;
}

#toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

#toolbar button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  box-shadow: none;
  padding: 8px 12px;
  color: #fff;
}

#toolbar button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

#toolbar .spacer {
  flex: 1;
}

#videoWrap {
  position: relative;
  width: 100%;
  background: #000 url('icon.svg') center/80px no-repeat;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.8);
}

#video {
  max-width: 100%;
  max-height: 80vh;
  display: block;
}

#inputLayer {
  position: absolute;
  inset: 0;
  outline: none;
  cursor: pointer !important;
}

#stats {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  padding: 10px 14px;
  border-radius: 10px;
  font: 12px/1.5 'JetBrains Mono', monospace;
  color: #34d399;
  box-shadow: var(--shadow);
}

#banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(19, 21, 32, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  padding: 16px 24px;
  border-radius: 16px;
  font-weight: 600;
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 90%;
}

/* ---------- Remote connect panel (remote.html) ---------- */
.connect-card {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.connect-title {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 2px;
}

.connect-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.field .opt {
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.8;
}

.field input {
  width: 100%;
}

#room {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  text-align: center;
}

.btn-block {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  margin-top: 4px;
}

.advanced {
  margin-top: 16px;
}

.advanced .row {
  gap: 8px;
}

.advanced .row input {
  flex: 1;
  min-width: 0;
}

/* ---------- Toolbar buttons (labeled) ---------- */
#toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

#toolbar button .ico {
  font-size: 15px;
  line-height: 1;
}

#toolbar button .lbl {
  font-size: 13px;
}

#reconnectBtn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: #fff;
}

/* ---------- Control help ---------- */
.control-help {
  margin-top: 14px;
}

.control-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
}

.control-help-list {
  list-style: none;
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 20px;
}

.control-help-list li {
  font-size: 13px;
  color: var(--text-muted);
}

.control-help-list strong {
  color: var(--text);
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  #app { padding: 16px 12px; gap: 16px; }
  header { padding: 12px 14px; }
  .title { font-size: 20px; }
  section { padding: 18px 16px; }
  #toolbar button .lbl { display: none; }
  #toolbar button { padding: 10px; min-width: 40px; justify-content: center; }
  #video { max-height: 70vh; }
}
