:root {
  --taskbar: #245edb;
  --taskbar-dark: #1746a2;
  --taskbar-light: #3c8cff;
  --green: #36a52f;
  --green-dark: #247f20;
  --window-blue: #0756d8;
  --cream: #fff7dc;
  --paper: #f7f3e8;
  --text: #172033;
}

.desktop.has-wallpaper {
  background:
    linear-gradient(rgba(30, 82, 150, .18), rgba(30, 82, 150, .18)),
    var(--desktop-wallpaper) center / cover no-repeat;
}

.desktop.has-wallpaper::before {
  opacity: 0;
}

/* ===== 新图片图标样式 ===== */
.desktop-icon-img {
  display: inline-block;
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .28));
}

.icon-img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  object-fit: contain;
}

.windows-mark-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.photo-window {
  width: min(820px, calc(100vw - 28px));
}

.photo-browser {
  display: grid;
  grid-template-columns: 170px minmax(230px, 1fr) 210px;
  gap: 10px;
  min-height: 390px;
  padding: 10px;
  background: #fff;
}

.photo-sidebar,
.photo-details {
  min-width: 0;
  padding: 10px;
  border-radius: 4px;
  background: linear-gradient(#dce8ff, #f4f7ff);
}

.photo-sidebar h2,
.photo-details h2 {
  margin: 0 0 9px;
  color: #1642a3;
  font-size: 13px;
}

.photo-folders {
  display: grid;
  gap: 5px;
}

.photo-folders button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: left;
}

.photo-folders button:hover,
.photo-folders button.active {
  border-color: #6a9ee8;
  background: #dbeafe;
}

.photo-folders button span:last-of-type {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-folders button em {
  color: #52607a;
  font-style: normal;
}

.photo-main {
  min-width: 0;
  overflow: auto;
  border: 1px solid #c7d7f2;
  background: #fff;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  align-content: start;
  gap: 10px;
  padding: 10px;
}

.photo-card {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 128px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: center;
}

.photo-card:hover,
.photo-card.selected {
  border-color: #7da8e8;
  background: #dbeafe;
}

.photo-card img {
  width: 96px;
  height: 78px;
  object-fit: cover;
  border: 1px solid #9aaed0;
  background: #eef3ff;
  box-shadow: 1px 2px 3px rgba(0, 0, 0, .18);
}

.photo-card span {
  width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.photo-preview {
  display: block;
  width: 100%;
  max-height: 132px;
  margin-bottom: 10px;
  object-fit: contain;
  border: 1px solid #a8b8d8;
  background: #fff;
}

.photo-details dl {
  display: grid;
  gap: 7px;
  margin: 0 0 12px;
}

.photo-details dl div {
  display: grid;
  gap: 2px;
}

.photo-details dt {
  color: #52607a;
  font-size: 12px;
}

.photo-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.set-wallpaper {
  width: 100%;
}

.muted {
  margin: 0;
  color: #5f6b80;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .photo-window {
    width: calc(100vw - 16px);
  }

  .photo-browser {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 190px);
    overflow: auto;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--text);
  font-family: Tahoma, "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
  user-select: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.desktop {
  position: relative;
  min-height: 100vh;
  padding: 18px 18px 46px;
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 18%, rgba(255, 255, 255, .75) 0 5%, transparent 18%),
    linear-gradient(145deg, rgba(36, 111, 220, .18), transparent 38%),
    linear-gradient(180deg, #75b7ff 0%, #3489e6 40%, #1f73d1 62%, #4aa64a 63%, #66b95b 100%);
}

.desktop::before {
  content: "";
  position: absolute;
  inset: 42% -8% 38px -8%;
  background:
    linear-gradient(9deg, transparent 0 44%, rgba(255, 255, 255, .28) 45% 46%, transparent 47%),
    linear-gradient(168deg, transparent 0 49%, rgba(255, 255, 255, .18) 50% 51%, transparent 52%),
    linear-gradient(13deg, #2d942c, #72c05c 42%, #3c9632 43%, #187726 100%);
  clip-path: polygon(0 62%, 18% 42%, 38% 54%, 57% 27%, 74% 48%, 100% 22%, 100% 100%, 0 100%);
}

.icons {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 18px;
  width: 88px;
}

.desktop-icon {
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 86px;
  min-height: 76px;
  padding: 5px 4px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #fff;
  background: transparent;
  text-shadow: 1px 1px 2px #00336d;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(30, 91, 190, .28);
  outline: none;
}

.drive-icon,
.disc-icon,
.network-icon,
.file-icon {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 30px;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .28));
}

.small {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  filter: none;
}

.window {
  position: absolute;
  z-index: 5;
  display: none;
  width: min(560px, calc(100vw - 28px));
  min-width: 300px;
  min-height: 260px;
  border: 3px solid #0863ea;
  border-radius: 8px 8px 4px 4px;
  background: #ece9d8;
  box-shadow: 4px 7px 22px rgba(0, 22, 72, .36);
}

.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 6;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 45%, rgba(0, 0, 0, .22) 46% 49%, transparent 50%),
    linear-gradient(135deg, transparent 0 62%, rgba(0, 0, 0, .22) 63% 66%, transparent 67%),
    linear-gradient(135deg, transparent 0 78%, rgba(0, 0, 0, .22) 79% 82%, transparent 83%);
}

.window.maximized .resize-handle {
  display: none;
}

.window.open,
.window.active {
  display: block;
}

