:root {
  --bg: #050507;
  --bg-soft: rgba(11, 11, 18, 0.92);
  --panel: rgba(10, 10, 16, 0.82);
  --panel-strong: rgba(19, 19, 30, 0.88);
  --line: rgba(255, 255, 255, 0.28);
  --line-dim: rgba(255, 255, 255, 0.16);
  --text: #f4f4f4;
  --muted: #9e9eab;
  --green: #a8ff8d;
  --cyan: #8ee9ff;
  --blue: #83b0ff;
  --pink: #ffb7cf;
  --orange: #ffcf87;
  --red: #ff9090;
  --shadow: 0 0 0 1px rgba(255,255,255,.08), 0 22px 60px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 12%, rgba(95, 88, 184, 0.12), transparent 26%),
    radial-gradient(circle at 78% 30%, rgba(77, 139, 255, 0.09), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(255, 99, 146, 0.06), transparent 22%),
    linear-gradient(180deg, #07070b 0%, #040406 100%);
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-x: hidden;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

.scanlines,
.noise,
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.055) 0px,
    rgba(255, 255, 255, 0.055) 1px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 8px
  );
  opacity: 0.38;
}

.noise {
  background-image:
    radial-gradient(rgba(255,255,255,.08) 0.5px, transparent 0.5px),
    radial-gradient(rgba(255,255,255,.03) 0.5px, transparent 0.5px);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  mix-blend-mode: soft-light;
  opacity: 0.14;
}

.vignette {
  box-shadow: inset 0 0 160px rgba(0,0,0,.9), inset 0 0 60px rgba(120, 100, 255, .08);
}

.screen-frame {
  position: relative;
  z-index: 1;
  width: min(1460px, calc(100% - 32px));
  margin: 16px auto;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(8,8,12,.82), rgba(5,5,8,.9));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), 0 24px 80px rgba(0,0,0,.55);
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 16, 24, 0.68), rgba(7, 7, 12, 0.84));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 18%, transparent 82%, rgba(255,255,255,.02));
  opacity: 0.7;
}

.title-bar,
.footer-bar,
.sidebar,
.content,
.details-dialog {
  border-radius: 14px;
}

.title-bar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 22px 24px;
  margin-bottom: 16px;
}

.micro-label,
.panel-label,
.progress-label,
.result-count,
.status-pill,
.lobby-id,
.detail-item span,
.settings-title,
.hud-key {
  font-family: "Press Start 2P", monospace;
}

.micro-label,
.panel-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.title-bar h1 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(30px, 4.2vw, 62px);
  line-height: 1;
  color: #f7f7f7;
  text-shadow: 0 0 12px rgba(255,255,255,.14);
}

.subtitle {
  margin: 14px 0 0;
  color: var(--cyan);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 14px;
}

.hud-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  width: min(700px, 100%);
}

.hud-item {
  padding: 14px 16px;
  border: 1px solid var(--line-dim);
  background: rgba(255,255,255,.025);
  min-height: 76px;
}

.hud-key {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-bottom: 14px;
}

.hud-value {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.hud-value.live { color: var(--green); }
.hud-value.offline { color: var(--red); }

.dashboard {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}

.sidebar,
.content {
  padding: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-section {
  border: 1px solid var(--line-dim);
  background: rgba(255,255,255,.02);
  padding: 14px;
}

.menu-button,
.terminal-select,
.terminal-input-wrap {
  width: 100%;
  border: 1px solid rgba(255,255,255,.32);
  background: linear-gradient(180deg, rgba(40,40,48,.5), rgba(17,17,24,.8));
  color: #f6f6f6;
  transition: transform .14s ease, background .14s ease, border-color .14s ease, color .14s ease;
}

.menu-button {
  min-height: 54px;
  padding: 14px 16px;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  letter-spacing: .02em;
  text-align: left;
}

.menu-button:hover,
.menu-button:focus-visible,
.terminal-select:focus,
.terminal-input-wrap:focus-within {
  outline: none;
  border-color: rgba(180, 231, 255, .55);
  background: linear-gradient(180deg, rgba(58,58,70,.58), rgba(23,23,32,.92));
  transform: translateY(-1px);
}

.menu-button.primary {
  color: #f5f7ff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 0 20px rgba(120, 160, 255, .08);
}

.menu-button.secondary {
  width: auto;
  min-height: 48px;
  padding: 12px 16px;
}

.filter-list {
  display: grid;
  gap: 10px;
}

.chip.active {
  border-color: rgba(169, 235, 255, .7);
  background: linear-gradient(180deg, rgba(80, 86, 100, .66), rgba(28, 28, 40, .95));
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(142,233,255,.14);
}

.terminal-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
}

.terminal-input-wrap span {
  color: var(--cyan);
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
}

.terminal-input-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
}

.terminal-input-wrap input::placeholder { color: #818194; }

.terminal-select {
  min-height: 52px;
  padding: 0 14px;
  appearance: none;
}

.stat-list {
  display: grid;
  gap: 10px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.stat-row:last-child { border-bottom: 0; }

.stat-row span {
  color: var(--muted);
  font-size: 13px;
}

.stat-row strong {
  color: var(--green);
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
}

.content-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.content-head h2 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(18px, 2.4vw, 28px);
  line-height: 1.3;
}

.result-count {
  color: var(--cyan);
  font-size: 10px;
}

.message-box {
  border: 1px solid rgba(255,255,255,.18);
  padding: 18px;
  background: rgba(255,255,255,.03);
}

.error-state {
  margin-bottom: 16px;
  color: #ffd3d3;
  border-color: rgba(255, 144, 144, 0.36);
  background: rgba(255, 112, 112, 0.08);
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.lobby-card {
  position: relative;
  min-height: 355px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.22);
  background:
    linear-gradient(180deg, rgba(28, 28, 40, 0.18), rgba(14, 14, 18, 0.48)),
    rgba(10,10,16,0.82);
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.lobby-card:hover {
  transform: translateY(-2px);
  border-color: rgba(173, 223, 255, .42);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 14px 30px rgba(0,0,0,.35);
}

.lobby-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.03) 0px,
    rgba(255,255,255,.03) 1px,
    transparent 1px,
    transparent 6px
  );
  opacity: 0.18;
}

