/* cIM — commodore. Instant Messenger */
/* Retro Windows 95/98 / AIM aesthetics */

:root {
  --bg: #008080;
  /* Teal desktop background */
  --win-bg: #c0c0c0;
  /* Classic grey */
  --win-border: #dfdfdf;
  --win-shadow: #808080;
  --win-dark: #000000;

  /* Active Blue Gradient */
  --titlebar: linear-gradient(to right, #000080, #1084d0);
  /* Inactive Titlebar */
  --titlebar-inactive: #808080;

  --accent: #000080;
  --accent2: #ff0000;
  --text: #000000;
  --text-dim: #404040;
  --online: #00ff00;
  --away: #ffcc00;
  --offline: #808080;

  --msg-self: #ffffff;
  --msg-other: #ffffff;

  /* Win95 3D effects */
  --outset: 1px 1px 0px #fff inset, -1px -1px 0px #808080 inset, 2px 2px 0px #dfdfdf inset, -2px -2px 0px #000 inset;
  --inset: 1px 1px 0px #808080 inset, -1px -1px 0px #fff inset, 2px 2px 0px #000 inset, -2px -2px 0px #dfdfdf inset;

  --font-ui: 'Tahoma', 'Segoe UI', 'MS Sans Serif', sans-serif;
  --font-msg: 'Arial', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  min-height: 100vh;
  overflow: hidden;
}

/* ── Desktop ──────────────────────────────────────────── */
#desktop {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: none;
}

#desktop.active {
  display: block;
}

/* ── Window chrome ────────────────────────────────────── */
.cim-window {
  position: absolute;
  background: var(--win-bg);
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  /* Simple 3D border */
  box-shadow: 1px 1px 0 #808080;
  min-width: 200px;
  user-select: none;
  padding: 2px;
}

.cim-window.focused {
  z-index: 100 !important;
}

.titlebar {
  background: var(--titlebar-inactive);
  padding: 3px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: move;
}

.focused .titlebar {
  background: var(--titlebar);
}

.titlebar-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.titlebar-title {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: bold;
  color: #dfdfdf;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.focused .titlebar-title {
  color: #fff;
}

.titlebar-buttons {
  display: flex;
  gap: 2px;
}

.win-btn {
  width: 16px;
  height: 14px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  color: #000;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.win-btn:active {
  border-color: #000 #fff #fff #000;
  padding-top: 1px;
  padding-left: 1px;
}

/* ── Login screen ─────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

#login-window {
  width: 280px;
}

.login-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cim-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--win-shadow);
  margin-bottom: 4px;
}

.cim-logo .logo-icon {
  font-size: 32px;
}

.cim-logo .logo-name {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: bold;
  color: #000;
  letter-spacing: -1px;
}

.cim-logo .logo-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-group label {
  font-size: 11px;
  font-weight: bold;
}

.cim-input {
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  color: #000;
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 3px 4px;
  outline: none;
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}

.cim-btn {
  min-width: 75px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  color: #000;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}

.cim-btn:active {
  border-color: #000 #fff #fff #000;
  padding-top: 5px;
  padding-left: 9px;
}

.login-error {
  color: #ff0000;
  font-size: 11px;
  text-align: center;
  min-height: 14px;
}

/* ── Buddy List ───────────────────────────────────────── */
#buddy-list-window {
  width: 180px;
  top: 40px;
  left: 40px;
}

.buddy-list-header {
  padding: 6px;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  margin: 4px;
}

.buddy-self {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border: 1px solid #000;
}

.status-dot.online {
  background: var(--online);
}

.status-dot.away {
  background: var(--away);
}

.status-dot.offline {
  background: var(--offline);
}

