/* ============================================================
   xp.css — Windows XP "Luna" + MSN Messenger chrome primitives
   ============================================================ */

:root {
  /* Luna blue */
  --xp-title-a: #0058e6;
  --xp-title-b: #3d95ff;
  --xp-title-c: #2a8cff;
  --xp-title-d: #1173f4;
  --xp-title-e: #0355d0;
  --xp-title-inactive-a: #7ba2e7;
  --xp-title-inactive-b: #a8c3f0;

  --xp-face: #ece9d8;
  --xp-face-light: #f5f3e9;
  --xp-frame: #0355d0;
  --xp-border-dark: #7f7f6f;
  --xp-text: #16213a;
  --xp-muted: #5b6676;
  --xp-link: #0b45a8;

  --xp-field-border: #7f9db9;
  --xp-green: #3c8a24;

  --radius-win: 8px 8px 0 0;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --shadow-win: 0 1px 2px rgba(0, 22, 66, .28), 0 10px 26px -8px rgba(0, 22, 66, .45);
  --shadow-win-focus: 0 2px 4px rgba(0, 22, 66, .32), 0 22px 48px -14px rgba(0, 22, 66, .6);

  --font-ui: Tahoma, "Segoe UI", Verdana, Geneva, sans-serif;
  --font-chat: "Comic Sans MS", "Comic Sans", Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font: 400 12px/1.55 var(--font-ui);
  color: var(--xp-text);
  background: #245edb;
  min-height: 100vh;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--xp-link); }

:focus-visible {
  outline: 1px dotted #1a1a1a;
  outline-offset: 2px;
}

/* ---------- Window ---------- */

.win {
  width: min(var(--win-w, 420px), 100%);
  background: var(--xp-face);
  border: 1px solid var(--xp-frame);
  border-radius: var(--radius-win);
  box-shadow: var(--shadow-win);
  padding: 0 3px 3px;
  position: relative;
  transition: box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.win.is-focused { box-shadow: var(--shadow-win-focus); }

.win.is-minimized { display: none; }

.win__bar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 3px 0 5px;
  border-radius: 6px 6px 0 0;
  background:
    linear-gradient(to bottom,
      var(--xp-title-a) 0%,
      var(--xp-title-b) 9%,
      var(--xp-title-c) 18%,
      var(--xp-title-c) 78%,
      var(--xp-title-d) 92%,
      var(--xp-title-e) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0, 20, 70, .7);
  cursor: default;
  user-select: none;
}

