:root {
  --bg: #040008;
  --panel: rgba(17, 4, 32, 0.72);
  --panel-strong: rgba(28, 5, 50, 0.88);
  --line: rgba(197, 55, 255, 0.55);
  --line-dim: rgba(168, 48, 234, 0.24);
  --hot: #f24dff;
  --violet: #a433ff;
  --lavender: #e5a3ff;
  --text: #d991ff;
  --muted: #9a5bb7;
  --radius: 4px;
  color-scheme: dark;
}

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

body {
  margin: 0;
  overflow: hidden;
  height: 100vh;
  background:
    radial-gradient(circle at 30% 40%, rgba(134, 28, 214, 0.15), transparent 40rem),
    radial-gradient(circle at 70% 60%, rgba(94, 21, 160, 0.1), transparent 30rem),
    #040008;
  color: var(--text);
  font-family: "Share Tech Mono", monospace;
  user-select: none;
}

.noise {
  position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: 0.04;
}

.scanlines {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 3px);
  opacity: 0.2;
}

/* Desktop */
.desktop {
  position: relative;
  height: calc(100vh - 40px);
  padding: 16px;
}

.desktop-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, 90px);
  grid-auto-rows: 100px;
  gap: 8px;
  align-content: start;
  max-width: 200px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--lavender);
  font-family: inherit;
  font-size: 0.68rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 200ms, border-color 200ms;
}

.desktop-icon:hover {
  background: rgba(164, 51, 255, 0.1);
  border-color: var(--line-dim);
}

.desktop-icon:active, .desktop-icon:focus {
  background: rgba(164, 51, 255, 0.2);
  border-color: var(--line);
}

.icon-glyph {
  font-size: 2rem;
  text-shadow: 0 0 12px var(--hot);
  line-height: 1;
}

/* Windows */
.window {
  position: absolute;
  min-width: 300px;
  min-height: 200px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(164, 51, 255, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 10;
  animation: windowOpen 0.25s ease-out;
}

@keyframes windowOpen {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.window.focused { z-index: 20; border-color: var(--hot); }

.window-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(164, 51, 255, 0.08);
  border-bottom: 1px solid var(--line-dim);
  cursor: grab;
}

.window-header:active { cursor: grabbing; }

.window-title {
  flex: 1;
  font-size: 0.75rem;
  color: var(--lavender);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.window-controls {
  display: flex;
  gap: 6px;
}

.window-controls button {
  width: 18px;
  height: 18px;
  background: none;
  border: 1px solid var(--line-dim);
  color: var(--muted);
  font-size: 0.6rem;
  line-height: 1;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms;
}

.window-controls button:hover { border-color: var(--hot); color: var(--hot); }

.window-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
}

.window-body h3 {
  color: var(--lavender);
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 12px;
}

.window-body p { margin: 0 0 10px; }

.window-body ul { list-style: none; padding: 0; margin: 0; }
.window-body li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line-dim);
}
.window-body li:last-child { border-bottom: none; }
.window-body li::before { content: "› "; color: var(--hot); }

.window-body .file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 200ms;
}

.file-item:hover { border-color: var(--line); }
.file-item .file-icon { color: var(--hot); font-size: 1.2rem; }

/* Chat log styling */
.chat-log {
  font-size: 0.78rem;
}

.chat-log .msg {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
}

.chat-log .msg-them {
  background: rgba(164, 51, 255, 0.08);
  border: 1px solid var(--line-dim);
  margin-right: 40px;
}

.chat-log .msg-me {
  background: rgba(242, 77, 255, 0.08);
  border: 1px solid rgba(242, 77, 255, 0.2);
  margin-left: 40px;
  text-align: right;
}

.chat-log .msg-name {
  display: block;
  font-size: 0.68rem;
  color: var(--hot);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.chat-log .msg-time {
  font-size: 0.6rem;
  color: var(--muted);
  opacity: 0.6;
}

/* Taskbar */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: rgba(8, 2, 18, 0.95);
  border-top: 1px solid var(--line-dim);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(164, 51, 255, 0.12);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  color: var(--lavender);
  font-family: inherit;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 200ms;
}

.start-btn:hover { background: rgba(242, 77, 255, 0.2); border-color: var(--line); }

.start-icon { color: var(--hot); font-size: 1rem; text-shadow: 0 0 8px var(--hot); }

.taskbar-windows {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.taskbar-item {
  padding: 4px 12px;
  background: rgba(164, 51, 255, 0.08);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.68rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 200ms;
  white-space: nowrap;
}

.taskbar-item:hover { border-color: var(--line); color: var(--lavender); }
.taskbar-item.active { background: rgba(242, 77, 255, 0.15); border-color: var(--hot); color: var(--lavender); }

.taskbar-tray {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  font-size: 0.7rem;
  color: var(--muted);
}

.tray-status { font-size: 0.65rem; opacity: 0.7; }

/* Start Menu */
.start-menu {
  position: fixed;
  bottom: 44px;
  left: 8px;
  width: 240px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
  animation: windowOpen 0.2s ease-out;
}

.start-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line-dim);
  color: var(--lavender);
  font-size: 0.85rem;
}

.start-avatar {
  font-size: 1.6rem;
  text-shadow: 0 0 10px var(--hot);
}

.start-items {
  padding: 8px;
}

.start-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms, color 200ms;
}

.start-item:hover { background: rgba(164, 51, 255, 0.15); color: var(--lavender); }

/* Shutdown animation */
.shutdown {
  animation: shutdown 2s forwards;
}

@keyframes shutdown {
  0% { filter: none; opacity: 1; }
  50% { filter: brightness(2) saturate(0); }
  100% { filter: brightness(0); opacity: 0; }
}