.buddy-self-name {
  font-size: 13px;
  font-weight: bold;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buddy-toolbar {
  display: flex;
  padding: 2px 4px;
  gap: 2px;
  border-bottom: 1px solid var(--win-shadow);
}

.tool-btn {
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
}

.tool-btn:active {
  border-color: #000 #fff #fff #000;
}

.buddy-list-body {
  overflow-y: auto;
  max-height: 400px;
  background: #fff;
  margin: 4px;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  min-height: 100px;
}

.buddy-group-header {
  padding: 2px 4px;
  font-size: 11px;
  font-weight: bold;
  background: #dfdfdf;
  border-bottom: 1px solid var(--win-shadow);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.buddy-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  cursor: pointer;
}

.buddy-entry:hover {
  background: #000080;
  color: #fff;
}

.buddy-name {
  font-size: 12px;
  flex: 1;
}

/* ── Chat Window ──────────────────────────────────────── */
.chat-window {
  width: 350px;
}

.chat-with {
  font-size: 12px;
  padding: 4px;
  border-bottom: 1px solid var(--win-shadow);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-messages {
  height: 200px;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  margin: 4px;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  font-family: var(--font-msg);
}

.msg {
  margin-bottom: 4px;
  font-size: 13px;
}

.msg-sender {
  font-weight: bold;
}

.msg.self .msg-sender {
  color: #0000ff;
}

.msg.other .msg-sender {
  color: #ff0000;
}

.chat-input-row {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-input {
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  color: #000;
  font-family: var(--font-msg);
  font-size: 13px;
  padding: 4px;
  outline: none;
  resize: none;
  height: 60px;
}

.chat-btn-row {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ── Taskbar ──────────────────────────────────────────── */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--win-bg);
  border-top: 1px solid #fff;
  display: none;
  align-items: center;
  padding: 2px;
  gap: 4px;
  z-index: 9999;
  box-shadow: 0 -1px 0 #808080 inset;
}

#taskbar.active {
  display: flex;
}

.start-btn {
  height: 22px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  font-weight: bold;
  cursor: pointer;
}

.taskbar-items {
  display: flex;
  gap: 2px;
  flex: 1;
}

.taskbar-item {
  height: 22px;
  padding: 0 8px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  cursor: pointer;
  font-size: 11px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.taskbar-item.active-win {
  border-color: #000 #fff #fff #000;
  background: #dfdfdf;
  font-weight: bold;
}

.taskbar-tray {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  height: 22px;
}

.conn-mode-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
}

.conn-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #808080;
}

.conn-indicator.ws {
  background: #00ff00;
}

.conn-indicator.rest {
  background: #ffcc00;
}

.taskbar-clock {
  font-size: 11px;
}

/* ── Disconnect banner ──────────────────────────────── */
#disconnect-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ffffc0;
  color: #000;
  text-align: center;
  padding: 2px;
  font-size: 11px;
  z-index: 99999;
  border-bottom: 1px solid #808080;
}

#disconnect-banner.visible {
  display: block;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background: #dfdfdf;
}

::-webkit-scrollbar-thumb {
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
}

::-webkit-scrollbar-button {
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  width: 16px;
  height: 16px;
}

/* ── Room Window ──────────────────────────────────────── */
.room-window {
  width: 480px;
}

.room-layout {
  display: flex;
  height: 280px;
  margin: 4px;
  gap: 4px;
}