.window.maximized {
  left: 8px !important;
  top: 8px !important;
  width: calc(100vw - 16px);
  height: calc(100vh - 56px);
}

.window.maximized .window-body {
  height: calc(100% - 31px);
  overflow: auto;
}

.window.maximized .photo-browser {
  height: calc(100% - 58px);
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 31px;
  padding: 3px 4px 3px 8px;
  color: #fff;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #4fa3ff 0%, var(--window-blue) 48%, #0647b7 100%);
  text-shadow: 1px 1px 1px #001e75;
  touch-action: none;
}

.titlebar strong {
  flex: 1;
}

.window-controls {
  display: flex;
  gap: 3px;
}

.window-controls button {
  display: grid;
  place-items: center;
  width: 23px;
  height: 22px;
  padding: 0;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 3px;
  background: linear-gradient(#76b2ff, #1f61d2 45%, #0b3f9d);
  font-weight: 700;
}

.window-controls button[data-close] {
  background: linear-gradient(#ffb199, #e45b29 50%, #b72e13);
}

.menu-row,
.browser-toolbar {
  padding: 6px 8px;
  border-bottom: 1px solid #c7c3b2;
  background: #f7f4e9;
}

.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
}

.browser-toolbar label {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.browser-toolbar input {
  width: 100%;
  min-width: 80px;
  height: 24px;
  padding: 2px 7px;
  border: 1px solid #8d8d8d;
  background: #fff;
  user-select: text;
}

.window-body {
  min-height: 220px;
  padding: 14px;
  background: var(--paper);
}

/* Resizable body: fill the window, scroll if needed */
.window .window-body {
  height: calc(100% - 31px);
  min-height: 0;
  overflow: auto;
  box-sizing: border-box;
}

/* Welcome window stays content-sized */
#window-about .window-body {
  height: calc(100% - 31px);
  min-height: 0;
  overflow: auto;
}

#window-about.window {
  min-height: 0;
  width: min(480px, calc(100vw - 40px));
}

/* Windows with a menu row: account for extra 27px */
.window .browser-toolbar ~ .window-body,
.window .menu-row ~ .window-body {
  height: calc(100% - 58px);
}

.welcome-body {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 18px;
  align-items: center;
}

.welcome-body h1,
.internet h2 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 0;
}

.welcome-body p,
.internet p {
  line-height: 1.55;
}

