:root {
  --theme-id: "retro";
  --theme-name: "Retro Neon";
  --theme-description: "Modern style with gradients";
  --wallpaper-top: #0d1f49;
  --wallpaper-bottom: #050f29;
  --wallpaper-neon: rgba(0, 214, 255, 0.11);
  --scanline: rgba(140, 255, 255, 0.03);
  --wallpaper-image: none;

  --desktop-text: #f3f8ff;
  --desktop-text-shadow: rgba(2, 16, 48, 0.9);
  --icon-focus: #7de9ff;

  --window-shell: #c3cddf;
  --window-shadow-dark: #273249;
  --window-shadow-light: #e8f2ff;
  --window-border-dark: #1e293f;
  --window-border-mid: #7588a9;

  --titlebar-top: #3e8bff;
  --titlebar-mid: #2464d8;
  --titlebar-bottom: #123f9b;
  --titlebar-glow: rgba(89, 229, 255, 0.22);

  --window-body: #0b1430;
  --window-accent: #71dfff;

  --taskbar-top: #3b4f6f;
  --taskbar-mid: #2a3f61;
  --taskbar-bottom: #1a2a47;
  --taskbar-border: #9fb1cf;

  --start-top: #59cb43;
  --start-bottom: #2f9225;
  --start-border-light: #b9f2a7;
  --start-border-dark: #1f5f18;

  --taskbtn-top: #d7e3f7;
  --taskbtn-bottom: #a6b9d8;
  --taskbtn-active-top: #9edcf1;
  --taskbtn-active-bottom: #6aa9cb;
  --taskbtn-text: #0d1f40;

  --clock-top: #d9e6fb;
  --clock-bottom: #a7bddf;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  font-family: "Tahoma", "Trebuchet MS", Arial, sans-serif;
  color: var(--desktop-text);
  background-color: #000;
  background-image:
    var(--wallpaper-image),
    radial-gradient(circle at 18% 20%, rgba(120, 180, 255, 0.12), transparent 34%),
    radial-gradient(circle at 82% 26%, var(--wallpaper-neon), transparent 38%),
    linear-gradient(165deg, var(--wallpaper-top), var(--wallpaper-bottom));
  background-size: var(--wallpaper-fit, contain), auto, auto, auto;
  background-position: center, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
}

#stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 2px,
      var(--scanline) 3px
    ),
    radial-gradient(1.4px 1.4px at 16% 33%, rgba(176, 245, 255, 0.34), transparent),
    radial-gradient(1.5px 1.5px at 68% 18%, rgba(176, 245, 255, 0.31), transparent),
    radial-gradient(1.3px 1.3px at 83% 63%, rgba(176, 245, 255, 0.28), transparent),
    radial-gradient(1.2px 1.2px at 34% 72%, rgba(176, 245, 255, 0.24), transparent);
  animation: crtDrift 10s linear infinite;
}

@keyframes crtDrift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-8px);
  }
}

#desktop {
  position: relative;
  z-index: 1;
  width: 100%;
  height: calc(100% - 44px);
  padding: 0.9rem;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, minmax(92px, 1fr));
  align-content: start;
  column-gap: 0.2rem;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 92px;
  min-height: 84px;
  padding: 0.4rem 0.3rem;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--desktop-text);
  text-shadow: 0 1px 0 var(--desktop-text-shadow);
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  outline: none;
  border-color: rgba(173, 245, 255, 0.95);
  background: rgba(93, 173, 255, 0.19);
  box-shadow: inset 0 0 0 1px rgba(20, 53, 119, 0.7), 0 0 7px rgba(95, 231, 255, 0.24);
}

.desktop-icon .emoji {
  font-size: 1.45rem;
  margin-bottom: 0.28rem;
  filter: drop-shadow(0 0 3px rgba(92, 229, 255, 0.4));
}

.desktop-icon span {
  font-size: 0.76rem;
  line-height: 1.15;
  text-align: center;
}

.window {
  position: absolute;
  width: min(420px, 94vw);
  min-width: 240px;
  min-height: 220px;
  display: none;
  overflow: hidden;
  border: 1px solid var(--window-border-dark);
  border-radius: 0;
  background: var(--window-shell);
  box-shadow:
    0 0 0 1px var(--window-shadow-light),
    0 0 0 2px var(--window-shadow-dark),
    0 0 14px rgba(66, 227, 255, 0.16),
    0 14px 30px rgba(0, 0, 0, 0.42);
}

