:root {
  --bg: #000000;
  --bg2: #030303;
  --panel: #050505;
  --panel2: #090909;
  --line: #1f1f1f;
  --line2: #363636;
  --text: #d4d4d4;
  --muted: #8a8a8a;
  --dim: #5c5c5c;
  --accent: #c8c8c8;
  --accent2: #ffffff;
  --warn: #b0b0b0;
  --bad: #b85c5c;
  --own: #eeeeee;
  --private: #bdbdbd;
  --font: "Courier New", Consolas, "Lucida Console", "Liberation Mono", monospace;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  font-family: var(--font);
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}


::selection {
  background: #d4d4d4;
  color: #000000;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #000000;
}

::-webkit-scrollbar-thumb {
  background: #2b2b2b;
  border: 1px solid #000000;
}

::-webkit-scrollbar-thumb:hover {
  background: #444444;
}

body {
  border-top: 3px solid #101010;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent2);
  text-decoration: underline;
}

button,
input,
textarea,
select {
  font-family: var(--font);
}

button {
  border: 1px solid var(--line2);
  background: #050505;
  color: var(--text);
  padding: 10px 13px;
  cursor: pointer;
  border-radius: 0;
  font-weight: 700;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
  color: var(--accent2);
  outline: none;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

input {
  min-width: 0;
  border: 1px solid var(--line2);
  background: #000000;
  color: var(--text);
  padding: 11px 12px;
  border-radius: 0;
  outline: none;
}

input::placeholder {
  color: var(--dim);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px #555555;
}

.index-shell {
  width: min(1040px, calc(100% - 28px));
  margin: 0 auto;
  padding: 42px 0 28px;
}

.index-shell.narrow {
  width: min(760px, calc(100% - 28px));
}

.terminal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.hero-card {
  padding: clamp(24px, 5vw, 54px);
}

.terminal-label {
  margin: 0 0 22px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(34px, 7vw, 74px);
  line-height: .98;
  letter-spacing: -.035em;
  font-weight: 700;
  color: var(--text);
}

h2 {
  color: var(--accent);
  font-size: 17px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.hero-text,
.plain-section p,
.terminal-card p,
.terminal-list {
  color: var(--muted);
  line-height: 1.65;
}

.hero-text {
  max-width: 780px;
  font-size: clamp(16px, 2vw, 20px);
  margin-bottom: 28px;
}

.join-form {
  max-width: 640px;
}

.join-form label,
.login-card label,
.join-channel-box label {
  display: block;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
}

.join-row {
  display: flex;
  gap: 10px;
}

.join-row input {
  flex: 1;
}

.form-error {
  color: var(--bad);
  margin: 10px 0 0;
}

.minor-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--dim);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 18px;
  background: var(--line);
  border: 1px solid var(--line);
}

.info-grid .terminal-card {
  padding: 20px;
  border: 0;
}

.plain-section {
  margin-top: 18px;
  padding: 24px;
}

.terminal-list {
  padding-left: 22px;
}

.terminal-list li {
  margin: 8px 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  color: var(--dim);
  font-size: 13px;
}

/* Chat */
.page-chat {
  overflow: hidden;
}

.login-panel {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(560px, 100%);
  padding: 28px;
}

.login-card h1 {
  font-size: clamp(28px, 6vw, 52px);
}

.chat-layout {
  height: calc(100dvh - 3px);
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 250px;
  grid-template-rows: 54px minmax(0, 1fr);
  grid-template-areas:
    "top top top"
    "left main right";
  background: var(--bg);
}

.chat-topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  color: var(--accent);
  font-weight: 700;
}

.brand-block div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-block strong {
  color: var(--text);
  line-height: 1.1;
}

