/* Buddy Chat '99 — a friendly pastiche of a certain yellow running man */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font: 11px Verdana, Geneva, "Trebuchet MS", sans-serif;
  color: #000;
  /* the family PC's teal desktop */
  background: #0d7f7f;
  background-image:
    radial-gradient(ellipse at 50% 30%, rgba(255,255,255,0.06), rgba(0,0,0,0.14) 75%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.03) 0 2px, transparent 2px 4px);
  overflow: auto;
}

::selection { background: #0a246a; color: #fff; }

/* ---------- retro bevels ---------- */
.win {
  background: #d4d0c8;
  padding: 3px;
  box-shadow:
    inset -1px -1px 0 #0a0a0a,
    inset  1px  1px 0 #ffffff,
    inset -2px -2px 0 #808080,
    inset  2px  2px 0 #dfdfdf,
    2px 3px 8px rgba(0,0,0,0.45);
}
.bevel-in,
.text-in,
.messages {
  background: #fff;
  box-shadow:
    inset -1px -1px 0 #ffffff,
    inset  1px  1px 0 #0a0a0a,
    inset -2px -2px 0 #dfdfdf,
    inset  2px  2px 0 #808080;
}

/* ---------- windows ---------- */
#desktop {
  min-height: 100%;
  padding: 24px 16px 60px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
}
.main-win { width: 640px; max-width: 96vw; }
.buddy-win { width: 208px; max-width: 96vw; margin-top: 26px; }
.main-win.maximized { width: min(1100px, 96vw); }

.win-title {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 2px 0 3px;
  background: linear-gradient(90deg, #0a246a 0%, #2148b0 40%, #a6caf0 100%);
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  user-select: none;
  cursor: default;
}
.win-title-icon { width: 14px; height: 14px; flex: none; }
.win-title-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.6);
}
.win-btns { display: flex; gap: 2px; flex: none; }
.wb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 14px;
  background: #d4d0c8;
  color: #000;
  font-style: normal;
  font-weight: bold;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset -1px -1px 0 #0a0a0a,
    inset  1px  1px 0 #ffffff,
    inset -2px -2px 0 #808080,
    inset  2px  2px 0 #dfdfdf;
}
.wb:active { box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff; }

.win-body { padding: 6px; }
.win-status {
  display: flex;
  gap: 2px;
  padding: 2px 1px 1px;
}
.status-cell {
  flex: 1;
  background: #d4d0c8;
  padding: 2px 4px 3px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow:
    inset  1px  1px 0 #808080,
    inset -1px -1px 0 #ffffff;
}
.status-right { flex: 0 0 auto; max-width: 55%; }

.win.minimized .win-body,
.win.minimized .win-status { display: none; }