.window.open {
  display: block;
}

.window.maximized {
  width: auto;
  height: auto;
}

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.34rem 0.4rem 0.36rem;
  border-bottom: 1px solid var(--window-border-mid);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.35) 0,
      rgba(255, 255, 255, 0) 42%
    ),
    linear-gradient(180deg, var(--titlebar-top), var(--titlebar-mid) 55%, var(--titlebar-bottom));
  box-shadow: inset 0 -1px 0 rgba(174, 216, 255, 0.5), inset 0 0 12px var(--titlebar-glow);
  cursor: move;
}

.window-header p {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f5fbff;
  text-shadow: 0 1px 0 rgba(15, 30, 78, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-actions {
  display: flex;
  gap: 0.22rem;
}

.window-btn {
  width: 22px;
  height: 20px;
  border: 1px solid #2e3f62;
  border-radius: 2px;
  padding: 0;
  color: #112245;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  background: linear-gradient(180deg, #ffffff, #c8d4ea);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.window-btn:hover {
  background: linear-gradient(180deg, #ffffff, #a8dfff);
}

.window-btn:active {
  background: linear-gradient(180deg, #b7c8e6, #e4f2ff);
  box-shadow: inset 0 1px 2px rgba(23, 39, 78, 0.45);
}

.window-body {
  height: calc(100% - 34px);
  padding: 2px;
  background:
    linear-gradient(180deg, rgba(113, 223, 255, 0.22), rgba(18, 38, 87, 0)) border-box,
    var(--window-body);
}

.window-frame {
  width: 100%;
  height: 100%;
  border: 1px solid #172a52;
  background: #ffffff;
}

#taskbar {
  position: fixed;
  inset: auto 0 0;
  z-index: 1000;
  height: 44px;
  padding: 0 0.42rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--taskbar-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.21) 0, rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, var(--taskbar-top), var(--taskbar-mid) 50%, var(--taskbar-bottom));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.task-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.start-pill {
  min-width: 94px;
  border: 1px solid var(--start-border-dark);
  border-radius: 999px;
  padding: 0.36rem 0.78rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f3fff0;
  white-space: nowrap;
  text-align: center;
  text-shadow: 0 1px 0 rgba(13, 68, 5, 0.8);
  background: linear-gradient(180deg, var(--start-top), var(--start-bottom));
  box-shadow:
    inset 0 1px 0 var(--start-border-light),
    inset 0 -1px 0 rgba(30, 94, 24, 0.9),
    0 0 7px rgba(80, 238, 137, 0.22);
}

#taskItems {
  display: flex;
  gap: 0.28rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

#taskItems::-webkit-scrollbar {
  height: 6px;
}

#taskItems::-webkit-scrollbar-thumb {
  background: rgba(147, 178, 225, 0.5);
}

.task-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid #5f7398;
  border-radius: 2px;
  color: var(--taskbtn-text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.33rem 0.62rem;
  cursor: pointer;
  background: linear-gradient(180deg, var(--taskbtn-top), var(--taskbtn-bottom));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.task-btn__content {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.task-btn__emoji {
  font-size: 0.92rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  padding: 0.08rem 0.18rem;
  border-radius: 3px;
  background: rgba(14, 40, 84, 0.4);
  box-shadow: inset 0 0 0 1px rgba(177, 228, 255, 0.2);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.35);
}

.task-btn__label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-btn:hover {
  background: linear-gradient(180deg, var(--taskbtn-active-top), var(--taskbtn-active-bottom));
}

.task-btn.task-btn--active {
  background: linear-gradient(180deg, #87d6ee, #5a9fc1);
  border-color: #3f6d92;
}

.task-btn.task-btn--minimized {
  opacity: 0.92;
}

.task-btn.task-btn--minimized .task-btn__label {
  opacity: 0.78;
}

.task-btn.task-btn--minimized .task-btn__emoji {
  opacity: 1;
  background: rgba(12, 34, 72, 0.5);
}

#clock {
  border: 1px solid #667aa1;
  border-radius: 2px;
  padding: 0.24rem 0.52rem;
  min-width: 60px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: #102448;
  white-space: nowrap;
  background: linear-gradient(180deg, var(--clock-top), var(--clock-bottom));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

/* Start Menu - Windows 7 Style */
.start-menu {
  position: fixed;
  bottom: 46px;
  left: 8px;
  width: 320px;
  max-height: auto;
  background: linear-gradient(to right, 
    var(--window-body) 0%,
    var(--window-body) 5px,
    var(--window-shell) 5px
  );
  border: 2px solid var(--window-border-dark);
  border-radius: 6px 6px 0 0;
  box-shadow: 
    inset 1px 1px 0 var(--window-shadow-light),
    2px 2px 12px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.start-menu--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* User Header */
.start-menu-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, 
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border-bottom: 1px solid var(--window-border-mid);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.start-menu-user-avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--titlebar-top), var(--titlebar-bottom));
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 
    inset 0 1px 2px rgba(255, 255, 255, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--window-border-dark);
}

