/* ===================================================================
   desktop.css - the XP shell: desktop + wallpaper, icons, taskbar,
   two-column Start menu, boot splash, Peedy, toasts, context menu, BSOD.
   =================================================================== */

/* ---------- desktop ---------- */
#desktop {
  position: fixed;
  inset: 0 0 30px 0;
  background: #5b9bd5;
  overflow: hidden;
}
/* the wallpaper scales by cropping, the way a real desktop background does */
#wallpaper {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}
#desktop.plain #wallpaper { display: none; }
#deskicons, #windows { position: relative; z-index: 1; }
body.booting #desktop,
body.booting #taskbar { visibility: hidden; }

#deskicons {
  position: absolute;
  inset: 6px auto 6px 6px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  max-height: 100%;
}
.deskicon {
  width: 80px;
  padding: 4px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
  user-select: none;
}
.deskicon .glyph {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  font-size: 27px;
  line-height: 1;
  filter: drop-shadow(1px 2px 2px rgba(0,0,0,.4));
}
.deskicon .glyph img,
.deskicon .glyph svg { width: 32px; height: 32px; display: block; object-fit: contain; }
.deskicon .label {
  color: #fff;
  font-size: 11px;
  text-align: center;
  line-height: 1.3;
  padding: 1px 3px;
  border-radius: 2px;
  /* Bliss is pale at the horizon, so one soft shadow isn't enough:
     this is a cheap outline in every direction */
  text-shadow:
    1px 1px 2px rgba(0,0,0,.9),
   -1px  1px 2px rgba(0,0,0,.6),
    1px -1px 2px rgba(0,0,0,.6),
   -1px -1px 2px rgba(0,0,0,.6);
  word-break: break-word;
}
.deskicon.selected .label { background: rgba(49,106,197,.85); text-shadow: none; }
.deskicon.selected .glyph { filter: drop-shadow(1px 2px 2px rgba(0,0,0,.4)) brightness(.8) saturate(1.5); }

/* ---------- taskbar ---------- */
#taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 30px;
  display: flex;
  align-items: stretch;
  z-index: 9000;
  /* the Luna taskbar: bright top edge, deep blue body, dark base line */
  background: linear-gradient(180deg,
    #1f6fd4 0%, #4a94f0 5%, #3d8bee 12%,
    #2b74e0 42%, #2a72dd 88%, #1e5fc8 94%, #14449e 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
  font-size: 11px;
}

