/* ══════════════════════════════════════════════════════════════════
   MSN Messenger 7 — la lista de contactos y la ventana de conversación.
   El cromo es el de entonces: cabecera con tu imagen y tu estado, la
   mariposa a la derecha, grupos que se pliegan, y abajo el anuncio.
   Lo que se mueve vive en msn.js.
   ══════════════════════════════════════════════════════════════════ */
.win--msn { width: min(300px, calc(100vw - 24px)); }
.win--msn .win-body {
  padding: 0; display: flex; flex-direction: column;
  height: min(540px, calc(var(--pantalla-h) - 160px));
  background: #fff;
}
.msn { font-family: var(--xp-font); font-size: 11px; color: #000; }

/* iniciando sesión */
.msn-signin {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: #444;
}
.msn-signin img { width: 48px; height: 48px; animation: msnBob 1.1s ease-in-out infinite; }
@keyframes msnBob { 50% { transform: translateY(-4px); } }
.msn-signin p { margin: 0; }
.msn-signin-bar { width: 140px; height: 10px; border: 1px solid #7f9db9; overflow: hidden; background: #fff; position: relative; }
.msn-signin-bar i { position: absolute; top: 1px; bottom: 1px; left: -40%; width: 40%; background: linear-gradient(90deg, #cfe0f7, #316ac5); animation: msnBar 1s linear infinite; }
@keyframes msnBar { to { left: 100%; } }
.msn-signin[hidden] { display: none; }

/* lista */
.msn-list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msn-list[hidden] { display: none; }
.msn-me {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 8px 6px;
  background: linear-gradient(180deg, #f3f7fd 0%, #dbe7f7 100%);
  border-bottom: 1px solid #a9c3e4; position: relative;
}
.msn-dp {
  flex: none; padding: 3px; border: 1px solid #7f9db9; border-radius: 3px;
  background: linear-gradient(180deg, #fff, #e4ecf7);
  display: grid; place-items: center;
}
.msn-dp img { display: block; object-fit: cover; }
.msn-dp--me { width: 56px; height: 56px; }
.msn-dp--me img { width: 48px; height: 48px; }
.msn-dp--them { width: 104px; height: 104px; }
.msn-dp--them img { width: 96px; height: 96px; }
button.msn-dp { font: inherit; }
button.msn-dp:hover { border-color: var(--xp-sel); }
.msn-me-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.msn-me-row { display: flex; align-items: center; gap: 4px; min-width: 0; position: relative; }
.msn-me-name {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: #000;
  max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msn-me-name:hover { text-decoration: underline; }
.msn-me-name input { font: inherit; font-weight: 700; width: 110px; padding: 0 2px; border: 1px solid #7f9db9; }
.msn-me-paren { color: #444; white-space: nowrap; }
.msn-me-chev { border: 0; background: none; padding: 0 3px; font: inherit; color: #444; line-height: 1; }
.msn-me-chev:hover { color: var(--xp-sel); }
#msnStateMenu { position: absolute; left: 0; top: 100%; z-index: 20; min-width: 150px; }
#msnStateMenu li[role="menuitem"] { padding-left: 28px; }
#msnStateMenu .msn-status { position: absolute; left: 7px; top: 50%; margin-top: -6px; }
.msn-pm {
  width: 100%; border: 1px solid transparent; background: none; font: inherit; font-style: italic; color: #555;
  padding: 1px 3px;
}
.msn-pm:hover, .msn-pm:focus { border-color: #7f9db9; background: #fff; outline: none; font-style: normal; color: #000; }
.msn-pm::placeholder { color: #666; font-style: italic; }
.msn-butterfly { position: absolute; right: 8px; bottom: 6px; height: 22px; width: auto; opacity: 0.9; }

/* el muñequito de estado, dibujado: cabeza y cuerpo */
.msn-status {
  display: inline-block; width: 12px; height: 12px; flex: none; position: relative;
}
.msn-status::before {             /* cabeza */
  content: ""; position: absolute; left: 3px; top: 0; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c, #4ea52a); box-shadow: inset -1px -1px 1px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.35);
}
.msn-status::after {              /* cuerpo */
  content: ""; position: absolute; left: 1px; top: 6px; width: 10px; height: 6px; border-radius: 5px 5px 1px 1px;
  background: var(--c, #4ea52a); box-shadow: inset -1px -1px 1px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.35);
}
.msn-status--online  { --c: #58b93a; }
.msn-status--busy    { --c: #d8473b; }
.msn-status--away    { --c: #e8b63a; }
.msn-status--offline { --c: #a8a8a8; }
.msn-status--busy::before { box-shadow: inset -1px -1px 1px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.35), 0 1px 0 1px rgba(216,71,59,0.0); }

.msn-tools {
  display: flex; gap: 2px; padding: 3px 6px; border-bottom: 1px solid #c9d7ea; background: #eef3fa;
}
.msn-tools button {
  width: 24px; height: 22px; padding: 0; border: 1px solid transparent; border-radius: 3px; background: none;
  display: grid; place-items: center;
}
.msn-tools button img { width: 16px; height: 16px; }
.msn-tools button:hover { border-color: #7f9db9; background: #fff; }

.msn-groups { flex: 1; min-height: 0; overflow: auto; padding: 4px 0; }
.msn-group ul { list-style: none; margin: 0; padding: 0; display: none; }
.msn-group.is-open ul { display: block; }
.msn-group-h {
  width: 100%; display: flex; align-items: center; gap: 5px; padding: 3px 8px;
  border: 0; background: none; font: inherit; font-size: 11px; font-weight: 700; color: #0a246a; text-align: left;
}
.msn-group-h i {
  width: 9px; height: 9px; border: 1px solid #7f9db9; background: #fff; position: relative; flex: none;
}
.msn-group-h i::before { content: ""; position: absolute; left: 1px; right: 1px; top: 3px; height: 1px; background: #000; }
.msn-group:not(.is-open) .msn-group-h i::after { content: ""; position: absolute; top: 1px; bottom: 1px; left: 3px; width: 1px; background: #000; }
.msn-group-h:hover { text-decoration: underline; }
.msn-contact {
  width: 100%; display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 22px;
  border: 1px solid transparent; background: none; font: inherit; font-size: 11px; text-align: left; color: #000;
}
.msn-contact img { width: 24px; height: 24px; border: 1px solid #7f9db9; object-fit: cover; flex: none; }
.msn-contact .msn-c-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.msn-contact b { font-weight: 400; }
.msn-contact small { font-size: 10px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msn-contact small .emo { width: 13px; height: 13px; vertical-align: -3px; }
.msn-contact:hover { background: #eef4fc; border-color: #c4d8f3; }
.msn-contact.is-sel { background: var(--xp-sel); color: #fff; }
.msn-contact.is-sel small { color: rgba(255,255,255,0.85); }
.msn-contact.is-off { color: #777; }
.msn-contact.is-off img { filter: grayscale(1) opacity(0.6); }
.msn-contact.is-hidden { display: none; }
.msn-empty { padding: 3px 8px 3px 22px; color: #777; font-style: italic; }

.msn-search {
  display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-top: 1px solid #c9d7ea; background: #eef3fa;
}
.msn-search img { width: 16px; height: 16px; }
.msn-search input { flex: 1; font: inherit; font-size: 11px; padding: 2px 4px; border: 1px solid #7f9db9; }
.msn-ad {
  padding: 8px; text-align: center; font-size: 10px; color: #666; line-height: 1.4;
  background: repeating-linear-gradient(45deg, #f3f3f3 0 6px, #ececec 6px 12px);
  border-top: 1px solid #ccc;
}

/* ── Conversación ───────────────────────────────────────────────── */
.win--chat { width: min(520px, calc(100vw - 24px)); }
.win--chat .win-body {
  padding: 0; display: flex;
  height: min(440px, calc(var(--pantalla-h) - 190px));
  background: #fff;
}
.chat-tools {
  flex: none; display: flex; align-items: center; gap: 2px; padding: 3px 6px;
  background: linear-gradient(180deg, #f6f9fd, #dde8f6); border-bottom: 1px solid #a9c3e4;
  position: relative;
}
.chat-tools button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 2px 6px; border: 1px solid transparent; border-radius: 3px; background: none;
  font: inherit; font-size: 10px; color: #000;
}
.chat-tools button img { width: 24px; height: 24px; }
.chat-tools button:hover { border-color: #7f9db9; background: #fff; }
.chat-msnlogo { position: absolute; right: 8px; top: 6px; height: 20px; width: auto; }
.chat { font-family: var(--xp-font); font-size: 11px; }
.chat-left { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 6px; gap: 4px; }
.chat-right {
  width: 116px; flex: none; padding: 6px 6px 6px 0;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 8px;
}
.chat-right .msn-dp--me { margin-top: auto; }
.chat-to {
  padding: 3px 6px; border: 1px solid #7f9db9; border-bottom: 0; background: #f4f7fb; color: #333;
}
.chat-to span { color: #777; }
.chat-log {
  flex: 1; min-height: 0; overflow: auto; padding: 6px 8px;
  border: 1px solid #7f9db9; background: #fff; line-height: 1.5;
  background-size: cover; background-position: center;
}
.chat-log.bg-1 { background-image: linear-gradient(rgba(255,255,255,0.86), rgba(255,255,255,0.86)), url("/assets/bliss.webp"); }
.chat-log.bg-2 { background-image: linear-gradient(rgba(255,255,255,0.84), rgba(255,255,255,0.84)), url("/assets/mbae/tex/paper.webp"); }
.chat-log.bg-3 { background-image: linear-gradient(rgba(255,255,255,0.78), rgba(255,255,255,0.78)), url("/assets/mbae/pics/dr-phil.webp"); background-size: 180px; background-repeat: repeat; }
.chat-msg { margin: 0 0 6px; }
.chat-msg .chat-who { display: block; color: #555; }
.chat-msg .chat-who b { font-weight: 400; }
.chat-msg .chat-txt { display: block; padding-left: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: #000; }
.chat-msg--sys .chat-txt { padding-left: 0; color: #777; font-style: italic; }
.chat-msg--nudge .chat-txt { padding-left: 0; color: #444; }
.chat-msg .emo { width: 19px; height: 19px; vertical-align: -5px; }
.chat-msg.font-comic .chat-txt { font-family: "Comic Sans MS", "Chalkboard SE", cursive; font-size: 12px; color: #c0007a; }
.chat-msg.font-mono .chat-txt { font-family: "Lucida Console XP", monospace; }
.chat-typing { height: 14px; font-size: 10px; color: #666; padding: 0 2px; }
.chat-compose { flex: none; display: flex; flex-direction: column; gap: 3px; }
.chat-fmt {
  display: flex; align-items: center; gap: 2px; padding: 2px 4px;
  border: 1px solid #7f9db9; border-bottom: 0; background: #eef3fa;
}
.chat-fmt button {
  height: 22px; min-width: 24px; padding: 0 5px; display: flex; align-items: center; gap: 4px;
  border: 1px solid transparent; border-radius: 3px; background: none; font: inherit; font-size: 10px; color: #000;
}
.chat-fmt button img { width: 16px; height: 16px; }
.chat-fmt button:hover, .chat-fmt button[aria-expanded="true"] { border-color: #7f9db9; background: #fff; }
.chat-fmt-a { font-family: "Times New Roman", serif; font-size: 15px !important; font-weight: 700; color: #1b3f8a !important; }
.chat-fmt-a[data-font="comic"] { font-family: "Comic Sans MS", cursive; color: #c0007a !important; }
.chat-fmt-a[data-font="mono"] { font-family: "Lucida Console XP", monospace; font-size: 12px !important; }
.chat-emo-picker {
  display: grid; grid-template-columns: repeat(10, 22px); gap: 2px; padding: 5px;
  border: 1px solid #7f9db9; border-bottom: 0; background: #fff;
}
.chat-emo-picker[hidden] { display: none; }
.chat-emo-picker button {
  width: 22px; height: 22px; padding: 0; border: 1px solid transparent; background: none; display: grid; place-items: center;
}
.chat-emo-picker button img { width: 19px; height: 19px; }
.chat-emo-picker button:hover { border-color: #7f9db9; background: #eef4fc; }
.chat-input { display: flex; gap: 4px; align-items: stretch; }
.chat-input textarea {
  flex: 1; min-width: 0; resize: none; font: inherit; font-size: 11px; padding: 4px 6px;
  border: 1px solid #7f9db9; outline: none; line-height: 1.4;
}
.chat-input textarea:focus { border-color: var(--xp-sel); }
.chat-send { display: flex; flex-direction: column; gap: 4px; }
.chat-send .xp-button { min-width: 62px; padding: 3px 8px; flex: 1; }
.chat-send .xp-button[disabled] { color: #a4a09c; }
.win--chat .win-statusbar { font-size: 10px; }

/* el zumbido */
.win.is-nudged { animation: msnNudge 0.5s linear; }
@keyframes msnNudge {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5px, 4px); }  20% { transform: translate(5px, -4px); }
  30% { transform: translate(-4px, -4px); } 40% { transform: translate(4px, 4px); }
  50% { transform: translate(-5px, 2px); }  60% { transform: translate(5px, -2px); }
  70% { transform: translate(-3px, 4px); }  80% { transform: translate(3px, -4px); }
  90% { transform: translate(-2px, 1px); }
}
/* el botón de la barra parpadea naranja cuando llega algo sin que mires */
.task-btn.is-flash { animation: msnFlash 1s steps(2, end) 4; }
@keyframes msnFlash { 50% { background: linear-gradient(180deg, #f3b25a, #e0821a); } }

@media (max-width: 720px) {
  .win--chat .win-body { flex-direction: column; }
  .chat-right { width: auto; flex-direction: row; justify-content: flex-start; padding: 0 6px 6px; }
  .chat-right .msn-dp--me { margin: 0 0 0 auto; }
  .msn-dp--them { width: 56px; height: 56px; }
  .msn-dp--them img { width: 48px; height: 48px; }
  .chat-tools button span { display: none; }
  .chat-emo-picker { grid-template-columns: repeat(auto-fill, 26px); }
  .chat-emo-picker button { width: 26px; height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .msn-signin img, .msn-signin-bar i, .win.is-nudged, .task-btn.is-flash { animation: none; }
}