.brand-block span:last-child {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-block {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border: 1px solid var(--line2);
  background: var(--bad);
}

.status-dot.online {
  background: var(--accent);
}

.status-dot.offline {
  background: var(--bad);
}

.panel {
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-left {
  grid-area: left;
}

.panel-right {
  grid-area: right;
  border-right: 0;
  border-left: 1px solid var(--line);
}

.panel-section {
  border-bottom: 1px solid var(--line);
  min-height: 0;
}

.panel-section.grow {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.panel-title {
  padding: 10px 12px;
  color: var(--accent);
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
}

.nav-list,
.users-list {
  overflow-y: auto;
  min-height: 0;
}

.nav-item,
.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  cursor: pointer;
  color: var(--muted);
}

.nav-item:hover,
.user-item:hover,
.nav-item.active,
.user-item.active {
  background: #0b0b0b;
  color: var(--text);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.unread::after {
  content: attr(data-count);
  margin-left: auto;
  min-width: 20px;
  text-align: center;
  padding: 1px 5px;
  background: var(--accent);
  color: #000000;
  font-size: 11px;
  font-weight: 700;
}

.nav-name,
.user-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.close-small {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 11px;
}

.empty-line {
  padding: 12px;
  color: var(--dim);
  font-size: 12px;
}

.join-channel-box {
  padding: 12px;
}

.side-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.side-form-row input {
  flex: 1;
  width: 100%;
}

.full-button {
  width: 100%;
}

.chat-main {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.tab-bar {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}

.tab-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tab-info strong,
.tab-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-info strong {
  color: var(--accent);
  font-size: 15px;
}

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

.message-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  background: #000000;
}

.message-row {
  display: grid;
  grid-template-columns: auto minmax(80px, auto) minmax(0, 1fr);
  gap: 8px;
  padding: 5px 7px;
  border-left: 2px solid transparent;
  font-size: 14px;
  line-height: 1.45;
}

.message-row:hover {
  background: #060606;
}

.message-row.own {
  border-left-color: var(--own);
}

.message-row.private {
  border-left-color: var(--private);
}

.message-row.system {
  grid-template-columns: auto minmax(0, 1fr);
  color: var(--dim);
}

.message-row.highlight {
  background: #101010;
  border-left-color: var(--warn);
}

.msg-time {
  color: var(--dim);
}

.msg-nick {
  color: var(--accent2);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row.own .msg-nick {
  color: var(--own);
}

.msg-text {
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: var(--panel2);
  border-top: 1px solid var(--line);
}

.message-form input {
  flex: 1;
  font-size: 15px;
}

.user-search-wrap {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.user-search-wrap input {
  width: 100%;
}

.user-item.own {
  color: var(--accent);
}

.user-prefix {
  color: var(--warn);
  width: 14px;
  flex: 0 0 14px;
}

.user-role {
  margin-left: auto;
  color: var(--dim);
  font-size: 11px;
}

.mobile-only {
  display: none;
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 40;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .72);
  z-index: 60;
  padding: 16px;
}

.modal-box {
  width: min(620px, 100%);
  max-height: min(720px, calc(100dvh - 32px));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  text-transform: uppercase;
}

.modal-list {
  overflow-y: auto;
  border: 1px solid var(--line);
}

.channel-option {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.channel-option:hover {
  background: #080808;
}

.channel-option strong {
  color: var(--accent);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 920px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "main";
  }

  .panel-left,
  .panel-right {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 50;
    width: min(330px, 86vw);
    border: 1px solid var(--line);
    transition: transform .18s linear;
  }

  .panel-left {
    left: 0;
    transform: translateX(-105%);
  }

  .panel-right {
    right: 0;
    transform: translateX(105%);
  }

  .panel-left.open,
  .panel-right.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-flex;
  }

  .tab-bar {
    gap: 6px;
  }

  .tab-bar button {
    padding: 8px 9px;
    font-size: 12px;
  }
}

@media (max-width: 680px) {
  .index-shell {
    width: min(100% - 18px, 1040px);
    padding-top: 22px;
  }

  .hero-card,
  .plain-section,
  .login-card {
    padding: 18px;
  }

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

  .join-row {
    flex-direction: column;
  }

  .join-row button,
  .message-form button {
    width: 100%;
  }

  .message-form {
    flex-direction: column;
  }

  .message-form input {
    font-size: 16px;
  }

  .message-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .msg-text {
    grid-column: 1 / -1;
    padding-left: 0;
  }
}
