:root {
  --bg: #12121a;
  --bg-dark: #0a0a10;
  --ink: #f2f5ff;
  --accent: #00d4ff;
  --accent-dark: #0088a7;
  --mint: #6ef7c8;
  --line: #2f2f45;
  --panel: #1b1b28;
  --shadow: #00000080;
  --glow: #00d4ff55;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "VT323", monospace;
  color: var(--ink);
  background: radial-gradient(circle at top left, #1f1f2e 0%, #0f0f18 45%, #07070d 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(transparent 95%, #00d4ff10 95%),
    linear-gradient(90deg, transparent 95%, #00d4ff10 95%);
  background-size: 32px 32px;
  opacity: 0.2;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 3px solid var(--line);
  box-shadow: 0 6px 0 var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  text-transform: uppercase;
}

.brand-logo {
  background: var(--accent);
  color: #001018;
  padding: 6px 10px;
  border: 2px solid var(--line);
  box-shadow: 0 0 12px var(--glow), 3px 3px 0 var(--line);
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
}

.session-email {
  font-weight: 600;
}

.layout {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px 80px;
}

.panel {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 10px 10px 0 var(--shadow);
  padding: 24px;
  position: relative;
}

.panel h1,
.panel h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  margin: 0 0 16px;
}

.panel .muted {
  opacity: 0.7;
}

.auth-panel {
  max-width: 460px;
  margin: 40px auto;
}

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

.field {
  display: grid;
  gap: 6px;
}

input,
textarea {
  font-family: "VT323", monospace;
  font-size: 20px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  background: #0f0f18;
  color: var(--ink);
  box-shadow: inset 3px 3px 0 #00000055;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 2px solid var(--line);
  background: #1f1f2e;
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--line);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--line);
}

.btn.primary {
  background: var(--accent);
  color: #001018;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  font-size: 10px;
  padding: 8px 10px;
}

.message {
  margin-top: 16px;
  padding: 12px;
  border: 2px dashed var(--line);
  background: #12121a;
}

.hidden {
  display: none !important;
}

.columns {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.column {
  display: grid;
  gap: 24px;
}

.panel-inner {
  border: 3px solid var(--line);
  padding: 16px;
  background: var(--bg);
  box-shadow: 6px 6px 0 var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-footer {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.panel-footer input {
  flex: 1;
  min-width: 140px;
}

.list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.list-item {
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: #0f0f18;
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  align-items: center;
  font-size: 18px;
}

.list-item.active {
  background: #142d2b;
  border-color: var(--mint);
}

.chat-column {
  min-width: 0;
}

.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  min-height: 520px;
}

.messages {
  border: 2px solid var(--line);
  background: #0f0f18;
  padding: 12px;
  overflow-y: auto;
  max-height: 420px;
}

.message-row {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #ffffff22;
}

.message-row:last-child {
  border-bottom: none;
}

.message-meta {
  font-size: 14px;
  opacity: 0.7;
}

.message-body {
  font-size: 20px;
  margin-top: 4px;
}

.message-form {
  display: flex;
  gap: 10px;
}

.typing-indicator {
  min-height: 22px;
  font-size: 18px;
  color: var(--mint);
  opacity: 0.9;
  padding: 2px 6px;
}

.message-form input {
  flex: 1;
}

.footer {
  text-align: center;
  padding: 20px;
  font-size: 16px;
  opacity: 0.6;
}

.search {
  margin-bottom: 10px;
}

.chat .panel-header {
  align-items: flex-start;
  gap: 12px;
}

.messages .author {
  cursor: pointer;
  color: var(--accent);
}

.channel-badge {
  font-size: 14px;
  opacity: 0.7;
  margin-left: auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: #000000aa;
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 24px;
}

.modal-card {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 12px 12px 0 var(--shadow);
  padding: 20px;
  width: min(960px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
}

.profile-left {
  display: grid;
  gap: 10px;
}

.profile-right {
  display: grid;
  gap: 12px;
}

.avatar {
  width: 120px;
  height: 120px;
  border: 3px solid var(--line);
  display: grid;
  place-items: center;
  font-family: "Press Start 2P", monospace;
  font-size: 28px;
  background: #0f0f18;
  color: var(--accent);
  box-shadow: 0 0 14px var(--glow);
  background-size: cover;
  background-position: center;
}

.profile-right h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  margin: 0 0 10px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

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

@media (max-width: 960px) {
  .columns {
    grid-template-columns: 1fr;
  }
  .chat {
    min-height: 420px;
  }
}
