/* =========================================================================
   AOL Instant Messenger — circa 5.x. A loving pastiche, not affiliated.
   ========================================================================= */

/* Overflow discipline: all AIM windows honor their declared widths and
   long content (buddy names, URLs, signon labels) truncates or wraps
   rather than pushing layout. */
#aimSignon, #aimSignon *,
#aimBuddyList, #aimBuddyList *,
.aim-im, .aim-im * { box-sizing: border-box; }

.aim-im > *, #aimBuddyList > *, #aimSignon > * { min-width: 0; }

/* 98.css sets min-width: 75px and min-height: 23px on .title-bar button.
   Our AIM title bar buttons need to actually be small — neutralize those. */
#aimSignon .title-bar button,
#aimBuddyList .title-bar button,
.aim-im .title-bar button {
  min-width: 0;
  min-height: 0;
}

:root {
  --aim-blue: #0b4b91;
  --aim-blue-dark: #093a71;
  --aim-yellow: #fef3c5;
  --aim-yellow-warm: #ffd96b;
  --aim-orange: #f7a100;
  --aim-red: #c40d10;
  --aim-beige: #f7f2d8;
  --aim-text: #000;
}

/* --- Running Man --------------------------------------------------------- */
.rm {
  display: inline-block;
  width: 22px;
  height: 24px;
  position: relative;
  flex: 0 0 auto;        /* never grow/shrink inside a flex row */
  line-height: 0;        /* no inline-gap under the SVG */
}
.rm svg {
  display: block;
  width: 100%;
  height: 100%;
}
.rm.rm-sm { width: 14px; height: 16px; }
.rm.rm-lg { width: 58px; height: 64px; }
.rm.rm-title { width: 18px; height: 20px; vertical-align: middle; }

/* --- Sign-On Window ----------------------------------------------------- */
#aimSignon {
  width: 305px;
  min-width: 305px;
  position: absolute;
  background: #d7d3b9;
  border: 1px solid #000;
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 #808080,
    2px 2px 0 rgba(0,0,0,0.3);
  z-index: 60;
  display: none;
  font-family: "Arial", "Helvetica", sans-serif;
}
#aimSignon.open { display: block; }
#aimSignon .title-bar {
  background: linear-gradient(90deg, var(--aim-blue), #2a73c4);
  color: #fff;
  padding: 2px 4px;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: move;
  user-select: none;
  font-family: "MS Sans Serif", "Pixelated MS Sans Serif", Arial, sans-serif;
}
#aimSignon .title-bar .title-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#aimSignon .title-bar button {
  width: 16px;
  height: 14px;
  font-family: "Arial", sans-serif;
  font-size: 10px;
  line-height: 1;
  border: 1px outset #fff;
  background: #c0c0c0;
  color: #000;
  cursor: pointer;
  padding: 0;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#aimSignon .title-bar button:active { border-style: inset; }

.aim-signon-banner {
  height: 72px;
  background:
    linear-gradient(180deg, #ffd96b 0%, #ffc233 60%, #f7a100 100%);
  border-bottom: 1px solid #7a5200;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 12px;
  overflow: hidden;
}
.aim-signon-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 40%, rgba(255,255,255,0.6) 0 3px, transparent 4px),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.5) 0 2px, transparent 3px);
}
.aim-signon-banner .rm { width: 42px; height: 48px; }
.aim-signon-banner .aim-title {
  margin-left: 10px;
  font-family: "Arial Black", "Arial", sans-serif;
  font-weight: 900;
  color: #0b4b91;
  line-height: 1;
  text-shadow: 1px 1px 0 #fff;
}
.aim-signon-banner .aim-title .big { font-size: 22px; letter-spacing: 1px; }
.aim-signon-banner .aim-title .sub { font-size: 10px; letter-spacing: 2px; color: #6a3e00; }

.aim-signon-body {
  padding: 10px 14px 12px;
  font-size: 12px;
}
.aim-signon-body .row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.aim-signon-body .row label {
  width: 90px;
  color: var(--aim-blue);
  font-weight: bold;
  text-align: right;
}
.aim-signon-body .row input[type="text"],
.aim-signon-body .row input[type="password"] {
  flex: 1;
  padding: 2px 4px;
  font-size: 12px;
  border: 1px inset #808080;
  background: #fff;
  font-family: inherit;
}
.aim-signon-body .row .link-btn {
  background: none;
  border: 0;
  color: var(--aim-blue);
  text-decoration: underline;
  font-size: 11px;
  cursor: pointer;
  padding: 0 2px;
}
.aim-signon-body .check-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #333;
  padding-left: 96px;
}
.aim-signon-body .check-row label { cursor: pointer; }
.aim-signon-body .signon-status {
  font-size: 11px;
  color: #222;
  min-height: 14px;
  margin: 6px 0;
  text-align: center;
}
.aim-signon-body .signon-status.err { color: var(--aim-red); font-weight: bold; }

