/* emessen — MSN 7.5-era vibes, hand-drawn heart */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --xp-blue-1: #7da7e8;
  --xp-blue-2: #4a6fc4;
  --xp-face: #ece9d8;
  --xp-border: #4a6fc4;
  --msn-bg: linear-gradient(180deg, #cfe0f7 0%, #eaf2fc 40%, #f7fafe 100%);
  --online: #6fbf44;
  --busy: #d0021b;
  --away: #f5a623;
  --offline: #9aa0a6;
  --ink: #2b2b2b;
}

body {
  font-family: Tahoma, 'Segoe UI', Verdana, sans-serif;
  font-size: 12px;
  color: var(--ink);
  background: #5a7edc url('') fixed;
  background-image: linear-gradient(160deg, #3f5ec0 0%, #6f93e0 45%, #a9c3ef 100%);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- XP window chrome ---------- */
.xp-window {
  background: var(--xp-face);
  border: 1px solid var(--xp-border);
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 6px 22px rgba(10, 25, 70, 0.35);
  overflow: hidden;
}
.xp-titlebar {
  background: linear-gradient(180deg, var(--xp-blue-1), var(--xp-blue-2));
  color: #fff;
  padding: 5px 10px;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
  user-select: none;
}
.xp-x {
  background: #d6663f;
  border: 1px solid #fff;
  border-radius: 3px;
  color: #fff;
  font-size: 10px;
  padding: 1px 7px;
  cursor: pointer;
}
.xp-x:hover { background: #e3491c; }

.xp-btn {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 16px;
  border: 1px solid #7f9db9;
  border-radius: 3px;
  background: linear-gradient(180deg, #fdfdfd, #e3e3df);
  cursor: pointer;
}
.xp-btn:hover { border-color: var(--xp-blue-2); }
.xp-btn.primary {
  background: linear-gradient(180deg, #8fb3ea, #4a6fc4);
  color: #fff;
  border-color: #2b4a8b;
  font-weight: bold;
  text-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.xp-btn.primary:hover { filter: brightness(1.08); }

input, select {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 6px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  background: #fff;
  outline: none;
}
input:focus, select:focus { border-color: var(--xp-blue-2); }
label { display: block; margin: 8px 0 3px; color: #444; }

.doodle { display: inline-block; }
.doodle svg { width: 100%; height: 100%; display: block; }

/* ---------- sign in ---------- */
.signin-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
}
.signin-window { width: 340px; }
.signin-body { padding: 18px 26px 22px; background: var(--msn-bg); text-align: center; }
.signin-logo { width: 88px; height: 88px; margin: 0 auto; }
.signin-logo svg { width: 100%; height: 100%; }
.wordmark {
  font-family: 'Comic Sans MS', 'Segoe Print', cursive;
  font-size: 30px;
  font-weight: bold;
  color: #2b4a8b;
  letter-spacing: -1px;
}
.wordmark .tm { font-size: 12px; color: #6a80ad; margin-left: 4px; letter-spacing: 0; }
.tagline { color: #56688f; margin: 2px 0 12px; font-style: italic; }
#signin-form { text-align: left; }
#signin-form input, #signin-form select { width: 100%; }
.signin-status-row { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; }
.signin-status-row select { flex: 1; width: auto; }
#signin-btn { width: 100%; margin-top: 10px; padding: 8px; font-size: 13px; }
.signin-toggle { text-align: center; margin-top: 12px; }
.signin-toggle a, .tiny-link { color: #2b4a8b; font-size: 11px; }
.err { color: #c00; min-height: 14px; margin-top: 8px; font-size: 11px; }
.signin-footer { color: #dce6f9; font-size: 11px; text-shadow: 0 1px 2px rgba(0,0,0,.3); }

/* ---------- app layout ---------- */
.app-screen {
  display: flex;
  gap: 14px;
  padding: 14px;
  height: 100vh;
  align-items: stretch;
}
.buddy-window {
  width: 300px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
}
.board { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* me header */
.me-header {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--msn-bg);
  border-bottom: 1px solid #c5d4ee;
}
.me-avatar {
  width: 56px; height: 56px;
  background: #fff;
  border: 2px solid #8fb3ea;
  border-radius: 6px;
  padding: 3px;
  flex-shrink: 0;
}
.me-info { flex: 1; min-width: 0; }
.me-name-row { display: flex; align-items: center; gap: 6px; }
.me-name { font-weight: bold; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-select { font-size: 11px; padding: 2px; border: 1px solid transparent; background: transparent; }
.status-select:hover { border-color: #7f9db9; background: #fff; }
.me-message {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-style: italic;
  color: #666;
  margin-top: 3px;
}
.me-message:hover, .me-message:focus { border-color: #7f9db9; background: #fff; }

/* buddy list */
.buddy-list { flex: 1; overflow-y: auto; background: #fff; padding: 6px 0; }
.buddy-group {
  font-weight: bold;
  color: #2b4a8b;
  padding: 7px 10px 3px;
  font-size: 11px;
  cursor: default;
}
.buddy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  cursor: pointer;
}
.buddy:hover { background: #e8f0fc; }
.buddy .doodle { width: 26px; height: 26px; flex-shrink: 0; opacity: .9; }
.buddy.offline .doodle { opacity: .35; }
.buddy-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buddy.offline .buddy-name { color: #999; }
.buddy-msg { color: #999; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,.25); }
.status-online { background: var(--online); }
.status-busy { background: var(--busy); }
.status-away, .status-brb { background: var(--away); }
.status-out { background: #b06fdc; }
.status-offline { background: var(--offline); }

/* board */
.board-body { flex: 1; overflow-y: auto; background: var(--msn-bg); padding: 12px; }
.composer {
  background: #fff;
  border: 1px dashed #8fb3ea;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.composer-title { font-weight: bold; color: #2b4a8b; margin-bottom: 6px; }
.composer-row { display: flex; gap: 8px; margin-top: 6px; }
.composer-row select, .composer-row input { flex: 1; min-width: 0; }

.beacon {
  background: #fff;
  border: 1px solid #c5d4ee;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.beacon .doodle { width: 40px; height: 40px; flex-shrink: 0; margin-top: 2px; }
.beacon-main { flex: 1; min-width: 0; }
.beacon-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.beacon-name { font-weight: bold; }
.beacon-where { color: #2b4a8b; font-weight: bold; }
.beacon-hood { color: #888; font-size: 11px; }
.beacon-when { color: #b0651a; font-weight: bold; }
.beacon-note { margin-top: 4px; color: #444; }
.beacon-actions { margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.beacon-time { color: #aaa; font-size: 10px; }
.empty-note { text-align: center; color: #7d8db0; padding: 30px 10px; font-style: italic; }

/* ---------- chat windows ---------- */
.chat-window {
  position: fixed;
  width: 360px;
  height: 400px;
  display: flex;
  flex-direction: column;
  z-index: 50;
}
.chat-window.shake { animation: nudgeshake .55s linear; }
@keyframes nudgeshake {
  0%,100% { transform: translate(0,0); }
  10% { transform: translate(-8px,-4px); } 20% { transform: translate(7px,5px); }
  30% { transform: translate(-6px,3px); } 40% { transform: translate(8px,-5px); }
  50% { transform: translate(-7px,-3px); } 60% { transform: translate(6px,4px); }
  70% { transform: translate(-5px,2px); } 80% { transform: translate(5px,-3px); }
  90% { transform: translate(-3px,1px); }
}
.chat-titlebar { cursor: move; }
.chat-to {
  background: var(--msn-bg);
  padding: 6px 10px;
  border-bottom: 1px solid #c5d4ee;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}
.chat-to .doodle { width: 30px; height: 30px; }
.chat-to-name { font-weight: bold; font-size: 12px; }
.chat-to-msg { color: #888; font-style: italic; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  padding: 8px 10px;
}
.chat-line { margin-bottom: 6px; word-wrap: break-word; }
.chat-line .who { color: #2b4a8b; }
.chat-line .who.them { color: #a0308a; }
.chat-line .text { display: block; padding-left: 14px; color: #222; }
.chat-nudge {
  text-align: center;
  color: #b0651a;
  font-size: 11px;
  margin: 8px 0;
  border-top: 1px dashed #e0c9a6;
  border-bottom: 1px dashed #e0c9a6;
  padding: 3px 0;
}
.chat-typing { min-height: 16px; font-size: 10px; color: #888; padding: 0 10px 2px; background: #fff; font-style: italic; }
.chat-inputbar {
  border-top: 1px solid #c5d4ee;
  background: var(--xp-face);
  padding: 6px;
  display: flex;
  gap: 6px;
}
.chat-inputbar input { flex: 1; }
.nudge-btn { font-size: 14px; padding: 4px 9px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 35, 80, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal { width: 420px; max-height: 90vh; overflow-y: auto; }
.modal-body { padding: 14px 18px 18px; background: var(--msn-bg); }
.modal-body input, .modal-body select { width: 100%; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 4px; }
.avatar-choice {
  background: #fff;
  border: 2px solid #d5dff0;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
}
.avatar-choice:hover { border-color: #8fb3ea; }
.avatar-choice.selected { border-color: #2b4a8b; background: #e8f0fc; }
.avatar-choice .doodle { width: 100%; height: auto; aspect-ratio: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#p-save { margin-top: 14px; width: 100%; }

@media (max-width: 760px) {
  .app-screen { flex-direction: column; height: auto; }
  .buddy-window { width: 100%; max-height: 40vh; }
  .chat-window { width: 94vw; left: 3vw !important; }
}