.xp-logo {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, .65);
  border-radius: 16px;
  background:
    linear-gradient(135deg, #f15a31 0 49%, transparent 50%),
    linear-gradient(45deg, #2e88ff 0 49%, transparent 50%),
    linear-gradient(225deg, #35ae46 0 49%, transparent 50%),
    linear-gradient(315deg, #ffcf27 0 49%, transparent 50%);
  box-shadow: inset 0 0 20px rgba(255, 255, 255, .38), 2px 5px 12px rgba(0, 0, 0, .22);
  font-size: 31px;
  font-weight: 800;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.xp-button {
  min-height: 25px;
  padding: 3px 12px;
  border: 1px solid #7f9db9;
  border-radius: 3px;
  background: linear-gradient(#fff, #e8e4d4);
  box-shadow: inset 1px 1px 0 #fff;
}

.xp-button:active {
  background: linear-gradient(#d7d2c2, #fff);
}

.explorer {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  background: #fff;
}

.explorer aside {
  padding: 10px;
  border-radius: 4px;
  background: linear-gradient(#dce8ff, #f4f7ff);
}

.explorer h2 {
  margin: 0 0 8px;
  color: #1642a3;
  font-size: 13px;
}

.explorer a {
  display: block;
  margin: 8px 0;
  color: #2155bb;
  text-decoration: none;
}

.drive-grid,
.documents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
}

.drive-grid button,
.documents button,
.start-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
}

.drive-grid button:hover,
.documents button:hover,
.start-menu button:hover {
  border-color: #8eb5ec;
  background: #dbeafe;
}

.drive-icon {
  border: 2px solid #8c8c8c;
  border-radius: 4px;
  background: linear-gradient(#f9f9f9, #a8a8a8);
}

.disc-icon {
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 13%, #9cc8ff 14% 38%, #e9f5ff 39% 58%, #6a8ec6 59%);
}

.network-icon {
  border-radius: 4px;
  background: linear-gradient(135deg, #56d37b, #19763e);
}

.file-icon {
  border: 2px solid #7b91bd;
  background: linear-gradient(#fff, #d7e4ff);
}

.file-icon::before {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  border-left: 10px solid transparent;
  border-bottom: 10px solid #9eb7e6;
}

.file-icon.sheet {
  border-color: #3b8f53;
  background: linear-gradient(#fff, #c9f0cf);
}

.file-icon.image {
  border-color: #9162a7;
  background: linear-gradient(#fff, #ead5f5);
}

.file-icon.text {
  border-color: #888;
  background: linear-gradient(#fff, #eee);
}

.internet {
  min-height: 210px;
  background:
    linear-gradient(rgba(255, 255, 255, .9), rgba(255, 255, 255, .9)),
    repeating-linear-gradient(135deg, #d7e7ff 0 8px, #fff 8px 16px);
}

.start-menu {
  position: absolute;
  left: 0;
  bottom: 38px;
  z-index: 2147483000;
  display: none;
  width: min(430px, calc(100vw - 16px));
  border: 2px solid #1557ce;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 4px 0 22px rgba(0, 0, 0, .35);
}

.start-menu.open {
  display: block;
}

.start-menu header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: #fff;
  background: linear-gradient(#69aeff, #1458d1);
  font-size: 16px;
  text-shadow: 1px 1px 1px #0a357e;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px solid #fff;
  border-radius: 5px;
  background: linear-gradient(135deg, #ffdf5b, #2e88ff);
  font-weight: 800;
}

.start-content {
  display: grid;
  grid-template-columns: 1fr 155px;
  min-height: 248px;
}

.start-left,
.start-right {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 8px;
}

.start-right {
  background: #d9e8ff;
}

.start-menu footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 7px;
  background: linear-gradient(#2d75e8, #1557ce);
}

.start-menu footer button {
  min-height: 28px;
  color: #fff;
}

.taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147482999;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 38px;
  background: linear-gradient(180deg, var(--taskbar-light), var(--taskbar) 38%, var(--taskbar-dark));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}

.start-button {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  min-width: 96px;
  padding: 0 16px 0 11px;
  border: 0;
  border-radius: 0 14px 14px 0;
  color: #fff;
  background: linear-gradient(#62cf58, var(--green) 45%, var(--green-dark));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 2px 0 5px rgba(0, 0, 0, .28);
  font-size: 16px;
  font-weight: 700;
  font-style: italic;
  text-shadow: 1px 1px 1px #145a10;
}

.task-buttons {
  display: flex;
  gap: 4px;
  min-width: 0;
  padding: 0 7px;
  overflow: hidden;
}

.task-buttons button {
  display: none;
  align-items: center;
  gap: 6px;
  width: min(170px, 24vw);
  height: 29px;
  min-width: 72px;
  overflow: hidden;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 3px;
  background: linear-gradient(#3f8cf4, #1d5bc6);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-buttons button.visible {
  display: flex;
}

.task-buttons button.active {
  background: linear-gradient(#1e56b8, #173f92);
  box-shadow: inset 1px 1px 5px rgba(0, 0, 0, .35);
}

.tray {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 100%;
  padding: 0 12px;
  color: #fff;
  background: linear-gradient(#28a9f5, #0b80ce);
  border-left: 1px solid rgba(255, 255, 255, .45);
}

.speaker {
  width: 16px;
  height: 14px;
  background: linear-gradient(90deg, #fff 0 35%, transparent 36%);
  clip-path: polygon(0 35%, 35% 35%, 70% 0, 70% 100%, 35% 65%, 0 65%);
}

@media (max-width: 720px) {
  .desktop {
    padding: 12px 12px 46px;
  }

  .icons {
    width: auto;
    gap: 9px;
  }

  .desktop-icon {
    width: 76px;
    font-size: 12px;
  }

  .window {
    left: 8px !important;
    top: 108px !important;
    width: calc(100vw - 16px);
  }

  .welcome-body,
  .explorer,
  .start-content {
    grid-template-columns: 1fr;
  }

  .xp-logo {
    width: 70px;
    height: 70px;
  }

  .drive-grid,
  .documents {
    grid-template-columns: 1fr;
  }

  .task-buttons button {
    width: 96px;
  }
}

.window.photo-window {
  width: min(920px, calc(100vw - 120px));
  height: min(640px, calc(100vh - 66px));
  min-height: 420px;
}

.window.photo-window .photo-browser {
  grid-template-columns: 170px minmax(300px, 1fr) 220px;
  height: calc(100% - 58px);
  min-height: 0;
  overflow: hidden;
}

.window.photo-window .photo-main,
.window.photo-window .photo-sidebar,
.window.photo-window .photo-details {
  min-height: 0;
  overflow-y: auto;
}

.window.photo-window .photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
}

.window.photo-window.maximized {
  width: calc(100vw - 16px);
  height: calc(100vh - 56px);
}

@media (max-width: 720px) {
  .window.photo-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 150px);
    min-height: 0;
  }

  .window.photo-window .photo-browser {
    grid-template-columns: 1fr;
    height: calc(100% - 58px);
    overflow: auto;
  }
}

@media (max-width: 720px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
  }

  .desktop {
    height: 100dvh;
    min-height: 100dvh;
    padding: 12px 10px calc(58px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .desktop::before {
    inset: 45% -18% 48px -18%;
  }

  .icons {
    width: auto;
    gap: 12px;
  }

  .desktop-icon {
    width: 86px;
    min-height: 82px;
    padding: 7px 2px;
    font-size: 12px;
    touch-action: manipulation;
  }

  .desktop-icon .desktop-icon-img {
    transform: scale(1.08);
    transform-origin: center bottom;
  }

  .window,
  .window.photo-window,
  .window.maximized,
  .window.photo-window.maximized {
    position: fixed !important;
    left: 0 !important;
    right: 0;
    top: max(18px, env(safe-area-inset-top)) !important;
    bottom: calc(48px + env(safe-area-inset-bottom));
    width: 100vw !important;
    height: calc(100dvh - 48px - max(18px, env(safe-area-inset-top)) - env(safe-area-inset-bottom)) !important;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }

  .titlebar {
    height: 48px;
    padding: 7px 10px;
    border-radius: 0;
    touch-action: auto;
  }

  .titlebar strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .window-controls {
    gap: 5px;
  }

  .window-controls button {
    width: 42px;
    height: 34px;
    font-size: 16px;
  }

  .window-controls button[data-minimize],
  .window-controls button[data-maximize] {
    display: none;
  }

  .menu-row {
    display: none;
  }

  .browser-toolbar {
    display: none;
  }

  .window-body {
    height: calc(100% - 48px);
    min-height: 0;
    padding: 12px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .welcome-body {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 14px;
  }

  .welcome-body h1,
  .internet h2 {
    font-size: 20px;
  }

  .xp-logo {
    width: 74px;
    height: 74px;
  }

  .actions,
  .drive-grid,
  .documents {
    grid-template-columns: 1fr;
  }

  .actions .xp-button,
  .drive-grid button,
  .documents button,
  .start-menu button,
  .photo-folders button,
  .set-wallpaper {
    min-height: 44px;
    touch-action: manipulation;
  }

  .explorer {
    grid-template-columns: 1fr;
  }

  .window.photo-window .photo-browser {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: calc(100% - 48px);
    min-height: 0;
    padding: 8px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .photo-sidebar,
  .photo-details {
    flex: 0 0 auto;
    padding: 8px;
  }

  .photo-folders {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
    -webkit-overflow-scrolling: touch;
  }

  .photo-folders button {
    flex: 0 0 auto;
    max-width: 220px;
    min-width: 132px;
  }

  .window.photo-window .photo-main {
    flex: 1 1 auto;
    min-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .window.photo-window .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 8px;
  }

  .photo-card {
    min-height: 142px;
    padding: 8px 5px;
  }

  .photo-card img {
    width: min(128px, 34vw);
    height: min(96px, 26vw);
  }

  .photo-preview {
    max-height: 190px;
  }

  .start-menu {
    position: fixed;
    z-index: 2147483000;
    left: 8px;
    right: 8px;
    bottom: calc(48px + env(safe-area-inset-bottom));
    width: auto;
    max-height: calc(100dvh - 72px);
    overflow: auto;
    border-radius: 8px 8px 0 0;
  }

  .start-content {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .start-menu footer {
    position: sticky;
    bottom: 0;
  }

  .taskbar {
    position: fixed;
    z-index: 2147482999;
    height: calc(48px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .start-button {
    height: 48px;
    min-width: 84px;
    padding: 0 13px 0 10px;
    font-size: 15px;
  }

  .task-buttons {
    gap: 3px;
    padding: 0 4px;
  }

  .task-buttons button {
    width: auto;
    min-width: 0;
    max-width: 110px;
    flex: 1 1 0;
    height: 34px;
    padding: 0 8px;
    font-size: 12px;
  }

  .tray {
    gap: 5px;
    padding: 0 8px;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .icons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .window.photo-window .photo-grid {
    grid-template-columns: 1fr 1fr;
  }

  .photo-card img {
    width: min(118px, 36vw);
  }
}

@media (max-width: 720px) {
  .window-controls {
    position: relative;
    z-index: 30;
    pointer-events: auto;
  }

  .window-controls button {
    touch-action: manipulation;
    pointer-events: auto;
  }

  .window .titlebar {
    position: relative;
    z-index: 20;
  }

  #window-about.window {
    position: fixed !important;
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: calc(60px + env(safe-area-inset-bottom));
    width: auto !important;
    height: auto !important;
    min-height: 0;
    max-height: 46dvh;
    border: 2px solid #0863ea;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0, 18, 70, .38);
  }

  .resize-handle {
    display: none;
  }

  #window-about .titlebar {
    height: 36px;
    padding: 4px 5px 4px 9px;
    border-radius: 5px 5px 0 0;
  }

  #window-about .window-controls button[data-minimize],
  #window-about .window-controls button[data-maximize] {
    display: none;
  }

  #window-about .window-controls button[data-close] {
    display: grid;
    width: 32px;
    height: 28px;
  }

  #window-about .window-body {
    height: auto;
    max-height: calc(46dvh - 36px);
    min-height: 0;
    padding: 10px;
    overflow: auto;
  }

  #window-about .welcome-body {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 10px;
    align-items: center;
  }

  #window-about .xp-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 20px;
  }

  #window-about .welcome-body h1 {
    margin-bottom: 4px;
    font-size: 16px;
  }

  #window-about .welcome-body p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
  }

  #window-about .actions {
    display: flex;
    flex-wrap: wrap;
  }

  #window-about .actions .xp-button {
    min-height: 38px;
    font-size: 13px;
  }
}

.image-viewer-window {
  width: min(860px, calc(100vw - 80px));
  height: min(620px, calc(100vh - 70px));
  min-height: 420px;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-bottom: 1px solid #c7c3b2;
  background: #f7f4e9;
  position: relative;
  z-index: 12;
}

.viewer-toolbar .xp-button,
.viewer-download {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 28px;
  color: #172033;
  text-decoration: none;
}

.image-viewer-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  height: calc(100% - 77px);
  min-height: 0;
  padding: 10px;
  background: #fff;
}

.viewer-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #a8b8d8;
  background:
    linear-gradient(45deg, #e8edf7 25%, transparent 25%),
    linear-gradient(-45deg, #e8edf7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8edf7 75%),
    linear-gradient(-45deg, transparent 75%, #e8edf7 75%);
  background-color: #fff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.viewer-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  transform-origin: center;
  transition: transform .16s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer-info-panel {
  display: none;
  min-width: 0;
  overflow: auto;
  padding: 10px;
  border-radius: 4px;
  background: linear-gradient(#dce8ff, #f4f7ff);
}

.image-viewer-body.info-visible {
  grid-template-columns: minmax(0, 1fr) 230px;
}

.image-viewer-body.info-visible .viewer-info-panel {
  display: block;
}

.viewer-info-panel h2 {
  margin: 0 0 9px;
  color: #1642a3;
  font-size: 13px;
}

.viewer-info-panel dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.viewer-info-panel dl div {
  display: grid;
  gap: 2px;
}

.viewer-info-panel dt {
  color: #52607a;
  font-size: 12px;
}

.viewer-info-panel dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .image-viewer-window.window {
    background: #050505;
  }

  .image-viewer-window .titlebar {
    background: linear-gradient(180deg, #202020, #050505);
    text-shadow: none;
  }

  .image-viewer-window .viewer-toolbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483001;
    justify-content: flex-start;
    gap: 4px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid rgba(255, 255, 255, .16);
    border-bottom: 0;
    background: rgba(8, 12, 20, .92);
  }

  .image-viewer-window .viewer-toolbar .xp-button,
  .image-viewer-window .viewer-download {
    flex: 0 0 auto;
    min-width: 42px;
    min-height: 40px;
    padding: 4px 8px;
    color: #fff;
    border-color: rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .12);
    box-shadow: none;
    font-size: 12px;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .image-viewer-window .image-viewer-body {
    display: block;
    height: calc(100% - 48px);
    padding: 0;
    background: #050505;
  }

  .image-viewer-window .viewer-stage {
    height: calc(100% - 58px - env(safe-area-inset-bottom));
    border: 0;
    background: #050505;
    pointer-events: auto;
  }

  .image-viewer-window .viewer-stage img {
    max-width: 96%;
    max-height: 96%;
  }

  .image-viewer-window .viewer-info-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 6;
    display: none;
    max-height: min(52dvh, 360px);
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 8px;
    background: rgba(240, 246, 255, .96);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .4);
  }

  .image-viewer-window .viewer-info-panel.open {
    display: block;
  }

  .photo-details {
    display: none;
  }

  .window.photo-window .photo-browser {
    height: calc(100% - 48px);
  }

  .photo-card {
    touch-action: manipulation;
  }
}

@media (max-width: 720px) {
  .icons {
    width: auto;
    gap: 12px;
  }

  .desktop-icon {
    width: 86px;
  }
}

/* ===== 音乐播放器 ===== */

.music-window {
  width: min(680px, calc(100vw - 28px));
}

.music-player-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
  min-height: 360px;
  padding: 10px;
  background: #fff;
}

.window.music-window .music-player-body {
  height: calc(100% - 58px);
  min-height: 0;
  overflow: hidden;
}

.window.music-window .music-sidebar,
.window.music-window .music-main {
  min-height: 0;
}

.window.music-window.maximized {
  width: calc(100vw - 16px);
  height: calc(100vh - 56px);
}

.music-sidebar {
  min-width: 0;
  padding: 10px;
  border-radius: 4px;
  background: linear-gradient(#dce8ff, #f4f7ff);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.music-sidebar h2 {
  margin: 0 0 4px;
  color: #1642a3;
  font-size: 13px;
}

.music-playlist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.music-track-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: left;
  overflow: hidden;
}

.music-track-item:hover,
.music-track-item.active {
  border-color: #6a9ee8;
  background: #dbeafe;
}

.music-track-item span:last-of-type {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-note-icon {
  flex: 0 0 auto;
  font-size: 13px;
}

.music-url-bar {
  display: flex;
  gap: 4px;
}

.music-url-bar input {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 2px 6px;
  border: 1px solid #8d8d8d;
  border-radius: 3px;
  font-size: 11px;
  user-select: text;
}

.music-url-bar .xp-button {
  flex: 0 0 auto;
  min-width: 30px;
  padding: 2px 6px;
}

.music-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px 16px;
  border: 1px solid #c7d7f2;
  border-radius: 4px;
  background: linear-gradient(#f8faff, #eef3ff);
}

.music-now-playing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.music-cover {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 2px solid #b8c8e0;
  border-radius: 8px;
  background: linear-gradient(135deg, #e8edf7, #fff);
  font-size: 42px;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, .12);
}

.music-track-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 100%;
}

.music-track-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-progress-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  font-size: 11px;
  color: #52607a;
  font-variant-numeric: tabular-nums;
}

.music-progress-bar input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 6px;
  accent-color: #245edb;
  cursor: pointer;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.music-controls .xp-button {
  min-width: 36px;
  min-height: 34px;
  font-size: 16px;
  padding: 2px 8px;
}

.music-play-btn {
  min-width: 42px !important;
  font-size: 18px !important;
}

.music-volume-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 240px;
  font-size: 14px;
}

.music-volume-bar input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 5px;
  accent-color: #245edb;
  cursor: pointer;
}

@media (max-width: 720px) {
  .music-window {
    width: calc(100vw - 16px);
  }

  .music-player-body {
    grid-template-columns: 1fr;
    grid-template-rows: 3fr 2fr;
    height: calc(100% - 48px);
    min-height: 0;
    overflow: hidden;
  }

  .music-sidebar {
    min-height: 0;
    overflow-y: auto;
  }

  .music-main {
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    gap: 10px;
  }

  .music-cover {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  .music-progress-bar {
    max-width: 100%;
  }

  .music-volume-bar {
    max-width: 100%;
  }

  .music-track-item,
  .music-controls .xp-button,
  .music-url-bar .xp-button {
    touch-action: manipulation;
  }
}

/* ===== 浮动音乐播放器 ===== */
.floating-player {
  position: absolute;
  right: 10px;
  bottom: 50px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(58, 130, 238, .88), rgba(24, 82, 184, .92));
  box-shadow: 2px 4px 14px rgba(0, 18, 56, .40), inset 0 1px 0 rgba(255, 255, 255, .28);
  color: #fff;
  font-family: Tahoma, "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
  cursor: default;
  touch-action: none;
  transition: opacity .18s ease;
}

.floating-player.hidden {
  display: none;
}

.fp-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fp-icon-img {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, .35));
  transition: filter .3s ease;
}

.fp-icon-img.playing {
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, .35)) brightness(1.3) saturate(1.4);
}

.fp-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, .35);
  font-size: 13px;
}

