@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500&display=swap');

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

:root {
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
  --wallpaper: url('/wallpaper.jpg');
  --bar-h: 28px;
  --win-radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0f; --surface: #141416; --surface2: #1a1a1e;
    --border: #26262c; --border2: rgba(255,255,255,0.06);
    --text: #e8e8f0; --text2: #a0a0b0; --muted: #55555f;
    --accent: #f4a227; --accent2: #3a3a41;
    --green: #3ecf8e; --red: #ff5f57; --yellow: #febc2e; --blue-dot: #28c840;
    --terminal-bg: #0a0a0c; --win-bg: rgba(16,16,20,0.94);
    --bar-bg: rgba(10,10,14,0.85);
    --trash-bg: #111113; --trash-item-bg: #1a1a1e; --trash-item-hover: #222228;
  }
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #e8e8ec; --surface: rgba(255,255,255,0.85); --surface2: rgba(255,255,255,0.6);
    --border: rgba(0,0,0,0.1); --border2: rgba(0,0,0,0.08);
    --text: #1a1a22; --text2: #444450; --muted: #888898;
    --accent: #e69010; --accent2: #6b6b7a;
    --green: #1aaa6a; --red: #ff5f57; --yellow: #febc2e; --blue-dot: #28c840;
    --terminal-bg: #1a1a20; --win-bg: rgba(248,248,252,0.95);
    --bar-bg: rgba(240,240,244,0.88);
    --trash-bg: #f5f5f7; --trash-item-bg: #fff; --trash-item-hover: #f0f0f5;
  }
}

html.force-dark {
  --bg: #0d0d0f; --surface: #141416; --surface2: #1a1a1e;
  --border: #26262c; --border2: rgba(255,255,255,0.06);
  --text: #e8e8f0; --text2: #a0a0b0; --muted: #55555f;
  --accent: #f4a227; --accent2: #5f5f67;
  --green: #3ecf8e; --terminal-bg: #0a0a0c;
  --win-bg: rgba(16,16,20,0.94); --bar-bg: rgba(10,10,14,0.85);
  --trash-bg: #111113; --trash-item-bg: #1a1a1e; --trash-item-hover: #222228;
}
html.force-light {
  --bg: #e8e8ec; --surface: rgba(255,255,255,0.85); --surface2: rgba(255,255,255,0.6);
  --border: rgba(0,0,0,0.1); --border2: rgba(0,0,0,0.08);
  --text: #1a1a22; --text2: #444450; --muted: #888898;
  --accent: #e69010; --accent2: #6b6b7a;
  --green: #1aaa6a; --terminal-bg: #1a1a20;
  --win-bg: rgba(248,248,252,0.95); --bar-bg: rgba(240,240,244,0.88);
  --trash-bg: #f5f5f7; --trash-item-bg: #fff; --trash-item-hover: #f0f0f5;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); font-family: var(--font-ui);
  color: var(--text); user-select: none; cursor: default;
}

.wallpaper {
  position: fixed; inset: 0;
  background-image: var(--wallpaper);
  background-size: cover; background-position: center; z-index: 0;
}

.menubar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h);
  background: var(--bar-bg); backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; z-index: 1000; gap: 20px;
}
.menubar-logo {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: 0.04em;
}
.menubar-logo-img { width: 16px; height: 16px; border-radius: 3px; }
.menubar-items { display: flex; gap: 16px; font-size: 12px; color: var(--text2); }
.menubar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 11px; color: var(--muted); }
.menubar-right .time { color: var(--text); font-weight: 500; }

.menu-item { position: relative; cursor: pointer; }
.menu-item > span { padding: 2px 6px; border-radius: 4px; transition: background 0.1s; display: block; }
.menu-item:hover > span, .menu-item.active > span { background: rgba(255,255,255,0.1); }
.menu-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 200px; background: var(--win-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4); padding: 4px; z-index: 2000;
}
.menu-dropdown.open { display: block; animation: fadeIn 0.12s ease; }
.menu-dd-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: 5px; font-size: 11px; color: var(--text2);
  cursor: pointer; transition: background 0.1s;
}
.menu-dd-item:hover { background: var(--accent2); color: var(--text); }
.menu-dd-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu-dd-version { color: var(--muted) !important; font-size: 10px !important; cursor: default !important; }
.menu-dd-version:hover { background: transparent !important; }
.menu-shortcut { margin-left: auto; font-size: 10px; color: var(--muted); opacity: 0.7; }