.aim-signon-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px 14px;
  font-size: 11px;
}
.aim-signon-actions .meta a {
  color: var(--aim-blue);
  text-decoration: underline;
  margin-right: 8px;
  cursor: pointer;
}
.aim-signon-actions button.signon-btn {
  min-width: 96px;
  padding: 6px 22px;
  font-weight: bold;
  background: linear-gradient(180deg, #4b91de 0%, #1f66b8 48%, #093a71 100%);
  border: 1px solid #062955;
  border-radius: 16px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: "Arial", sans-serif;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.25),
    1px 1px 2px rgba(0,0,0,0.3);
}
.aim-signon-actions button.signon-btn:hover {
  background: linear-gradient(180deg, #5ea1ed 0%, #2676c8 48%, #0e4a8a 100%);
}
.aim-signon-actions button.signon-btn:active {
  background: linear-gradient(180deg, #1f66b8, #4b91de);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
.aim-signon-actions button.signon-btn:disabled {
  background: linear-gradient(180deg, #aab4c3, #7c8596);
  color: #e6e6e6;
  cursor: progress;
}

.aim-connecting-bar {
  height: 12px;
  background: #fff;
  border: 1px inset #808080;
  margin: 0 14px 8px;
  position: relative;
  overflow: hidden;
  display: none;
}
.aim-connecting-bar.on { display: block; }
.aim-connecting-bar .fill {
  position: absolute;
  top: 1px; bottom: 1px;
  width: 40%;
  background: repeating-linear-gradient(90deg, var(--aim-blue) 0 10px, #2a73c4 10px 12px);
  animation: aim-cylon 1.1s ease-in-out infinite alternate;
}
@keyframes aim-cylon {
  from { left: 0%; }
  to   { left: 60%; }
}

/* --- Buddy List --------------------------------------------------------- */
#aimBuddyList {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 186px;
  background: #ccc6a8;
  border: 1px solid #000;
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 #808080,
    2px 2px 0 rgba(0,0,0,0.35);
  z-index: 25;
  display: none;
  font-family: "Arial", "Helvetica", sans-serif;
  font-size: 12px;
  user-select: none;
}
#aimBuddyList.open { display: block; }
#aimBuddyList .title-bar {
  background: linear-gradient(90deg, var(--aim-blue), #2a73c4);
  color: #fff;
  padding: 2px 4px;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: move;
  font-family: "MS Sans Serif", Arial, sans-serif;
}
#aimBuddyList .title-bar .title-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#aimBuddyList .title-bar button {
  width: 16px;
  height: 14px;
  font-family: "Arial", sans-serif;
  font-size: 10px;
  border: 1px outset #fff;
  background: #c0c0c0;
  color: #000;
  cursor: pointer;
  padding: 0;
  font-weight: bold;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#aimBuddyList .title-bar button:active { border-style: inset; }
#aimBuddyList .title-bar .tb-min { position: relative; }
#aimBuddyList .title-bar .tb-min::before {
  content: "";
  position: absolute;
  left: 3px; right: 3px;
  bottom: 3px;
  height: 2px;
  background: #000;
}
#aimBuddyList .menubar {
  background: #ccc6a8;
  border-bottom: 1px solid #888;
  padding: 1px 4px;
  font-size: 11px;
  display: flex;
  gap: 8px;
}
#aimBuddyList .menubar span {
  padding: 1px 4px;
  cursor: default;
}
#aimBuddyList .menubar span:hover {
  background: var(--aim-blue);
  color: #fff;
}

#aimBuddyList .tabs {
  display: flex;
  background: #ccc6a8;
  padding: 3px 3px 0;
  gap: 2px;
  border-bottom: 1px solid #888;
}
#aimBuddyList .tab {
  padding: 3px 10px 5px;
  background: #bdb595;
  border: 1px solid #888;
  border-bottom: 0;
  font-size: 11px;
  font-weight: bold;
  color: #444;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
}
#aimBuddyList .tab.active {
  background: #fff;
  color: var(--aim-blue);
  position: relative;
  top: 1px;
}