.fp-mid {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fp-seek {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  outline: none;
}

.fp-seek::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

.fp-time {
  flex: 0 0 auto;
  font-size: 10px;
  min-width: 30px;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, .35);
}

.fp-bot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.fp-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(0, 0, 0, .12));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22);
  font-size: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.fp-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, .30), rgba(0, 0, 0, .08));
}

.fp-btn:active {
  background: linear-gradient(180deg, rgba(0, 0, 0, .10), rgba(255, 255, 255, .10));
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .28);
}

.fp-play-btn {
  width: 34px;
  height: 34px;
  font-size: 16px;
}

.fp-vol-label {
  flex: 0 0 auto;
  font-size: 12px;
  margin-left: 4px;
}

.fp-vol {
  flex: 1;
  min-width: 40px;
  max-width: 80px;
  height: 4px;
  accent-color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  outline: none;
}

.fp-vol::-webkit-slider-thumb {
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

.fp-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 120, 100, .65), rgba(200, 48, 8, .75));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.fp-close:hover {
  background: linear-gradient(180deg, rgba(255, 150, 130, .75), rgba(220, 58, 18, .85));
}

@media (max-width: 720px) {
  .floating-player {
    right: 4px;
    bottom: 46px;
    width: min(260px, calc(100vw - 16px));
    gap: 4px;
    padding: 6px 8px;
  }
}/* ===== 启动动画遮罩 ===== */
.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  justify-content: center;
  align-items: center;
  background: #000;
}

