:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --border2: rgba(255, 255, 255, 0.18);
  --accent: #7c5cff;
  --accent2: #33d6a6;
  --danger: #ff4d6d;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 20% 0%, rgba(124, 92, 255, 0.25), transparent 60%),
    radial-gradient(1000px 600px at 85% 20%, rgba(51, 214, 166, 0.18), transparent 55%),
    linear-gradient(180deg, #070a14, #0b1020 40%, #070a14);
}

code {
  font-family: var(--mono);
}

.menubar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  height: 74px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(11, 16, 32, 0.92), rgba(11, 16, 32, 0.55));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand__title {
  font-weight: 750;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand__subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.identity {
  display: grid;
  gap: 8px;
  min-width: min(620px, 100%);
}

.identity--inline {
  min-width: min(540px, 100%);
}

.identity__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.launcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.desktop {
  position: fixed;
  inset: 75px 0 0 0;
  overflow: hidden;
  user-select: none;
}

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  min-width: 320px;
  min-height: 200px;
  resize: both;
  overflow: hidden;
}

.window.is-hidden {
  display: none;
}

.window__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
  cursor: move;
}

.window__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  font-weight: 700;
}

.window__close {
  padding: 6px 10px;
}

.window__content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  user-select: text;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 16px;
}

.card--wide {
  grid-column: 1 / -1;
}

h2 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
}

.stack {
  display: grid;
  gap: 10px;
}

.stack--fill {
  height: 100%;
  grid-template-rows: auto 1fr;
}

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

.row--wrap {
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.btn {
  border: 1px solid var(--border2);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.22), rgba(124, 92, 255, 0.08));
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.06);
}

.input,
.textarea,
.select {
  width: 100%;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.input::placeholder,
.textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

.input--grow {
  flex: 1 1 280px;
}

.textarea {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
  resize: vertical;
}

.token {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 7px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.peers {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.peer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.peer__meta {
  display: grid;
  gap: 2px;
}

.peer__title {
  font-weight: 700;
  font-size: 13px;
}

.peer__subtitle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: rgba(255, 255, 255, 0.82);
  background: rgba(0, 0, 0, 0.22);
}

.badge--ok {
  border-color: rgba(51, 214, 166, 0.45);
  background: rgba(51, 214, 166, 0.1);
}

.badge--warn {
  border-color: rgba(255, 210, 87, 0.45);
  background: rgba(255, 210, 87, 0.1);
}

.badge--bad {
  border-color: rgba(255, 77, 109, 0.45);
  background: rgba(255, 77, 109, 0.1);
}

.chatlog {
  height: 100%;
  min-height: 120px;
  overflow: auto;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.msg {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.msg__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}

.msg__text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
  font-size: 13px;
}

.log {
  margin: 0;
  height: 100%;
  min-height: 120px;
  overflow: auto;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .identity--inline {
    min-width: 0;
  }

  .identity__row {
    grid-template-columns: 1fr auto;
    grid-auto-flow: row;
  }

  .identity__row .muted {
    display: none;
  }

  .launcher {
    display: none;
  }
}