.room-messages {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  font-family: var(--font-msg);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-members {
  width: 100px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  padding: 2px;
}

.room-members-header {
  font-size: 10px;
  font-weight: bold;
  color: var(--text-dim);
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  margin-bottom: 2px;
}

.room-member {
  font-size: 12px;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.room-member:hover {
  background: #000080;
  color: #fff;
}

/* ── Send button (chat + room) ────────────────────────── */
.send-btn {
  min-width: 60px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  color: #000;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  align-self: flex-end;
}

.send-btn:active {
  border-color: #000 #fff #fff #000;
  padding-top: 5px;
  padding-left: 9px;
}

/* ── Typing indicator ─────────────────────────────────── */
.typing-indicator {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  padding: 0 4px;
  min-height: 14px;
}

/* ── Buddy away text ──────────────────────────────────── */
.buddy-away-text {
  font-size: 10px;
  color: #808080;
  font-style: italic;
  padding: 0 8px 2px 26px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Dialog messages ──────────────────────────────────── */
.dialog-msg {
  font-size: 11px;
  min-height: 14px;
}

.dialog-msg.error {
  color: #ff0000;
}

.dialog-msg.success {
  color: #008000;
}

/* ── Room list entries ────────────────────────────────── */
.room-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 6px;
  cursor: pointer;
  border-bottom: 1px solid #dfdfdf;
}

.room-entry:hover {
  background: #000080;
  color: #fff;
}

.room-entry-name {
  font-size: 13px;
  font-weight: bold;
}

.room-entry-count {
  font-size: 11px;
  color: var(--text-dim);
}

.room-entry:hover .room-entry-count {
  color: #dfdfdf;
}

.room-create-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-top: 1px solid #808080;
}

/* fix chat input row to be horizontal */
.chat-input-row {
  flex-direction: row !important;
  align-items: flex-end;
}

/* ── Start Menu ───────────────────────────────────────── */
#start-menu {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 2px;
  width: 200px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: 2px 2px 0 #808080;
  z-index: 99998;
  user-select: none;
  overflow: visible;
}

#start-menu.open {
  display: block;
}

.start-menu-header {
  background: linear-gradient(to bottom, #000080, #1084d0);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.start-menu-runner {
  font-size: 24px;
}

.start-menu-username {
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.start-menu-items {
  padding: 2px 0;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.start-menu-item:hover {
  background: #000080;
  color: #fff;
}

.start-menu-item.danger:hover {
  background: #800000;
  color: #fff;
}

.smenu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.start-menu-divider {
  height: 1px;
  background: #808080;
  margin: 3px 0;
  border-bottom: 1px solid #fff;
}

/* ── About Dialog ─────────────────────────────────────── */
#about-dialog {
  width: 360px;
  display: none;
}

.about-body {
  padding: 0;
}

.about-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.about-logo-icon {
  font-size: 48px;
}

.about-product {
  font-size: 28px;
  font-weight: bold;
  letter-spacing: -1px;
}

.about-version {
  font-size: 12px;
  color: var(--text-dim);
}

.about-divider {
  height: 1px;
  background: #808080;
  border-bottom: 1px solid #fff;
  margin: 0 8px;
}

.about-info {
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.6;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  margin: 8px;
}

.about-user-row {
  padding: 8px 16px;
  font-size: 12px;
  line-height: 1.6;
}

/* ── Rooms window improvements ────────────────────────── */
#rooms-window {
  width: 300px;
}

.rooms-toolbar {
  padding: 3px 6px;
  font-size: 11px;
  color: var(--text-dim);
  border-bottom: 1px solid #808080;
  background: #dfdfdf;
}

.rooms-body {
  height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  margin: 4px 4px 0 4px;
}

.rooms-footer {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-top: 1px solid #808080;
}

.room-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  border-bottom: 1px solid #dfdfdf;
}

.room-entry:hover {
  background: #000080;
  color: #fff;
}

.room-entry-info {
  display: flex;
  flex-direction: column;
}

.room-entry-name {
  font-size: 13px;
  font-weight: bold;
}

.room-entry-topic {
  font-size: 10px;
  color: #808080;
}

.room-entry:hover .room-entry-topic {
  color: #dfdfdf;
}

.room-entry-count {
  font-size: 11px;
  color: #808080;
  white-space: nowrap;
}

.room-entry:hover .room-entry-count {
  color: #dfdfdf;
}


/* ── Message timestamps ───────────────────────────────── */
.msg-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 1px;
}

.msg-time {
  font-size: 10px;
  color: #808080;
  white-space: nowrap;
  flex-shrink: 0;
}

.msg.self .msg-time {
  color: #808080;
}

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