#aimBuddyList .buddy-tree {
  background: #fff;
  margin: 0 3px;
  border: 1px inset #aaa;
  min-height: 200px;
  max-height: 50vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0;
}
.buddy-group {
  padding: 2px 4px;
  font-weight: bold;
  font-size: 11px;
  background: linear-gradient(180deg, #eae5c3, #d7d2b0);
  border-bottom: 1px solid #aaa;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.buddy-group .count {
  margin-left: auto;
  font-weight: normal;
  color: #555;
  font-size: 10px;
}
.buddy-group .caret { font-family: monospace; font-size: 10px; }
.buddy-row {
  padding: 1px 4px 1px 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #000;
  cursor: default;
  border-bottom: 1px dotted #eee;
  position: relative;
  overflow: hidden;
}
.buddy-row .rm { width: 14px; height: 16px; }
.buddy-row > .bname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.buddy-row.away .rm { filter: grayscale(0.4) brightness(1.1) saturate(0.5); }
.buddy-row.idle .rm { opacity: 0.5; }
.buddy-row.self { font-weight: bold; color: var(--aim-blue); }
.buddy-row:hover { background: var(--aim-blue); color: #fff; }
.buddy-row.away::after {
  content: "(away)";
  font-style: italic;
  color: #888;
  font-size: 10px;
  margin-left: auto;
  padding-left: 4px;
}
.buddy-row:hover.away::after { color: #ffd96b; }
.buddy-empty { padding: 14px 8px; color: #888; font-style: italic; text-align: center; font-size: 11px; }

#aimBuddyList .bl-bottom {
  padding: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  font-size: 11px;
}
#aimBuddyList .bl-bottom .setup-btn,
#aimBuddyList .bl-bottom .im-btn {
  padding: 3px 8px;
  background: linear-gradient(180deg, #e6e0b2, #c8c09a);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080;
  font-size: 11px;
  cursor: pointer;
  font-family: "Arial", sans-serif;
  color: var(--aim-blue);
  font-weight: bold;
  white-space: nowrap;
  flex: 0 0 auto;
}
#aimBuddyList .status-bar {
  background: #ccc6a8;
  border-top: 1px solid #888;
  padding: 2px 6px;
  font-size: 10px;
  color: #333;
  display: flex;
  gap: 8px;
  align-items: center;
}
#aimBuddyList .status-bar .away-flag {
  color: var(--aim-red);
  font-weight: bold;
}

/* --- IM Window ---------------------------------------------------------- */
.aim-im {
  position: absolute;
  width: 340px;
  height: 320px;
  background: #ccc6a8;
  border: 1px solid #000;
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 #808080,
    2px 2px 0 rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  font-family: "Arial", "Helvetica", sans-serif;
  font-size: 12px;
  z-index: 30;
}
.aim-im .title-bar {
  background: linear-gradient(90deg, var(--aim-blue), #2a73c4);
  color: #fff;
  padding: 2px 4px;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: move;
  font-family: "MS Sans Serif", Arial, sans-serif;
}
.aim-im .title-bar .rm { width: 14px; height: 16px; flex-shrink: 0; }
.aim-im .title-bar .title-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aim-im .title-bar button {
  width: 16px;
  height: 14px;
  border: 1px outset #fff;
  background: #c0c0c0;
  font-family: "Arial", sans-serif;
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  font-weight: bold;
  line-height: 1;
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aim-im .title-bar button:active { border-style: inset; }

.aim-im .menubar {
  background: #ccc6a8;
  padding: 1px 4px;
  font-size: 11px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #888;
}
.aim-im .menubar span { padding: 1px 4px; cursor: default; }
.aim-im .menubar span:hover { background: var(--aim-blue); color: #fff; }

.aim-im .history {
  flex: 1;
  background: #fff;
  margin: 2px;
  border: 1px inset #808080;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.35;
  min-height: 80px;
}
.aim-im .history .msg {
  margin-bottom: 2px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.aim-im .history .msg .who { font-weight: bold; }
.aim-im .history .msg.out .who { color: var(--aim-red); }
.aim-im .history .msg.in .who { color: var(--aim-blue); }
.aim-im .history .msg.auto .who::after { content: " (Auto-Response)"; font-weight: normal; font-style: italic; color: #888; }
.aim-im .history .msg.sys {
  color: #555;
  font-style: italic;
  font-size: 11px;
  padding: 2px 0;
  border-top: 1px dashed #ccc;
  border-bottom: 1px dashed #ccc;
  margin: 4px 0;
}
.aim-im .history .msg a { color: var(--aim-blue); }
.aim-im .history .smiley { font-size: 13px; }

.aim-im .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  background: linear-gradient(180deg, #e2dcba, #ccc6a8);
  border-top: 1px solid #888;
  border-bottom: 1px solid #888;
  font-size: 11px;
  position: relative;
}
.aim-im .toolbar button { flex: 0 0 auto; }
.aim-im .toolbar button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  font-family: "Arial", sans-serif;
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aim-im .toolbar button:hover {
  border: 1px outset #fff;
  background: #f2ecca;
}
.aim-im .toolbar button.active {
  border: 1px inset #888;
  background: #e8e2c0;
}
.aim-im .toolbar .sep {
  width: 1px;
  height: 18px;
  background: #999;
  margin: 0 4px;
}

/* Palette popovers */
.aim-popover {
  position: absolute;
  background: #ccc6a8;
  border: 1px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  padding: 4px;
  z-index: 80;
  display: none;
  font-family: "Arial", sans-serif;
  max-width: calc(100% - 8px);
}
.aim-popover.open { display: grid; }
.aim-popover.colors {
  grid-template-columns: repeat(8, 16px);
  gap: 2px;
}
.aim-popover.colors button {
  width: 16px;
  height: 16px;
  border: 1px solid #000;
  padding: 0;
  cursor: pointer;
}
.aim-popover.colors button:hover { outline: 2px solid #fff; outline-offset: -1px; }

.aim-popover.smilies {
  grid-template-columns: repeat(6, 22px);
  gap: 2px;
  font-size: 14px;
}
.aim-popover.smilies button {
  width: 22px;
  height: 22px;
  background: #f2ecca;
  border: 1px outset #fff;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.aim-popover.smilies button:hover { background: #fff8d6; }

.aim-im .compose {
  background: #fff;
  margin: 2px;
  border: 1px inset #808080;
  min-height: 44px;
  max-height: 100px;
  padding: 4px 6px;
  font-size: 12px;
  outline: none;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: "Arial", sans-serif;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.aim-im .compose:empty::before {
  content: attr(data-placeholder);
  color: #aaa;
}

.aim-im .bottom-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 4px;
  background: #ccc6a8;
}
.aim-im .bottom-bar .hint {
  flex: 1 1 100%;
  font-size: 10px;
  color: #666;
  font-style: italic;
  min-height: 0;
  padding: 0 4px;
  order: -1;
}
.aim-im .bottom-bar .hint:empty { display: none; }
.aim-im .bottom-bar button {
  padding: 3px 10px;
  background: linear-gradient(180deg, #e6e0b2, #c8c09a);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080;
  font-size: 11px;
  cursor: pointer;
  font-family: "Arial", sans-serif;
  color: var(--aim-blue);
  font-weight: bold;
  white-space: nowrap;
  flex: 0 0 auto;
}
.aim-im .bottom-bar .send-btn { margin-left: auto; }
.aim-im .bottom-bar button:active {
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
}
.aim-im .bottom-bar .warn-btn { color: var(--aim-red); }
.aim-im .bottom-bar .send-btn {
  min-width: 68px;
  background: linear-gradient(180deg, #4b91de 0%, #1f66b8 50%, #093a71 100%);
  color: #fff;
  border: 1px solid #062955;
  border-radius: 12px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    inset 0 -2px 3px rgba(0,0,0,0.2);
}
.aim-im .bottom-bar .send-btn:hover {
  background: linear-gradient(180deg, #5ea1ed, #2676c8 50%, #0e4a8a 100%);
}
.aim-im .bottom-bar .send-btn:active {
  background: linear-gradient(180deg, #1f66b8, #4b91de);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}

.aim-im .warn-bar {
  display: none;
  padding: 2px 6px;
  background: linear-gradient(90deg, #fff2c0, #ffd96b);
  border-bottom: 1px solid #888;
  font-size: 10px;
  color: #6a3e00;
}
.aim-im .warn-bar.on { display: flex; align-items: center; gap: 6px; }
.aim-im .warn-bar .level-bar {
  flex: 1;
  height: 8px;
  background: #fff;
  border: 1px inset #aaa;
  position: relative;
  overflow: hidden;
}
.aim-im .warn-bar .level-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffe100, var(--aim-red));
  transition: width 0.4s ease-out;
}
.aim-im .warn-bar .level-num { min-width: 32px; text-align: right; font-weight: bold; }

/* Shrinks on narrow viewports so buddy list doesn't cover the desktop */
@media (max-width: 720px) {
  #aimBuddyList { width: 168px; }
  .aim-im { width: 92vw; max-width: 360px; }
}
