/* ============ 基础重置 ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --statusbar-h: 32px;
  --dock-h: 64px;
  --bg-0: #0b0e14;
  --bg-1: #0f1219;
  --bg-2: #141a23;
  --bg-3: #1a212c;
  --bg-4: #232b38;
  --border: #2d3a4b;
  --text-0: #e2e8f0;
  --text-1: #cbd5e0;
  --text-2: #8899b0;
  --text-3: #6b7d99;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #68d391;
  --warning: #fbbf24;
  --danger: #fc8181;
  --purple: #a78bfa;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 6px rgba(0,0,0,.3);
  --shadow: 0 6px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 40px -8px rgba(0,0,0,.8);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
svg { display: block; }

/* ============ 登录界面 ============ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0e14 0%, #101828 50%, #0a0e14 100%);
  transition: opacity .4s, visibility .4s;
}
.login-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(59,130,246,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(167,139,250,.12) 0%, transparent 50%);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: 380px;
  max-width: calc(100vw - 40px);
  padding: 40px 32px;
  background: rgba(20, 26, 35, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.06);
  text-align: center;
  animation: cardIn .5s ease-out;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--accent), #1e40af);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(59,130,246,.4);
}
.login-logo svg { width: 32px; height: 32px; stroke: white; }
.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 6px;
  letter-spacing: -.5px;
}
.login-subtitle { color: var(--text-3); font-size: 13px; margin-bottom: 28px; }
.login-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(11,14,20,.6);
  border-radius: 10px;
  margin-bottom: 24px;
}
.login-tab {
  flex: 1;
  padding: 9px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  border: none;
  background: transparent;
  cursor: pointer;
}
.login-tab.active { background: var(--accent); color: white; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form.hidden { display: none; }
.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(11,14,20,.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-0);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, background .2s;
}
.form-group input:focus {
  border-color: var(--accent);
  background: rgba(11,14,20,.9);
}
.btn-primary {
  padding: 12px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: background .2s;
  margin-top: 4px;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.login-error {
  color: var(--danger);
  font-size: 12px;
  min-height: 16px;
  text-align: left;
}
.login-hint {
  color: var(--text-3);
  font-size: 11px;
  margin-top: 4px;
}
.skip-btn {
  margin-top: 20px;
  color: var(--text-3);
  font-size: 12px;
  text-decoration: underline;
  transition: color .2s;
  background: none;
  border: none;
  cursor: pointer;
}
.skip-btn:hover { color: var(--text-1); }

/* ============ WebOS 主界面 ============ */
.webos {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
}

