:root {
  --bg: #0a0d12;
  --bg-soft: #11161e;
  --surface: #151b24;
  --surface-2: #1a2230;
  --surface-3: #0d1118;
  --line: rgba(164, 190, 226, 0.12);
  --line-strong: rgba(164, 190, 226, 0.22);
  --text: #edf4ff;
  --muted: #8fa1b8;
  --cyan: #46d3ff;
  --cyan-soft: #1faee7;
  --blue: #4f7cff;
  --orange: #ff9d57;
  --green: #36d88d;
  --red: #ff5d6f;
  --violet: #9b7cff;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(70, 211, 255, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 157, 87, 0.1), transparent 24%),
    linear-gradient(180deg, #06080c 0%, #0b1017 52%, #090d12 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
  mask-image: radial-gradient(circle at center, black 44%, transparent 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6f89a8;
}

.button {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.button.primary {
  background: linear-gradient(135deg, var(--cyan-soft), var(--blue));
  color: white;
  box-shadow: 0 12px 26px rgba(40, 118, 255, 0.26);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup.compact {
  margin: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--orange));
  color: white;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  box-shadow: 0 14px 30px rgba(70, 211, 255, 0.24);
}

.brand-lockup strong,
.topbar-user strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
}

.brand-lockup span,
.topbar-user span {
  display: block;
  color: var(--muted);
}

label span {
  display: block;
  margin-bottom: 8px;
  color: #d9e9ff;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(9, 12, 18, 0.95);
  color: var(--text);
  padding: 13px 15px;
  outline: 0;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(70, 211, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(70, 211, 255, 0.12);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(5, 8, 12, 0.9);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
}

.search-bar input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
}

.search-bar i {
  color: var(--muted);
}

.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 140;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
}