.card-frame {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255,255,255,.07);
  pointer-events: none;
}

.card-topline,
.card-footer,
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-pill,
.lobby-id,
.badge,
.detail-item span,
.settings-title,
.progress-label,
.inspect-button {
  font-size: 9px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.04);
  color: var(--green);
}

.status-pill.full { color: var(--pink); }
.status-pill.open { color: var(--green); }

.lobby-id {
  color: var(--muted);
}

.lobby-name {
  margin: 18px 0 10px;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.host-line {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.host-line b { color: var(--text); }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.meta-box {
  padding: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.02);
}

.meta-box span,
.detail-item span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.meta-box strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.progress-wrap {
  margin-top: 16px;
}

.progress-label {
  color: var(--muted);
  margin-bottom: 8px;
}

.progress {
  height: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(117, 164, 255, .9), rgba(171, 241, 255, .94));
  box-shadow: 0 0 18px rgba(131,176,255,.28);
}

.card-footer {
  margin-top: 18px;
  align-items: flex-end;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  padding: 7px 8px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-family: "Press Start 2P", monospace;
}

.badge.pvp { color: var(--pink); }
.badge.pve { color: var(--green); }
.badge.brutal { color: var(--orange); }
.badge.warning { color: var(--red); }

.inspect-button {
  width: auto;
  min-width: 150px;
  min-height: 48px;
  padding: 12px 14px;
}

.empty-state {
  text-align: center;
  padding: 54px 20px;
}

.empty-symbol {
  margin-bottom: 18px;
  font-family: "Press Start 2P", monospace;
  font-size: 26px;
  color: var(--cyan);
}

.empty-state h3 {
  margin: 0 0 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 20px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--muted);
}

.footer-bar {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 12px;
}

.details-dialog {
  width: min(860px, calc(100% - 24px));
  max-height: 88vh;
  padding: 0;
  color: var(--text);
  background: linear-gradient(180deg, rgba(12,12,16,.98), rgba(6,6,10,.98));
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 26px 100px rgba(0,0,0,.72);
}

.details-dialog::backdrop {
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.dialog-head h3 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 20px;
  line-height: 1.45;
}

.icon-button {
  width: 48px;
  min-height: 48px;
  text-align: center;
  padding: 0;
}

.dialog-body {
  padding: 18px;
  overflow: auto;
}

.detail-grid,
.settings-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  padding: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
}

.detail-item strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.settings-title {
  margin: 20px 0 12px;
  color: var(--cyan);
}

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

.setting span { color: var(--muted); }
.setting .yes { color: var(--green); }
.setting .no { color: var(--red); }

.hidden { display: none !important; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  right: 14px;
  top: calc(50% - 8px);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.26);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@media (max-width: 1180px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .content {
    order: 1;
  }
}

@media (max-width: 920px) {
  .title-bar {
    flex-direction: column;
  }

  .hud-strip {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .screen-frame {
    width: min(100% - 12px, 1460px);
    margin: 6px auto;
    padding: 10px;
    border-radius: 16px;
  }

  .title-bar,
  .sidebar,
  .content,
  .footer-bar {
    padding: 14px;
  }

  .title-bar h1 {
    font-size: 28px;
  }

  .content-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .meta-grid,
  .detail-grid,
  .settings-list {
    grid-template-columns: 1fr;
  }

  .card-footer,
  .footer-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .inspect-button,
  .menu-button.secondary {
    width: 100%;
  }

  .lobby-card {
    min-height: auto;
  }
}

.process-panel {
  background:
    linear-gradient(180deg, rgba(76, 90, 138, .08), rgba(255,255,255,.01)),
    rgba(255,255,255,.018);
}

.process-title-row,
.process-bar-label,
.process-uptime {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.process-title-row .panel-label {
  margin-bottom: 0;
}

.process-status {
  padding: 5px 7px;
  border: 1px solid rgba(255,255,255,.14);
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  background: rgba(255,255,255,.025);
}

.process-status.online { color: var(--green); }
.process-status.offline { color: var(--red); }
.process-status.waiting { color: var(--cyan); }

.process-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.process-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(255,255,255,.025);
}

.process-metric span,
.process-bar-label,
.process-uptime span {
  color: var(--muted);
  font-size: 10px;
}

.process-metric strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.process-bar-block {
  margin-top: 14px;
}

.process-bar-label {
  margin-bottom: 7px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
}

.process-bar {
  height: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.025);
  overflow: hidden;
}

.process-bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(120, 170, 255, .82), rgba(149, 236, 255, .96));
  box-shadow: 0 0 15px rgba(131,176,255,.26);
  transition: width .35s ease;
}

.process-bar.memory > span {
  background: linear-gradient(90deg, rgba(170, 141, 255, .72), rgba(255, 183, 207, .88));
}

.process-uptime {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.09);
}

.process-uptime strong {
  color: var(--cyan);
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
}
