/* ─── Win98 Pixel Font ──────────────────────────────────────────────── */
@font-face {
  font-family: "Pixelated MS Sans Serif";
  font-style: normal;
  font-weight: 400;
  src: url('fonts/ms_sans_serif.woff2') format('woff2'),
       url('fonts/ms_sans_serif.woff') format('woff');
}
@font-face {
  font-family: "Pixelated MS Sans Serif";
  font-style: normal;
  font-weight: 700;
  src: url('fonts/ms_sans_serif_bold.woff2') format('woff2'),
       url('fonts/ms_sans_serif_bold.woff') format('woff');
}

/* ─── CSS Variables (Win98 system colors) ──────────────────────────── */
:root {
  --btn-face:       #d4d0c8;
  --btn-highlight:  #ffffff;
  --btn-shadow:     #808080;
  --btn-dark:       #404040;
  --win-frame:      #000000;
  --caption-active: linear-gradient(to right, #000080 0%, #1084d0 100%);
  --caption-inactive: linear-gradient(to right, #808080 0%, #b0b0b0 100%);
  --desktop-bg:     #008080;
  --select-bg:      #000080;
}

/* ─── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Pixelated MS Sans Serif", "MS Sans Serif", Tahoma, sans-serif;
  -webkit-font-smoothing: none;
  font-size: 11px;
  background: var(--desktop-bg);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* ─── Desktop ──────────────────────────────────────────────────────── */
#desktop {
  position: absolute;
  inset: 0 0 calc(30px + env(safe-area-inset-bottom, 0px)) 0;
  background: var(--desktop-bg);   /* flat — exactly what Win98 showed */
  overflow: hidden;
}

/* ─── Desktop Icons ────────────────────────────────────────────────── */
.desktop-icon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 76px;
  padding: 4px;
  cursor: default;
}

.desktop-icon:focus { outline: none; }

/* selected state: Win98 draws a solid navy box, dotted outline */
.desktop-icon.selected .icon-img-wrap {
  background: var(--select-bg);
  outline: 1px dotted #fff;
  outline-offset: 1px;
}
.desktop-icon.selected span {
  background: var(--select-bg);
  color: #fff;
  outline: 1px dotted #fff;
}

.icon-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.icon-img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  display: block;
  /* disable browser smoothing so pixel-art icons stay crisp */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.desktop-icon span {
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  text-align: center;
  font-size: 11px;
  line-height: 1.25;
  margin-top: 3px;
  word-break: break-word;
  max-width: 72px;
  padding: 0 2px;
}

/* icon positions — left column, top to bottom, right-aligned to left edge */
#icon-mycomp   { top: 10px;  left: 10px; }
#icon-mydocs   { top: 92px;  left: 10px; }
#icon-ie       { top: 174px; left: 10px; }
#icon-aim      { top: 256px; left: 10px; }
#icon-awaymsg  { top: 338px; left: 10px; }
#icon-chatrooms { top: 420px; left: 10px; }
#icon-chatrooms .icon-img { width: 48px; height: 48px; }
#icon-recycle  { bottom: 40px; right: 10px; }

/* ─── Generic Window overrides ─────────────────────────────────────── */
.window {
  position: absolute;
  min-width: 200px;
  box-shadow: 2px 2px 0 0 #000, 3px 3px 6px rgba(0,0,0,0.4);
  overflow: visible;
}

/* ─── Resize handles ────────────────────────────────────────────────── */
.rsz-handle { position: absolute; z-index: 9998; }
.rsz-n  { top: -4px;    left: 8px;    right: 8px;   height: 8px;  cursor: n-resize; }
.rsz-s  { bottom: -4px; left: 8px;    right: 8px;   height: 8px;  cursor: s-resize; }
.rsz-e  { right: -4px;  top: 8px;     bottom: 8px;  width: 8px;   cursor: e-resize; }
.rsz-w  { left: -4px;   top: 8px;     bottom: 8px;  width: 8px;   cursor: w-resize; }
.rsz-ne { top: -4px;    right: -4px;  width: 12px;  height: 12px; cursor: ne-resize; }
.rsz-nw { top: -4px;    left: -4px;   width: 12px;  height: 12px; cursor: nw-resize; }
.rsz-se { bottom: -4px; right: -4px;  width: 12px;  height: 12px; cursor: se-resize; }
.rsz-sw { bottom: -4px; left: -4px;   width: 12px;  height: 12px; cursor: sw-resize; }
body.is-resizing,
body.is-resizing * { cursor: inherit !important; user-select: none !important; }