.toast {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(17, 24, 34, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.toast.success { border-color: rgba(54, 216, 141, 0.34); }
.toast.error { border-color: rgba(255, 93, 111, 0.34); }
.toast.info { border-color: rgba(70, 211, 255, 0.34); }

.flash {
  display: none;
}

.auth-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 24px;
}

.register-shell {
  grid-template-columns: 1fr;
  max-width: 760px;
}

.auth-poster,
.auth-card,
.topbar,
.chat-rail,
.chat-core,
.screen-shell {
  background: linear-gradient(180deg, rgba(23, 28, 38, 0.94), rgba(12, 16, 23, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-poster {
  min-height: 680px;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(180deg, rgba(8, 12, 18, 0.18), rgba(8, 12, 18, 0.94)),
    radial-gradient(circle at top right, rgba(70, 211, 255, 0.28), transparent 40%),
    linear-gradient(135deg, #121821, #0a0d12);
}

.auth-poster h1 {
  margin: 0 0 16px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.4rem, 4vw, 4.8rem);
  line-height: 0.95;
}

.auth-poster p {
  max-width: 560px;
  color: #c7d8f2;
}

.poster-metrics {
  list-style: none;
  padding: 0;
  margin: 30px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.poster-metrics li {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-card {
  display: grid;
  place-items: center;
}

.auth-card.wide {
  max-width: 760px;
  margin: 0 auto;
}

.auth-card-inner {
  width: min(460px, 100%);
  padding: 40px;
}

.auth-form,
.panel-form,
.control-form {
  display: grid;
  gap: 14px;
}

.auth-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-grid .full,
.auth-grid button {
  grid-column: 1 / -1;
}

.auth-links {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.auth-links a {
  color: #b6c7e4;
}

.app-shell {
  width: min(1680px, calc(100% - 24px));
  margin: 14px auto 110px;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

.desktop-nav,
.mobile-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.desktop-nav a,
.mobile-nav a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 999px;
  padding: 11px 16px;
  color: #9cb0c9;
  border: 1px solid transparent;
}

.desktop-nav a.active,
.mobile-nav a.active {
  color: white;
  border-color: rgba(70, 211, 255, 0.24);
  background: linear-gradient(180deg, rgba(70, 211, 255, 0.12), rgba(79, 124, 255, 0.14));
}

.counter {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 93, 111, 0.18);
  color: #ffb5bf;
  font-size: 0.75rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user img,
.profile-summary img {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  object-fit: cover;
}

.app-stage {
  margin-top: 18px;
}

.panel-screen {
  display: none;
}

.panel-screen.active {
  display: block;
}

.chat-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 310px;
  gap: 18px;
  min-height: calc(100vh - 160px);
}

.chat-rail,
.chat-core,
.screen-shell {
  padding: 20px;
}

.chat-rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chat-core {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.rail-title h2,
.screen-head h1,
.chat-hero h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.chat-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at right top, rgba(70, 211, 255, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(27, 37, 50, 0.95), rgba(15, 21, 29, 0.92));
  border: 1px solid var(--line);
}

.hero-subtitle {
  margin: 12px 0 0;
  color: var(--muted);
}

.chat-status,
.message-meta,
.pm-meta,
.user-info,
.profile-summary,
.toolbar,
.form-row,
.avatar-upload,
.pagination-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(54, 216, 141, 0.15);
}

.role-entrance {
  padding: 16px 18px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(70, 211, 255, 0.14), rgba(155, 124, 255, 0.14), rgba(255, 157, 87, 0.14));
  border: 1px solid rgba(70, 211, 255, 0.24);
  animation: pulseGlow 1.2s ease;
}

.inline-alerts {
  display: grid;
  gap: 10px;
}

.inline-alert {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(19, 27, 39, 0.96);
  border: 1px solid var(--line);
  color: #dcecff;
}

.message-stream,
.pm-thread-stream {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 8px;
}

.mirc-stream {
  flex: 1;
  min-height: 380px;
  max-height: calc(100vh - 340px);
}

.message-bubble,
.pm-bubble,
.conversation-item,
.user-item,
.control-form,
.ban-row,
.level-row,
.room-admin-row {
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(25, 33, 45, 0.94), rgba(15, 20, 27, 0.96));
  border: 1px solid var(--line);
}

.message-bubble,
.pm-bubble {
  padding: 14px 16px;
}

.message-system {
  border-left: 3px solid var(--cyan);
}

.level-up-notice {
  background:
    linear-gradient(90deg, rgba(155, 124, 255, 0.16), rgba(70, 211, 255, 0.12), rgba(255, 157, 87, 0.12)),
    linear-gradient(180deg, rgba(25, 33, 45, 0.94), rgba(15, 20, 27, 0.96));
}

.staff-entry-notice {
  border-left-color: var(--orange);
  background:
    linear-gradient(90deg, rgba(255, 157, 87, 0.16), rgba(70, 211, 255, 0.08)),
    linear-gradient(180deg, rgba(25, 33, 45, 0.94), rgba(15, 20, 27, 0.96));
  animation: staffSweep 1.25s ease;
}

.message-avatar,
.pm-avatar,
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  object-fit: cover;
}

.message-author,
.pm-author,
.user-name {
  font-weight: 600;
}

.message-body,
.pm-body {
  color: #ecf6ff;
  line-height: 1.55;
  word-break: break-word;
}

.mirc-composer {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(11, 14, 20, 0.94);
  border: 1px solid var(--line);
}

.mirc-composer input,
.composer input {
  flex: 1;
}

.mirc-room-list,
.room-user-list,
.conversation-list,
.admin-user-table,
.room-admin-list,
.ban-list,
.level-list {
  display: grid;
  gap: 12px;
}

.room-pill {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(7, 10, 15, 0.9);
  border: 1px solid var(--line);
  cursor: pointer;
  color: white;
}

.room-pill.active {
  border-color: color-mix(in srgb, var(--room-color) 58%, white);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--room-color) 16%, transparent), transparent),
    rgba(7, 10, 15, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 12px 24px rgba(0, 0, 0, 0.22);
}

.room-accent {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--room-color);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--room-color) 14%, transparent);
}

.room-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.room-pill-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "IBM Plex Mono", monospace;
}

.room-meta,
.user-meta,
.conversation-snippet,
.pm-thread-header,
.room-history-preview,
.pagination-row {
  color: var(--muted);
}

.user-item,
.conversation-item,
.ban-row,
.room-admin-row,
.level-row {
  padding: 14px;
}

.user-item,
.conversation-item,
.ban-row,
.admin-user-row,
.room-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-item button,
.conversation-item button,
.panel-tab,
.pagination-row button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.screen-shell {
  min-height: calc(100vh - 160px);
}