.boot-overlay.active {
  display: flex;
}

.boot-content {
  text-align: center;
  color: #fff;
}

.boot-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 26px;
  object-fit: contain;
  animation: boot-pulse 1.2s ease-in-out infinite;
}

@keyframes boot-pulse {
  0%, 100% { transform: scale(1); opacity: .8; }
  50% { transform: scale(1.08); opacity: 1; }
}

.boot-text {
  margin-bottom: 20px;
  font-size: 15px;
  letter-spacing: 1px;
}

.boot-bar {
  width: 280px;
  max-width: 70vw;
  height: 6px;
  margin: 0 auto;
  border-radius: 3px;
  background: rgba(255, 255, 255, .2);
  overflow: hidden;
}

.boot-bar-fill {
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #3ba1ff, #7ec8ff);
  transition: width .08s linear;
}

/* ===== Windows 7 Frutiger Aero 主题 ===== */
[data-theme="win7"] .desktop {
  background:
    linear-gradient(rgba(255, 255, 255, .06), rgba(255, 255, 255, .06)),
    url("icon/win7/windows7wallpaper.jpg") center / cover no-repeat !important;
}

[data-theme="win7"] .desktop::before {
  display: none;
}

[data-theme="win7"] .desktop.has-wallpaper {
  background:
    linear-gradient(rgba(255, 255, 255, .06), rgba(255, 255, 255, .06)),
    var(--desktop-wallpaper) center / cover no-repeat !important;
}