.start-menu-user-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--desktop-text);
  text-shadow: 1px 1px 2px var(--desktop-text-shadow);
}

/* Power Actions Section */
.start-menu-actions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 16px;
  min-height: 0;
}

.start-menu-action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--taskbtn-top), var(--taskbtn-bottom));
  border: 1px solid var(--window-border-dark);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.start-menu-action-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--window-accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.start-menu-action-btn:hover::before {
  opacity: 1;
}

.start-menu-action-btn:hover {
  background: linear-gradient(180deg, 
    var(--taskbtn-active-top), 
    var(--taskbtn-active-bottom)
  );
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 3px 6px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.start-menu-action-btn:active {
  background: linear-gradient(180deg, 
    var(--taskbtn-active-bottom), 
    var(--taskbtn-active-top)
  );
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
}

.start-menu-action-btn--shutdown {
  border-color: #d32f2f;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 2px 4px rgba(211, 47, 47, 0.3);
}

.start-menu-action-btn--shutdown::before {
  background: #d32f2f;
}

.start-menu-action-btn--shutdown:hover {
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 3px 8px rgba(211, 47, 47, 0.4);
}

.start-menu-action-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.start-menu-action-btn--shutdown .start-menu-action-icon {
  color: #d32f2f;
}

.start-menu-action-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--taskbtn-text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Shutdown Dialog */
.shutdown-dialog {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.shutdown-dialog--open {
  opacity: 1;
  pointer-events: all;
}

.shutdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.shutdown-box {
  position: relative;
  background: var(--window-shell);
  border: 2px solid var(--window-border-dark);
  border-radius: 6px;
  padding: 24px;
  min-width: 360px;
  max-width: 90vw;
  box-shadow: 
    inset 1px 1px 0 var(--window-shadow-light),
    0 4px 20px rgba(0, 0, 0, 0.6);
  animation: dialogSlideIn 0.2s ease;
}

@keyframes dialogSlideIn {
  from {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.shutdown-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--titlebar-bottom);
  margin: 0 0 16px 0;
  text-shadow: 1px 1px 0 var(--window-shadow-light);
}

.shutdown-message {
  font-size: 0.95rem;
  color: var(--window-border-dark);
  margin-bottom: 24px;
  line-height: 1.5;
}

.shutdown-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.shutdown-btn {
  padding: 8px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--window-border-dark);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

.shutdown-btn--confirm {
  background: linear-gradient(180deg, #ff6b6b, #d32f2f);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.shutdown-btn--confirm:hover {
  background: linear-gradient(180deg, #ff5252, #c62828);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.shutdown-btn--confirm:active {
  background: linear-gradient(180deg, #c62828, #ff5252);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.shutdown-btn--cancel {
  background: linear-gradient(180deg, var(--taskbtn-top), var(--taskbtn-bottom));
  color: var(--taskbtn-text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.shutdown-btn--cancel:hover {
  background: linear-gradient(180deg, 
    var(--taskbtn-active-top), 
    var(--taskbtn-active-bottom)
  );
}

.shutdown-btn--cancel:active {
  background: linear-gradient(180deg, 
    var(--taskbtn-active-bottom), 
    var(--taskbtn-active-top)
  );
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

@media (max-width: 700px) {
  #desktop {
    padding: 0.6rem 0.48rem;
    grid-template-rows: repeat(auto-fill, minmax(88px, 1fr));
  }

  .window {
    width: min(370px, 96vw);
  }

  .start-pill {
    min-width: auto;
    padding-inline: 0.62rem;
  }

  .start-menu {
    width: min(320px, calc(100vw - 16px));
  }

  .shutdown-box {
    min-width: auto;
    width: 90vw;
  }

  .shutdown-buttons {
    flex-direction: column;
  }

  .shutdown-btn {
    width: 100%;
  }
}

