:root {
  color-scheme: dark;
  --bg: #000;
  --panel: rgba(0, 0, 0, 0.48);
  --line: rgba(103, 232, 249, 0.22);
  --line-strong: rgba(103, 232, 249, 0.58);
  --cyan: #67e8f9;
  --teal: #2dd4bf;
  --mint: #a7f3d0;
  --amber: #f59e0b;
  --red: #ef4444;
  --dim: rgba(255, 255, 255, 0.42);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --pad: 14px;
  --rad: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: #fff;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  letter-spacing: 0.02em;
}

body {
  background:
    radial-gradient(circle at 50% 50%, rgba(103,232,249,0.045), transparent 36%),
    radial-gradient(ellipse at 18% 86%, rgba(245,158,11,0.04), transparent 36%),
    #000;
}

/* TOPBAR */
.topbar {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 50;
  pointer-events: none;
}

.brand {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  pointer-events: auto;
  white-space: nowrap;
}

.brand .dim { color: var(--dim); margin-left: 6px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

/* MODE TABS — 10 chips */
.mode-tabs {
  display: flex;
  gap: 4px;
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-tabs button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: rgba(255,255,255,0.5);
  font-family: var(--mono);
  padding: 5px 8px;
  cursor: pointer;
  border-radius: var(--rad);
  backdrop-filter: blur(14px);
  transition: border-color 0.18s, color 0.18s;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 32px;
  justify-content: center;
}

.mode-tabs button b {
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mode-tabs button .tab-key {
  font-size: 9px;
  color: rgba(255,255,255,0.32);
}

.mode-tabs button.active {
  border-color: var(--line-strong);
  color: var(--cyan);
  background: rgba(103,232,249,0.08);
}

.mode-tabs button.active .tab-key { color: var(--cyan); }

.mode-tabs button:hover { color: #fff; }

/* INFO BUTTON */
.info-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  padding: 0;
}
.info-btn:hover { border-color: var(--line-strong); background: rgba(103,232,249,0.08); }

/* STATUS CHIP */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 99px;
  backdrop-filter: blur(14px);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.62);
}

.status-chip .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.32; }
}

/* PANELS */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  padding: var(--pad);
  backdrop-filter: blur(14px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-head > span:first-child { color: var(--cyan); }
.panel-head > span:last-child,
.panel-head > b:last-child { color: var(--dim); font-weight: 400; }

/* HINT BAR */
.hint {
  position: fixed;
  bottom: 14px;
  left: 14px;
  right: 14px;
  font-size: 11px;
  color: rgba(255,255,255,0.58);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  padding: 10px 14px;
  backdrop-filter: blur(14px);
  letter-spacing: 0.04em;
  z-index: 40;
}

.hint b { color: var(--cyan); font-weight: 400; }
.hint .sep { color: var(--dim); margin: 0 6px; }

/* POPUP */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: pop-fade 0.18s ease-out;
}

@keyframes pop-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.popup-overlay[hidden] { display: none; }

.popup-card {
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  background: rgba(8, 12, 16, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(103,232,249,0.08), 0 0 0 1px rgba(103,232,249,0.05) inset;
  animation: pop-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pop-in {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.popup-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.popup-letter {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 22px;
  font-weight: 400;
  color: var(--cyan);
  text-transform: uppercase;
  background: rgba(103,232,249,0.06);
  flex-shrink: 0;
}

.popup-title-block { flex: 1; min-width: 0; }
.popup-title-block h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 400;
}

.popup-signal {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.1em;
  text-transform: lowercase;
}

.popup-close {
  background: transparent;
  border: 1px solid var(--line);
  color: rgba(255,255,255,0.62);
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
}
.popup-close:hover { color: var(--cyan); border-color: var(--line-strong); }

.popup-body {
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255,255,255,0.86);
}

.popup-body p { margin: 0 0 12px; }
.popup-body p:last-child { margin-bottom: 0; }
.popup-body b { color: var(--cyan); font-weight: 400; }
.popup-body ul { margin: 8px 0 12px; padding-left: 18px; }
.popup-body li { margin-bottom: 6px; }
.popup-body a { color: var(--amber); text-decoration: none; border-bottom: 1px dotted var(--amber); }
.popup-body a:hover { color: #fbbf24; }
.popup-body .ref { color: var(--dim); font-size: 11px; letter-spacing: 0.06em; }

.popup-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.popup-foot b { color: var(--cyan); font-weight: 400; }

/* FORMS */
textarea, input[type=text], input[type=range] {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--line);
  color: #fff;
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px;
  resize: vertical;
  outline: none;
  border-radius: var(--rad);
  letter-spacing: 0.02em;
  line-height: 1.55;
}

textarea:focus, input:focus {
  border-color: var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(103,232,249,0.16);
}

button.primary {
  background: rgba(103,232,249,0.12);
  border: 1px solid var(--line-strong);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: var(--rad);
}
button.primary:hover { background: rgba(103,232,249,0.22); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* CAMERA / MIC GATE */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  z-index: 60;
}
.gate .gate-card {
  background: rgba(8, 12, 16, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 22px 28px;
  text-align: center;
  max-width: 360px;
}
.gate .gate-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 400;
}
.gate .gate-card p {
  margin: 0 0 18px;
  font-size: 12px;
  color: rgba(255,255,255,0.74);
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .brand, .topbar-right { justify-content: center; }
  .topbar-right { display: flex; }
}

@media (max-width: 720px) {
  .hint { font-size: 10px; padding: 8px 10px; }
  .popup-card { max-height: 92vh; }
}