/* ── Inline emoji images ──────────────────────────────── */
.chat-emoji {
  width: 11px;
  height: 11px;
  image-rendering: pixelated;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ── Emoji trigger button ─────────────────────────────── */
.emoji-trigger {
  width: 22px;
  flex-shrink: 0;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}

.emoji-trigger:active {
  border-color: #000 #fff #fff #000;
}

/* ── Emoji picker ─────────────────────────────────────── */
.emoji-picker {
  position: fixed;
  width: 244px;
  height: 260px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: 2px 2px 0 #808080;
  z-index: 999999;
  display: flex;
  flex-direction: column;
}

.emoji-search {
  border: none;
  border-bottom: 1px solid #808080;
  padding: 3px 5px;
  font-family: var(--font-ui);
  font-size: 11px;
  outline: none;
  background: #fff;
  flex-shrink: 0;
}

.emoji-tabs {
  display: flex;
  border-bottom: 1px solid #808080;
  flex-shrink: 0;
}

.emoji-tab {
  flex: 1;
  background: var(--win-bg);
  border: none;
  border-right: 1px solid #808080;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
}

.emoji-tab:last-child {
  border-right: none;
}

.emoji-tab.active {
  background: #fff;
  font-weight: bold;
}

.emoji-tab:hover:not(.active) {
  background: #dfdfdf;
}

.emoji-grid {
  overflow-y: auto;
  padding: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  flex: 1;
}

.emoji-btn {
  width: 20px;
  height: 20px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.emoji-btn:hover {
  background: #000080;
  border-color: #000080;
}

.emoji-btn img {
  image-rendering: pixelated;
  width: 11px;
  height: 11px;
}

/* ── Chat input row (fix for all windows) ─────────────── */
.chat-input-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch;
  padding: 4px;
  gap: 2px;
  border-top: 1px solid #808080;
}

.chat-input {
  flex: 1;
  height: 48px;
  resize: none;
}

/* ── Context menu ─────────────────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--win-bg);
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: 2px 2px 0 #808080;
  z-index: 999999;
  min-width: 140px;
  padding: 2px 0;
}

.context-menu-item {
  padding: 4px 16px;
  font-size: 12px;
  cursor: pointer;
}

.context-menu-item:hover {
  background: #000080;
  color: #fff;
}

.context-menu-item.danger:hover {
  background: #800000;
  color: #fff;
}

.context-menu-sep {
  height: 1px;
  background: #808080;
  margin: 2px 0;
  border-bottom: 1px solid #fff;
}

/* ── Sound toggle ─────────────────────────────────────── */
.sound-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

/* ── Room window ──────────────────────────────────────── */
.room-window {
  width: 480px;
}

.room-layout {
  display: flex;
  height: 280px;
  margin: 4px;
  gap: 4px;
}

.room-messages {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  font-family: var(--font-msg);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-members {
  width: 100px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  padding: 2px;
}

.room-members-header {
  font-size: 10px;
  font-weight: bold;
  color: var(--text-dim);
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  margin-bottom: 2px;
}

.room-member {
  font-size: 12px;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.room-member:hover {
  background: #000080;
  color: #fff;
}

/* ── Send button ──────────────────────────────────────── */
.send-btn {
  min-width: 50px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px 6px;
  cursor: pointer;
  align-self: stretch;
}

.send-btn:active {
  border-color: #000 #fff #fff #000;
}

/* ── Typing indicator ─────────────────────────────────── */
.typing-indicator {
  font-size: 11px;
  color: #808080;
  font-style: italic;
  padding: 1px 4px;
  min-height: 14px;
}

/* ── Buddy extras ─────────────────────────────────────── */
.buddy-away-text {
  font-size: 10px;
  color: #808080;
  font-style: italic;
  padding: 0 8px 2px 26px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-msg {
  font-size: 11px;
  min-height: 14px;
}

.dialog-msg.error {
  color: #ff0000;
}

.dialog-msg.success {
  color: #008000;
}

/* ── Rooms ────────────────────────────────────────────── */
#rooms-window {
  width: 300px;
}

.rooms-toolbar {
  padding: 3px 6px;
  font-size: 11px;
  color: var(--text-dim);
  border-bottom: 1px solid #808080;
  background: #dfdfdf;
}

.rooms-body {
  height: 180px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  margin: 4px 4px 0;
}

.rooms-footer {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-top: 1px solid #808080;
}

.room-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  border-bottom: 1px solid #dfdfdf;
}

.room-entry:hover {
  background: #000080;
  color: #fff;
}

.room-entry-info {
  display: flex;
  flex-direction: column;
}

.room-entry-name {
  font-size: 13px;
  font-weight: bold;
}

.room-entry-topic {
  font-size: 10px;
  color: #808080;
}

.room-entry:hover .room-entry-topic {
  color: #dfdfdf;
}

.room-entry-count {
  font-size: 11px;
  color: #808080;
  white-space: nowrap;
}

.room-entry:hover .room-entry-count {
  color: #dfdfdf;
}

.room-create-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-top: 1px solid #808080;
}

/* ── About dialog ─────────────────────────────────────── */
#about-dialog {
  width: 360px;
  display: none;
}