.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  font: 11px Verdana, Geneva, sans-serif;
  color: #000;
  background: #d4d0c8;
  border: none;
  padding: 3px 12px 4px;
  min-width: 60px;
  cursor: pointer;
  box-shadow:
    inset -1px -1px 0 #0a0a0a,
    inset  1px  1px 0 #ffffff,
    inset -2px -2px 0 #808080,
    inset  2px  2px 0 #dfdfdf;
}
.btn:hover { background: #e0dcd4; }
.btn:active {
  background: #c8c4bc;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
  padding: 4px 11px 3px 13px;
}
.btn-default { outline: 1px solid #000; outline-offset: 0; }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

.linkish {
  font: inherit;
  color: #0016a0;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.text-in {
  font: 12px Verdana, Geneva, sans-serif;
  padding: 3px 4px;
  border: none;
  width: 100%;
}
.text-in:focus { outline: none; background: #ffffe8; }

/* ---------- sign on ---------- */
#signon-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  z-index: 40;
}
#signon-win { width: 330px; max-width: 94vw; }
.signon-body { padding: 14px 14px 10px; }
.signon-logo { text-align: center; margin-bottom: 12px; }
.wordmark {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 30px;
  font-weight: bold;
  font-style: italic;
  letter-spacing: -1px;
  color: #0a246a;
  text-shadow: 2px 2px 0 #a6caf0, 3px 3px 2px rgba(0,0,0,0.25);
}
.wordmark .tm { font-size: 10px; vertical-align: super; font-style: normal; }
.wordmark-sub { color: #555; font-size: 10px; margin-top: 2px; }
.field-label { display: block; margin: 8px 0 3px; color: #222; }
.signon-row { display: flex; gap: 4px; }
.signon-row .text-in { flex: 1; }
.signon-row #suggest { min-width: 26px; padding: 3px 6px; }
.chk { display: flex; align-items: center; gap: 5px; margin: 10px 0 4px; color: #222; }
.chk input { accent-color: #0a246a; }
.signon-btns { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.signon-err { color: #a00000; min-height: 14px; text-align: center; margin-top: 8px; }
.share-hint { color: #d8f3f3; font-size: 10px; text-shadow: 1px 1px 1px rgba(0,0,0,0.5); }
.share-hint .linkish { color: #fff8a0; word-break: break-all; }

/* ---------- chat window ---------- */
.chat-body { padding: 4px; display: flex; flex-direction: column; gap: 4px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  background: #d4d0c8;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #808080;
}
.tbtn { min-width: 0; padding: 2px 7px 3px; font-size: 10px; }
.tb-sep {
  width: 2px; align-self: stretch; margin: 1px 3px;
  box-shadow: inset 1px 0 0 #808080, inset -1px 0 0 #fff;
}
.tb-spacer { flex: 1; }
.tb-brand { color: #7a7a7a; font-size: 10px; padding-right: 4px; font-style: italic; }

.messages {
  height: 320px;
  overflow-y: auto;
  padding: 6px 8px;
  font: 13px Arial, Helvetica, sans-serif;
  line-height: 1.45;
  overscroll-behavior: contain;
}
.main-win.maximized .messages { height: 56vh; }

.msg { margin: 1px 0; word-wrap: break-word; overflow-wrap: break-word; }
.msg-name { color: #0000cc; font-weight: bold; }
.msg-name.me { color: #a000a0; }
.msg-time { color: #8a8a8a; font-size: 11px; }
.msg-body a { color: #0000ee; text-decoration: underline; word-break: break-all; }
.msg.sys {
  color: #767676;
  font-style: italic;
  font-size: 12px;
  margin: 3px 0;
}
.msg.day { color: #999; font-size: 10px; text-align: center; margin: 6px 0 3px; letter-spacing: 1px; }

img.smiley {
  width: 19px; height: 19px;
  vertical-align: -4px;
  margin: 0 1px;
}

.composer { display: flex; flex-direction: column; gap: 4px; }
.smileypicker {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  padding: 3px;
  background: #d4d0c8;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
}
.smileypicker button {
  border: none; background: none; padding: 1px; cursor: pointer; line-height: 0;
}
.smileypicker button:hover { background: rgba(10,36,106,0.15); }
.smileypicker img { width: 19px; height: 19px; }
.composer-row { display: flex; gap: 4px; }
.composer-row .text-in { flex: 1; height: 26px; }
#send-btn { min-width: 76px; }

/* ---------- buddy list ---------- */
.buddy-body { padding: 4px 4px 6px; }
.menubar {
  display: flex;
  gap: 2px;
  padding: 1px 2px 3px;
  border-bottom: 1px solid #808080;
  box-shadow: 0 1px 0 #fff;
  margin-bottom: 5px;
}
.menu-item { padding: 1px 6px; cursor: pointer; user-select: none; }
.menu-item:hover { background: #0a246a; color: #fff; }

.buddy-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 6px;
}
.buddy-head-txt { display: flex; flex-direction: column; line-height: 1.25; }
.buddy-head-txt b { font-family: "Trebuchet MS", Verdana, sans-serif; font-style: italic; color: #0a246a; font-size: 14px; }
.buddy-head-txt span { color: #666; font-size: 9px; }

.group-head {
  padding: 2px 4px 3px;
  background: #c8c4bc;
  font-weight: bold;
  color: #0a246a;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080;
}
.group-head:hover { background: #d8d4cc; }
.tri { font-size: 8px; display: inline-block; width: 10px; }

.buddy-list { list-style: none; margin: 3px 0 0; }
.buddy-list li {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px 2px 6px;
  cursor: pointer;
  user-select: none;
}
.buddy-list li img { width: 14px; height: 14px; flex: none; }
.buddy-list li:hover { background: #e4e0d8; }
.buddy-list li.selected { background: #0a246a; color: #fff; }
.buddy-list li.selected .buddy-tag { color: #a6caf0; }
.buddy-list .buddy-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buddy-list .buddy-tag { color: #8a8a8a; font-size: 9px; }
.buddy-list.collapsed { display: none; }
.offline-note { color: #777; font-size: 10px; padding: 8px 6px; font-style: italic; }

/* ---------- running man (pure CSS, 1999 energy) ---------- */
.running-man {
  display: inline-block;
  width: 34px; height: 34px;
  flex: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg stroke='%2312572f' stroke-width='0' fill='none'%3E%3Cpath d='M30 8 l6 3 M31 13 l7 1' stroke='%23f5a30f' stroke-width='1.6' stroke-linecap='round'/%3E%3Cellipse cx='26.5' cy='7.5' rx='4.4' ry='5' fill='%23ffd23f' stroke='%23a06a00' stroke-width='1'/%3E%3Cpath d='M25 12.5 C21 14 18.5 18 17 24 M25 12.5 C28 14.5 30 17.5 31 21' stroke='%23ffd23f' stroke-width='3.4' stroke-linecap='round' fill='none'/%3E%3Cpath d='M17 24 L13.5 31 M17 24 L19 32.5 M31 21 L36.5 27 M31 21 L27.5 29' stroke='%23ffd23f' stroke-width='3' stroke-linecap='round' fill='none'/%3E%3Cpath d='M13.5 31 L10.5 34 M19 32.5 L18 36.5 M36.5 27 L39 30.5 M27.5 29 L24.5 33' stroke='%2312572f' stroke-width='3' stroke-linecap='round' fill='none'/%3E%3Cellipse cx='25.3' cy='6.6' rx='0.7' ry='1' fill='%2312572f'/%3E%3C/g%3E%3C/svg%3E");
}
.running-man.small { width: 16px; height: 16px; background-image: none; position: relative; }
.running-man.small::before { content: "\1F3C3"; font-size: 11px; }
.wordmark .running-man, .buddy-head .running-man { animation: run 0.45s steps(2) infinite alternate; }
@keyframes run {
  from { transform: rotate(-4deg) translateY(0); }
  to   { transform: rotate(4deg) translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark .running-man, .buddy-head .running-man { animation: none; }
}

/* ---------- dialogs ---------- */
#dialog-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.22);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 60;
}
.dialog-win { width: 340px; max-width: 94vw; }
.dialog-icon { font-size: 12px; line-height: 14px; color: #fff; }
.dialog-body { padding: 14px 12px; font-size: 11px; line-height: 1.6; text-align: center; }
.dialog-body .dialog-btns { margin-top: 14px; display: flex; justify-content: center; gap: 8px; }
.dialog-body .profile { text-align: left; margin: 8px 0; }
.dialog-body .profile div { padding: 2px 0; border-bottom: 1px dotted #aaa; }
.dialog-body .profile b { color: #0a246a; }

/* ---------- scrollbars, the way nature intended ---------- */
.messages::-webkit-scrollbar { width: 16px; }
.messages::-webkit-scrollbar-track {
  background: #dfdfdf;
  box-shadow: inset 1px 0 0 #fff;
}
.messages::-webkit-scrollbar-thumb {
  background: #d4d0c8;
  box-shadow: inset -1px -1px 0 #0a0a0a, inset 1px 1px 0 #fff, inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf;
}
.messages { scrollbar-color: #d4d0c8 #dfdfdf; scrollbar-width: auto; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  #desktop { padding: 10px 8px 40px; }
  .main-win { order: 1; }
  .buddy-win { order: 2; margin-top: 0; width: min(640px, 96vw); }
  .messages { height: 46vh; }
  .main-win.maximized .messages { height: 60vh; }
  .wordmark { font-size: 24px; }
}
