/* Windows-95-ish, deadpan, no-JS friendly */

:root {
  --bg: #008080;
  /* classic-ish teal */
  --win: #c0c0c0;
  /* window grey */
  --border-dark: #000000;
  --border-mid: #808080;
  --border-light: #ffffff;
  --title: #000080;
  /* title bar blue */
  --text: #1a1a1a;
  --link: #000080;
  --link-visited: #800080;
  --focus: #000000;

  /* Consistent page sizing */
  --page-width: 75vw;
  --page-max: 1200px;
  --page-min: 720px;

  --pad: 14px;
  --gap: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  line-height: 1.35;
}

/* Accessibility */
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  padding: 8px 10px;
  background: var(--win);
  color: var(--text);
  border: 2px solid var(--border-dark);
}

.skip-link:focus {
  left: 8px;
  outline: 2px solid var(--focus);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Shared page width */
.topbar,
.layout,
.footer {
  width: min(var(--page-width), var(--page-max));
  min-width: var(--page-min);
  margin-left: auto;
  margin-right: auto;
}

/* Top bar */
.topbar {
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--win);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand__logo {
  width: 14px;
  height: 14px;
  display: inline-block;
  background: var(--title);
}

.brand__name {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  color: var(--link);
  text-decoration: underline;
  padding: 2px 4px;
}

.nav a:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Layout */
.layout {
  margin-top: 16px;
  margin-bottom: 16px;
  padding: 0 12px;
  display: grid;
  gap: var(--gap);
}

.grid-2 {
  display: grid;
  gap: var(--gap);
}

@media (min-width: 860px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Window chrome */
.window {
  background: var(--win);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
}

.window__titlebar {
  background: var(--title);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px 8px;
  gap: 8px;
}

.window__title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.window__controls {
  display: flex;
  gap: 6px;
}

/* Window buttons: same markup everywhere, icons drawn in CSS */
.winbtn {
  width: 18px;
  height: 16px;
  background: var(--win);
  position: relative;

  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);

  user-select: none;
}

/* Minimize glyph (a line) */
.winbtn--min::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 9px;
  height: 2px;
  background: #000;
}

/* Maximize glyph (a square) */
.winbtn--max::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 8px;
  border: 2px solid #000;
  background: transparent;
}

/* Close glyph (an X) */
.winbtn--close::before,
.winbtn--close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 2px;
  background: #000;
  transform-origin: center;
}

.winbtn--close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.winbtn--close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Window body */
.window__body {
  padding: var(--pad);
  border-top: 2px solid var(--border-mid);
}

/* Hero tweaks */
.window--hero .window__body {
  padding: 18px;
}

.h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.1;
}

.lede {
  margin: 0 0 14px;
  font-size: 16px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 10px;
  background: var(--win);
  color: var(--text);
  text-decoration: none;

  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
}

.btn:active {
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.btn:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn--secondary {
  text-decoration: underline;
}

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 10px;
}

/* Links */
.link {
  color: var(--link);
  text-decoration: underline;
}

.link:visited {
  color: var(--link-visited);
}

.link:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.small {
  font-size: 13px;
}

.muted {
  color: #3a3a3a;
}

.row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sep {
  opacity: 0.7;
}

/* Meta block */
.meta {
  margin: 14px 0 0;
  display: grid;
  gap: 10px;
}

@media (min-width: 680px) {
  .meta {
    grid-template-columns: repeat(3, 1fr);
  }
}

.meta dt {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 2px;
}

.meta dd {
  margin: 0;
  font-size: 13px;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: #fff;
  border: 2px solid var(--border-dark);
}

.table th,
.table td {
  padding: 8px;
  border: 1px solid var(--border-mid);
  text-align: left;
  vertical-align: top;
}

.table th {
  background: #e6e6e6;
  font-weight: 700;
}

/* Lists */
.list {
  margin: 6px 0 0;
  padding-left: 18px;
}

.list li {
  margin: 4px 0;
}

.list .muted {
  margin-top: 0px;
}

/* Contact */
.contact-grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 680px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.label {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 4px;
}

/* Footer */
.footer {
  margin-bottom: 28px;
  padding: 0 16px 16px;
}

.footer .muted {
  display: block;
  margin: 0;
  line-height: 1.1;
}

/* Small screens */
@media (max-width: 420px) {
  .h1 {
    font-size: 24px;
  }

  .topbar {
    gap: 8px;
  }

  .nav {
    gap: 6px;
  }

  .topbar,
  .layout,
  .footer {
    min-width: unset;
    width: 100%;
  }
}

.chat-layout {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
  width: min(var(--page-width), var(--page-max));
  min-width: var(--page-min);
  margin: 16px auto;
  padding: 0 12px;
}

@media (min-width: 860px) {
  .chat-layout {
    grid-template-columns: 2fr 1fr;
  }
}

@media (max-width: 420px) {
  .chat-layout {
    min-width: unset;
    width: 100%;
  }
}

/* Chat window body — flex column so messages grow and input sticks to bottom */
.chat-window-body {
  display: flex;
  flex-direction: column;
  height: 520px;
  padding: 0;
}

/* Scrollable message area */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--pad);
  background: #fff;
  border-bottom: 2px solid var(--border-mid);
  font-size: 13px;
  line-height: 1.5;
}

/* Individual chat messages */
.chat-msg {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0 6px;
  align-items: baseline;
  margin: 3px 0;
}

.chat-msg--dabi .chat-author {
  color: var(--title);
  font-weight: 700;
}

.chat-author {
  font-weight: 700;
  white-space: nowrap;
}

.chat-time {
  color: #666;
  font-size: 11px;
  white-space: nowrap;
}

.chat-text {
  word-break: break-word;
}

/* System / join / leave notices */
.chat-system {
  text-align: center;
  color: #666;
  font-size: 11px;
  font-style: italic;
  margin: 4px 0;
}

/* Error messages */
.chat-error {
  color: #800000;
  font-size: 12px;
  margin: 2px 0;
}

/* Input row */
#chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px var(--pad);
  background: var(--win);
}

#chat-input {
  flex: 1;
  padding: 5px 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  border-top: 2px solid var(--border-mid);
  border-left: 2px solid var(--border-mid);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  outline: none;
}

#chat-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

#chat-send {
  padding: 5px 14px;
  font-size: 13px;
  font-family: inherit;
  background: var(--win);
  color: var(--text);
  cursor: pointer;
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
}

#chat-send:active {
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

#chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Stats panel */
.stats-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border-mid);
  padding-bottom: 6px;
  font-size: 13px;
}

.stats-row dt {
  font-weight: 700;
  color: var(--text);
}

.stats-row dd {
  margin: 0;
  font-family: "Courier New", monospace;
  color: var(--title);
  font-weight: 700;
}