:root {
  color-scheme: light;
  --blue: #174d9e;
  --blue-dark: #082e6c;
  --blue-bright: #2468c6;
  --cream: #eee9d9;
  --panel: #f7f5eb;
  --border-dark: #4c4a42;
  --border-mid: #8d8a80;
  --green: #25a244;
  --ink: #171b21;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background-color: #617f9d;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.11) 0 1px, transparent 1px),
    linear-gradient(135deg, rgba(255,255,255,.04) 25%, transparent 25%),
    linear-gradient(315deg, rgba(0,0,0,.04) 25%, transparent 25%);
  background-size: 5px 5px, 18px 18px, 18px 18px;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.desktop-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 22px;
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 13px;
  color: white;
  margin: 0 4px 18px;
  text-shadow: 1px 2px 0 rgba(0,0,0,.3);
}

.brand-bar h1 { margin: 0; font-size: 30px; line-height: .95; letter-spacing: -1px; }
.eyebrow { margin: 0 0 4px; font-size: 10px; font-weight: 800; letter-spacing: 2px; }

.brand-mark {
  width: 46px;
  height: 46px;
  position: relative;
  filter: drop-shadow(1px 2px 0 rgba(0,0,0,.25));
}
.brand-mark span { position: absolute; width: 19px; height: 19px; border-radius: 50%; border: 2px solid white; }
.brand-mark span:nth-child(1) { background: #f04b35; top: 1px; left: 14px; }
.brand-mark span:nth-child(2) { background: #f7d12e; top: 12px; left: 25px; }
.brand-mark span:nth-child(3) { background: #4bc069; top: 26px; left: 20px; }
.brand-mark span:nth-child(4) { background: #4b86dd; top: 25px; left: 5px; }
.brand-mark span:nth-child(5) { background: #a35bc4; top: 11px; left: 1px; }
.brand-mark.large { transform: scale(1.45); transform-origin: center; }

.connection-pill {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.45);
  background: rgba(3, 25, 55, .35);
  box-shadow: inset 1px 1px rgba(255,255,255,.14);
  font: bold 11px "Courier New", monospace;
  text-shadow: none;
}
.status-light { width: 8px; height: 8px; border-radius: 50%; background: #edbf38; box-shadow: 0 0 0 2px rgba(0,0,0,.2); }
.connection-pill.connected .status-light { background: #5be26d; }
.connection-pill.disconnected .status-light { background: #e0473d; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 258px; gap: 16px; align-items: stretch; }

.window {
  border: 1px solid #25251f;
  background: var(--cream);
  box-shadow:
    inset 1px 1px 0 white,
    inset -1px -1px 0 #77756d,
    5px 7px 0 rgba(11,27,44,.26);
}

.titlebar {
  min-height: 31px;
  padding: 4px 5px 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: linear-gradient(180deg, #2a72ce 0%, #174f9f 48%, #0b3e86 50%, #174f9f 100%);
  border-bottom: 1px solid var(--blue-dark);
  text-shadow: 1px 1px #092e65;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: .2px;
}
.titlebar-copy { display: flex; align-items: center; gap: 7px; }
.title-icon { color: #ffe745; font-size: 15px; }
.window-buttons { display: flex; gap: 3px; }
.window-buttons span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #0b2f63;
  background: #e9e5d8;
  border: 1px solid white;
  border-right-color: #57554f;
  border-bottom-color: #57554f;
  text-shadow: none;
  font: bold 13px Arial;
}

.chat-window { min-height: 675px; display: flex; flex-direction: column; }

.toolbar {
  height: 38px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid #9d9a8f;
  background: #ded9c9;
  box-shadow: inset 0 1px white;
}
.toolbar button {
  width: 25px;
  height: 23px;
  padding: 0;
  background: #efecdf;
  border: 1px solid white;
  border-right-color: #77746c;
  border-bottom-color: #77746c;
  color: #21242a;
}
.toolbar-divider { height: 22px; border-left: 1px solid #858279; border-right: 1px solid white; margin: 0 4px; }
.toolbar-label { font: 11px "Courier New", monospace; color: #45443f; }

.transcript {
  flex: 1;
  min-height: 390px;
  margin: 9px;
  padding: 17px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: white;
  border: 2px solid #6c6b64;
  border-right-color: white;
  border-bottom-color: white;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.13);
}

.empty-state {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: #77746c;
  text-align: center;
  font-size: 13px;
}
.empty-state strong { color: #41403c; font-size: 15px; }
.empty-star { color: #edca21; font-size: 34px; text-shadow: 1px 1px #8f7a12; }

.message { margin: 0 0 15px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.message:last-child { margin-bottom: 0; }
.message-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.message-name { color: #154f9b; font-weight: 800; }
.message-time { color: #85827a; font: 10px "Courier New", monospace; }
.message-text { white-space: pre-wrap; }
.message.own .message-name { color: #8b3fa1; }

.composer {
  border-top: 1px solid #858279;
  padding: 10px;
  background: #dad5c5;
  box-shadow: inset 0 1px white;
}
.composer > label, .dialog-body label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: bold; }
.composer-row { display: flex; align-items: stretch; gap: 8px; }
textarea, .dialog-body input {
  border: 2px solid #65645e;
  border-right-color: white;
  border-bottom-color: white;
  border-radius: 0;
  background: white;
  color: #15171b;
  outline: none;
}
textarea:focus, .dialog-body input:focus { box-shadow: inset 0 0 0 2px #b7d3f3; }
textarea { flex: 1; min-height: 60px; padding: 8px; resize: vertical; line-height: 1.35; }

.send-button, .sign-on-button {
  color: white;
  font-weight: bold;
  text-shadow: 1px 1px #092d61;
  background: linear-gradient(#2e79d3, #124a95);
  border: 2px solid #80aee0;
  border-right-color: #092d61;
  border-bottom-color: #092d61;
  box-shadow: inset 1px 1px white;
}
.send-button { width: 91px; }
.send-button:active, .sign-on-button:active { transform: translate(1px, 1px); }
.send-button:disabled { filter: grayscale(1); opacity: .6; cursor: not-allowed; }
.composer-hint { display: flex; justify-content: space-between; margin-top: 6px; color: #68665f; font: 10px "Courier New", monospace; }

.buddy-window { min-height: 675px; display: flex; flex-direction: column; }
.buddy-titlebar .title-icon { color: #5be26d; font-size: 10px; }
.profile-card { display: flex; align-items: center; gap: 9px; padding: 12px 10px; background: #f4f1e5; border-bottom: 1px solid #969389; }
.avatar {
  flex: 0 0 38px; height: 38px; display: grid; place-items: center;
  color: white; background: #6a46a3; border: 2px solid white; outline: 1px solid #5e5c55;
  font: bold 18px "Courier New", monospace;
}
.profile-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-copy strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 118px; }
.online-label { color: #5f5d56; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; }
.online-label i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.change-name { margin-left: auto; padding: 3px 6px; font-size: 10px; background: #e7e3d5; border: 1px solid white; border-right-color: #64625b; border-bottom-color: #64625b; }

.buddy-group { flex: 1; margin: 8px; border: 2px solid #6b6962; border-right-color: white; border-bottom-color: white; background: #fff; }
.buddy-group-title { display: flex; justify-content: space-between; padding: 6px 8px; color: white; background: #1b509a; font-size: 11px; }
.buddy-list { margin: 0; padding: 5px 0; list-style: none; }
.buddy-list li { display: flex; align-items: center; gap: 7px; padding: 6px 9px; font-size: 12px; }
.buddy-list li::before { content: "●"; color: #27a848; font-size: 9px; }
.buddy-list li.self { color: #71408d; font-weight: bold; }
.buddy-list-empty { color: #7e7b72; font-style: italic; }
.buddy-list .buddy-list-empty::before { color: #aaa69b; }

.away-note { display: flex; gap: 8px; align-items: center; margin: 0 8px 8px; padding: 9px; background: #fff7bd; border: 1px solid #b8a951; font-size: 10px; color: #5d5632; }
.away-note span { font-size: 22px; }
.away-note p { margin: 0; line-height: 1.35; }

footer { display: flex; justify-content: space-between; gap: 20px; margin: 13px 5px 0; color: #dce7f2; font: 10px "Courier New", monospace; text-shadow: 1px 1px rgba(0,0,0,.4); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 19, 36, .72);
  backdrop-filter: blur(2px);
}
.modal-backdrop.hidden { display: none; }
.name-dialog { width: min(440px, 100%); box-shadow: inset 1px 1px white, inset -1px -1px #77756d, 12px 15px 0 rgba(0,0,0,.28); }
.dialog-body { padding: 23px 25px 25px; display: grid; grid-template-columns: 70px 1fr; gap: 16px 14px; align-items: center; }
.dialog-logo { display: grid; place-items: center; }
.dialog-body h2 { margin: 0 0 6px; color: #154f9b; font-size: 23px; letter-spacing: -1px; }
.dialog-body p { margin: 0; color: #5a5851; font-size: 12px; line-height: 1.45; }
.dialog-body form { grid-column: 1 / -1; padding-top: 4px; }
.dialog-body input { width: 100%; padding: 9px; }
.form-error { min-height: 18px; padding: 3px 0 0; color: #b12121 !important; }
.sign-on-button { float: right; min-width: 105px; padding: 7px 16px; }

@media (max-width: 760px) {
  .desktop-shell { width: min(100% - 18px, 620px); padding-top: 18px; }
  .workspace { grid-template-columns: 1fr; }
  .chat-window, .buddy-window { min-height: auto; }
  .transcript { height: 54vh; min-height: 310px; }
  .buddy-window { max-height: 270px; }
  .buddy-group { min-height: 100px; overflow-y: auto; }
  .away-note { display: none; }
}

@media (max-width: 460px) {
  .brand-bar h1 { font-size: 24px; }
  .connection-pill { padding: 6px 8px; }
  .toolbar-label { display: none; }
  .composer-row { flex-direction: column; }
  .send-button { width: 100%; min-height: 40px; }
  .composer-hint span:first-child { display: none; }
  .composer-hint { justify-content: flex-end; }
  .dialog-body { grid-template-columns: 1fr; text-align: center; }
  .dialog-body form { grid-column: auto; text-align: left; }
  footer { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