[data-theme="win7"] .theme-switch-icon {
  border-color: rgba(255, 255, 255, .65) !important;
  background: rgba(80, 160, 240, .22) !important;
}

[data-theme="win7"] .theme-switch-icon:hover {
  background: rgba(80, 160, 240, .38) !important;
}

/* Win7 窗口 Aero Glass */
[data-theme="win7"] .window {
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px 8px 6px 6px;
  background: rgba(220, 230, 245, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0, 20, 60, .32), inset 0 0 0 1px rgba(255, 255, 255, .25);
}

[data-theme="win7"] .titlebar {
  height: 32px;
  padding: 4px 8px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(210,228,248,.72) 40%, rgba(180,210,240,.82));
  color: #1a3350;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
}

[data-theme="win7"] .titlebar strong {
  font-weight: 600;
}

[data-theme="win7"] .window-controls button {
  width: 28px;
  height: 22px;
  border: 1px solid rgba(120, 160, 200, .35);
  border-radius: 4px;
  color: #3a5570;
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(210,225,245,.65));
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

[data-theme="win7"] .window-controls button:hover {
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(220,235,250,.78));
}

[data-theme="win7"] .window-controls button[data-close] {
  background: linear-gradient(180deg, rgba(255,180,170,.7), rgba(220,100,70,.65));
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,.2);
}

[data-theme="win7"] .window-controls button[data-close]:hover {
  background: linear-gradient(180deg, rgba(255,140,120,.8), rgba(210,70,40,.75));
}

[data-theme="win7"] .window-body {
  background: rgba(245, 248, 252, .65);
}

[data-theme="win7"] .menu-row,
[data-theme="win7"] .browser-toolbar {
  background: rgba(235, 242, 250, .65);
  border-bottom-color: rgba(180, 200, 225, .5);
}

/* Win7 任务栏 */
[data-theme="win7"] .taskbar {
  height: 42px;
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(210,225,245,.52));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 -1px 8px rgba(0,0,0,.1);
}