/* ============ 状态栏 ============ */
.status-bar {
  height: calc(var(--statusbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20,24,32,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 12px;
  color: var(--text-1);
  flex-shrink: 0;
  z-index: 1000;
}
.status-left, .status-right { display: flex; gap: 10px; align-items: center; }
.status-btn {
  width: 32px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background .15s;
  border: none;
  background: transparent;
  color: var(--text-1);
  cursor: pointer;
}
.status-btn:hover { background: rgba(255,255,255,.08); }
.status-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.status-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-0);
}
.status-title svg { width: 14px; height: 14px; stroke: var(--accent); stroke-width: 2; fill: none; }
.badge {
  background: rgba(45,55,72,.7);
  padding: 3px 8px;
  border-radius: 40px;
  font-size: 10px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.badge.node { background: rgba(30,58,46,.7); color: var(--success); }
.badge.node.disconnected { background: rgba(58,30,30,.7); color: var(--danger); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dot.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.status-time { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--text-0); }

/* ============ 桌面 ============ */
.desktop {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at 30% 10%, #1a2230 0%, #0f1219 70%);
  overflow: hidden;
  touch-action: none;
  min-height: 0;
}
.desktop-wallpaper {
  position: absolute;
  inset: 0;
  background: var(--wallpaper, radial-gradient(circle at 30% 10%, #1a2230 0%, #0f1219 70%));
  background-size: cover;
  background-position: center;
  transition: background .5s;
}

/* ============ 桌面图标 ============ */
.desktop-icons {
  position: absolute;
  top: 0; left: 0;
  right: 0; bottom: 0;
  padding: 20px 16px;
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  display: grid;
  grid-template-columns: repeat(auto-fill, 84px);
  grid-template-rows: repeat(auto-fill, 100px);
  grid-auto-flow: column;
  gap: 8px 4px;
  align-content: start;
  justify-content: start;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}
.desktop-icons > * {
  pointer-events: auto;
}
.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 84px;
  height: 100px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background .15s, transform .15s;
  padding: 10px 4px 6px;
  box-sizing: border-box;
}
.icon-item:active { background: rgba(255,255,255,.08); transform: scale(.94); }
.icon-item.selected { background: rgba(59,130,246,.2); }
.icon-box {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--bg-4), var(--bg-3));
  box-shadow: var(--shadow-sm), inset 0 1px 1px rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.icon-box svg { width: 24px; height: 24px; stroke: var(--accent); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-item[data-app="terminal"] .icon-box svg { stroke: var(--success); }
.icon-item[data-app="files"] .icon-box svg { stroke: var(--warning); }
.icon-item[data-app="settings"] .icon-box svg { stroke: var(--purple); }
.icon-item[data-app="editor"] .icon-box svg { stroke: #60a5fa; }
.icon-item[data-app="task-manager"] .icon-box svg { stroke: #f472b6; }
.icon-item[data-app="packages"] .icon-box svg { stroke: #34d399; }
.icon-item[data-app="calculator"] .icon-box svg { stroke: #fbbf24; }
.icon-item[data-app="notes"] .icon-box svg { stroke: #facc15; }
.icon-item[data-app="music"] .icon-box svg { stroke: #a78bfa; }
.icon-item[data-app="image-viewer"] .icon-box svg { stroke: #fb7185; }
.icon-label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  color: var(--text-1);
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

/* ============ 窗口容器 ============ */
.windows-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.window {
  position: absolute;
  background: var(--bg-3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  min-width: 260px;
  min-height: 160px;
  transition: box-shadow .2s, opacity .15s, transform .15s;
  will-change: left, top, width, height;
}
.window.active { box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent); }
.window.closing { opacity: 0; transform: scale(.95); }
.window.minimized { display: none; }
.window.maximized { border-radius: 0 !important; }
.window.resizing { transition: none !important; }

.window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px 8px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  touch-action: none;
  min-height: 42px;
  cursor: grab;
}
.window-header:active { cursor: grabbing; }
.window-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  min-width: 0;
}
.window-title svg { width: 14px; height: 14px; stroke-width: 2; flex-shrink: 0; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.window-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.window-controls { display: flex; gap: 4px; flex-shrink: 0; }
.win-ctrl {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-2);
  transition: background .15s, color .15s;
  border: none;
  cursor: pointer;
  padding: 0;
}
.win-ctrl svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.win-ctrl:hover { background: rgba(255,255,255,.1); color: white; }
.win-ctrl.close:hover { background: #e53e3e; color: white; }

.window-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text-1);
  font-size: 13px;
  background: var(--bg-3);
  position: relative;
}

.resize-handle { position: absolute; z-index: 5; }
.resize-handle.r { right: 0; top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
.resize-handle.b { bottom: 0; left: 0; right: 0; height: 6px; cursor: ns-resize; }
.resize-handle.br { right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.resize-handle.l { left: 0; top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
.resize-handle.t { top: 0; left: 0; right: 0; height: 6px; cursor: ns-resize; }

/* ============ Dock ============ */
.dock {
  height: calc(var(--dock-h) + var(--safe-bottom));
  padding: 8px 12px;
  padding-bottom: calc(8px + var(--safe-bottom));
  padding-left: calc(12px + var(--safe-left));
  padding-right: calc(12px + var(--safe-right));
  background: rgba(18,22,30,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 200;
  overflow-x: auto;
  scrollbar-width: none;
}
.dock::-webkit-scrollbar { display: none; }
.dock-item {
  width: 48px; height: 48px;
  border-radius: 13px;
  background: var(--bg-4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .18s;
  box-shadow: var(--shadow-sm), inset 0 1px 1px rgba(255,255,255,.05);
  border: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}
.dock-item svg { width: 22px; height: 22px; stroke: var(--text-2); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: stroke .18s; }
.dock-item:hover { transform: translateY(-3px); background: #2d3b4f; }
.dock-item:active { transform: scale(.92); }
.dock-item.active { background: var(--accent); border-color: #60a5fa; box-shadow: 0 4px 14px rgba(59,130,246,.5); }
.dock-item.active svg { stroke: white; }
.dock-item::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #60a5fa;
  opacity: 0;
  transition: opacity .2s;
}
.dock-item.active::after { opacity: 1; }
.dock-divider { width: 1px; height: 32px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

/* ============ 上下文菜单 ============ */
.context-menu {
  position: fixed;
  background: rgba(20,26,35,.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
  box-shadow: var(--shadow);
  min-width: 180px;
  z-index: 9999;
  animation: menuIn .12s ease-out;
}
@keyframes menuIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: none; }
}
.context-menu-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s;
  cursor: pointer;
  white-space: nowrap;
}
.context-menu-item:hover { background: rgba(59,130,246,.25); color: white; }
.context-menu-item.danger:hover { background: rgba(229,62,62,.3); }
.context-menu-item svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.context-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ============ 模态框 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  animation: fadeIn .15s;
  padding: 20px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.08);
  width: 440px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-0);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
}
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-0);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.modal-input:focus { border-color: var(--accent); }
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s;
  white-space: nowrap;
  cursor: pointer;
  border: none;
}
.btn-secondary { background: var(--bg-4); color: var(--text-1); }
.btn-secondary:hover { background: #2d3b4f; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-danger { background: #e53e3e; color: white; }
.btn-danger:hover { background: #c53030; }

/* ============ 通知 ============ */
.notification-stack {
  position: fixed;
  top: calc(var(--statusbar-h) + var(--safe-top) + 12px);
  right: calc(16px + var(--safe-right));
  z-index: 9997;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 340px;
}
.notification {
  background: rgba(20,26,35,.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: notifIn .25s ease-out;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 260px;
}
@keyframes notifIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: none; }
}
.notification.closing { animation: notifOut .25s ease-in forwards; }
@keyframes notifOut { to { opacity: 0; transform: translateX(30px); } }
.notification-icon { width: 20px; height: 20px; flex-shrink: 0; }
.notification-icon svg { width: 100%; height: 100%; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.notification-icon.info svg { stroke: var(--accent); }
.notification-icon.success svg { stroke: var(--success); }
.notification-icon.warn svg { stroke: var(--warning); }
.notification-icon.error svg { stroke: var(--danger); }
.notification-content { flex: 1; min-width: 0; }
.notification-title { font-weight: 600; font-size: 13px; color: var(--text-0); margin-bottom: 2px; }
.notification-msg { font-size: 12px; color: var(--text-2); word-break: break-word; }
.notification-close { color: var(--text-3); padding: 2px; flex-shrink: 0; cursor: pointer; border: none; background: none; }
.notification-close:hover { color: var(--text-0); }
.notification-close svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ============ 通用工具类 ============ */
.hidden { display: none !important; }
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 100px;
  color: var(--text-3);
  gap: 10px;
  font-size: 13px;
  flex-direction: column;
}
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-msg {
  color: var(--danger);
  padding: 12px;
  background: rgba(42,26,26,.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(91,59,59,.5);
  font-size: 12px;
}
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 150px;
}
.empty-state svg { width: 48px; height: 48px; stroke: var(--border); stroke-width: 1.5; fill: none; margin-bottom: 12px; }

/* ============ 终端 ============ */
.app-terminal {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px;
  background: #0a0d12;
}
.app-terminal .terminal-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-terminal .terminal {
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  background: #0a0d12;
  color: #b3e5fc;
  padding: 12px;
  border-radius: var(--radius);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 12.5px;
  line-height: 1.55;
  outline: none;
  border: 1px solid #1e2836;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  cursor: text;
  word-wrap: break-word;
}
.app-terminal .terminal::-webkit-scrollbar { width: 8px; }
.app-terminal .terminal::-webkit-scrollbar-track { background: rgba(0,0,0,.2); }
.app-terminal .terminal::-webkit-scrollbar-thumb {
  background: rgba(120,140,170,.4);
  border-radius: 4px;
}
.app-terminal .terminal::-webkit-scrollbar-thumb:hover {
  background: rgba(120,140,170,.6);
}
.app-terminal .terminal-line { white-space: pre-wrap; word-break: break-all; }
.app-terminal .prompt { color: var(--success); }
.app-terminal .cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: #b3e5fc;
  animation: blink 1s infinite;
  vertical-align: middle;
  margin-left: 2px;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ============ 文件管理器 ============ */
.app-files {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.app-files .fm-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  background: var(--bg-2);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-files .fm-toolbar::-webkit-scrollbar { display: none; }
.app-files .path-input {
  flex: 1;
  min-width: 100px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  color: var(--text-0);
  outline: none;
}
.app-files .path-input:focus { border-color: var(--accent); }
.app-files .fm-btn {
  padding: 6px 10px;
  background: var(--bg-4);
  border-radius: 7px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background .15s;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-1);
  border: none;
}
.app-files .fm-btn:hover { background: #2d3b4f; }
.app-files .fm-btn:active { transform: scale(.96); }
.app-files .fm-btn svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-files .fm-content { flex: 1; min-height: 0; overflow: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.app-files .file-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.app-files .file-item {
  padding: 9px 12px;
  background: var(--bg-4);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}
.app-files .file-item:hover { background: #2d3a4b; border-color: var(--border); }
.app-files .file-item.selected { background: rgba(59,130,246,.25); border-color: var(--accent); }
.app-files .file-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-files .file-item.dir svg { stroke: var(--warning); }
.app-files .file-item.doc svg { stroke: #60a5fa; }
.app-files .file-item.image svg { stroke: #fb7185; }
.app-files .file-item.audio svg { stroke: var(--purple); }
.app-files .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-0); }
.app-files .file-meta { color: var(--text-3); font-size: 11px; font-family: 'SF Mono', monospace; flex-shrink: 0; }

/* ============ 编辑器 ============ */
.app-editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.app-editor .editor-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  align-items: center;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-editor .editor-toolbar::-webkit-scrollbar { display: none; }
.app-editor .editor-path {
  flex: 1;
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-editor .editor-area {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.app-editor .line-numbers {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 44px;
  padding: 12px 8px;
  background: var(--bg-1);
  color: var(--text-3);
  font-family: 'SF Mono', monospace;
  font-size: 12.5px;
  line-height: 1.55;
  text-align: right;
  overflow: hidden;
  border-right: 1px solid var(--border);
  user-select: none;
}
.app-editor .editor-textarea {
  position: absolute;
  top: 0; left: 44px; right: 0; bottom: 0;
  padding: 12px 16px;
  background: var(--bg-1);
  color: var(--text-0);
  border: none;
  outline: none;
  font-family: 'SF Mono', 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12.5px;
  line-height: 1.55;
  resize: none;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}
.app-editor .editor-status {
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
  font-family: 'SF Mono', monospace;
}

/* ============ 任务管理器 ============ */
.app-tm {
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.app-tm .tm-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; flex-shrink: 0; }
@media (min-width: 500px) { .app-tm .tm-stats { grid-template-columns: repeat(4, 1fr); } }
.app-tm .tm-stat {
  background: var(--bg-4);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.app-tm .tm-stat-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.app-tm .tm-stat-value { font-size: 18px; font-weight: 700; color: var(--text-0); font-family: 'SF Mono', monospace; }
.app-tm .tm-chart {
  background: var(--bg-4);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.app-tm .tm-chart-title { font-size: 11px; color: var(--text-2); margin-bottom: 8px; display: flex; justify-content: space-between; }
.app-tm canvas { width: 100%; height: 90px; display: block; }
.app-tm .tm-process-list { background: var(--bg-4); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; flex-shrink: 0; }
.app-tm .tm-proc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.app-tm .tm-proc-table th {
  text-align: left;
  padding: 10px 8px;
  color: var(--text-3);
  font-weight: 500;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky; top: 0;
}
.app-tm .tm-proc-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(45,58,75,.4);
  font-family: 'SF Mono', monospace;
  font-size: 11.5px;
  color: var(--text-1);
}
.app-tm .tm-proc-table tr:hover td { background: rgba(59,130,246,.08); }
.app-tm .tm-proc-table td.name { font-family: inherit; color: var(--text-0); }
.app-tm .tm-proc-table td.pid { color: var(--text-3); }
.app-tm .tm-proc-table td.cpu { color: var(--success); }
.app-tm .kill-btn {
  padding: 3px 9px;
  background: rgba(229,62,62,.2);
  color: var(--danger);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  transition: background .15s;
  cursor: pointer;
  border: none;
}
.app-tm .kill-btn:hover { background: rgba(229,62,62,.4); }

/* ============ 设置 ============ */
.app-settings {
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.app-settings .setting-section {
  background: var(--bg-4);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.app-settings .section-title {
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-settings .section-title svg { width: 15px; height: 15px; stroke: var(--accent); stroke-width: 2; fill: none; }
.app-settings .info-grid { display: grid; grid-template-columns: 1fr; gap: 6px; font-size: 12px; }
@media (min-width: 400px) { .app-settings .info-grid { grid-template-columns: 1fr 1fr; } }
.app-settings .info-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  gap: 8px;
}
.app-settings .info-row:last-child { border-bottom: none; }
.app-settings .info-label { color: var(--text-2); flex-shrink: 0; }
.app-settings .info-value {
  color: var(--success);
  font-family: 'SF Mono', monospace;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.app-settings .wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
.app-settings .wallpaper-item {
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s, transform .15s;
  background-size: cover;
  background-position: center;
}
.app-settings .wallpaper-item:hover { transform: scale(1.03); }
.app-settings .wallpaper-item.active { border-color: var(--accent); }

/* ============ 包管理器 ============ */
.app-packages {
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.app-packages .pkg-toolbar { display: flex; gap: 6px; flex-shrink: 0; }
.app-packages .pkg-search {
  flex: 1;
  padding: 9px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  color: var(--text-0);
  font-size: 13px;
}
.app-packages .pkg-search:focus { border-color: var(--accent); }
.app-packages .pkg-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-1);
  padding: 4px;
  border-radius: 8px;
  flex-shrink: 0;
}
.app-packages .pkg-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-2);
  transition: background .15s;
  cursor: pointer;
  border: none;
  background: transparent;
  flex: 1;
}
.app-packages .pkg-tab.active { background: var(--bg-4); color: var(--text-0); }
.app-packages .pkg-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.app-packages .pkg-item {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
.app-packages .pkg-info { flex: 1; min-width: 0; }
.app-packages .pkg-name { font-weight: 600; color: var(--text-0); font-size: 13px; font-family: 'SF Mono', monospace; }
.app-packages .pkg-version { color: var(--text-3); font-size: 11px; margin-left: 6px; }
.app-packages .pkg-desc { color: var(--text-2); font-size: 11px; margin-top: 3px; }
.app-packages .pkg-action {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  transition: background .15s;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  color: white;
}
.app-packages .pkg-action.install { background: var(--accent); }
.app-packages .pkg-action.install:hover { background: var(--accent-hover); }
.app-packages .pkg-action.uninstall { background: rgba(229,62,62,.2); color: var(--danger); }
.app-packages .pkg-action.uninstall:hover { background: rgba(229,62,62,.35); }
.app-packages .pkg-action:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 计算器 ============ */
.app-calc {
  flex: 1;
  min-height: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.app-calc .calc-display {
  background: var(--bg-1);
  padding: 16px;
  border-radius: var(--radius);
  text-align: right;
  font-family: 'SF Mono', monospace;
  border: 1px solid var(--border);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.app-calc .calc-history { font-size: 12px; color: var(--text-3); min-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-calc .calc-result { font-size: 28px; font-weight: 600; color: var(--text-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-calc .calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex: 1;
  min-height: 0;
}
.app-calc .calc-btn {
  background: var(--bg-4);
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-0);
  transition: background .12s, transform .1s;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'SF Mono', monospace;
  cursor: pointer;
  border: none;
}
.app-calc .calc-btn:hover { background: #2d3b4f; }
.app-calc .calc-btn:active { transform: scale(.96); }
.app-calc .calc-btn.op { background: rgba(59,130,246,.2); color: #93c5fd; }
.app-calc .calc-btn.op:hover { background: rgba(59,130,246,.35); }
.app-calc .calc-btn.eq { background: var(--accent); color: white; }
.app-calc .calc-btn.eq:hover { background: var(--accent-hover); }
.app-calc .calc-btn.clear { background: rgba(229,62,62,.2); color: var(--danger); }
.app-calc .calc-btn.clear:hover { background: rgba(229,62,62,.35); }

/* ============ 便签 ============ */
.app-notes {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
}
.app-notes .notes-sidebar {
  width: 200px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.app-notes .notes-header {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.app-notes .notes-new {
  flex: 1;
  padding: 7px;
  background: var(--accent);
  color: white;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  transition: background .15s;
  border: none;
  cursor: pointer;
}
.app-notes .notes-new:hover { background: var(--accent-hover); }
.app-notes .notes-list { flex: 1; min-height: 0; overflow: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.app-notes .note-item {
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  margin-bottom: 3px;
  transition: background .15s;
  overflow: hidden;
}
.app-notes .note-item:hover { background: rgba(59,130,246,.15); }
.app-notes .note-item.active { background: rgba(59,130,246,.3); }
.app-notes .note-title { font-size: 12px; font-weight: 500; color: var(--text-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-notes .note-time { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.app-notes .notes-editor { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-notes .notes-title {
  padding: 12px;
  background: var(--bg-2);
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  color: var(--text-0);
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.app-notes .notes-textarea {
  flex: 1;
  min-height: 0;
  padding: 14px;
  background: var(--bg-1);
  color: var(--text-1);
  border: none;
  outline: none;
  resize: none;
  font-family: -apple-system, 'PingFang SC', sans-serif;
  font-size: 13.5px;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}
.app-notes .notes-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
}
.app-notes .notes-empty svg { width: 48px; height: 48px; stroke: var(--border); stroke-width: 1.5; fill: none; }

/* ============ 音乐播放器 ============ */
.app-music {
  flex: 1;
  min-height: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.app-music .music-now {
  background: linear-gradient(135deg, rgba(167,139,250,.2), rgba(59,130,246,.2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
}
.app-music .music-art {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--purple), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.app-music .music-art svg { width: 36px; height: 36px; stroke: white; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-music .music-art.playing { animation: musicPulse 2s ease-in-out infinite; }
@keyframes musicPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.app-music .music-info { flex: 1; min-width: 0; }
.app-music .music-title { font-size: 16px; font-weight: 600; color: var(--text-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-music .music-artist { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.app-music .music-controls { display: flex; gap: 12px; align-items: center; justify-content: center; flex-shrink: 0; }
.app-music .music-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg-4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  border: none;
  cursor: pointer;
}
.app-music .music-btn:hover { background: #2d3b4f; }
.app-music .music-btn:active { transform: scale(.94); }
.app-music .music-btn svg { width: 20px; height: 20px; stroke: var(--text-0); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-music .music-btn.play { width: 60px; height: 60px; background: var(--accent); }
.app-music .music-btn.play:hover { background: var(--accent-hover); }
.app-music .music-btn.play svg { stroke: white; width: 24px; height: 24px; }
.app-music .music-progress { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-3); font-family: 'SF Mono', monospace; flex-shrink: 0; }
.app-music .music-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-1);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.app-music .music-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .1s linear; }
.app-music .music-volume { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-music .music-volume svg { width: 16px; height: 16px; stroke: var(--text-2); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-music .music-volume input[type="range"] { flex: 1; accent-color: var(--accent); }

/* ============ 图片查看器 ============ */
.app-image-viewer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.app-image-viewer .iv-toolbar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-image-viewer .iv-toolbar::-webkit-scrollbar { display: none; }
.app-image-viewer .iv-info { flex: 1; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'SF Mono', monospace; min-width: 0; }
.app-image-viewer .iv-btn {
  padding: 6px 10px;
  background: var(--bg-4);
  border-radius: 7px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-1);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.app-image-viewer .iv-btn:hover { background: #2d3b4f; }
.app-image-viewer .iv-btn svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-image-viewer .iv-canvas {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #050810;
  background-image:
    linear-gradient(45deg, #0a0e14 25%, transparent 25%),
    linear-gradient(-45deg, #0a0e14 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0a0e14 75%),
    linear-gradient(-45deg, transparent 75%, #0a0e14 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  -webkit-overflow-scrolling: touch;
}
.app-image-viewer .iv-img { max-width: 100%; max-height: 100%; transition: transform .15s; transform-origin: center; }

/* ============ 移动端适配 ============ */
@media (max-width: 640px) {
  .window { width: 100% !important; height: 100% !important; left: 0 !important; top: 0 !important; border-radius: 0 !important; }
  .window.maximized { border-radius: 0 !important; }
  .resize-handle { display: none; }
  .desktop-icons {
    grid-template-columns: repeat(auto-fill, 76px);
    grid-template-rows: repeat(auto-fill, 92px);
    padding: 16px 12px;
    gap: 6px 2px;
  }
  .icon-item {
    width: 76px;
    height: 92px;
    padding: 8px 2px 4px;
  }
  .icon-box { width: 48px; height: 48px; }
  .icon-box svg { width: 24px; height: 24px; }
  .icon-label { font-size: 11px; }
  .dock-item { width: 44px; height: 44px; }
  .dock-item svg { width: 20px; height: 20px; }
  .app-notes .notes-sidebar { width: 160px; }
  .window-header { padding: 8px 10px; min-height: 40px; }
}
@media (max-width: 400px) {
  .desktop-icons { grid-template-columns: repeat(auto-fill, 68px); grid-template-rows: repeat(auto-fill, 86px); }
  .icon-item { width: 68px; height: 86px; }
  .icon-box { width: 42px; height: 42px; }
  .icon-box svg { width: 22px; height: 22px; }
  .app-notes .notes-sidebar { width: 120px; }
  .app-music .music-art { width: 60px; height: 60px; }
  .app-music .music-art svg { width: 28px; height: 28px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --statusbar-h: 26px; --dock-h: 52px; }
  .desktop-icons { grid-template-columns: repeat(auto-fill, 68px); grid-template-rows: repeat(auto-fill, 76px); padding: 12px; }
  .icon-item { width: 68px; height: 76px; padding: 6px 2px 4px; }
  .icon-box { width: 38px; height: 38px; }
  .icon-box svg { width: 18px; height: 18px; }
  .icon-label { font-size: 10px; }
  .dock-item { width: 40px; height: 40px; }
  .dock-item svg { width: 18px; height: 18px; }
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3f4f66; }

/* ============ 设置应用（增强版） ============ */
.app-settings {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  padding: 0 !important;
}

.settings-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.settings-sidebar {
  width: 180px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 2px;
  flex-shrink: 0;
  overflow-y: auto;
}

.settings-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  transition: background .15s, color .15s;
  user-select: none;
  white-space: nowrap;
}
.settings-nav:hover { background: rgba(255,255,255,.05); color: var(--text-0); }
.settings-nav.active {
  background: rgba(59,130,246,.2);
  color: var(--text-0);
}
.settings-nav.active svg { stroke: var(--accent); }
.settings-nav svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 4px;
  padding: 0 4px;
}

/* 壁纸 */
.wallpaper-item {
  position: relative;
  overflow: hidden;
}
.wallpaper-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  font-size: 10px;
  color: white;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}

/* 主题 */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.theme-item {
  cursor: pointer;
  border-radius: var(--radius);
  border: 2px solid transparent;
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.theme-item:hover { transform: scale(1.03); }
.theme-item.active { border-color: var(--accent); }
.theme-preview {
  aspect-ratio: 16/10;
  width: 100%;
  border: 1px solid var(--border);
}
.theme-name {
  padding: 6px;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg-1);
}

/* 开关 */
.setting-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  gap: 12px;
}
.setting-option:last-child { border-bottom: none; }
.option-title {
  font-size: 13px;
  color: var(--text-0);
  margin-bottom: 2px;
}
.option-desc {
  font-size: 11px;
  color: var(--text-3);
}
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: .3s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: var(--text-3);
  border-radius: 50%;
  transition: .3s;
}
.switch input:checked + .slider {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + .slider::before {
  transform: translateX(18px);
  background: white;
}

/* 网络接口 */
.iface-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.iface-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg-1);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.iface-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(59,130,246,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.iface-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
}
.iface-info { flex: 1; min-width: 0; }
.iface-name {
  font-size: 13px;
  color: var(--text-0);
  font-weight: 600;
}
.iface-addr {
  font-size: 12px;
  color: var(--success);
  font-family: 'SF Mono', monospace;
  margin-top: 2px;
}
.iface-mac {
  font-size: 11px;
  color: var(--text-3);
  font-family: 'SF Mono', monospace;
  margin-top: 2px;
}

/* 账户卡片 */
.account-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
}
.account-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #1e40af);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
}
.account-info { flex: 1; min-width: 0; }
.account-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-0);
}
.account-username {
  font-size: 12px;
  color: var(--text-3);
  font-family: 'SF Mono', monospace;
  margin-top: 2px;
}
.account-role {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  background: rgba(59,130,246,.2);
  color: var(--accent);
  border-radius: 10px;
  font-size: 10px;
  text-transform: uppercase;
}

/* 实时状态 */
.realtime-stats {
  display: flex;
  flex-direction: column;
}
.realtime-stats > div {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.realtime-stats > div:last-child { border-bottom: none; }
.realtime-stats span { color: var(--text-2); }
.realtime-stats b {
  color: var(--success);
  font-family: 'SF Mono', monospace;
  font-weight: 500;
}

/* 关于页面的应用列表 */
.app-list-about {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.app-item-about {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-1);
}
.app-icon-about {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-icon-about svg {
  width: 14px;
  height: 14px;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
}

/* 移动端设置布局 */
@media (max-width: 640px) {
  .settings-sidebar {
    width: 60px;
    padding: 8px 6px;
  }
  .settings-nav {
    justify-content: center;
    padding: 10px 6px;
  }
  .settings-nav span { display: none; }
  .settings-nav svg { width: 18px; height: 18px; }
}
/* ============================================ */
/* ============ 浅色主题 ===================== */
/* ============================================ */
body.theme-light {
  --bg-0: #e8ecf1;
  --bg-1: #f5f7fa;
  --bg-2: #eef2f7;
  --bg-3: #ffffff;
  --bg-4: #e2e8f0;
  --border: #cbd5e1;
  --text-0: #0f172a;
  --text-1: #1e293b;
  --text-2: #475569;
  --text-3: #64748b;
  --shadow-sm: 0 2px 6px rgba(15,23,42,.08);
  --shadow: 0 6px 16px rgba(15,23,42,.1);
  --shadow-lg: 0 20px 40px -8px rgba(15,23,42,.15);
}

body.theme-light { background: var(--bg-0); color: var(--text-1); }

/* 状态栏 */
body.theme-light .status-bar {
  background: rgba(245,247,250,.9);
  border-bottom-color: rgba(15,23,42,.08);
}
body.theme-light .status-btn:hover { background: rgba(15,23,42,.06); }
body.theme-light .status-time { color: var(--text-0); }
body.theme-light .status-title { color: var(--text-0); }
body.theme-light .badge { background: rgba(203,213,225,.6); color: var(--text-2); }
body.theme-light .badge.node { background: rgba(104,211,145,.2); color: #15803d; }
body.theme-light .badge.node.disconnected { background: rgba(252,129,129,.2); color: #b91c1c; }

/* 桌面 */
body.theme-light .desktop {
  background: radial-gradient(circle at 30% 10%, #d8e0ea 0%, #e8ecf1 70%);
}
body.theme-light .icon-box {
  background: linear-gradient(145deg, #ffffff, #f1f5f9);
  border-color: rgba(15,23,42,.06);
  box-shadow: 0 2px 6px rgba(15,23,42,.08), inset 0 1px 1px rgba(255,255,255,.8);
}
body.theme-light .icon-item:active { background: rgba(15,23,42,.06); }
body.theme-light .icon-item.selected { background: rgba(59,130,246,.15); }
body.theme-light .icon-label {
  color: var(--text-0);
  text-shadow: 0 1px 2px rgba(255,255,255,.9);
}

/* 窗口 */
body.theme-light .window {
  background: var(--bg-3);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(15,23,42,.06);
}
body.theme-light .window-header {
  background: var(--bg-2);
  border-bottom-color: var(--border);
  color: var(--text-0);
}
body.theme-light .window-title { color: var(--text-0); }
body.theme-light .win-ctrl { color: var(--text-2); }
body.theme-light .win-ctrl:hover { background: rgba(15,23,42,.08); color: var(--text-0); }
body.theme-light .win-ctrl.close:hover { background: #e53e3e; color: white; }
body.theme-light .window-body { background: var(--bg-3); color: var(--text-1); }

/* Dock */
body.theme-light .dock {
  background: rgba(245,247,250,.92);
  border-top-color: rgba(15,23,42,.08);
}
body.theme-light .dock-item {
  background: var(--bg-4);
  border-color: var(--border);
  box-shadow: 0 2px 6px rgba(15,23,42,.08), inset 0 1px 1px rgba(255,255,255,.8);
}
body.theme-light .dock-item svg { stroke: var(--text-2); }
body.theme-light .dock-item:hover { background: #d8e0ea; }
body.theme-light .dock-item.active { background: var(--accent); border-color: #60a5fa; }
body.theme-light .dock-item.active svg { stroke: white; }
body.theme-light .dock-divider { background: var(--border); }

/* 上下文菜单 */
body.theme-light .context-menu {
  background: rgba(255,255,255,.98);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(15,23,42,.15);
}
body.theme-light .context-menu-item { color: var(--text-1); }
body.theme-light .context-menu-item:hover { background: rgba(59,130,246,.12); color: var(--accent); }
body.theme-light .context-menu-item.danger:hover { background: rgba(229,62,62,.1); color: #b91c1c; }
body.theme-light .context-menu-sep { background: var(--border); }

/* 模态框 */
body.theme-light .modal-overlay { background: rgba(15,23,42,.4); }
body.theme-light .modal { background: var(--bg-3); box-shadow: var(--shadow-lg), 0 0 0 1px rgba(15,23,42,.08); }
body.theme-light .modal-header { border-bottom-color: var(--border); color: var(--text-0); }
body.theme-light .modal-footer { border-top-color: var(--border); }
body.theme-light .modal-input { background: var(--bg-1); border-color: var(--border); color: var(--text-0); }
body.theme-light .btn-secondary { background: var(--bg-4); color: var(--text-1); }
body.theme-light .btn-secondary:hover { background: #d8e0ea; }

/* 通知 */
body.theme-light .notification {
  background: rgba(255,255,255,.98);
  border-color: var(--border);
  box-shadow: 0 6px 20px rgba(15,23,42,.12);
}
body.theme-light .notification-title { color: var(--text-0); }
body.theme-light .notification-msg { color: var(--text-2); }
body.theme-light .notification-close { color: var(--text-3); }
body.theme-light .notification-close:hover { color: var(--text-0); }

/* 登录页 */
body.theme-light .login-screen {
  background: linear-gradient(135deg, #e8ecf1 0%, #f5f7fa 50%, #e8ecf1 100%);
}
body.theme-light .login-card {
  background: rgba(255,255,255,.9);
  box-shadow: 0 20px 40px -8px rgba(15,23,42,.15), 0 0 0 1px rgba(15,23,42,.06);
}
body.theme-light .login-card h1 { color: var(--text-0); }
body.theme-light .login-tabs { background: rgba(226,232,240,.6); }
body.theme-light .login-tab { color: var(--text-2); }
body.theme-light .login-tab.active { background: var(--accent); color: white; }
body.theme-light .form-group input { background: rgba(241,245,249,.8); border-color: var(--border); color: var(--text-0); }
body.theme-light .form-group input:focus { background: white; }

/* 终端 —— 保持深色 */
body.theme-light .app-terminal { background: #1a1f2e; }
body.theme-light .app-terminal .terminal { background: #1a1f2e; color: #e2e8f0; }
body.theme-light .app-terminal .terminal-line { color: #e2e8f0; }

/* 文件管理器 */
body.theme-light .app-files .fm-toolbar { background: var(--bg-2); border-bottom-color: var(--border); }
body.theme-light .app-files .path-input { background: var(--bg-1); border-color: var(--border); color: var(--text-0); }
body.theme-light .app-files .fm-btn { background: var(--bg-4); color: var(--text-1); }
body.theme-light .app-files .fm-btn:hover { background: #d8e0ea; }
body.theme-light .app-files .file-item { background: var(--bg-1); border-color: transparent; }
body.theme-light .app-files .file-item:hover { background: var(--bg-4); border-color: var(--border); }
body.theme-light .app-files .file-item.selected { background: rgba(59,130,246,.15); border-color: var(--accent); }
body.theme-light .app-files .file-name { color: var(--text-0); }

/* 编辑器 */
body.theme-light .app-editor .editor-toolbar { background: var(--bg-2); border-bottom-color: var(--border); }
body.theme-light .app-editor .line-numbers { background: var(--bg-2); color: var(--text-3); border-right-color: var(--border); }
body.theme-light .app-editor .editor-textarea { background: var(--bg-1); color: var(--text-0); }
body.theme-light .app-editor .editor-status { background: var(--bg-2); border-top-color: var(--border); }

/* 任务管理器 */
body.theme-light .app-tm .tm-stat,
body.theme-light .app-tm .tm-chart,
body.theme-light .app-tm .tm-process-list { background: var(--bg-1); border-color: var(--border); }
body.theme-light .app-tm .tm-stat-value { color: var(--text-0); }
body.theme-light .app-tm .tm-proc-table th { background: var(--bg-2); color: var(--text-3); border-bottom-color: var(--border); }
body.theme-light .app-tm .tm-proc-table td { border-bottom-color: rgba(203,213,225,.5); color: var(--text-1); }
body.theme-light .app-tm .tm-proc-table td.name { color: var(--text-0); }
body.theme-light .app-tm .tm-proc-table tr:hover td { background: rgba(59,130,246,.06); }

/* 设置 */
body.theme-light .settings-sidebar { background: var(--bg-2); border-right-color: var(--border); }
body.theme-light .settings-nav { color: var(--text-2); }
body.theme-light .settings-nav:hover { background: rgba(15,23,42,.05); color: var(--text-0); }
body.theme-light .settings-nav.active { background: rgba(59,130,246,.15); color: var(--accent); }
body.theme-light .setting-section { background: var(--bg-1); border-color: var(--border); }
body.theme-light .section-title { color: var(--text-0); }
body.theme-light .info-row { border-bottom-color: rgba(15,23,42,.05); }
body.theme-light .info-label { color: var(--text-2); }
body.theme-light .info-value { color: #15803d; }
body.theme-light .realtime-stats > div { border-bottom-color: rgba(15,23,42,.05); }
body.theme-light .realtime-stats span { color: var(--text-2); }
body.theme-light .realtime-stats b { color: #15803d; }
body.theme-light .setting-option { border-bottom-color: rgba(15,23,42,.05); }
body.theme-light .switch .slider { background: var(--bg-4); border-color: var(--border); }
body.theme-light .switch .slider::before { background: white; }
body.theme-light .iface-item { background: var(--bg-1); border-color: var(--border); }
body.theme-light .iface-icon { background: rgba(59,130,246,.12); }
body.theme-light .iface-name { color: var(--text-0); }
body.theme-light .theme-preview { border-color: var(--border); }
body.theme-light .theme-name { background: var(--bg-2); color: var(--text-2); }
body.theme-light .account-name { color: var(--text-0); }
body.theme-light .account-username { color: var(--text-3); }
body.theme-light .app-item-about { background: var(--bg-2); color: var(--text-1); }

/* 包管理器 */
body.theme-light .app-packages .pkg-search { background: var(--bg-1); border-color: var(--border); color: var(--text-0); }
body.theme-light .app-packages .pkg-tabs { background: var(--bg-1); }
body.theme-light .app-packages .pkg-tab { color: var(--text-2); }
body.theme-light .app-packages .pkg-tab.active { background: var(--bg-4); color: var(--text-0); }
body.theme-light .app-packages .pkg-item { background: var(--bg-1); border-color: var(--border); }
body.theme-light .app-packages .pkg-name { color: var(--text-0); }
body.theme-light .app-packages .pkg-desc { color: var(--text-2); }

/* 计算器 */
body.theme-light .app-calc .calc-display { background: var(--bg-1); border-color: var(--border); }
body.theme-light .app-calc .calc-result { color: var(--text-0); }
body.theme-light .app-calc .calc-history { color: var(--text-3); }
body.theme-light .app-calc .calc-btn { background: var(--bg-4); color: var(--text-0); }
body.theme-light .app-calc .calc-btn:hover { background: #d8e0ea; }

/* 便签 */
body.theme-light .app-notes .notes-sidebar { background: var(--bg-2); border-right-color: var(--border); }
body.theme-light .app-notes .notes-header { border-bottom-color: var(--border); }
body.theme-light .app-notes .note-item:hover { background: rgba(59,130,246,.08); }
body.theme-light .app-notes .note-item.active { background: rgba(59,130,246,.18); }
body.theme-light .app-notes .note-title { color: var(--text-0); }
body.theme-light .app-notes .notes-title { background: var(--bg-2); border-bottom-color: var(--border); color: var(--text-0); }
body.theme-light .app-notes .notes-textarea { background: var(--bg-1); color: var(--text-1); }

/* 音乐 */
body.theme-light .app-music .music-now { background: linear-gradient(135deg, rgba(167,139,250,.15), rgba(59,130,246,.15)); border-color: var(--border); }
body.theme-light .app-music .music-title { color: var(--text-0); }
body.theme-light .app-music .music-artist { color: var(--text-2); }
body.theme-light .app-music .music-btn { background: var(--bg-4); }
body.theme-light .app-music .music-btn svg { stroke: var(--text-1); }
body.theme-light .app-music .music-btn.play { background: var(--accent); }
body.theme-light .app-music .music-btn.play svg { stroke: white; }

/* 图片查看器 */
body.theme-light .app-image-viewer .iv-toolbar { background: var(--bg-2); border-bottom-color: var(--border); }
body.theme-light .app-image-viewer .iv-btn { background: var(--bg-4); color: var(--text-1); }
body.theme-light .app-image-viewer .iv-info { color: var(--text-2); }

/* 空状态 / 滚动条 */
body.theme-light .empty-state { color: var(--text-3); }
body.theme-light .empty-state svg { stroke: var(--border); }
body.theme-light .loading { color: var(--text-3); }
body.theme-light ::-webkit-scrollbar-thumb { background: #cbd5e1; }
body.theme-light ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
body.theme-light .app-terminal .terminal::-webkit-scrollbar-thumb { background: rgba(120,140,170,.4); }
/* ============================================ */
/* ============ 系统动画 ===================== */
/* ============================================ */

/* ---------- 全局缓动曲线 ---------- */
:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --spring: cubic-bezier(.5, 1.6, .4, 1);
}

/* ---------- 桌面图标 ---------- */
.icon-item {
  transition: background .2s var(--ease-out), transform .25s var(--ease-bounce);
}
.icon-item:hover {
  background: rgba(255,255,255,.06);
  transform: translateY(-2px);
}
.icon-item:hover .icon-box {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,255,255,.1);
}
.icon-item:active {
  transform: scale(.92);
}
.icon-box {
  transition: transform .3s var(--ease-bounce), box-shadow .3s var(--ease-out);
}

/* 图标进入桌面的错位动画（首次加载时） */
@keyframes iconEnter {
  0% {
    opacity: 0;
    transform: scale(.3) translateY(20px);
  }
  60% {
    opacity: 1;
    transform: scale(1.08) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.icon-item.entering {
  animation: iconEnter .6s var(--ease-out) backwards;
}

/* ---------- Dock ---------- */
.dock-item {
  transition: all .25s var(--ease-bounce);
}
.dock-item:hover {
  transform: translateY(-6px) scale(1.08);
}
.dock-item:hover::before {
  /* 悬停时工具提示 */
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,26,35,.95);
  color: var(--text-0);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  animation: tooltipIn .18s var(--ease-out);
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  border: 1px solid var(--border);
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Dock 应用启动时的弹跳 */
@keyframes dockBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  20% { transform: translateY(-14px) scale(1.12); }
  40% { transform: translateY(-4px) scale(1.04); }
  60% { transform: translateY(-8px) scale(1.06); }
  80% { transform: translateY(-2px) scale(1.02); }
}
.dock-item.bouncing {
  animation: dockBounce .7s var(--ease-out);
}

/* Dock 启动波纹 */
.dock-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
}
@keyframes dockRipple {
  0% { transform: scale(.6); opacity: .5; }
  100% { transform: scale(2.4); opacity: 0; }
}
.dock-item .ripple {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: rgba(59,130,246,.4);
  pointer-events: none;
  animation: dockRipple .6s var(--ease-out) forwards;
}

/* ---------- 窗口 ---------- */
.window {
  transition:
    box-shadow .25s var(--ease-out),
    opacity .25s var(--ease-out),
    transform .3s var(--ease-out);
}

/* 窗口打开动画 */
@keyframes windowOpen {
  0% {
    opacity: 0;
    transform: scale(.85) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.window.opening {
  animation: windowOpen .4s var(--ease-out) forwards;
}

/* 窗口关闭动画 */
@keyframes windowClose {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(.9) translateY(15px);
  }
}
.window.closing {
  animation: windowClose .28s var(--ease-in-out) forwards;
  pointer-events: none;
}

/* 窗口最小化 */
@keyframes windowMinimize {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(.5) translateY(200px);
  }
}
.window.minimizing {
  animation: windowMinimize .3s var(--ease-in-out) forwards;
  pointer-events: none;
}

/* 窗口聚焦时的"振一下" */
@keyframes windowPulse {
  0% { box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent); }
  50% { box-shadow: var(--shadow-lg), 0 0 0 6px rgba(59,130,246,.3); }
  100% { box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent); }
}
.window.active.pulse {
  animation: windowPulse .6s var(--ease-out);
}

/* 窗口拖拽时轻微变透明 */
.window.dragging {
  opacity: .94;
  cursor: grabbing;
  transition: opacity .15s;
}
.window.dragging .window-header {
  cursor: grabbing;
}

/* 窗口缩放时轻微变透明 */
.window.resizing {
  opacity: .96;
}

/* 最大化/还原过渡 */
.window.maximizing,
.window.restoring {
  transition:
    left .3s var(--ease-out),
    top .3s var(--ease-out),
    width .3s var(--ease-out),
    height .3s var(--ease-out),
    border-radius .3s var(--ease-out);
}

/* ---------- 状态栏 ---------- */
.status-bar {
  transition: background .3s, border-color .3s;
}

.status-btn {
  transition: background .2s var(--ease-out), transform .15s var(--ease-bounce);
}
.status-btn:active {
  transform: scale(.88);
}

/* 时钟数字变化 */
.status-time {
  transition: color .3s;
}

/* 后端连接状态的圆点脉冲 */
.badge.node .dot {
  transition: background .3s;
}
.badge.node .dot.pulse {
  animation: dotPulse 1.8s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: .6; box-shadow: 0 0 0 5px transparent; }
}

/* 连接断开时的抖动 */
@keyframes badgeShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
.badge.shake {
  animation: badgeShake .4s var(--ease-out);
}

/* ---------- 上下文菜单 ---------- */
.context-menu {
  animation: menuPop .18s var(--ease-out);
  transform-origin: top left;
}
@keyframes menuPop {
  0% {
    opacity: 0;
    transform: scale(.92) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.context-menu-item {
  transition: background .15s var(--ease-out), padding-left .2s var(--ease-out);
}
.context-menu-item:hover {
  padding-left: 16px;
}

/* ---------- 模态框 ---------- */
.modal-overlay {
  animation: overlayIn .25s var(--ease-out);
}
@keyframes overlayIn {
  from { opacity: 0; backdrop-filter: blur(0); }
  to { opacity: 1; backdrop-filter: blur(4px); }
}
.modal-overlay.closing {
  animation: overlayOut .2s var(--ease-in-out) forwards;
}
@keyframes overlayOut {
  to { opacity: 0; backdrop-filter: blur(0); }
}
.modal {
  animation: modalPop .32s var(--ease-bounce);
}
@keyframes modalPop {
  0% {
    opacity: 0;
    transform: scale(.85) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal.closing {
  animation: modalClose .22s var(--ease-in-out) forwards;
}
@keyframes modalClose {
  to {
    opacity: 0;
    transform: scale(.92) translateY(10px);
  }
}

/* 模态框按钮点击效果 */
.btn {
  transition: background .15s var(--ease-out), transform .1s var(--ease-bounce);
  position: relative;
  overflow: hidden;
}
.btn:active {
  transform: scale(.96);
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.25);
  border-radius: inherit;
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}
@keyframes btnRipple {
  0% { transform: scale(0); opacity: .5; }
  100% { transform: scale(2.5); opacity: 0; }
}
.btn .btn-ripple {
  position: absolute;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: btnRipple .55s var(--ease-out) forwards;
}

/* ---------- 通知 ---------- */
.notification {
  animation: notificationIn .35s var(--ease-bounce);
}
@keyframes notificationIn {
  0% {
    opacity: 0;
    transform: translateX(80px) scale(.9);
  }
  60% {
    opacity: 1;
    transform: translateX(-6px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
.notification.closing {
  animation: notificationOut .28s var(--ease-in-out) forwards;
}
@keyframes notificationOut {
  to {
    opacity: 0;
    transform: translateX(80px) scale(.9);
  }
}
.notification-icon svg {
  animation: iconPop .4s var(--ease-bounce) .1s backwards;
}
@keyframes iconPop {
  0% { transform: scale(0) rotate(-90deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- 应用内交互 ---------- */

/* 文件管理器 */
.app-files .file-item {
  transition: background .15s var(--ease-out), transform .15s var(--ease-out), border-color .15s;
}
.app-files .file-item:hover {
  transform: translateX(2px);
}
.app-files .file-item:active {
  transform: scale(.99);
}

/* 终端光标闪烁已有 */

/* 加载 spinner */
.spinner {
  animation: spin .8s linear infinite;
}

/* 列表进入动画 */
@keyframes listItemIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.app-files .file-item,
.app-packages .pkg-item,
.app-notes .note-item,
.app-tm .tm-proc-table tbody tr {
  animation: listItemIn .25s var(--ease-out) backwards;
}
.app-files .file-item:nth-child(1),
.app-packages .pkg-item:nth-child(1),
.app-notes .note-item:nth-child(1),
.app-tm .tm-proc-table tbody tr:nth-child(1) { animation-delay: 0s; }
.app-files .file-item:nth-child(2),
.app-packages .pkg-item:nth-child(2),
.app-notes .note-item:nth-child(2),
.app-tm .tm-proc-table tbody tr:nth-child(2) { animation-delay: .03s; }
.app-files .file-item:nth-child(3),
.app-packages .pkg-item:nth-child(3),
.app-notes .note-item:nth-child(3),
.app-tm .tm-proc-table tbody tr:nth-child(3) { animation-delay: .06s; }
.app-files .file-item:nth-child(4),
.app-packages .pkg-item:nth-child(4),
.app-notes .note-item:nth-child(4),
.app-tm .tm-proc-table tbody tr:nth-child(4) { animation-delay: .09s; }
.app-files .file-item:nth-child(5),
.app-packages .pkg-item:nth-child(5),
.app-notes .note-item:nth-child(5),
.app-tm .tm-proc-table tbody tr:nth-child(5) { animation-delay: .12s; }
.app-files .file-item:nth-child(6),
.app-packages .pkg-item:nth-child(6),
.app-notes .note-item:nth-child(6),
.app-tm .tm-proc-table tbody tr:nth-child(6) { animation-delay: .15s; }
.app-files .file-item:nth-child(7),
.app-packages .pkg-item:nth-child(7),
.app-notes .note-item:nth-child(7),
.app-tm .tm-proc-table tbody tr:nth-child(7) { animation-delay: .18s; }
.app-files .file-item:nth-child(8),
.app-packages .pkg-item:nth-child(8),
.app-notes .note-item:nth-child(8),
.app-tm .tm-proc-table tbody tr:nth-child(8) { animation-delay: .21s; }
.app-files .file-item:nth-child(n+9),
.app-packages .pkg-item:nth-child(n+9),
.app-notes .note-item:nth-child(n+9),
.app-tm .tm-proc-table tbody tr:nth-child(n+9) { animation-delay: .24s; }

/* 计算器按钮 */
.app-calc .calc-btn {
  transition: background .15s var(--ease-out), transform .12s var(--ease-bounce);
}
.app-calc .calc-btn:active {
  transform: scale(.9);
  background: var(--accent);
  color: white;
}

/* 包管理器按钮 */
.app-packages .pkg-action {
  transition: background .15s, transform .12s var(--ease-bounce);
}
.app-packages .pkg-action:active {
  transform: scale(.94);
}

/* 设置里的壁纸和主题 item */
.app-settings .wallpaper-item {
  transition: transform .2s var(--ease-bounce), border-color .15s;
}
.app-settings .wallpaper-item:hover {
  transform: scale(1.05);
}
.app-settings .wallpaper-item:active {
  transform: scale(.98);
}
.app-settings .theme-item {
  transition: transform .2s var(--ease-bounce), border-color .15s;
}
.app-settings .theme-item:hover {
  transform: scale(1.04);
}
.app-settings .theme-item:active {
  transform: scale(.98);
}

/* 设置导航 */
.app-settings .settings-nav {
  transition: background .2s var(--ease-out), color .2s, padding-left .2s var(--ease-out);
}
.app-settings .settings-nav:hover {
  padding-left: 16px;
}

/* 开关 */
.app-settings .switch .slider {
  transition: background .3s var(--ease-out), border-color .3s;
}
.app-settings .switch .slider::before {
  transition: transform .3s var(--ease-bounce), background .3s;
}

/* 便签列表 */
.app-notes .note-item {
  transition: background .15s, transform .15s var(--ease-out);
}
.app-notes .note-item:active {
  transform: scale(.98);
}

/* 音乐播放按钮 */
.app-music .music-btn {
  transition: background .15s, transform .15s var(--ease-bounce);
}
.app-music .music-btn:active {
  transform: scale(.9);
}
.app-music .music-art.playing {
  animation: musicPulse 2s ease-in-out infinite;
}

/* 任务管理器进程行的进入 */
.app-tm .tm-proc-table tbody tr {
  transition: background .15s;
}

/* 图片查看器按钮 */
.app-image-viewer .iv-btn {
  transition: background .15s, transform .15s var(--ease-bounce);
}
.app-image-viewer .iv-btn:active {
  transform: scale(.92);
}

/* ---------- 通用工具类 ---------- */
.fade-in {
  animation: fadeIn .3s var(--ease-out);
}
.fade-up {
  animation: fadeUp .35s var(--ease-out);
}
.scale-in {
  animation: scaleIn .35s var(--ease-bounce);
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}

/* 面板折叠/展开动画（供未来功能用） */
@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 500px; }
}
@keyframes slideUp {
  from { opacity: 1; max-height: 500px; }
  to { opacity: 0; max-height: 0; }
}

/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
/* ============================================ */
/* ============ Dock tooltip ================= */
/* ============================================ */
.dock-tooltip {
  position: fixed;
  background: rgba(20,26,35,.98);
  color: var(--text-0);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 99999;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  border: 1px solid var(--border);
  animation: dockTooltipIn .18s var(--ease-out);
}
.dock-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(20,26,35,.98);
}
@keyframes dockTooltipIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.theme-light .dock-tooltip {
  background: rgba(255,255,255,.98);
  color: var(--text-0);
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(15,23,42,.15);
}
body.theme-light .dock-tooltip::after {
  border-top-color: rgba(255,255,255,.98);
}

/* 修复：Dock 悬停时的图标动画 */
.dock-item {
  position: relative;
}
.dock-item:hover {
  transform: translateY(-6px) scale(1.08);
  z-index: 10;
}
/* ============================================ */
/* ============ Dock 交互修复 ================= */
/* ============================================ */

/* 去掉 hover 时的浏览器原生 title 黑条：不写 content: attr(title) */
.dock-item {
  position: relative;
}

/* 悬停上浮（保留视觉反馈，无 tooltip） */
.dock-item:hover {
  transform: translateY(-6px) scale(1.08);
  z-index: 10;
}

/* active 小圆点：固定在图标底部 */
.dock-item::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #60a5fa;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.dock-item.active::after {
  opacity: 1;
}