.win__bar--error {
  background: linear-gradient(to bottom, #9a2c2c 0%, #d05353 12%, #c14747 80%, #8e1f1f 100%);
}

.js-drag-handle { cursor: grab; }
.js-drag-handle:active { cursor: grabbing; }

.win__icon {
  display: inline-flex;
  width: 16px; height: 16px;
  align-items: center; justify-content: center;
  font-size: 12px;
  flex: none;
}

.win__title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.win__buttons { display: flex; gap: 2px; flex: none; }

.wbtn {
  width: 21px; height: 21px;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 3px;
  background: linear-gradient(to bottom, #4a9dff, #1c6fdd 48%, #0e5bc4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  transition: filter 140ms var(--ease-out), transform 140ms var(--ease-out);
}
.wbtn:hover { filter: brightness(1.15); }
.wbtn:active { transform: scale(0.93); }

.wbtn--close { background: linear-gradient(to bottom, #f08a6a, #e0452a 48%, #c32f18); }

.wbtn i { display: block; background: #fff; }
.wbtn--min i { width: 8px; height: 2px; margin-top: 6px; }
.wbtn--max i { width: 9px; height: 8px; border: 2px solid #fff; border-top-width: 3px; background: none; }
.wbtn--close i {
  width: 9px; height: 9px;
  background:
    linear-gradient(45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%);
}

.win__menu {
  padding: 3px 8px;
  font-size: 11px;
  color: #21303f;
  background: linear-gradient(to bottom, #fbfaf5, #ece9d8);
  border-bottom: 1px solid #d9d4c0;
  user-select: none;
}

.win__body {
  background: #fff;
  border: 1px solid #a0a0a0;
  border-top-color: #808080;
  padding: 14px 16px;
}

.win--signin .win__body,
.win__body--face { background: var(--xp-face); }

.win__status {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  font-size: 11px;
  color: #3d4a5c;
  padding: 2px 8px;
  border: 1px solid #fff;
  border-top-color: #9a9a8c;
  border-left-color: #9a9a8c;
  background: var(--xp-face);
}

/* multi-cell variant: wrap each cell in .win__statuscell */
.win__status:has(.win__statuscell) {
  padding: 0;
  border: 0;
  background: none;
}

.win__statuscell {
  padding: 2px 8px;
  border: 1px solid #fff;
  border-top-color: #9a9a8c;
  border-left-color: #9a9a8c;
  background: var(--xp-face);
}
.win__statuscell:first-child { flex: 1; }

/* ---------- Buttons ---------- */

.xpbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 4px 12px;
  font: 400 12px/1.3 var(--font-ui);
  color: #12233c;
  text-decoration: none;
  background: linear-gradient(to bottom, #fefefe 0%, #f2f1ea 46%, #e3e1d3 47%, #f4f3ee 100%);
  border: 1px solid #8d8d78;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #fff, 0 1px 1px rgba(0,0,0,.08);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), filter 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .xpbtn:hover {
    border-color: #f2ac39;
    box-shadow: inset 0 0 0 1px #ffe9b0, 0 1px 2px rgba(0,0,0,.12);
  }
}

.xpbtn:active {
  transform: scale(0.97);
  background: linear-gradient(to bottom, #dedcd0, #efeee7);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.18);
}

.xpbtn--default {
  border-color: #2b5fb8;
  box-shadow: inset 0 0 0 1px #b9d4ff, 0 1px 2px rgba(0,0,0,.12);
}

.xpbtn--big {
  min-width: 132px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 700;
}

/* ---------- Fields ---------- */

.fld { display: block; margin-bottom: 9px; }
.fld__label { display: block; margin-bottom: 3px; font-size: 11px; }

.fld__input {
  width: 100%;
  padding: 3px 5px;
  font: 400 12px var(--font-ui);
  color: #12233c;
  background: #fff;
  border: 1px solid var(--xp-field-border);
  box-shadow: inset 1px 1px 0 rgba(0,0,0,.08);
  border-radius: 0;
}
.fld__input:focus { outline: none; border-color: #3d7bcf; box-shadow: inset 0 0 0 1px #bcd6f5; }

.fld__combo { position: relative; display: block; }
.fld__combo .fld__input { padding-right: 22px; }

.fld__arrow {
  position: absolute;
  top: 1px; right: 1px;
  width: 17px; height: calc(100% - 2px);
  background: linear-gradient(to bottom, #fdfdfc, #e7e5d8);
  border-left: 1px solid var(--xp-field-border);
  display: grid; place-items: center;
}
.fld__arrow::after {
  content: "";
  border: 3.5px solid transparent;
  border-top-color: #2c3a4d;
  margin-top: 3px;
}
.fld__arrow--inline {
  position: static;
  display: inline-grid;
  width: 15px; height: 14px;
  border: 1px solid var(--xp-field-border);
  vertical-align: middle;
}

.chk {
  display: block;
  margin: 3px 0;
  font-size: 11px;
  cursor: pointer;
}
.chk input { margin: 0 5px 0 0; vertical-align: -1px; accent-color: #2b5fb8; }

/* ---------- MSN butterfly ---------- */

.butterfly {
  display: inline-block;
  width: 15px; height: 13px;
  background: url("../img/msn.svg?v=2") center / contain no-repeat;
  flex: none;
}
.butterfly--lg { width: 23px; height: 20px; }
.butterfly--xl { width: 42px; height: 36px; }

/* ---------- Taskbar ---------- */

.taskbar {
  position: fixed;
  inset: auto 0 0 0;
  height: 34px;
  display: flex;
  align-items: stretch;
  z-index: 300;
  background: linear-gradient(to bottom,
    #2a63dd 0%, #4a8ae8 4%, #2f6ad9 8%, #2560d6 14%, #2560d6 86%, #1d51c1 92%, #163f9c 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 -1px 4px rgba(0,0,0,.25);
  user-select: none;
}

.startbtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 22px 2px 9px;
  border: 0;
  font: italic 700 16px/1 var(--font-ui);
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0,40,0,.6);
  cursor: pointer;
  background: linear-gradient(to bottom, #4a9a2f 0%, #63b93f 10%, #3f8b23 52%, #357c1c 92%, #2a6516 100%);
  border-radius: 0 9px 9px 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
  transition: filter 140ms var(--ease-out);
}
.startbtn:hover { filter: brightness(1.1); }
.startbtn:active { filter: brightness(0.92); }

.startbtn__flag, .mslogo {
  display: grid;
  grid-template-columns: 7px 7px;
  grid-template-rows: 7px 7px;
  gap: 1.5px;
  transform: perspective(20px) rotateY(-12deg);
}
.startbtn__flag i:nth-child(1), .mslogo i:nth-child(1) { background: #f25022; }
.startbtn__flag i:nth-child(2), .mslogo i:nth-child(2) { background: #7fba00; }
.startbtn__flag i:nth-child(3), .mslogo i:nth-child(3) { background: #00a4ef; }
.startbtn__flag i:nth-child(4), .mslogo i:nth-child(4) { background: #ffb900; }

.taskbar__tasks {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  flex: 1;
  overflow: hidden;
}

.taskbtn {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 190px;
  padding: 0 10px;
  height: 100%;
  font-size: 11px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 3px;
  background: linear-gradient(to bottom, #4b8bea, #2f6cd8 55%, #2b63cf);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
  transition: filter 140ms var(--ease-out), transform 140ms var(--ease-out);
}
.taskbtn:hover { filter: brightness(1.12); }
.taskbtn:active { transform: scale(0.98); }
.taskbtn--active {
  background: linear-gradient(to bottom, #1a49aa, #2a62cc 55%, #3a72d8);
  box-shadow: inset 1px 1px 3px rgba(0,0,0,.35);
}

.tray {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px 0 9px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(to bottom, #1290e8 0%, #14a5f0 8%, #0e8ad9 45%, #1279c6 100%);
  box-shadow: inset 1px 0 0 #0c5fb0, inset 2px 0 0 rgba(255,255,255,.25);
}
.tray__icons { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.tray__clock { font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 rgba(0,0,0,.25); }

/* ---------- Start menu ---------- */

.startmenu {
  position: fixed;
  left: 4px;
  bottom: 36px;
  width: 340px;
  z-index: 320;
  border: 1px solid #0a3fa8;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  box-shadow: 0 12px 30px -8px rgba(0, 20, 60, .6);
  transform-origin: bottom left;
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.startmenu[hidden] { display: block; opacity: 0; transform: scale(.96) translateY(6px); pointer-events: none; }

.startmenu__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 1px 1px 1px rgba(0,20,70,.6);
  background: linear-gradient(to bottom, #1e63d4, #3d8ae8 45%, #1c62d2);
}
.startmenu__avatar {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  font-size: 18px;
  background: #fff;
  border: 2px solid #e8a33d;
  border-radius: 3px;
}

.startmenu__cols { display: grid; grid-template-columns: 1fr 130px; }
.startmenu__col { margin: 0; padding: 7px 0; list-style: none; }
.startmenu__col--left { background: #fff; }
.startmenu__col--right { background: #d3e5fa; border-left: 1px solid #a8c6e8; }
.startmenu__col a {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  color: #16213a; text-decoration: none; font-size: 11px;
}
.startmenu__col a:hover { background: #2b5fb8; color: #fff; }
.startmenu__col--left a { font-weight: 700; }

.startmenu__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 6px 12px;
  background: linear-gradient(to bottom, #3d8ae8, #1c62d2);
}
.startmenu__foot-btn {
  border: 0; background: none; color: #fff; font: 400 11px var(--font-ui);
  cursor: pointer; padding: 2px 4px; border-radius: 3px;
}
.startmenu__foot-btn:hover { background: rgba(255,255,255,.18); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 10px;
  bottom: 42px;
  z-index: 340;
  width: 268px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 14px;
  background: linear-gradient(to bottom, #fdfdfd, #dfe9f6);
  border: 1px solid #6f8cae;
  border-radius: 5px;
  box-shadow: 0 8px 26px -6px rgba(0, 20, 60, .55);
  transform: translateY(calc(100% + 48px));
  transition: transform 320ms var(--ease-out), opacity 320ms var(--ease-out);
  opacity: 0;
}
.toast.is-open { transform: translateY(0); opacity: 1; }
.toast__text { margin: 0; font-size: 12px; font-weight: 700; color: #123; }
.toast__close {
  position: absolute; top: 4px; right: 5px;
  border: 0; background: none; cursor: pointer; font-size: 11px; color: #43536b;
  padding: 2px 4px; border-radius: 2px;
}
.toast__close:hover { background: rgba(0,0,0,.07); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 200ms ease; transform: none; }
  .toast:not(.is-open) { opacity: 0; pointer-events: none; }
}