/* inactive title bar: override 98.css active gradient with gray */
.window.inactive .title-bar {
  background: var(--caption-inactive) !important;
}
.window.inactive .title-bar .title-bar-text { color: #c0c0c0; }

/* all window title bars: move cursor */
.window .title-bar { cursor: move; }

/* ─── AIM Window ───────────────────────────────────────────────────── */
.aim-window {
  top: 80px;
  right: 70px;
  width: 222px;
  height: 420px;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* ─── AIM Panels ───────────────────────────────────────────────────── */
.aim-panel {
  background: var(--btn-face);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ─── Sign-on blue header ──────────────────────────────────────────── */
.aim-signon-header {
  line-height: 0;
  overflow: hidden;
}

.aim-signon-logo-img {
  width: 100%;
  display: block;
  image-rendering: pixelated;
}

/* running man SVG (connecting screen) */
.aim-runman-svg {
  width: 36px;
  height: 44px;
  filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.35));
  flex-shrink: 0;
}

.aim-runman-svg.anim {
  animation: runStep 0.44s steps(2) infinite;
  transform-origin: center 90%;
}
@keyframes runStep {
  0%   { transform: translateY(0px)  rotate(-4deg); }
  50%  { transform: translateY(-5px) rotate(4deg); }
  100% { transform: translateY(0px)  rotate(-4deg); }
}

/* connecting header keeps orange */
.aim-header {
  background: linear-gradient(to bottom, #ffee40 0%, #ffa000 45%, #e03200 100%);
  padding: 10px 8px 8px;
  border-bottom: 2px solid #882000;
}
.aim-logo-area { display: flex; align-items: center; gap: 8px; }
.aim-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.aim-aol { font-size: 22px; font-weight: bold; color: #fff; text-shadow: 1px 1px 0 #7a3000; letter-spacing: 2px; }
.aim-im  { font-size: 9px; color: #fff; font-weight: bold; letter-spacing: 0.3px; }

/* ─── Sign-on body ─────────────────────────────────────────────────── */
.aim-signin-body {
  padding: 8px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--btn-face);
}

/* screen name label row with key icon */
.aim-sn-label-row { display: flex; align-items: center; margin-bottom: 1px; }
.aim-sn-label { font-weight: bold; font-size: 11px; font-style: italic; }
.aim-pw-label { font-weight: bold; font-size: 11px; margin-top: 4px; display: block; }

/* screen name is a dropdown in real AIM */
.aim-sn-select { width: 100%; font-size: 11px; height: 22px; }

.aim-link {
  color: #0000cc;
  text-decoration: underline;
  font-size: 10px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  display: block;
  margin-top: 1px;
  margin-bottom: 2px;
}
.aim-link:hover { color: #cc0000; }

.aim-checks-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 10px;
}
.aim-checks-row label { font-size: 10px; }

/* ─── Sign-on bottom toolbar ───────────────────────────────────────── */
.aim-signon-toolbar {
  display: flex;
  align-items: center;
  background: var(--btn-face);
  border-top: 2px groove var(--btn-face);
  padding: 3px 4px;
  gap: 2px;
}
.aim-signon-tb-sep {
  width: 2px;
  height: 26px;
  border-left: 1px solid var(--btn-shadow);
  border-right: 1px solid #fff;
  margin: 0 3px;
}
.aim-tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
  padding: 2px 4px;
  min-width: 0 !important;
  min-height: 0 !important;
}
.aim-tb-btn:hover img  { filter: brightness(1.12); }
.aim-tb-btn:active img { filter: brightness(0.78); }
.aim-signon-btn { margin-left: auto; }

.aim-version-bar {
  text-align: center;
  font-size: 9px;
  color: #555;
  background: var(--btn-face);
  padding: 2px 0 3px;
  border-top: 1px solid #c8c4bc;
}

.aim-input {
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  font-size: 11px;
  width: 100%;
  height: 21px;
  padding: 1px 3px;
  border: 2px inset;
  border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
  background: #fff;
  color: #000;
}
select.aim-input { height: 21px; padding: 0 2px; }

.field-row-stacked label { font-size: 11px; margin-bottom: 1px; display: block; }

.aim-checkrow { gap: 5px; margin-top: 1px; }

.aim-signin-buttons {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: center;
}

.aim-btn-sign-on {
  background: linear-gradient(to bottom, #ffe050 0%, #ffaa00 100%);
  border: 2px outset;
  border-color: #ffe080 #aa6600 #aa6600 #ffe080;
  color: #000;
  font-weight: bold;
  font-size: 11px;
  font-family: inherit;
  padding: 3px 14px;
  cursor: pointer;
  min-width: 74px;
}
.aim-btn-sign-on:active {
  border-style: inset;
  border-color: #aa6600 #ffe080 #ffe080 #aa6600;
}

.aim-status-text {
  font-size: 10px;
  color: #000080;
  text-align: center;
  min-height: 14px;
  margin-top: 2px;
}

/* ─── UI icon image helpers ──────────────────────────────────────────── */
.aim-tb-icon,
.aim-fmt-icon,
.aim-chat-action-icon,
.aim-bl-action-icon {
  display: block;
  image-rendering: pixelated;
  max-width: none !important;
  flex-shrink: 0;
}

/* ─── AIM Footer ───────────────────────────────────────────────────── */
.aim-footer {
  background: #c8c4bc;
  border-top: 1px solid var(--btn-shadow);
  padding: 3px 8px;
  font-size: 10px;
  text-align: center;
  color: #555;
}
.aim-footer a { color: #0000cc; text-decoration: none; }
.aim-footer a:hover { text-decoration: underline; }

/* ─── Connecting ───────────────────────────────────────────────────── */
.aim-connecting-body {
  padding: 0 10px 8px;
  text-align: center;
  background: var(--btn-face);
}
#connecting-sn {
  font-size: 11px;
  font-weight: bold;
  color: #000;
  margin: 8px 0;
}
.aim-connecting-body p {
  font-size: 11px;
  color: #000;
  margin: 8px 0;
}

/* ─── Buddy List – Win98 menu bar ──────────────────────────────────── */
.aim-bl-menubar {
  display: flex;
  background: var(--btn-face);
  border-bottom: 1px solid var(--btn-shadow);
  padding: 1px 0;
}
.aim-bl-mi {
  padding: 2px 8px;
  font-size: 11px;
  cursor: default;
}
.aim-bl-mi:hover { background: var(--select-bg); color: #fff; }

/* ─── Buddy list banner ─────────────────────────────────────────────── */
.aim-bl-banner { line-height: 0; text-align: center; }
.aim-bl-banner-img { display: inline-block; }

/* ─── Tab bar ────────────────────────────────────────────────────────── */
.aim-tab-bar {
  display: flex;
  align-items: flex-end;
  background: var(--btn-face);
  padding: 4px 3px 0;
  border-bottom: 1px solid #808080;
}
.aim-tab {
  position: relative;
  padding: 3px 10px;
  font-size: 11px;
  cursor: default;
  background: #b8b4ac;
  border: 1px solid;
  border-color: #fff #808080 #808080 #fff;
  border-bottom: none;
  white-space: nowrap;
}
#tab-online    { border-radius: 3px 0 0 0; }
#tab-listsetup { border-radius: 0 3px 0 0; }
.aim-tab-active {
  background: var(--btn-face);
  font-weight: bold;
  padding: 4px 10px;
  border-color: #fff #808080 #808080 #fff;
  border-bottom: 2px solid var(--btn-face);
  margin-bottom: -1px;
  z-index: 2;
}

/* ─── Buddy tree ─────────────────────────────────────────────────────── */
.aim-buddy-tree {
  background: #fff;
  border: 2px inset;
  border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
  margin: 3px 3px 2px;
  min-height: 60px;
  flex: 1;
  overflow-y: auto;
  font-size: 11px;
}
.aim-buddy-group { }

.aim-group-header {
  background: var(--btn-face);
  padding: 1px 4px;
  font-weight: bold;
  cursor: default;
  font-size: 11px;
  border-bottom: 1px solid #c8c4bc;
  color: #000;
  display: flex;
  align-items: center;
  gap: 2px;
  user-select: none;
}
.aim-group-header:hover { background: #c8c4bc; }

.aim-group-arrow {
  font-size: 7px;
  display: inline-block;
  transition: transform 0.12s;
  color: #000;
}
.aim-group-header.collapsed .aim-group-arrow { transform: rotate(-90deg); }

.aim-buddy {
  padding: 1px 4px 1px 16px;
  cursor: default;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.aim-buddy.online { color: #000; }
.aim-buddy.offline { color: #888; font-style: italic; }
.aim-buddy:hover { background: var(--select-bg); color: #fff; font-style: normal; }
.aim-buddy.selected { background: var(--select-bg); color: #fff; font-style: normal; }

/* ─── Action icon buttons ─────────────────────────────────────────── */
.aim-action-bar {
  display: flex;
  padding: 3px 5px;
  gap: 6px;
  background: var(--btn-face);
  border-top: 1px solid #fff;
  border-bottom: 1px solid var(--btn-shadow);
  align-items: center;
}
.aim-action-btn {
  display: flex; align-items: center; justify-content: center;
  min-width: 0;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
  padding: 4px;
}
.aim-action-btn:hover img  { filter: brightness(1.12); }
.aim-action-btn:active img { filter: brightness(0.78); }

/* ─── Away Message Dialog ─────────────────────────────────────────── */
.aim-away-fmtbar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 3px;
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  margin-bottom: 0;
}
.away-msg-editor {
  width: 100%;
  min-height: 80px;
  overflow-y: auto;
  background: #fff;
  border: 2px inset;
  border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
  padding: 5px 6px;
  font-size: 11px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  outline: none;
  cursor: text;
  word-wrap: break-word;
  box-sizing: border-box;
  line-height: 1.4;
}
/* Ensure highlight spans stretch to full line height */
.away-msg-editor span[style*="background-color"] {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  line-height: inherit;
  padding: 1px 0;
}
.away-msg-editor:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}
.away-special-chars {
  margin-top: 8px;
  font-size: 10px;
  color: #333;
  line-height: 1.6;
}
#away-save-cb {
  appearance: checkbox !important;
  -webkit-appearance: checkbox !important;
  opacity: 1 !important;
  width: 13px !important;
  height: 13px !important;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* Flex-column dialogs — display:none is set inline on load; JS clears it to reveal as flex */
.aim-flex-dialog {
  display: flex;
  flex-direction: column;
}

/* ─── Groove separator ────────────────────────────────────────────── */
.aim-groove-sep {
  height: 2px;
  border-top: 1px solid var(--btn-shadow);
  border-bottom: 1px solid #fff;
  margin: 2px 3px;
}

/* ─── Today bar ───────────────────────────────────────────────────── */
.aim-today-bar {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  background: var(--btn-face);
  gap: 2px;
}
.aim-today-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-family: inherit; font-weight: bold;
  padding: 2px 8px 2px 4px; min-width: 0;
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  background: var(--btn-face); cursor: pointer;
}
.aim-today-btn:active { border-style: inset; border-color: var(--btn-shadow) #fff #fff var(--btn-shadow); }
.aim-today-icon-btn {
  min-width: 0 !important; min-height: 0 !important;
  display: flex; align-items: center; justify-content: center;
  padding: 2px 3px;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none; cursor: pointer;
}
.aim-today-icon-btn:hover img  { filter: brightness(1.12); }
.aim-today-icon-btn:active img { filter: brightness(0.78); }

/* ─── aWaY MeSsAgEs app ──────────────────────────────────────────── */
.awaymsg-row {
  padding: 5px 6px;
  border-bottom: 1px solid #e8e8e8;
  cursor: pointer;
}
.awaymsg-row:hover { background: #d4e5ff; }
.awaymsg-row:last-child { border-bottom: none; }
.awaymsg-preview { pointer-events: none; }

/* ─── CTA / Sign Off button ───────────────────────────────────────── */
.aim-cta-bar {
  padding: 2px 3px;
  background: var(--btn-face);
  border-top: 1px solid var(--btn-shadow);
  text-align: center;
}
.aim-tryaol-img { display: block; margin: 0 auto; cursor: pointer; }

/* ─── Stock ticker ────────────────────────────────────────────────── */
.aim-stock-bar {
  background: var(--btn-face);
  border-top: 1px solid var(--btn-shadow);
  padding: 2px 4px 2px;
  font-size: 10px;
}
.aim-stock-row { font-size: 10px; }
.aim-stock-icon { width: 12px; height: 12px; vertical-align: middle; cursor: pointer; }
.aim-stock-icon:hover { content: url('img/ui/stkiconhvr.png'); }
.aim-stock-up { color: #006600; font-weight: bold; }
.aim-stock-note { font-size: 9px; color: #555; }

/* ─── Chat buddy icon overlay ───────────────────────────────────────── */
.aim-chat-body { position: relative; }
.aim-chat-icon-box {
  position: absolute;
  top: 22px;
  right: 5px;
  width: 52px;
  height: 52px;
  border: 2px inset;
  border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
  background: #fff;
  z-index: 5;
  overflow: hidden;
}
.aim-chat-icon-box img {
  width: 48px; height: 48px;
  display: block;
  image-rendering: pixelated;
}

/* ─── Chat Window ──────────────────────────────────────────────────── */
.aim-chat-window {
  width: 430px;
  height: 310px;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.aim-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--btn-face);
  overflow: hidden;
  min-height: 0;
}

/* Menu bar */
.aim-chat-menubar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--btn-face);
  border-bottom: 1px solid var(--btn-shadow);
  padding: 1px 2px;
  font-size: 11px;
}
.aim-chat-mi {
  padding: 1px 6px;
  cursor: default;
}
.aim-chat-mi:hover { background: var(--select-bg); color: #fff; }
.aim-chat-warning {
  margin-left: auto;
  padding: 1px 6px;
  font-size: 11px;
  color: #000;
}

/* Chat log */
.aim-chat-log {
  flex: 1;
  min-height: 60px;
  background: #fff;
  box-shadow: inset 2px 2px 1px #000;
  margin-top: 6px;
  margin-bottom: 2px;
  overflow-y: auto;
  padding: 6px;
  font-size: 11px;
  line-height: 1.5;
  user-select: text !important;
  -webkit-user-select: text !important;
}
.aim-chat-log .msg-line { margin-bottom: 2px; word-wrap: break-word; }
.aim-chat-log .msg-screen-name { font-weight: bold; }
.msg-mine .msg-screen-name   { color: #000080; }
.msg-theirs .msg-screen-name { color: #cc0000; }
.msg-system { color: #008800; font-style: italic; }
.msg-action { color: #800080; }
.msg-action .msg-screen-name { color: #800080; font-style: normal; }
/* Remove Win98 doubled scrollbar arrows globally */
::-webkit-scrollbar-button:start:increment,
::-webkit-scrollbar-button:end:decrement { display: none; }

/* Format toolbar (below log) */
.aim-format-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 20px;
  box-shadow: inset -1px -1px #dfdfdf, inset 1px 1px grey;
  margin: 1px 0 2px;
  padding: 2px 3px;
  background: var(--btn-face);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.aim-fmt-btn {
  min-width: 0 !important;
  min-height: 0 !important;
  width: auto !important;
  height: auto !important;
  padding: 1px 2px !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.aim-fmt-btn:hover img  { filter: brightness(1.12); }
.aim-fmt-btn:active img { filter: brightness(0.78); }
.aim-toolbar-sep {
  width: 1px; height: 20px; flex-shrink: 0;
  background: var(--btn-shadow);
  border-right: 1px solid #fff;
  margin: 0 2px;
}

/* Text input (contenteditable div) */
.aim-chat-input {
  display: block;
  margin: 3px 0 4px;
  min-height: 62px;
  flex-shrink: 0;
  overflow-y: auto;
  font-family: 'MS Sans Serif', 'Pixelated MS Sans Serif', Arial, sans-serif;
  font-size: 11px;
  box-shadow: inset 2px 2px 1px #000;
  padding: 4px 6px;
  background: #fff;
  border: 0;
  outline: none;
  cursor: text;
  word-wrap: break-word;
  line-height: 1.07;
  user-select: text !important;
  -webkit-user-select: text !important;
}
.aim-chat-input * {
  user-select: text !important;
  -webkit-user-select: text !important;
}
.aim-chat-input:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}

/* ─── Smileys ───────────────────────────────────────────────────────── */
.smiley {
  background-repeat: no-repeat;
  background-position: 50%;
  width: 19px; height: 19px;
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;
  color: transparent;
  text-indent: -9999px;
  image-rendering: pixelated;
}
.smiley--smile      { background-image: url('img/smileys/smile.png'); }
.smiley--frown      { background-image: url('img/smileys/frown.png'); }
.smiley--wink       { background-image: url('img/smileys/wink.png'); }
.smiley--tongue     { background-image: url('img/smileys/tongue.png'); }
.smiley--oface      { background-image: url('img/smileys/oface.png'); }
.smiley--kiss       { background-image: url('img/smileys/kiss.png'); }
.smiley--angry      { background-image: url('img/smileys/angry.png'); }
.smiley--glasses    { background-image: url('img/smileys/glasses.png'); }
.smiley--money      { background-image: url('img/smileys/money.png'); }
.smiley--foot       { background-image: url('img/smileys/foot.png'); }
.smiley--embarassed { background-image: url('img/smileys/embarassed.png'); }
.smiley--halo       { background-image: url('img/smileys/halo.png'); }
.smiley--slant      { background-image: url('img/smileys/slant.png'); }
.smiley--cry        { background-image: url('img/smileys/cry.png'); }
.smiley--silent     { background-image: url('img/smileys/silent.png'); }
.smiley--grin       { background-image: url('img/smileys/grin.png'); }

/* Smiley picker popup */
.aim-smiley-picker {
  position: fixed;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 4px;
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  z-index: 9999;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.35);
}
.aim-smiley-opt {
  min-width: 0;
  width: 28px; height: 28px;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  padding: 0;
}
.aim-smiley-opt:hover { background: var(--select-bg); border-color: var(--btn-shadow); }

/* Bottom icon bar */
.aim-chat-iconbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 53px;
  box-shadow: inset -1px -1px #dfdfdf, inset 1px 1px grey;
  margin: 2px 0 2px;
  padding: 0 5px;
  flex-shrink: 0;
}
.aim-iconbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.aim-iconbar-send {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.aim-warn-meter {
  display: flex;
  width: 48px;
  height: 8px;
  padding: 1px;
  background: #000;
  border-top: 1px solid #a0a0a0;
  border-left: 1px solid #a0a0a0;
  border-bottom: 1px solid #fff;
  border-right: 1px solid #fff;
  box-sizing: border-box;
  gap: 1px;
}
.aim-warn-bar {
  width: 2px;
  height: 100%;
  flex-shrink: 0;
}

/* ─── Buddy Info (Get Info) ─────────────────────────────────────────── */
.aim-getinfo-win { min-width: 360px; }
.aim-gi-body {
  background: var(--btn-face);
  display: flex;
  flex-direction: column;
  font-size: 11px;
}
.aim-gi-lookup-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 6px 8px 4px;
  gap: 6px;
}
.aim-gi-lookup-left { flex: 1; min-width: 0; }
.aim-gi-label { margin-bottom: 4px; line-height: 1.3; }
.aim-gi-sel {
  width: 100%;
  height: 20px;
  font-size: 11px;
  font-family: inherit;
}
.aim-gi-lookup-btns {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.aim-gi-lookup-btns button { min-width: 60px; }
.aim-gi-stats {
  padding: 4px 8px 4px;
  line-height: 1.6;
  border-top: 1px solid var(--btn-shadow);
  border-bottom: 1px solid var(--btn-shadow);
}
.aim-gi-profile-hdr {
  padding: 4px 8px 2px;
  font-weight: bold;
}
.aim-gi-profile-box {
  margin: 0 8px 6px;
  background: #fff;
  border: 2px inset;
  border-color: var(--btn-shadow) #fff #fff var(--btn-shadow);
  height: 160px;
  overflow-y: auto;
  padding: 6px;
  font-size: 11px;
  line-height: 1.4;
}
.aim-gi-bottombar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 8px 6px;
  border-top: 1px solid var(--btn-shadow);
}
.aim-gi-action-btn {
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 3px 10px !important;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
}
.aim-gi-action-btn:hover { background: #d4d0c8 !important; }
.aim-gi-action-btn:active { background: #b8b4ac !important; }

/* ─── Win98 System Dialogs ─────────────────────────────────────────── */
.w98-dialog { min-width: 260px; max-width: 400px; }
.w98-dlg-body {
  padding: 14px 16px 12px;
  background: var(--btn-face);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.w98-dlg-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.w98-dlg-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  font-family: serif;
  flex-shrink: 0;
  font-style: italic;
}
.w98-dlg-info     { background: #0000aa; color: #fff; }
.w98-dlg-question { background: #0000aa; color: #fff; }
.w98-dlg-warn {
  background: #ffcc00;
  color: #000;
  border-radius: 0;
  clip-path: polygon(50% 4%, 100% 96%, 0% 96%);
  font-size: 14px;
  padding-top: 10px;
}
.w98-dlg-error { background: #cc0000; color: #fff; font-style: normal; }
.w98-dlg-msg {
  font-size: 11px;
  line-height: 1.5;
  flex: 1;
  padding-top: 4px;
}
.w98-dlg-input {
  width: 100%;
  height: 20px;
  font-size: 11px;
  font-family: inherit;
  box-sizing: border-box;
  margin-top: -4px;
}
.w98-dlg-btns {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.w98-dlg-btn { min-width: 75px; }
.aim-icon-btn {
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 3px;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
}
.aim-icon-btn:hover img  { filter: brightness(1.12); }
.aim-icon-btn:active img { filter: brightness(0.78); }

.aim-send-btn {
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
}
.aim-send-btn:hover img  { filter: brightness(1.12); }
.aim-send-btn:active img { filter: brightness(0.78); }

/* ─── Taskbar ──────────────────────────────────────────────────────── */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(30px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--btn-face);
  /* raised 3D edge at top: white line, then #dfdfdf, then the body */
  border-top: 1px solid #fff;
  box-shadow: inset 0 1px 0 #dfdfdf, 0 -1px 0 var(--btn-dark);
  display: flex;
  align-items: center;
  z-index: 9000;
}

/* ─── Win98 toolbar groove separator (double-bar dimple) ───────────── */
.tb-groove {
  width: 4px;
  height: 22px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
  box-shadow: 2px 0 0 #808080, 3px 0 0 #fff;
  margin: 0 4px;
  flex-shrink: 0;
}

/* ─── Start Button ─────────────────────────────────────────────────── */
#start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: bold;
  font-size: 11px;
  font-family: "Pixelated MS Sans Serif", "MS Sans Serif", Tahoma, sans-serif;
  -webkit-font-smoothing: none;
  padding: 2px 8px 2px 5px;
  height: 24px;
  margin: 3px 2px 3px 3px;
  cursor: pointer;
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  color: #000;
}
#start-btn:active, #start-btn.pressed {
  border-style: inset;
  border-color: var(--btn-shadow) #fff #fff var(--btn-shadow);
}

/* ─── Quick Launch ─────────────────────────────────────────────────── */
#quick-launch {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  height: 100%;
}

/* Dotted drag-gripper at left edge of Quick Launch band */
.ql-gripper {
  width: 4px;
  height: 22px;
  flex-shrink: 0;
  margin-right: 2px;
  background-image:
    radial-gradient(circle, #808080 1px, transparent 1px),
    radial-gradient(circle, #ffffff 1px, transparent 1px);
  background-size: 4px 4px, 4px 4px;
  background-position: 0px 1px, 1px 2px;
  background-repeat: repeat-y;
  cursor: e-resize;
}

.ql-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  min-height: 0;
  min-width: 0;
  cursor: pointer;
  padding: 2px;
  color: inherit;
  text-shadow: none;
}
.ql-btn:hover {
  border-color: #fff #808080 #808080 #fff;
  background: var(--btn-face);
  box-shadow: none;
}
.ql-btn:active {
  border-color: #808080 #fff #fff #808080;
  background: #c4c0b8;
  box-shadow: none;
}

/* ─── Task Buttons ─────────────────────────────────────────────────── */
.taskbar-tasks {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  overflow: hidden;
  height: 100%;
}
.taskbar-btn {
  height: 22px;
  min-width: 110px;
  max-width: 150px;
  font-size: 11px;
  font-family: "Pixelated MS Sans Serif", "MS Sans Serif", Tahoma, sans-serif;
  -webkit-font-smoothing: none;
  padding: 1px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  text-align: left;
  color: #000;
}
.taskbar-btn.active {
  border-style: inset;
  border-color: var(--btn-shadow) #fff #fff var(--btn-shadow);
  background: #c4c0b8;
}

/* ─── System Tray ──────────────────────────────────────────────────── */
#system-tray {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 5px;
  /* Win98 tray is sunken/inset with a groove left border */
  box-shadow: inset 1px 1px #808080, inset -1px -1px #fff, inset 2px 2px #404040, inset -2px -2px #dfdfdf;
  background: var(--btn-face);
}

.tray-icon { width: 16px; height: 16px; cursor: default; }

#tray-sep {
  width: 0;
  height: 16px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
  margin: 0 1px;
}

#clock {
  font-size: 11px;
  font-family: "Pixelated MS Sans Serif", "MS Sans Serif", Tahoma, sans-serif;
  -webkit-font-smoothing: none;
  min-width: 58px;
  text-align: center;
  cursor: default;
}

/* ─── Start Menu ───────────────────────────────────────────────────── */
#start-menu {
  position: fixed;
  bottom: 30px;
  left: 0;
  display: flex;
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  box-shadow: 3px -3px 8px rgba(0,0,0,0.35), inset 1px 1px 0 #fff;
  z-index: 9500;
  min-width: 220px;
}

/* Items area fills the remaining width */
.sm-items { flex: 1; padding: 4px 0 2px; position: relative; }

/* Sidebar — narrow dark column, text pinned to bottom near taskbar */
.sm-sidebar {
  width: 24px;
  background: linear-gradient(to top, #0a1070 0%, #1a3898 55%, #2858b8 100%);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

/* Text block absolutely positioned at the bottom of the sidebar */
.sm-sidebar-text {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center center;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 3px;
  /* shift slightly since rotation is around center */
  margin-left: 0;
}

.sm-win {
  font-size: 16px;
  font-weight: bold;
  font-style: italic;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 2px #000040;
  line-height: 1;
  font-family: 'Arial', sans-serif;
}
.sm-98 {
  font-size: 13px;
  font-weight: bold;
  font-style: italic;
  color: #aaccff;
  letter-spacing: 0;
  text-shadow: 1px 1px 2px #000040;
  font-family: 'Arial', sans-serif;
}

/* Items area */
.sm-items {
  flex: 1;
  padding: 4px 0 2px;
  position: relative;
}

.sm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: default;
  white-space: nowrap;
  position: relative;
  min-height: 24px;
}
.sm-item:hover {
  background: var(--select-bg);
  color: #fff;
}
.sm-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  image-rendering: pixelated;
}
.sm-arrow { margin-left: auto; font-size: 8px; padding-left: 16px; color: inherit; }
.sm-sep {
  height: 0;
  border-top: 1px solid var(--btn-shadow);
  border-bottom: 1px solid #fff;
  margin: 3px 6px;
}

/* Submenus */
.sm-submenu {
  position: fixed;
  bottom: 30px;
  left: 260px; /* overridden by JS */
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  box-shadow: 3px 3px 6px rgba(0,0,0,0.3);
  z-index: 9600;
  min-width: 180px;
}

/* ─── Right-click Context Menu ─────────────────────────────────────── */
#ctx-menu {
  position: fixed;
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  box-shadow: 3px 3px 6px rgba(0,0,0,0.3);
  z-index: 9800;
  min-width: 180px;
  padding: 2px 0;
}
.ctx-item {
  padding: 3px 20px 3px 24px;
  font-size: 12px;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ctx-item:hover { background: var(--select-bg); color: #fff; }
.ctx-sep {
  height: 1px;
  background: var(--btn-shadow);
  margin: 2px 2px;
  border-bottom: 1px solid #fff;
}
.ctx-arrow { font-size: 9px; }
.ctx-has-arrow { justify-content: space-between; }

/* ─── Scrollbar (Win98 era wide scrollbars) ────────────────────────── */
::-webkit-scrollbar { width: 17px; height: 17px; }
::-webkit-scrollbar-track { background: var(--btn-face); }
::-webkit-scrollbar-thumb {
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  min-height: 20px;
}
::-webkit-scrollbar-button {
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  height: 17px;
  display: block;
}

/* ─── Drag cursor ──────────────────────────────────────────────────── */
.dragging { cursor: move !important; }

/* ─── Tooltip-style title bar icons ───────────────────────────────── */
.aim-title-icon { vertical-align: middle; margin-right: 3px; }

/* ─── Preferences Dialog ─────────────────────────────────────────────── */
.aim-prefs-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--btn-shadow);
}
.aim-prefs-sidebar {
  width: 115px;
  flex-shrink: 0;
  background: var(--btn-face);
  font-size: 11px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
}
.aim-prefs-cat-label {
  font-size: 11px;
  margin-bottom: 3px;
  padding-left: 1px;
}
.aim-prefs-cat-box {
  flex: 1;
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-bottom: 1px solid #fff;
  border-right: 1px solid #fff;
  box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #0a0a0a;
  background: #fff;
  overflow: auto;
}
.aim-prefs-cat-item {
  padding: 3px 6px;
  font-size: 11px;
  cursor: default;
}
.aim-prefs-cat-sel {
  background: var(--select-bg);
  color: #fff;
}
.aim-prefs-main {
  flex: 1;
  padding: 8px 10px;
  background: var(--btn-face);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.aim-prefs-section-hdr {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--btn-shadow);
}
.aim-prefs-bid-cols {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 0;
}
.aim-prefs-bid-left {
  width: 180px;
  flex-shrink: 0;
  font-size: 11px;
  display: flex;
  flex-direction: column;
}
.aim-prefs-bid-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 2px;
  background:
    linear-gradient(#808080, #808080) 0 0 / 1px 100% no-repeat,
    linear-gradient(#808080, #808080) 0 0 / 100% 1px no-repeat,
    linear-gradient(#0a0a0a, #0a0a0a) 0 0 / 2px 100% no-repeat,
    linear-gradient(#0a0a0a, #0a0a0a) 0 0 / 100% 2px no-repeat,
    linear-gradient(#fff, #fff) 100% 0 / 1px 100% no-repeat,
    linear-gradient(#fff, #fff) 0 100% / 100% 1px no-repeat,
    linear-gradient(#dfdfdf, #dfdfdf) 100% 0 / 2px 100% no-repeat,
    linear-gradient(#dfdfdf, #dfdfdf) 0 100% / 100% 2px no-repeat;
}
.aim-bid-grid-frame {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #fff;
}
.aim-prefs-fs {
  border: 1px solid var(--btn-shadow);
  padding: 4px 6px;
  font-size: 11px;
  margin: 0;
}
.aim-prefs-fs legend { font-size: 11px; padding: 0 3px; }
.aim-bid-listbox {
  border: 2px inset;
  border-color: var(--btn-shadow) #fff #fff var(--btn-shadow);
  background: #fff;
  height: 72px;
  overflow-y: auto;
  margin-top: 3px;
  font-size: 11px;
}
.aim-bid-list-sel { padding: 2px 4px; background: var(--select-bg); color: #fff; }
.aim-bid-icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.aim-bid-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-bottom: 1px solid #dfdfdf;
  border-right: 1px solid #dfdfdf;
}
.aim-bid-icon-btns {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.aim-prefs-radio {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 11px;
  margin-bottom: 3px;
  line-height: 1.4;
  cursor: default;
}
.aim-bid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 58px);
  justify-content: start;
  background: #fff;
  align-content: start;
  gap: 0;
  width: 100%;
}
.aim-bid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  box-sizing: border-box;
  padding: 4px;
  cursor: pointer;
  border-right: 1px solid #c0c0c0;
  border-bottom: 1px solid #c0c0c0;
  flex-shrink: 0;
  background: #fff;
}

.aim-bid-cell img { width: 48px; height: 48px; image-rendering: pixelated; }
.aim-bid-cell:hover { background: #dde8ff; }
.aim-bid-cell-sel { background: var(--select-bg) !important; outline: 2px solid var(--select-bg); outline-offset: -2px; }
.aim-bid-cell-sel .aim-bid-cell-lbl { color: #fff; }
.aim-bid-cell-lbl {
  font-size: 9px;
  line-height: 1.2;
  margin-top: 3px;
  text-align: center;
  word-break: break-word;
  width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.aim-prefs-btnbar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--btn-face);
}

/* ─── Chat Window – AIM Rewind layout ───────────────────────────────── */
.aim-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--btn-face);
  overflow: hidden;
  min-height: 0;
  position: static;  /* clear old position:relative */
}
.aim-chat-main-row {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 0 6px;
}
/* Left sidebar: remote icon top, local icon pinned to bottom */
.aim-chat-sidebar {
  flex-shrink: 0;
  display: grid;
  grid-template-rows: 1fr 48px;
  padding-top: 7px;
  padding-right: 10px;
  background: var(--btn-face);
}
.aim-chat-sidebar-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: default;
}
.aim-chat-sidebar-icon img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  display: block;
}
.aim-chat-sidebar-icon span {
  font-size: 10px;
  text-align: center;
  max-width: 56px;
  word-break: break-word;
}
/* Right: log + format bar + input stacked */
.aim-chat-right-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* ─── Typing Indicator ─────────────────────────────────────────────── */
.aim-typing-indicator {
  font-size: 10px;
  color: #808080;
  font-style: italic;
  padding: 0 6px;
  height: 13px;
  line-height: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

/* ─── Format bar font family select ───────────────────────────────── */
.aim-font-sel {
  height: 16px;
  font-size: 9px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  border: 1px solid var(--btn-shadow);
  background: #fff;
  padding: 0 1px;
  max-width: 80px;
  flex-shrink: 0;
  cursor: default;
}

/* ─── Color picker popup ───────────────────────────────────────────── */
.aim-color-picker {
  position: fixed;
  z-index: 10100;
  background: var(--btn-face);
  border: 2px outset;
  border-color: #fff var(--btn-shadow) var(--btn-shadow) #fff;
  padding: 6px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
}
.aim-color-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 18px);
  gap: 2px;
}
.aim-color-swatch {
  width: 18px;
  height: 14px;
  cursor: pointer;
  border: 1px solid #808080;
  box-sizing: border-box;
}
.aim-color-swatch:hover {
  border: 2px solid #000;
  transform: scale(1.1);
}

/* ─── Buddy alert toasts ───────────────────────────────────────────── */
#buddy-alerts {
  position: fixed;
  bottom: 34px;
  right: 4px;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  pointer-events: none;
}
.aim-buddy-alert {
  pointer-events: all;
  position: relative !important; /* override .window's position:absolute so it stays in flex flow */
  width: 210px;
  animation: aim-alert-slide 0.2s ease-out;
}
@keyframes aim-alert-slide {
  from { transform: translateX(220px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ─── Online view wrapper (must be flex col so buddy-tree's flex:1 works) ── */
#aim-online-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ─── List Setup view ──────────────────────────────────────────────── */
#aim-listsetup-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.aim-ls-group-header {
  padding: 2px 4px;
  font-weight: bold;
  cursor: default;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.aim-ls-group-header:hover { background: #e8e4dc; }

/* Buddy rows with Win98 tree-connector dotted lines */
.aim-ls-buddy {
  padding: 1px 4px 1px 28px;
  cursor: default;
  user-select: none;
  position: relative;
  font-size: 11px;
  line-height: 16px;
}
/* Horizontal dotted branch line from spine to text */
.aim-ls-buddy::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 14px;
  border-top: 1px dotted #808080;
}
/* Vertical dotted spine — runs full height except on last child */
.aim-ls-buddy::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  border-left: 1px dotted #808080;
}
.aim-ls-buddy:last-child::after {
  bottom: 50%;
}
.aim-ls-buddy:hover { background: #e8e4dc; }

.aim-ls-selected {
  background: var(--select-bg) !important;
  color: #fff !important;
}

/* ─── Chat Room Window ───────────────────────────────────────────────── */
.aim-chatroom-window {
  width: 560px;
  height: 500px;
  z-index: 200;
  display: flex;
  flex-direction: column;
}
.aim-chatroom-main {
  display: flex;
  flex: 1;
  min-height: 0;
}
.aim-chatroom-log {
  flex: 1;
  min-height: 0;
  background: #fff;
  border: 2px inset #808080;
  margin: 4px 0 4px 4px;
  overflow-y: auto;
  padding: 6px;
  font-size: 11px;
  line-height: 1.5;
  user-select: text;
  -webkit-user-select: text;
}
.aim-chatroom-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #808080;
  background: var(--btn-face);
}
.aim-chatroom-count {
  font-size: 11px;
  padding: 2px 4px;
  border-bottom: 1px solid #808080;
}
.aim-chatroom-members {
  flex: 1;
  min-height: 0;
  background: #fff;
  border: 2px inset #808080;
  margin: 2px;
  overflow-y: auto;
  font-size: 11px;
}
.aim-chatroom-member {
  padding: 1px 4px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aim-chatroom-member.selected {
  background: var(--select-bg, #000080);
  color: #fff;
}
.aim-chatroom-sidebar-actions {
  display: flex;
  justify-content: space-around;
  padding: 3px 2px;
  border-top: 1px solid #808080;
}
.aim-chatroom-action-btn {
  flex-direction: column;
  gap: 1px;
  padding: 2px !important;
}
.aim-chatroom-action-btn span { font-size: 10px; }
.aim-chatroom-fmtbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 3px 8px;
  background: var(--btn-face);
  border-top: 2px groove var(--btn-face);
  border-bottom: 1px solid #808080;
  flex-shrink: 0;
}
.aim-chatroom-fmt-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
  padding: 1px 3px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  min-width: 0 !important;
  min-height: 0 !important;
}
.aim-chatroom-fmt-btn:hover { background: #d4d0c8 !important; }
.aim-chatroom-input-row {
  display: flex;
  flex-shrink: 0;
  min-height: 64px;
  max-height: 120px;
}
.aim-chatroom-input {
  flex: 1;
  background: #fff;
  border: 2px inset #808080;
  border-right: none;
  padding: 4px;
  outline: none;
  font-size: 11px;
  overflow-y: auto;
  line-height: 1.4;
}
.aim-chatroom-input:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}
.aim-chatroom-send-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  background: var(--btn-face);
  border: 2px inset #808080;
  gap: 2px;
}

/* ─── Chat Directory (AOL Chat Room Listings) ──────────────────────── */
.chatdir-body {
  display: flex;
  flex-direction: column;
  background: #c8d8e8;
  font-size: 11px;
}
.chatdir-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 6px 10px 6px 10px;
  border-bottom: 1px solid #a0b0c0;
}
.chatdir-header-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.chatdir-aol {
  font-size: 22px;
  font-weight: bold;
  font-family: Arial Black, Arial, sans-serif;
  background: linear-gradient(135deg, #cc0000 0%, #003399 60%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}
.chatdir-title-text {
  font-size: 20px;
  font-weight: bold;
  color: #003399;
}
.chatdir-hdr-btn {
  font-size: 11px;
  padding: 2px 10px;
  min-width: 50px;
  margin-left: 4px;
}
.chatdir-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #dde8f0;
  border-bottom: 1px solid #a0b0c0;
}
.chatdir-search-label { white-space: nowrap; font-weight: bold; font-size: 11px; }
.chatdir-search-input {
  width: 160px;
  height: 20px;
  font-size: 11px;
  border: 2px inset #808080;
  padding: 1px 3px;
  background: #fff;
}
.chatdir-search-btn {
  background: #3a8a3a;
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  padding: 2px 10px;
  border: 2px outset #5aaa5a;
  cursor: pointer;
}
.chatdir-search-btn:active { border-style: inset; }
.chatdir-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px 0 0;
  background: #b8c8d8;
  border-bottom: 2px solid #808080;
}
.chatdir-tab {
  padding: 3px 14px;
  font-size: 11px;
  border: 2px outset #d0d0d0;
  border-bottom: none;
  background: #c0c0c0;
  cursor: pointer;
  color: #000;
}
.chatdir-tab-active {
  background: #fff;
  border-color: #808080;
  position: relative;
  bottom: -2px;
  z-index: 1;
}
.chatdir-main {
  display: flex;
  flex: 1;
  gap: 0;
  min-height: 0;
}
.chatdir-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
  border-right: 1px solid #a0b0c0;
}
.chatdir-steps-row {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}
.chatdir-step-hdr {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-weight: bold;
  font-size: 11px;
  flex: 1;
  line-height: 1.3;
}
.chatdir-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #003399;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
}
.chatdir-lists-row {
  display: flex;
  gap: 6px;
  flex: 1;
  min-height: 0;
}
.chatdir-lists-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chatdir-col-hdr {
  font-size: 11px;
  font-weight: bold;
  padding: 1px 3px;
  background: #c0d0e0;
  border: 1px solid #808080;
  border-bottom: none;
}
.chatdir-rooms-hdr {
  font-size: 11px;
  padding: 1px 3px;
  background: #c0d0e0;
  border: 1px solid #808080;
  border-bottom: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chatdir-listbox {
  border: 2px inset #808080;
  background: #fff;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.chatdir-list-row {
  display: flex;
  align-items: center;
  padding: 1px 4px;
  cursor: default;
  white-space: nowrap;
  font-size: 11px;
  min-height: 18px;
  line-height: 18px;
}
.chatdir-list-row:hover { background: #e0ecf8; }
.chatdir-list-row.selected { background: #000080; color: #fff; }
.chatdir-room-count {
  width: 28px;
  text-align: right;
  margin-right: 8px;
  font-size: 11px;
  flex-shrink: 0;
  color: inherit;
}
.chatdir-room-name { flex: 1; font-size: 11px; }
.chatdir-bottom-row {
  display: flex;
  gap: 4px;
  padding-top: 4px;
}
.chatdir-go-btn {
  font-size: 11px;
  padding: 2px 10px;
  min-width: 80px;
}
.chatdir-sidebar {
  width: 175px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  gap: 4px;
  font-size: 11px;
  overflow-y: auto;
}
.chatdir-sidebar-title {
  color: #cc0000;
  font-weight: bold;
  font-size: 11px;
  margin-bottom: 2px;
}
.chatdir-sidebar-links {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}
.chatdir-sidebar-links a { color: #003399; text-decoration: none; font-size: 11px; }
.chatdir-sidebar-links a:hover { text-decoration: underline; }
.chatdir-sidebar-sep { border: none; border-top: 1px solid #a0b0c0; margin: 3px 0; }
.chatdir-sidebar-checkbox-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 1px 0;
}
.chatdir-sidebar-checkbox-row a { color: #003399; text-decoration: none; font-size: 11px; }
.chatdir-sidebar-checkbox-row a:hover { text-decoration: underline; }
.chatdir-city-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}
.chatdir-city-list a { color: #003399; text-decoration: none; font-size: 11px; }
.chatdir-city-list a:hover { text-decoration: underline; }
.chatdir-gowhere-content {
  font-size: 11px;
  line-height: 1.4;
  overflow: hidden;
}
.chatdir-gowhere-content a { color: #003399; text-decoration: none; }
.chatdir-gowhere-content a:hover { text-decoration: underline; }
.chatdir-footer {
  background: #c0d0e0;
  border-top: 1px solid #a0b0c0;
  padding: 2px 8px;
  font-size: 10px;
  color: #333;
  text-align: right;
}

/* ── IM Input Context Menu ────────────────────────────────────────────────── */
.im-ctx-item {
  padding: 2px 20px 2px 20px;
  cursor: default;
  white-space: nowrap;
  color: #000;
}
.im-ctx-item:hover {
  background: #000080;
  color: #fff;
}
.im-ctx-item.im-ctx-arrow::after {
  content: '▶';
  float: right;
  margin-left: 16px;
  font-size: 9px;
  line-height: 18px;
}
.im-ctx-item.im-ctx-kb {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}
.im-ctx-item.im-ctx-kb span:last-child {
  color: #444;
}
.im-ctx-item.im-ctx-kb:hover span:last-child {
  color: #ccc;
}
.im-ctx-sep {
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
  margin: 2px 0;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  /* Prevent iOS auto-zoom when tapping the IM input */
  [data-chat-input] {
    font-size: 16px !important;
  }

  /* Cap AIM buddy list and chat windows to viewport width */
  .aim-window,
  .aim-chat-window {
    max-width: calc(100vw - 8px) !important;
  }
}