/* Start button: green pill, rounded on the right only */
.start-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 0 20px 2px 8px;
  margin-right: 6px;
  font-size: 15px;
  font-style: italic;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,.45);
  cursor: pointer; user-select: none;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(180deg,
    #63b563 0%, #4ea54e 8%, #3f9a3f 22%,
    #338a33 55%, #2d802d 86%, #256e25 96%, #1c5c1c 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5),
              inset -2px 0 4px rgba(0,0,0,.18);
}
.start-btn:hover { filter: brightness(1.09); }
.start-btn.active {
  background: linear-gradient(180deg, #1c5c1c 0%, #2d802d 20%, #338a33 60%, #3f9a3f 100%);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.35);
}

/* the real XP flag off the Start button */
.win-flag { width: 21px; height: 21px; flex: 0 0 21px; display: block;
            filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }

.tb-sep { display: none; }   /* XP has no raised gripper between start and tasks */

#taskbtns {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 3px;
  padding: 3px 4px;
  overflow: hidden;
}
.taskbtn {
  display: flex; align-items: center; gap: 5px;
  height: 22px;
  min-width: 130px; max-width: 180px;
  padding: 0 8px;
  color: #fff;
  cursor: pointer; user-select: none;
  border-radius: 3px;
  background: linear-gradient(180deg, #5fa3f5 0%, #3b83ea 12%, #2f76e2 55%, #2a6dd6 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset -1px -1px 2px rgba(0,0,0,.15);
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
}
.taskbtn:hover { background: linear-gradient(180deg, #7fb8f8 0%, #5195ef 12%, #4187e8 55%, #3a7ee0 100%); }
.taskbtn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskbtn img, .taskbtn svg { width: 15px; height: 15px; flex: 0 0 15px; object-fit: contain; }
.taskbtn.active {
  background: linear-gradient(180deg, #1c56b8 0%, #2364c9 20%, #2a6fd6 70%, #3179df 100%);
  box-shadow: inset 1px 1px 4px rgba(0,0,0,.4);
}

/* system tray: lighter blue well with a curved left edge */
#systray {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 14px;
  color: #fff;
  border-radius: 14px 0 0 0;
  background: linear-gradient(180deg,
    #1290e8 0%, #3fb6f5 8%, #23a3ef 20%, #1494e9 60%, #0d80d8 100%);
  box-shadow: inset 2px 0 4px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.4);
}
#systray .tray-ico { font-size: 13px; cursor: pointer; line-height: 1; }
#systray .tray-ico img { width: 16px; height: 16px; }
#clock {
  font-size: 11px; min-width: 56px; text-align: center;
  text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

/* ---------- Start menu (the two-column XP panel) ---------- */
#startmenu {
  position: fixed;
  left: 2px; bottom: 32px;
  width: 400px;
  max-width: calc(100vw - 8px);
  max-height: calc(100vh - 40px);
  display: none;
  flex-direction: column;
  z-index: 9500;
  border: 1px solid #0a3f9e;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  box-shadow: 3px 0 18px rgba(0,0,0,.5);
  background: #fff;
}
#startmenu.open { display: flex; }

.sm-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  color: #fff;
  background: linear-gradient(180deg,
    #1f6fd4 0%, #4a94f0 8%, #3d8bee 20%, #2b74e0 70%, #205fc0 100%);
  border-bottom: 2px solid #e97d2b;   /* the orange rule under the header */
}
.sm-head .av {
  width: 42px; height: 42px; flex: 0 0 42px;
  border: 2px solid #fff;
  border-radius: 4px;
  background: #6ba7f0;
  display: grid; place-items: center;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.sm-head .av img, .sm-head .av svg, .sm-head .av .peedy-still { width: 100%; height: 100%; object-fit: contain; }
.sm-head .nm {
  font-size: 15px; font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,.45);
}

.sm-cols { flex: 1 1 auto; display: flex; min-height: 0; }
.sm-left {
  flex: 1 1 58%;
  background: #fff;
  padding: 6px 4px;
  overflow-y: auto;
  border-right: 1px solid #c3d5ee;
}
.sm-right {
  flex: 0 0 42%;
  background: #d3e5fa;
  padding: 6px 4px;
  overflow-y: auto;
}

.startitem {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: default;
  user-select: none;
  border-radius: 3px;
}
.startitem:hover { background: #2f71cd; color: #fff; }
.startitem:hover .si-sub { color: #cfe0f7; }
.si-ico {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1;
  flex: 0 0 24px;
}
.si-ico img, .si-ico svg { width: 24px; height: 24px; object-fit: contain; }
.si-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.si-txt > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-sub { font-size: 10px; color: #5a6b7d; }
.sm-right .startitem { font-weight: bold; }
.sm-right .si-sub { font-weight: normal; }

.start-sep { height: 1px; margin: 5px 8px; background: #c3d5ee; }
.sm-left .start-sep { background: #dfe6ee; }

.sm-foot {
  flex: 0 0 auto;
  display: flex; justify-content: flex-end; gap: 16px;
  padding: 7px 14px;
  color: #fff;
  background: linear-gradient(180deg, #3d8bee 0%, #2b74e0 40%, #205fc0 100%);
  border-top: 1px solid #4f96f0;
}
.sm-foot .sf {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; cursor: pointer; user-select: none;
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
}
.sm-foot .sf:hover { text-decoration: underline; }
.sm-foot .sf .b {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 3px;
  background: linear-gradient(180deg, #f08a72, #c62d10);
  border: 1px solid rgba(255,255,255,.7);
  font-size: 11px;
}

/* ---------- boot splash ---------- */
#splash {
  position: fixed; inset: 0;
  z-index: 10000;
  display: none;
  place-items: center;
  background: #000;
  color: #fff;
}
.splash-inner { text-align: center; user-select: none; }
.splash-flag {
  width: 108px; height: 108px;
  margin: 0 auto 18px;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(80,150,255,.45));
}
.splash-title { font-size: 14px; letter-spacing: 1px; color: #cfd8e3; }
.splash-title b { font-size: 34px; display: block; letter-spacing: -.5px; color: #fff; }
.splash-sub { color: #ff9d2e; font-size: 12px; margin-top: 8px; letter-spacing: .5px; }

/* the XP progress bar: three blocks sliding left to right inside a well */
.splash-bar {
  width: 168px; height: 16px; margin: 26px auto 0;
  background: #16181c;
  border: 1px solid #2d3138;
  border-radius: 9px;
  overflow: hidden;
  position: relative;
}
.splash-bar i {
  position: absolute; top: 3px; left: 0;
  width: 46px; height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #1d4ea8, #4f9df5 40%, #9fd0ff 60%, #4f9df5 80%, #1d4ea8);
  animation: xpslide .8s linear infinite;
}
@keyframes xpslide {
  from { transform: translateX(-52px); }
  to   { transform: translateX(172px); }
}
.splash-foot {
  position: absolute; left: 0; right: 0; bottom: 22px;
  text-align: center; color: #6f7885; font-size: 11px;
}

/* ---------- Peedy ---------- */
/* One 160x128 cell of the original sprite sheet. All movement comes from
   his real frame data, so there are no CSS keyframes on the character. */
#peedy-agent {
  position: fixed;
  right: 18px; bottom: 32px;
  width: 160px; height: 128px;
  z-index: 8000;
  cursor: pointer;
  user-select: none;
}
#peedy-agent .peedy-stage {
  width: 160px; height: 128px;
  filter: drop-shadow(2px 5px 4px rgba(0,0,0,.3));
}
#peedy-agent.asleep { opacity: .9; }
#peedy-agent .zzz {
  position: absolute; top: 4px; right: 26px;
  font-size: 15px; color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,.7);
  display: none;
}
#peedy-agent.asleep .zzz { display: block; animation: zfloat 1.4s ease-in-out infinite alternate; }
@keyframes zfloat { from { transform: translateY(0); opacity: .7; } to { transform: translateY(-5px); opacity: 1; } }

/* his balloon - the tooltip yellow the real Agent balloons used */
.peedy-bubble {
  position: fixed;
  right: 20px; bottom: 194px;
  width: 310px;
  z-index: 8100;
  background: #ffffe1;
  border: 1px solid #8a8a5a;
  border-radius: 4px;
  padding: 11px 13px;
  font-size: 11.5px;
  line-height: 1.55;
  box-shadow: 3px 4px 10px rgba(0,0,0,.35);
  display: none;
}
.peedy-bubble.show { display: block; animation: pop .16s ease-out; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.peedy-bubble::after {
  content: "";
  position: absolute;
  right: 44px; bottom: -9px;
  width: 0; height: 0;
  border: 9px solid transparent;
  border-top-color: #ffffe1;
  border-bottom: 0;
  filter: drop-shadow(0 1px 0 #8a8a5a);
}
.pb-close {
  position: absolute; top: 4px; right: 5px;
  width: 16px; height: 15px;
  display: grid; place-items: center;
  font-size: 9px; font-weight: bold;
  border: 1px solid #a8a888;
  border-radius: 2px;
  background: linear-gradient(180deg, #fff, #ece9d8);
  cursor: pointer;
}
.pb-actions { display: flex; gap: 6px; margin-top: 11px; justify-content: flex-end; }
.pb-actions .btn { min-width: 64px; padding: 2px 9px; min-height: 21px; font-size: 11px; }

/* ---------- toasts (XP balloon tips) ---------- */
#toasts {
  position: fixed;
  /* offset left of the bird, who owns the bottom-right corner */
  right: 190px; bottom: 36px;
  z-index: 9200;
  display: flex; flex-direction: column-reverse; gap: 7px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: 272px;
  background: #ffffe1;
  border: 1px solid #8a8a5a;
  border-radius: 4px;
  box-shadow: 2px 3px 9px rgba(0,0,0,.32);
  padding: 8px 10px;
}
.t-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: bold;
  margin-bottom: 5px;
}
.t-head span:nth-child(2) { flex: 1 1 auto; }
.t-x {
  width: 15px; height: 14px;
  display: grid; place-items: center;
  font-size: 9px;
  border: 1px solid #a8a888;
  border-radius: 2px;
  background: linear-gradient(180deg, #fff, #ece9d8);
  cursor: pointer;
}
.t-body { font-size: 11px; line-height: 1.5; }

/* ---------- context menu ---------- */
#ctxmenu {
  position: fixed;
  display: none;
  min-width: 176px;
  z-index: 9600;
  background: #fff;
  border: 1px solid #a0a0a0;
  box-shadow: 2px 3px 8px rgba(0,0,0,.32);
  padding: 3px;
}
#ctxmenu.open { display: block; }
.ctxitem { padding: 5px 22px; font-size: 11px; cursor: default; user-select: none; border-radius: 2px; }
.ctxitem:hover { background: var(--sel); color: #fff; }
.ctxsep { height: 1px; margin: 4px 6px; background: #dcdcdc; }

/* ---------- BSOD ---------- */
#bsod {
  position: fixed; inset: 0;
  z-index: 12000;
  display: none;
  background: #0000aa;
  color: #fff;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 12vh 8vw;
  cursor: pointer;
}
#bsod.show { display: block; }
#bsod .bs { max-width: 780px; margin: 0 auto; text-align: center; }
#bsod h2 {
  background: #c0c0c0; color: #0000aa;
  display: inline-block;
  margin: 0 auto 22px;
  padding: 0 10px;
  font-size: 13px;
}
#bsod p { text-align: left; margin: 10px 0; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  #deskicons { flex-direction: row; inset: 6px 6px auto 6px; max-height: none; }
  .deskicon { width: 74px; }

  #startmenu { width: calc(100vw - 8px); }
  .sm-cols { flex-direction: column; }
  .sm-right { flex: 0 0 auto; }

  .peedy-bubble { right: 8px; left: 8px; width: auto; bottom: 140px; }
  .peedy-bubble::after { display: none; }
  /* scale the sprite rather than resizing it, so the frame stays exact */
  #peedy-agent { right: 2px; bottom: 28px; transform: scale(.72); transform-origin: bottom right; }

  #toasts { left: 8px; right: 108px; align-items: stretch; }
  .toast { width: auto; }

  #taskbtns .taskbtn { min-width: 0; flex: 1 1 0; max-width: 150px; }
  .start-btn { font-size: 13px; padding: 0 14px 2px 6px; }
  #systray { padding: 0 6px 0 10px; gap: 6px; }
  #systray .tray-ico[title="Network"] { display: none; }

  /* bigger touch targets on the title bar */
  .titlebar { height: 30px; }
  .titlebar-btn { width: 26px; height: 23px; font-size: 12px; }
}
@media (max-width: 380px) {
  .deskicon { width: 66px; }
  #peedy-agent { transform: scale(.6); }
}