.panel-form {
  display: grid;
  gap: 14px;
}

.screen-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
}

.modern-messages {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.conversation-sidebar,
.premium-thread {
  padding: 18px;
  border-radius: 22px;
  background: rgba(11, 16, 23, 0.72);
  border: 1px solid var(--line);
}

.premium-thread {
  display: grid;
  gap: 14px;
}

.conversation-item.active {
  border-color: rgba(70, 211, 255, 0.28);
  background:
    linear-gradient(90deg, rgba(70, 211, 255, 0.08), transparent),
    linear-gradient(180deg, rgba(25, 33, 45, 0.94), rgba(15, 20, 27, 0.96));
}

.modern-profile {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr 0.85fr;
  gap: 18px;
}

.control-form {
  padding: 18px;
}

.control-form h3 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
}

.hero-card {
  display: grid;
  gap: 20px;
}

.profile-summary span {
  color: var(--muted);
}

.panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.panel-tab {
  padding: 11px 16px;
  border-radius: 999px;
  color: #97abc6;
  border: 1px solid var(--line);
  background: rgba(8, 11, 16, 0.78);
}

.panel-tab.active {
  color: white;
  border-color: rgba(70, 211, 255, 0.28);
  background: linear-gradient(180deg, rgba(70, 211, 255, 0.13), rgba(79, 124, 255, 0.15));
}

.panel-pane {
  display: none;
}

.panel-pane.active {
  display: block;
}

.panel-grid.two-cols {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
}

.color-preview-card {
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 12, 19, 0.82);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.room-color-preview {
  width: 100%;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.room-history-preview {
  min-height: 240px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: rgba(7, 10, 15, 0.9);
  border: 1px solid var(--line);
}

.ban-row small,
.level-row small,
.room-admin-row small {
  color: var(--muted);
  display: block;
}

.pagination-row {
  justify-content: flex-end;
  margin-top: 14px;
}

.pagination-row button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 11, 16, 0.85);
}

.level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.mobile-nav {
  display: none;
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 12px;
  padding: 10px;
  justify-content: space-around;
  border-radius: 24px;
  background: rgba(10, 13, 18, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 120;
}

.floating-logout {
  position: fixed;
  right: 22px;
  bottom: 94px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 0;
  background: linear-gradient(135deg, var(--red), var(--orange));
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.logout-form {
  margin: 0;
}

.hidden {
  display: none !important;
}

.error-shell {
  max-width: 560px;
  margin: 12vh auto;
  padding: 40px;
  border-radius: 28px;
  background: rgba(18, 24, 34, 0.94);
  border: 1px solid var(--line);
}

@keyframes pulseGlow {
  0% { transform: scale(0.98); opacity: 0; }
  55% { transform: scale(1.01); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes staffSweep {
  0% {
    transform: translateX(-10px);
    opacity: 0;
    box-shadow: 0 0 0 rgba(255, 157, 87, 0);
  }
  45% {
    opacity: 1;
    box-shadow: 0 0 24px rgba(255, 157, 87, 0.16);
  }
  100% {
    transform: translateX(0);
    opacity: 1;
    box-shadow: 0 0 0 rgba(255, 157, 87, 0);
  }
}

@media (max-width: 1320px) {
  .chat-layout,
  .modern-profile,
  .panel-grid.two-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .auth-shell,
  .modern-messages {
    grid-template-columns: 1fr;
  }

  .topbar-user {
    display: none;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .app-shell {
    margin-bottom: 122px;
  }

  .chat-layout {
    min-height: auto;
  }

  .floating-logout {
    right: 18px;
  }
}

@media (max-width: 760px) {
  .auth-grid,
  .poster-metrics {
    grid-template-columns: 1fr;
  }

  .auth-poster {
    min-height: 440px;
  }

  .app-shell {
    width: min(100%, calc(100% - 14px));
  }

  .topbar {
    padding: 14px 16px;
  }

  .chat-hero,
  .screen-head,
  .mirc-composer,
  .form-row,
  .toolbar,
  .pagination-row {
    flex-direction: column;
    align-items: stretch;
  }
}