.about-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.about-logo-icon {
  font-size: 48px;
}

.about-product {
  font-size: 28px;
  font-weight: bold;
  letter-spacing: -1px;
}

.about-version {
  font-size: 12px;
  color: var(--text-dim);
}

.about-divider {
  height: 1px;
  background: #808080;
  border-bottom: 1px solid #fff;
  margin: 0 8px;
}

.about-info {
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.6;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  margin: 8px;
}

.about-user-row {
  padding: 8px 16px;
  font-size: 12px;
  line-height: 1.6;
}

/* ── Start Menu ───────────────────────────────────────── */
#start-menu {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 2px;
  width: 200px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: 2px 2px 0 #808080;
  z-index: 99998;
  user-select: none;
}

#start-menu.open {
  display: block;
}

.start-menu-header {
  background: linear-gradient(to bottom, #000080, #1084d0);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.start-menu-runner {
  font-size: 24px;
}

.start-menu-username {
  color: #fff;
  font-weight: bold;
  font-size: 14px;
}

.start-menu-items {
  padding: 2px 0;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}

.start-menu-item:hover {
  background: #000080;
  color: #fff;
}

.start-menu-item.danger:hover {
  background: #800000;
  color: #fff;
}

.smenu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.start-menu-divider {
  height: 1px;
  background: #808080;
  margin: 3px 0;
  border-bottom: 1px solid #fff;
}

/* ── Start Menu Submenu ───────────────────────────────── */
.start-menu-has-sub {
  position: relative;
}

.smenu-arrow {
  margin-left: auto;
  font-size: 10px;
  padding-right: 2px;
}

.start-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: silver;
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
  min-width: 160px;
  z-index: 100000;
  padding: 2px 0;
}

.start-menu-has-sub:hover .start-submenu {
  display: block;
}

.start-submenu .start-menu-item {
  padding: 5px 12px;
  white-space: nowrap;
}

/* ── Buddy Requests section ───────────────────────────── */
.buddy-requests-section {
  border-bottom: 2px solid #808080;
  margin-bottom: 2px;
}

.buddy-requests-header {
  background: #ffffc0;
  border-bottom: 1px solid #808080;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: bold;
  color: #000;
}

.buddy-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  font-size: 12px;
  background: #fff;
  border-bottom: 1px solid #dfdfdf;
}

.buddy-request-name {
  flex: 1;
  font-weight: bold;
}

.buddy-request-btns {
  display: flex;
  gap: 3px;
}