.desktop {
  position: fixed; top: var(--bar-h); left: 0; right: 0; bottom: 0;
  z-index: 1; overflow: hidden;
}

.window {
  position: absolute; background: var(--win-bg);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--win-radius);
  box-shadow: 0 24px 60px rgba(0,0,0,0.35), 0 0 0 0.5px var(--border2) inset;
  display: flex; flex-direction: column; overflow: hidden;
  min-width: 380px; min-height: 260px;
  transition: box-shadow 0.15s, opacity 0.2s, transform 0.2s;
}
.window.focused {
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 0 0.5px var(--border2) inset;
}
.window[data-maximized="true"] {
  border-radius: 0 !important;
  border: none !important;
}

.win-titlebar {
  height: 38px; display: flex; align-items: center; padding: 0 12px; gap: 8px;
  background: var(--border2); border-bottom: 1px solid var(--border);
  flex-shrink: 0; cursor: grab;
}
.win-titlebar:active { cursor: grabbing; }
.win-controls { display: flex; gap: 6px; }
.win-btn {
  width: 12px; height: 12px; border-radius: 50%; border: none; cursor: pointer;
  transition: filter 0.15s, transform 0.1s; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.win-btn:hover { filter: brightness(1.2); transform: scale(1.1); }
.win-btn.close   { background: var(--red); }
.win-btn.minimize { background: var(--yellow); }
.win-btn.maximize { background: var(--blue-dot); }
.win-btn.maximize.is-maximized { background: #28c840; }

.win-controls:hover .win-btn.close::before,
.win-controls:hover .win-btn.close::after {
  content: ''; position: absolute; width: 6px; height: 1.5px;
  background: rgba(0,0,0,0.5); border-radius: 1px;
}
.win-controls:hover .win-btn.close::before { transform: rotate(45deg); }
.win-controls:hover .win-btn.close::after  { transform: rotate(-45deg); }
.win-controls:hover .win-btn.minimize::before {
  content: ''; position: absolute; width: 6px; height: 1.5px;
  background: rgba(0,0,0,0.5); border-radius: 1px;
}

.win-title {
  flex: 1; text-align: center; font-size: 11px; color: var(--muted);
  font-weight: 500; pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.win-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.docs-body { display: flex; flex: 1; overflow: hidden; }
.docs-sidebar {
  width: 170px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 10px 0; overflow-y: auto; background: var(--surface2);
}
.docs-sidebar-section {
  padding: 8px 14px 3px; font-size: 9px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.docs-sidebar-item {
  padding: 5px 14px; font-size: 11px; color: var(--text2);
  cursor: pointer; transition: all 0.1s; border-left: 2px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.docs-sidebar-item:hover { color: var(--text); background: var(--border2); }
.docs-sidebar-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(244,162,39,0.06); }

.docs-main-content {
  flex: 1; padding: 20px 24px; overflow-y: auto;
  font-size: 13px; line-height: 1.8; color: var(--text2);
  user-select: text; cursor: text;
}
.docs-main-content h1 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.docs-main-content h2 { font-size: 14px; font-weight: 700; color: var(--text); margin: 28px 0 10px; padding-top: 28px; border-top: 1px solid var(--border); }
.docs-main-content h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.docs-main-content h3 { font-size: 11px; font-weight: 700; color: var(--accent); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.docs-main-content p { margin-bottom: 10px; }
.docs-main-content p a, .docs-main-content a { color: var(--accent); }
.docs-main-content strong { color: var(--text); font-weight: 700; }
.docs-main-content code {
  background: var(--border2); border: 1px solid var(--border); border-radius: 3px;
  padding: 1px 5px; font-size: 11px; color: var(--accent); font-family: var(--font-mono);
}
.docs-main-content ul, .docs-main-content ol {
  padding-left: 0; list-style: none; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.docs-main-content ul li, .docs-main-content ol li { font-size: 13px; color: var(--text2); display: flex; gap: 8px; }
.docs-main-content ul li::before { content: '·'; color: var(--muted); flex-shrink: 0; }
.docs-main-content ol { counter-reset: docs-counter; }
.docs-main-content ol li { counter-increment: docs-counter; }
.docs-main-content ol li::before { content: counter(docs-counter) '.'; color: var(--muted); flex-shrink: 0; }
.docs-main-content .code-block {
  background: var(--terminal-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 16px; font-size: 12px;
  line-height: 1.8; margin: 12px 0 18px; overflow-x: auto; font-family: var(--font-mono);
}
.docs-main-content .code-block .cb-comment { color: #666; }
.docs-main-content .code-block .cb-cmd { color: #e0e0e0; }
.docs-main-content .code-block .cb-ok { color: #4ade80; }
.docs-main-content .callout {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 12px 16px; margin: 14px 0; font-size: 12px;
  color: var(--text2); line-height: 1.7; border-radius: 0 4px 4px 0;
}
.docs-main-content .callout.green { border-left-color: var(--green); }
.docs-main-content .callout.blue  { border-left-color: #60a5fa; }
.docs-main-content .cmd-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 10px 0 18px; }
.docs-main-content .cmd-table th {
  text-align: left; font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
}
.docs-main-content .cmd-table td { padding: 8px 0; border-bottom: 1px dotted var(--border); color: var(--text2); vertical-align: top; }
.docs-main-content .cmd-table td:first-child { padding-right: 16px; white-space: nowrap; }
.docs-main-content .app-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 6px;
  border-radius: 2px; border: 1px solid; vertical-align: middle;
}
.docs-main-content .app-badge.live  { color: var(--green); border-color: var(--green); }
.docs-main-content .app-badge.beta  { color: var(--accent); border-color: var(--accent); }
.docs-main-content .docs-lead {
  font-size: 13px; color: var(--text); margin-bottom: 24px;
  line-height: 1.7; border-left: 3px solid var(--accent); padding-left: 14px;
}

.docs-loading {
  display: flex; align-items: center; justify-content: center;
  flex: 1; color: var(--muted); font-size: 12px; gap: 6px; font-family: var(--font-mono);
  height: 100%;
}
.docs-loading-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.docs-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.docs-loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%,100%{opacity:0.3;transform:scale(0.8)} 50%{opacity:1;transform:scale(1)} }

.trash-body {
  display: flex; flex: 1; overflow: hidden; background: var(--trash-bg);
}
.trash-sidebar {
  width: 200px; flex-shrink: 0; border-right: 1px solid var(--border);
  background: var(--surface2); padding: 10px 0; overflow-y: auto;
  display: flex; flex-direction: column;
}
.trash-sidebar-label {
  padding: 6px 14px 3px; font-size: 9px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.trash-sidebar-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  font-size: 11px; color: var(--text2); cursor: pointer;
  border-left: 2px solid transparent; transition: all 0.1s;
}
.trash-sidebar-item:hover { color: var(--text); background: var(--border2); }
.trash-sidebar-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(244,162,39,0.06); }
.trash-sidebar-item svg { flex-shrink: 0; color: var(--muted); }

.trash-main {
  flex: 1; overflow-y: auto; padding: 0;
}

.trash-section { padding: 16px 20px 4px; }
.trash-section-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text2);
  margin-bottom: 12px; cursor: pointer; user-select: none;
}
.trash-section-header svg { color: var(--muted); transition: transform 0.15s; }
.trash-section-header.collapsed svg { transform: rotate(-90deg); }
.trash-section-count {
  font-size: 10px; color: var(--muted); font-weight: 400;
}

.trash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 4px; margin-bottom: 8px;
}
.trash-file {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: 8px; cursor: pointer;
  transition: background 0.1s; text-align: center;
  background: transparent;
}
.trash-file:hover { background: var(--trash-item-hover); }
.trash-file-icon {
  width: 44px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.trash-file-icon svg { position: absolute; }
.trash-file-ext {
  position: absolute; bottom: 6px;
  font-size: 7px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #fff;
  background: var(--accent); padding: 1px 3px; border-radius: 2px;
}
.trash-file-ext.pdf  { background: #e44; }
.trash-file-ext.md   { background: #555; }
.trash-file-ext.txt  { background: #777; }
.trash-file-ext.doc  { background: #2b5be0; }
.trash-file-ext.docx { background: #2b5be0; }
.trash-file-ext.mov  { background: #8b5cf6; }
.trash-file-ext.mp4  { background: #8b5cf6; }
.trash-file-ext.tsx  { background: #3178c6; }
.trash-file-ext.ts   { background: #3178c6; }
.trash-file-ext.js   { background: #f7df1e; color: #000; }
.trash-file-ext.go   { background: #00acd7; }
.trash-file-ext.canvas { background: #9333ea; }
.trash-file-ext.ics  { background: var(--green); }
.trash-file-name {
  font-size: 10px; color: var(--text2); line-height: 1.3;
  max-width: 84px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word;
}

.trash-sep { height: 1px; background: var(--border); margin: 4px 20px; }

.desktop-icons {
  position: absolute; top: 16px; left: 24px;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.desktop-icon {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 6px; border-radius: 10px; cursor: pointer; width: 72px;
  transition: background 0.15s, transform 0.15s;
}
.desktop-icon:hover { background: rgba(255,255,255,0.12); transform: scale(1.05); }
.desktop-icon:active { transform: scale(0.96); }
.icon-bounce { animation: iconBounce 0.35s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes iconBounce { 0%{transform:scale(1)} 40%{transform:scale(0.88)} 100%{transform:scale(1)} }
.desktop-icon .icon-wrap { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.desktop-icon .icon-wrap img { width: 56px; height: 56px; border-radius: 12px; pointer-events: none; }
.desktop-icon .icon-label { font-size: 12px; font-weight: 600; color: #fff; text-align: center; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,0.5); pointer-events: none; }

.visitor-widget {
  position: absolute; bottom: 16px; right: 16px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; color: #e8e8f0;
}
.visitor-info { display: flex; flex-direction: column; gap: 1px; }
.visitor-label { font-size: 9px; color: #e8e8f0; text-transform: uppercase; letter-spacing: 0.08em; }
.visitor-num { font-size: 16px; font-weight: 700; color: #e8e8f0; font-family: var(--font-mono); line-height: 1; }

.resize-handle { position: absolute; z-index: 10; }
.resize-handle.se { bottom: 0; right: 0; width: 16px; height: 16px; cursor: se-resize; }
.resize-handle.s  { bottom: 0; left: 16px; right: 16px; height: 5px; cursor: s-resize; }
.resize-handle.e  { top: 38px; right: 0; bottom: 5px; width: 5px; cursor: e-resize; }
.resize-handle.sw { bottom: 0; left: 0; width: 16px; height: 16px; cursor: sw-resize; }
.resize-handle.w  { top: 38px; left: 0; bottom: 5px; width: 5px; cursor: w-resize; }

.mobile-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.88);
  backdrop-filter: blur(20px); z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.mobile-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 24px; max-width: 320px; width: 100%;
  text-align: center; box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}
.mobile-card h2 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.mobile-card p  { font-size: 13px; color: var(--text2); line-height: 1.6; }
.mobile-card strong { color: var(--text); }
.mobile-btn {
  margin-top: 20px; padding: 10px 24px; background: var(--accent2);
  color: #fff; border: none; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; font-family: var(--font-ui); transition: filter 0.15s;
}
.mobile-btn:hover { filter: brightness(1.1); }

.hidden { display: none !important; }
@keyframes fadeIn { from{opacity:0;transform:translateY(2px)} to{opacity:1;transform:translateY(0)} }

.activity-indicator {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 5px rgba(62,207,142,0.6);
  display: none;
}
.activity-indicator.has-open { display: inline-block; }

.activity-win-item { display: flex; align-items: center; gap: 8px; }

.act-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
}
.act-dot-open      { background: var(--green); box-shadow: 0 0 6px rgba(62,207,142,0.5); }
.act-dot-minimized { background: var(--accent); box-shadow: 0 0 5px rgba(244,162,39,0.5); }

.activity-close-btn {
  font-size: 10px; color: var(--muted);
  padding: 1px 4px; border-radius: 3px; transition: all 0.1s;
}
.activity-close-btn:hover { background: var(--red); color: #fff; }
.trash-file:not([data-video]) { pointer-events: none; }
.trash-file:not([data-video]):hover { background: transparent; }
.trash-file[data-video] { cursor: pointer; }