:root {
  --bg: #070a0c;
  --bg-2: #10161c;
  --ink: #ebe4d7;
  --muted: rgba(235, 228, 215, 0.62);
  --line: rgba(235, 228, 215, 0.12);
  --panel: rgba(255, 255, 255, 0.035);
  --panel-solid: #121920;
  --accent: #3dcfb6;
  --accent-2: #e2b15a;
  --join: #3dcfb6;
  --leave: #e07a5f;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.console {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 8% -12%, rgba(61, 207, 182, 0.16), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(226, 177, 90, 0.1), transparent 48%),
    linear-gradient(165deg, var(--bg), var(--bg-2));
  padding: 24px clamp(14px, 3.5vw, 42px) 42px;
  position: relative;
  overflow-x: hidden;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.03;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.top, .metrics, .room-bar, .grid, .foot {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 26px;
  animation: rise 0.65s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.back {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-weight: 800;
  background: linear-gradient(120deg, #fff6e8, var(--accent) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 40ch;
  font-size: 0.98rem;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 0.88rem;
  font-weight: 600;
}
.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #777;
}
.status-pill.ok .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(61, 207, 182, 0.2);
}
.status-pill.bad .dot { background: var(--leave); }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--accent);
  color: #07100e;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  animation: rise 0.75s ease both;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-bottom: 8px;
}
.metric-value {
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}

.room-bar {
  display: flex;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.field {
  display: grid;
  gap: 6px;
  min-width: min(100%, 320px);
}
.field span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}
.field select,
.field input {
  font: inherit;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0d1318;
  color: var(--ink);
}
.room-meta {
  margin: 0 0 8px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr;
  gap: 14px;
  animation: rise 0.85s ease both;
}
.panel {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel.wide { grid-column: 1 / -1; min-height: 300px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.panel-body {
  padding: 8px 10px 14px;
  overflow: auto;
  max-height: 340px;
  flex: 1;
}
.panel-body.chat { max-height: 400px; }

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

.guest {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
}
.guest:hover { background: rgba(61, 207, 182, 0.06); }
.guest strong { display: block; font-size: 0.98rem; }
.guest span { color: var(--muted); font-size: 0.82rem; }
.guest .ago {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
}
.row:hover { background: rgba(255, 255, 255, 0.03); }
.row .when {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding-top: 3px;
}
.row .body { min-width: 0; }
.row .who { font-weight: 700; }
.row .msg {
  color: var(--ink);
  opacity: 0.85;
  word-break: break-word;
}
.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-right: 6px;
}
.badge.join { background: rgba(61, 207, 182, 0.15); color: var(--join); }
.badge.leave { background: rgba(224, 122, 95, 0.15); color: var(--leave); }

.foot {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}
.foot a { color: var(--accent); font-weight: 700; text-decoration: none; }
.foot code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
  background: #121920;
  color: var(--ink);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.settings { padding: 22px; display: grid; gap: 12px; }
.settings h3 { margin: 0; font-family: var(--display); }
.settings p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .panel.wide { grid-column: auto; }
  .top { flex-direction: column; align-items: start; }
}