.req-btn {
  width: 18px;
  height: 16px;
  border: 1px solid;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.req-btn.accept {
  background: #c0ffc0;
  border-color: #008000;
  color: #008000;
}

.req-btn.accept:hover {
  background: #008000;
  color: #fff;
}

.req-btn.decline {
  background: #ffc0c0;
  border-color: #800000;
  color: #800000;
}

.req-btn.decline:hover {
  background: #800000;
  color: #fff;
}

/* ── Emoji sizes ──────────────────────────────────────── */
.chat-emoji {
  image-rendering: pixelated;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.emoji-solo {
  width: 32px;
  height: 32px;
  top: -2px;
}

.emoji-few {
  width: 22px;
  height: 22px;
  top: -2px;
}

.emoji-inline {
  width: 16px;
  height: 16px;
  top: -1px;
}

/* Make solo emoji messages have more breathing room */
.msg-text:has(.emoji-solo) {
  line-height: 1.8;
}

.msg-text:has(.emoji-few) {
  line-height: 1.5;
}

/* ── Toast ────────────────────────────────────────────── */
.cim-toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffc0;
  border: 1px solid #808080;
  box-shadow: 2px 2px 0 #808080;
  padding: 4px 14px;
  font-size: 12px;
  z-index: 999999;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Scroll to bottom button ──────────────────────────── */
.scroll-to-bottom {
  position: absolute;
  bottom: 62px;
  right: 18px;
  width: 20px;
  height: 20px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 0;
}

.scroll-to-bottom:hover {
  background: #dfdfdf;
}

/* parent needs relative positioning */
.chat-window,
.room-window {
  position: absolute;
}

/* ── Status system ────────────────────────────────────── */

/* Extended status dot colors */
.status-dot.idle {
  background: #ffaa00;
}

/* amber */
.status-dot.dnd {
  background: #dd2222;
}

/* red */
.status-dot.invisible {
  background: #c0c0c0;
  border: 1px dashed #808080;
}

/* Self status button - wraps the dot, makes it clickable */
.self-status-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.self-status-btn:hover .status-dot {
  outline: 1px solid #000080;
  outline-offset: 1px;
}

/* Status picker dropdown */
.status-picker {
  position: absolute;
  left: 4px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: 2px 2px 0 #808080;
  z-index: 99999;
  min-width: 160px;
  padding: 2px 0;
}

.status-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.status-picker-item:hover {
  background: #000080;
  color: #fff;
}

.status-picker-item:hover .status-dot {
  border-color: #fff;
}

.status-picker-sep {
  height: 1px;
  background: #808080;
  margin: 2px 0;
  border-bottom: 1px solid #fff;
}

/* DND indicator on buddy list entry */
.buddy-entry.dnd .buddy-name {
  text-decoration: line-through;
  text-decoration-color: #dd2222;
}

/* Status label next to buddy name in buddy list for dnd */
.buddy-status-label {
  font-size: 9px;
  color: #808080;
  margin-left: 2px;
}

.buddy-entry.dnd .buddy-status-label {
  color: #dd2222;
}

/* ── Custom status in picker ──────────────────────────── */
.status-picker-section {
  font-size: 9px;
  font-weight: bold;
  color: #808080;
  padding: 4px 12px 2px;
  letter-spacing: 1px;
}

.status-custom-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
}

.status-emoji-btn {
  width: 24px;
  height: 22px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.status-emoji-btn:active {
  border-color: #000 #fff #fff #000;
}

.status-custom-input {
  flex: 1;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 2px 4px;
  outline: none;
  min-width: 0;
}

.status-picker-actions {
  display: flex;
  gap: 4px;
  padding: 4px 6px;
}

/* ── Custom status line in buddy list ─────────────────── */
.buddy-custom-status-line {
  font-size: 10px;
  color: #000080;
  padding: 0 8px 3px 26px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 2px;
}

.buddy-custom-status-line .chat-emoji {
  width: 11px;
  height: 11px;
  top: 0;
}

/* ── Self status line in buddy list header ────────────── */
.buddy-self-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.self-status-line {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 12px;
  line-height: 1.2;
  padding-top: 1px;
}

/* ── Bot Badge ───────────────────────────────────────────────────────────── */
.bot-badge {
  background-color: #F97300;
  color: white;
  font-size: 9px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
  display: inline-block;
  letter-spacing: 0.5px;
}

/* ── Desktop Context Menu ────────────────────────────────────────────────── */
.desktop-menu {
  position: absolute;
  background: silver;
  border: 2px solid;
  border-color: white #808080 #808080 white;
  padding: 2px;
  font-family: Consolas, monospace;
  font-size: 12px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 9999;
}

.desktop-menu-item {
  padding: 4px 16px 4px 8px;
  cursor: pointer;
  color: black;
  white-space: nowrap;
}

.desktop-menu-item:hover {
  background: #000080;
  color: white;
}

.desktop-menu-sep {
  height: 1px;
  background: #808080;
  border-bottom: 1px solid white;
  margin: 2px 1px;
}

/* ── Minesweeper ─────────────────────────────────────────────────────────── */
.ms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 2px inset #fff;
  background: silver;
  padding: 4px 8px;
  margin-bottom: 4px;
  font-family: Consolas, monospace;
}

.ms-counter {
  background: black;
  color: red;
  font-family: Consolas, monospace;
  font-size: 20px;
  font-weight: bold;
  padding: 2px 4px;
  border: 1px inset #808080;
  letter-spacing: 1px;
}

.ms-face-btn {
  width: 24px;
  height: 24px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px outset #fff;
  background: silver;
}

.ms-face-btn:active {
  border: 2px inset #fff;
}

.ms-board {
  display: grid;
  border: 3px inset #fff;
  background: #808080;
}

.ms-cell {
  width: 16px;
  height: 16px;
  border: 2px outset #fff;
  background: silver;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  cursor: default;
  user-select: none;
}

.ms-cell.revealed {
  border: 1px solid #808080;
  border-right-color: #eee;
  border-bottom-color: #eee;
  background: #c0c0c0;
}

.ms-cell.revealed.mine {
  background: red;
}

/* Cell numbers */
.ms-cell[data-val="1"] {
  color: blue;
}

.ms-cell[data-val="2"] {
  color: green;
}

.ms-cell[data-val="3"] {
  color: red;
}

.ms-cell[data-val="4"] {
  color: navy;
}

.ms-cell[data-val="5"] {
  color: darkred;
}

.ms-cell[data-val="6"] {
  color: teal;
}

.ms-cell[data-val="7"] {
  color: black;
}

.ms-cell[data-val="8"] {
  color: gray;
}

.ms-controls {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

/* ── Sudoku ──────────────────────────────────────────────────────────────── */
.sdk-controls {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  align-items: center;
}

.sdk-controls select {
  font-family: Consolas, monospace;
  font-size: 11px;
}

.sdk-status-bar {
  display: flex;
  justify-content: space-between;
  font-family: Consolas, monospace;
  font-size: 12px;
  background: black;
  color: red;
  padding: 2px 6px;
  border: 1px inset #808080;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.sdk-board {
  display: grid;
  grid-template-columns: repeat(9, 32px);
  grid-template-rows: repeat(9, 32px);
  border: 3px inset #fff;
  background: #808080;
  gap: 1px;
  width: fit-content;
}

.sdk-cell {
  width: 32px;
  height: 32px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  position: relative;
  color: #000080;
  border: 1px solid #c0c0c0;
}

.sdk-cell.given {
  background: #dfdfdf;
  color: #000;
  cursor: default;
}

.sdk-cell.selected {
  background: #000080 !important;
  color: #fff !important;
}

.sdk-cell.highlight {
  background: #c8d8f8;
}

.sdk-cell.error {
  color: #cc0000 !important;
  background: #ffc0c0 !important;
}

.sdk-cell.box-right {
  border-right: 2px solid #000;
}

.sdk-cell.box-bottom {
  border-bottom: 2px solid #000;
}

.sdk-numpad {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  justify-content: center;
}

.sdk-num-btn {
  width: 28px;
  height: 28px;
  background: var(--win-bg);
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #000080;
}

.sdk-num-btn:active {
  border-color: #000 #fff #fff #000;
  padding-top: 1px;
  padding-left: 1px;
}

.sdk-num-btn.erase {
  font-size: 11px;
  color: #800000;
  width: 36px;
}

.sdk-complete-banner {
  text-align: center;
  font-family: Consolas, monospace;
  font-size: 13px;
  color: #000080;
  font-weight: bold;
  padding: 4px;
  background: #ffffc0;
  border: 1px solid #808080;
  margin-top: 4px;
  display: none;
}