[data-theme="win7"] .start-button {
  height: 42px;
  min-width: 50px;
  padding: 0 12px;
  border-radius: 0 10px 10px 0;
  color: #fff;
  background: linear-gradient(180deg, rgba(80,180,255,.85), rgba(30,100,200,.88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 2px 0 8px rgba(0,0,0,.15);
  font-size: 13px;
  font-weight: 600;
  font-style: normal;
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}

[data-theme="win7"] .start-button:hover {
  background: linear-gradient(180deg, rgba(100,200,255,.9), rgba(40,120,220,.92));
}

[data-theme="win7"] .tray {
  background: rgba(200, 220, 240, .4);
  border-left: 1px solid rgba(255, 255, 255, .35);
}

[data-theme="win7"] .task-buttons button {
  background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(200,220,240,.5));
  color: #1a3350;
  border-color: rgba(160, 190, 215, .5);
  text-shadow: none;
}

[data-theme="win7"] .task-buttons button.active {
  background: linear-gradient(180deg, rgba(255,255,255,.65), rgba(210,230,248,.6));
  box-shadow: inset 0 1px 4px rgba(0,0,0,.12);
}

/* Win7 开始菜单 */
[data-theme="win7"] .start-menu {
  background: rgba(225, 238, 250, .78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(255,255,255,.4);
  box-shadow: 0 10px 40px rgba(0,18,50,.35);
}

[data-theme="win7"] .start-menu header {
  background: rgba(210, 228, 248, .65);
}

[data-theme="win7"] .start-menu footer {
  background: rgba(200, 220, 240, .55);
}

/* Win7 浮动播放器 */
[data-theme="win7"] .floating-player {
  background: linear-gradient(180deg, rgba(70, 150, 220, .78), rgba(30, 90, 170, .82));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
}

/* Win7 响应式 */
@media (max-width: 720px) {
  [data-theme="win7"] .taskbar {
    height: 46px;
  }
  [data-theme="win7"] .start-button {
    height: 46px;
  }
}

@media (max-width: 500px) {
  .icons {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    width: auto;
  }
}
/* Desktop icon layout override v24: fill top-to-bottom first, then start a new column. */
.icons {
  display: grid !important;
  grid-auto-flow: column !important;
  grid-template-columns: none !important;
  grid-template-rows: repeat(auto-fill, 92px) !important;
  grid-auto-columns: 92px !important;
  align-content: start !important;
  justify-content: start !important;
  gap: 14px 12px !important;
  width: max-content !important;
  max-width: none !important;
  height: calc(100vh - 58px) !important;
  overflow: visible !important;
}

.desktop-icon {
  width: 86px !important;
  min-height: 82px !important;
}

@media (max-width: 720px) {
  .desktop {
    overflow: hidden !important;
  }

  .icons {
    grid-auto-flow: column !important;
    grid-template-columns: none !important;
    grid-template-rows: repeat(auto-fill, 108px) !important;
    grid-auto-columns: 96px !important;
    gap: 12px 10px !important;
    width: max-content !important;
    max-width: none !important;
    height: calc(100dvh - 72px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    overflow: visible !important;
  }

  .desktop-icon {
    width: 90px !important;
    min-height: 98px !important;
  }
}
/* ClippyJS desktop assistant */
.assistant-window {
  width: min(460px, calc(100vw - 28px));
}

.assistant-body {
  display: grid;
  gap: 12px;
  min-height: 210px;
  background: #fff;
}

.assistant-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.assistant-panel select {
  min-height: 28px;
  border: 1px solid #7f9db9;
  background: #fff;
  font: inherit;
}

.assistant-panel input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #245edb;
  cursor: pointer;
}

.assistant-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.assistant-actions .xp-button,
.assistant-panel .xp-button {
  min-height: 32px;
}

.clippy,
[class*="clippy"],
[id*="clippy"] {
  z-index: 2147482500 !important;
}

@media (max-width: 720px) {
  .assistant-window {
    width: calc(100vw - 18px) !important;
  }

  .assistant-panel {
    grid-template-columns: 1fr;
  }

  .assistant-panel select,
  .assistant-panel .xp-button {
    min-height: 44px;
    font-size: 16px;
    touch-action: manipulation;
  }

  .assistant-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .assistant-actions .xp-button {
    min-height: 46px;
    font-size: 15px;
    touch-action: manipulation;
  }

  .chat-api-key {
    grid-template-columns: 1fr auto;
  }

  .chat-api-key input,
  .chat-input-row input {
    height: 42px;
    font-size: 16px;
    touch-action: manipulation;
  }

  .chat-input-row .xp-button {
    min-height: 42px;
    min-width: 54px;
    touch-action: manipulation;
  }
}

/* ===== Chat UI ===== */
.assistant-chat {
  display: grid;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #c7d7f2;
}

.chat-api-key {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.chat-api-key input {
  height: 28px;
  padding: 2px 6px;
  border: 1px solid #8d8d8d;
  background: #fff;
  font: inherit;
  font-size: 12px;
  user-select: text;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.chat-input-row input {
  height: 30px;
  padding: 2px 8px;
  border: 1px solid #8d8d8d;
  background: #fff;
  font: inherit;
  user-select: text;
}

/* ===== 关机遮罩 ===== */
.shutdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: none;
  visibility: hidden;
  opacity: 0;
  justify-content: center;
  align-items: center;
  background: #000;
  cursor: pointer;
  transition: opacity .3s;
}

.shutdown-overlay.active {
  display: flex;
  visibility: visible;
  opacity: 1;
}

.shutdown-content {
  text-align: center;
  color: #aaa;
}

.shutdown-text {
  font-size: 18px;
  margin-bottom: 14px;
  animation: shutdown-blink .9s ease-in-out infinite;
}

.shutdown-hint {
  font-size: 12px;
  color: #555;
}

@keyframes shutdown-blink {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

/* ===== 系统属性 ===== */
.sysinfo-body {
  display: grid;
  gap: 10px;
  min-height: 280px;
  background: #fff;
}

.sysinfo-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid #8d8d8d;
}

.sysinfo-tab {
  padding: 4px 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  cursor: pointer;
}

.sysinfo-tab.active {
  border-color: #8d8d8d;
  background: #fff;
  position: relative;
  bottom: -1px;
}

.sysinfo-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  padding: 10px;
}

.sysinfo-logo {
  display: grid;
  place-items: center;
  width: 120px;
  height: 100px;
  border: 1px solid #ccc;
  background: linear-gradient(180deg, #1a3d82, #2e6fd6 30%, #3366cc 50%, #2948a3);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  text-shadow: 1px 1px 1px #001c4e;
}

.sysinfo-text {
  font-size: 12px;
  line-height: 1.6;
}

.sysinfo-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 12px;
}

.sysinfo-dl dt {
  color: #52607a;
  text-align: right;
}

.sysinfo-dl dd {
  margin: 0;
}

/* ===== 访客留言板 ===== */
.guestbook-body {
  display: grid;
  gap: 12px;
  min-height: 260px;
  background: #fff;
}

.guestbook-form {
  display: grid;
  gap: 6px;
}

.guestbook-form input,
.guestbook-form textarea {
  padding: 4px 8px;
  border: 1px solid #8d8d8d;
  background: #fff;
  font: inherit;
  user-select: text;
  resize: vertical;
}

@media (max-width: 720px) {
  .guestbook-form input {
    height: 44px;
    font-size: 16px;
    touch-action: manipulation;
  }
  .guestbook-form textarea {
    font-size: 16px;
    touch-action: manipulation;
  }
}

.guestbook-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.gb-msg {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 4px;
  background: linear-gradient(#eef3ff, #fff);
  border: 1px solid #dbe4f8;
}

.gb-msg .gb-name {
  font-weight: 700;
  color: #245edb;
  font-size: 11px;
}

.gb-msg .gb-text {
  line-height: 1.45;
}

.gb-msg .gb-time {
  color: #9aa5b8;
  font-size: 10px;
}

/* ===== 便签 ===== */
.note-window {
  position: absolute !important;
  z-index: 5;
  width: 210px;
  min-height: 180px;
  border: 1px solid #c9a84c;
  box-shadow: 3px 4px 10px rgba(0,0,0,.25);
}

.note-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding: 2px 6px;
  background: linear-gradient(180deg, #ffe48c, #f0c950);
  cursor: move;
  touch-action: none;
  font-size: 11px;
  color: #6b4f10;
}

.note-close {
  width: 20px;
  height: 18px;
  padding: 0;
  border: 1px solid #c9a84c;
  border-radius: 2px;
  background: linear-gradient(#fff3c8, #f0d060);
  color: #6b4f10;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.note-body {
  min-height: 150px;
  padding: 8px;
  background: linear-gradient(#fff8d6, #fff3b0);
  color: #3a3000;
  font-family: "Comic Sans MS", "KaiTi", cursive;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: break-word;
  user-select: text;
  outline: none;
}

.note-body:empty::before {
  content: "双击编辑...";
  color: #b8a060;
}

@media (max-width: 720px) {
  .note-window {
    width: 180px;
    min-height: 150px;
    z-index: 100;
  }
}

/* ===== 三维弹球 ===== */
.game-window {
  width: min(680px, calc(100vw - 40px));
  height: min(520px, calc(100vh - 120px));
}

.game-body {
  padding: 0 !important;
  background: #000 !important;
  height: calc(100% - 31px);
  min-height: 0;
  overflow: hidden;
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ===== 弹球触控按钮(仅移动端/平板) ===== */
.pinball-touch-controls {
  display: none;
}

@media (max-width: 1024px) {
  .game-body {
    display: flex;
    flex-direction: column;
  }

  .game-body .game-iframe {
    flex: 1;
    min-height: 0;
  }

  .pinball-touch-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 5px 4px;
    background: rgba(0,0,0,.85);
    flex: 0 0 auto;
    z-index: 10;
    flex-wrap: wrap;
  }

  .pinball-btn {
    flex: 1;
    min-width: 48px;
    min-height: 40px;
    padding: 5px 3px;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 5px;
    background: rgba(255,255,255,.1);
    color: #fff;
    font-size: 11px;
    font-family: Tahoma, sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }

  .pinball-btn:active {
    background: rgba(255,255,255,.3);
  }
}

/* ===== 网址导航 ===== */
.nav-header {
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #c7d7f2;
}

.nav-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #1642a3;
}

.nav-header p {
  margin: 0;
  color: #5f6b80;
  font-size: 12px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.nav-section {
  padding: 8px;
  border-radius: 4px;
  background: linear-gradient(#eef3ff, #fff);
  border: 1px solid #dce4f8;
}

.nav-section h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #1642a3;
}

.nav-section a {
  display: block;
  padding: 3px 4px;
  color: #2155bb;
  text-decoration: none;
  font-size: 12px;
  border-radius: 2px;
}

.nav-section a:hover {
  background: #dbeafe;
  color: #0a3d99;
}

@media (max-width: 720px) {
  .nav-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
