/* ================================================================
   STARTPUP — RETRO FINANCIAL OPERATING SYSTEM
   A self-investing entity. We buy ourselves.
   ================================================================ */

/* --- CUSTOM PROPERTIES ---------------------------------------- */
:root {
  --win-bg: #c0c0c0;
  --win-light: #dfdfdf;
  --win-mid: #bfbfbf;
  --win-dark: #808080;
  --win-darker: #404040;
  --win-shadow: #000;
  --win-titlebar: #000080;
  --win-titlebar-end: #1084d0;
  --win-titlebar-inactive: #808080;
  --win-titlebar-inactive-end: #b4b4b4;

  --term-green: #00ff41;
  --term-amber: #ffb000;
  --term-cyan: #00e5ff;
  --term-white: #e0e0e0;
  --term-bg: #0c0c0c;
  --term-bg-alt: #0a1a0a;

  --profit: #00ff00;
  --loss: #ff3333;
  --alert: #ff0000;
  --highlight: #ffff00;

  --font-terminal: 'VT323', 'Courier New', monospace;
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --ticker-height: 28px;
  --taskbar-height: 36px;
  --ad-height: 32px;
}

/* --- RESET & BASE --------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow: hidden;
  height: 100%;
}

body {
  font-family: var(--font-terminal);
  background: #000;
  color: var(--term-green);
  overflow: hidden;
  height: 100%;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Crect width='2' height='16' fill='white'/%3E%3Crect width='16' height='2' y='7' fill='white'/%3E%3C/svg%3E") 8 8, crosshair;
  user-select: none;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

.hidden { display: none !important; }

::selection {
  background: var(--win-titlebar);
  color: #fff;
}

/* --- CRT OVERLAY ---------------------------------------------- */
#crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

.crt-flicker {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 16, 0);
  animation: crt-flicker 0.15s infinite;
}

.crt-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.5) 100%
  );
}

@keyframes crt-flicker {
  0%   { opacity: 0.27861; }
  5%   { opacity: 0.34769; }
  10%  { opacity: 0.23604; }
  15%  { opacity: 0.90626; }
  20%  { opacity: 0.18128; }
  25%  { opacity: 0.83891; }
  30%  { opacity: 0.65583; }
  35%  { opacity: 0.67807; }
  40%  { opacity: 0.26559; }
  45%  { opacity: 0.84693; }
  50%  { opacity: 0.96019; }
  55%  { opacity: 0.08594; }
  60%  { opacity: 0.20313; }
  65%  { opacity: 0.71988; }
  70%  { opacity: 0.53455; }
  75%  { opacity: 0.37288; }
  80%  { opacity: 0.71428; }
  85%  { opacity: 0.70419; }
  90%  { opacity: 0.7003;  }
  95%  { opacity: 0.36108; }
  100% { opacity: 0.24387; }
}

/* --- GLITCH OVERLAY ------------------------------------------- */
#glitch-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
}

#glitch-overlay.active {
  animation: glitch-block 0.2s steps(3) forwards;
}

@keyframes glitch-block {
  0%   { opacity: 1; background: rgba(255,0,0,0.05); transform: translate(2px, -1px); }
  25%  { opacity: 1; background: rgba(0,255,0,0.05); transform: translate(-3px, 2px); }
  50%  { opacity: 1; background: rgba(0,0,255,0.05); transform: translate(1px, -3px); }
  75%  { opacity: 1; background: rgba(255,0,0,0.03); transform: translate(-2px, 1px); }
  100% { opacity: 0; transform: translate(0); }
}

.glitch-tear {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 255, 65, 0.15);
  transform: translateX(8px);
}

/* --- BOOT SCREEN ---------------------------------------------- */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

#boot-screen.fade-out {
  animation: crt-off 0.6s ease-in forwards;
}

@keyframes crt-off {
  0%   { transform: scale(1, 1); filter: brightness(1); opacity: 1; }
  40%  { transform: scale(1.3, 0.01); filter: brightness(3); opacity: 1; }
  70%  { transform: scale(1.3, 0.01); filter: brightness(5); opacity: 0.7; }
  100% { transform: scale(0, 0); filter: brightness(0); opacity: 0; }
}

#boot-terminal {
  width: 100%;
  max-width: 720px;
  max-height: 70vh;
  overflow-y: auto;
  font-family: var(--font-terminal);
  font-size: 18px;
  line-height: 1.5;
  color: var(--term-green);
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.4);
  scrollbar-width: none;
}

#boot-terminal::-webkit-scrollbar {
  display: none;
}

#boot-output .boot-line {
  white-space: pre-wrap;
  word-break: break-all;
}

#boot-output .boot-line.warning {
  color: var(--term-amber);
  text-shadow: 0 0 6px rgba(255, 176, 0, 0.4);
}

#boot-output .boot-line.error {
  color: var(--alert);
  text-shadow: 0 0 6px rgba(255, 0, 0, 0.4);
}

#boot-output .boot-line.success {
  color: var(--profit);
}

#boot-output .boot-line.cyan {
  color: var(--term-cyan);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}

#boot-output .cursor-blink::after {
  content: '█';
  animation: blink-cursor 0.6s step-end infinite;
}

@keyframes blink-cursor {
  50% { opacity: 0; }
}

/* Boot progress bar */
#boot-progress {
  margin-top: 16px;
}

#boot-progress-track {
  width: 100%;
  height: 20px;
  border: 1px solid var(--term-green);
  background: transparent;
}

#boot-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--term-green);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
  transition: width 0.1s linear;
}

#boot-progress-label {
  text-align: center;
  margin-top: 4px;
  font-size: 14px;
  color: var(--term-green);
}

/* Enter button */
#boot-enter {
  margin-top: 40px;
  font-family: var(--font-pixel);
  font-size: 16px;
  color: #000;
  background: var(--win-bg);
  border: 3px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  padding: 16px 48px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 var(--win-darker),
    2px 2px 0 #000;
  animation: enter-pulse 1.5s ease-in-out infinite;
}

#boot-enter:hover {
  background: #d4d4d4;
}

#boot-enter:active {
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  box-shadow:
    inset 1px 1px 0 var(--win-darker),
    inset -1px -1px 0 #fff;
  transform: translate(1px, 1px);
}

@keyframes enter-pulse {
  0%, 100% { box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--win-darker), 2px 2px 0 #000, 0 0 20px rgba(0,255,65,0.2); }
  50%      { box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--win-darker), 2px 2px 0 #000, 0 0 40px rgba(0,255,65,0.5); }
}

/* --- DESKTOP -------------------------------------------------- */
#desktop {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #008080;
}

#desktop.boot-in {
  animation: crt-on 0.4s ease-out forwards;
}

@keyframes crt-on {
  0%   { transform: scale(0, 0.01); filter: brightness(5); }
  50%  { transform: scale(1.1, 0.01); filter: brightness(3); }
  70%  { transform: scale(1.1, 1.05); filter: brightness(1.5); }
  100% { transform: scale(1, 1); filter: brightness(1); }
}

/* --- DESKTOP BACKGROUND --------------------------------------- */
#desktop-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #001a0a;
  overflow: hidden;
}

.noise-layer {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  animation: noise-drift 0.5s steps(4) infinite;
}

@keyframes noise-drift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, -3%); }
  50%  { transform: translate(1%, 2%); }
  75%  { transform: translate(-1%, 1%); }
  100% { transform: translate(2%, -2%); }
}

.grid-layer {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.video-slot {
  position: absolute;
  bottom: 60px;
  right: 20px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px dashed var(--term-green);
  color: var(--term-green);
  font-family: var(--font-terminal);
  font-size: 12px;
  opacity: 0.4;
}

/* --- TICKER BAR ----------------------------------------------- */
#ticker-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--ticker-height);
  background: #1a0000;
  border-bottom: 2px solid #330000;
  z-index: 900;
  overflow: hidden;
  display: flex;
  align-items: center;
}

#ticker-track {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#ticker-content {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--font-terminal);
  font-size: 16px;
  animation: ticker-scroll 30s linear infinite;
}

#ticker-content .tick-item {
  margin-right: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#ticker-content .tick-symbol {
  color: var(--term-amber);
  font-weight: bold;
}

#ticker-content .tick-price {
  color: var(--term-white);
}

#ticker-content .tick-change.up {
  color: var(--profit);
}

#ticker-content .tick-change.down {
  color: var(--loss);
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- AD BANNERS ----------------------------------------------- */
.ad-banner {
  background: #1a0000;
  border-top: 2px solid #ffb000;
  border-bottom: 2px solid #ffb000;
  padding: 6px 20px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--highlight);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
  z-index: 50;
  overflow: hidden;
}

#ad-banner-top {
  position: fixed;
  top: var(--ticker-height);
  left: 0;
  right: 0;
  height: var(--ad-height);
}

#ad-banner-bottom {
  position: relative;
  margin-top: 1200px;
  width: 100%;
}

#ad-banner-side {
  position: fixed;
  top: calc(var(--ticker-height) + var(--ad-height) + 20px);
  right: 0;
  width: 140px;
  z-index: 50;
  flex-direction: column;
  gap: 12px;
  padding: 12px 8px;
  border-left: 2px solid #ffb000;
  border-top: none;
  border-bottom: none;
  writing-mode: initial;
  text-align: center;
  height: auto;
}

.ad-separator {
  color: var(--alert);
}

.ad-text {
  white-space: nowrap;
}

.blink {
  animation: blink-text 0.8s step-end infinite;
}

@keyframes blink-text {
  50% { opacity: 0; }
}

/* --- DESKTOP ICONS -------------------------------------------- */
#desktop-icons {
  position: absolute;
  top: calc(var(--ticker-height) + var(--ad-height) + 20px);
  left: 20px;
  display: grid;
  grid-template-columns: repeat(2, 90px);
  gap: 8px 12px;
  z-index: 10;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.desktop-icon:hover {
  background: rgba(0, 0, 128, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

.desktop-icon:active,
.desktop-icon.selected {
  background: rgba(0, 0, 128, 0.5);
  border-color: rgba(255, 255, 255, 0.4);
}

.icon-image {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
}

.icon-image svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.6));
}

.icon-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #fff;
  text-align: center;
  text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000;
  word-break: break-all;
  line-height: 1.2;
  max-width: 80px;
}

/* --- IMAGE SLOTS ---------------------------------------------- */
#image-slots {
  position: absolute;
  top: calc(var(--ticker-height) + var(--ad-height) + 20px);
  right: 160px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 5;
}

.image-slot {
  width: 200px;
  height: 140px;
  border: 2px solid rgba(0, 255, 65, 0.2);
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.08);
}

.image-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.1) brightness(0.95);
  transition: filter 0.3s;
}

.image-slot img:hover {
  filter: contrast(1.2) brightness(1.05);
}

/* --- WINDOWS SYSTEM ------------------------------------------- */
.window {
  position: absolute;
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 var(--win-darker);
  display: flex;
  flex-direction: column;
  min-width: 250px;
  min-height: 120px;
}

.window.focused {
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 var(--win-darker),
    4px 4px 0 rgba(0, 0, 0, 0.3);
}

/* Title bar */
.window-titlebar {
  background: linear-gradient(90deg, var(--win-titlebar), var(--win-titlebar-end));
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 4px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  flex-shrink: 0;
}

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

.window:not(.focused) .window-titlebar {
  background: linear-gradient(90deg, var(--win-titlebar-inactive), var(--win-titlebar-inactive-end));
}

.window-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 8px;
}

.window-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.win-btn {
  width: 18px;
  height: 16px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #000;
  padding: 0;
}

.win-btn:active {
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
}

.win-close:hover {
  background: #c0392b;
  color: #fff;
}

/* Menu bar (optional) */
.window-menubar {
  background: var(--win-bg);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 0;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--win-dark);
  flex-shrink: 0;
}

.window-menubar span {
  padding: 2px 8px;
  cursor: default;
  color: #000;
}

.window-menubar span:hover {
  background: var(--win-titlebar);
  color: #fff;
}

/* Window body */
.window-body {
  flex: 1;
  overflow: auto;
  border: 2px solid;
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  margin: 2px;
  background: #fff;
}

/* Resize handle */
.window-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(
    135deg,
    transparent 30%,
    var(--win-dark) 30%,
    var(--win-dark) 40%,
    transparent 40%,
    transparent 50%,
    var(--win-dark) 50%,
    var(--win-dark) 60%,
    transparent 60%,
    transparent 70%,
    var(--win-dark) 70%,
    var(--win-dark) 80%,
    transparent 80%
  );
}

/* --- WINDOW CONTENT: NOTEPAD ---------------------------------- */
.notepad-content {
  background: #fff;
  color: #000;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 8px 12px;
  white-space: pre-wrap;
  min-height: 100%;
}

/* --- WINDOW CONTENT: TERMINAL --------------------------------- */
.terminal-content {
  background: var(--term-bg);
  color: var(--term-green);
  font-family: var(--font-terminal);
  font-size: 16px;
  line-height: 1.4;
  padding: 8px 10px;
  min-height: 100%;
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

.terminal-content .term-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-content .term-line.amber {
  color: var(--term-amber);
  text-shadow: 0 0 4px rgba(255, 176, 0, 0.3);
}

.terminal-content .term-line.red {
  color: var(--alert);
  text-shadow: 0 0 4px rgba(255, 0, 0, 0.3);
}

.terminal-content .term-line.cyan {
  color: var(--term-cyan);
}

.terminal-content .term-cursor::after {
  content: '█';
  animation: blink-cursor 0.6s step-end infinite;
}

/* --- WINDOW CONTENT: SPREADSHEET ------------------------------ */
.spreadsheet-content {
  background: #fff;
  min-height: 100%;
}

.spreadsheet-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.spreadsheet-content th {
  background: var(--win-bg);
  border: 1px solid var(--win-dark);
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  padding: 3px 8px;
  text-align: center;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
}

.spreadsheet-content td {
  border: 1px solid #c0c0c0;
  padding: 3px 8px;
  text-align: right;
  color: #000;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.spreadsheet-content td.label-cell {
  text-align: left;
  font-weight: 600;
  background: #f0f0f0;
}

.spreadsheet-content td.cell-up {
  color: #006600;
  background: #e6ffe6;
}

.spreadsheet-content td.cell-down {
  color: #cc0000;
  background: #ffe6e6;
}

.spreadsheet-content td.cell-flash {
  animation: cell-flash 0.3s ease;
}

@keyframes cell-flash {
  0%   { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

.spreadsheet-header {
  background: var(--win-bg);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #000;
  border-bottom: 1px solid var(--win-dark);
  display: flex;
  align-items: center;
  gap: 4px;
}

.spreadsheet-cell-ref {
  background: #fff;
  border: 1px solid;
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  padding: 1px 4px;
  width: 60px;
  font-size: 11px;
}

.spreadsheet-formula {
  flex: 1;
  background: #fff;
  border: 1px solid;
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  padding: 1px 4px;
  font-size: 11px;
}

/* --- WINDOW CONTENT: CHART ------------------------------------ */
.chart-content {
  background: #0a0a14;
  min-height: 100%;
  padding: 8px;
}

.chart-content canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-header {
  font-family: var(--font-terminal);
  font-size: 14px;
  color: var(--term-green);
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #222;
}

.chart-price {
  font-size: 22px;
  font-weight: bold;
  color: var(--profit);
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

.chart-label {
  color: var(--term-amber);
}

/* --- WINDOW CONTENT: INVEST CTA ------------------------------- */
.invest-content {
  background: var(--term-bg);
  color: var(--term-green);
  font-family: var(--font-terminal);
  font-size: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  text-align: center;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.3);
}

.invest-content .invest-prompt {
  margin-bottom: 24px;
  line-height: 1.6;
}

.invest-btn {
  font-family: var(--font-pixel);
  font-size: 14px;
  padding: 16px 40px;
  background: var(--profit);
  color: #000;
  border: 3px solid;
  border-color: #66ff66 #006600 #006600 #66ff66;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: invest-glow 1s ease-in-out infinite;
}

.invest-btn:hover {
  background: #33ff33;
}

.invest-btn:active {
  border-color: #006600 #66ff66 #66ff66 #006600;
  transform: translate(1px, 1px);
}

@keyframes invest-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 0, 0.4); }
  50%      { box-shadow: 0 0 40px rgba(0, 255, 0, 0.8), 0 0 80px rgba(0, 255, 0, 0.3); }
}

/* --- TASKBAR -------------------------------------------------- */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  background: var(--win-bg);
  border-top: 2px solid;
  border-color: var(--win-light);
  display: flex;
  align-items: center;
  padding: 2px 4px;
  gap: 4px;
  z-index: 1000;
  box-shadow: inset 0 1px 0 #fff;
}

#start-button {
  height: 28px;
  padding: 2px 8px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  box-shadow: inset 1px 1px 0 #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: #000;
}

#start-button:active,
#start-button.active {
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  box-shadow: inset 1px 1px 0 var(--win-darker);
}

.start-logo {
  font-size: 16px;
}

#taskbar-divider {
  width: 2px;
  height: 24px;
  border-left: 1px solid var(--win-dark);
  border-right: 1px solid var(--win-light);
  margin: 0 2px;
}

#taskbar-windows {
  flex: 1;
  display: flex;
  gap: 2px;
  overflow: hidden;
}

.taskbar-btn {
  height: 24px;
  padding: 2px 8px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #000;
}

.taskbar-btn.active {
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  box-shadow: inset 1px 1px 0 var(--win-darker);
  background: #b0b0b0;
}

#taskbar-tray {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 2px solid;
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #000;
  height: 24px;
}

.tray-blink {
  color: var(--profit);
  animation: blink-text 1s step-end infinite;
  font-size: 8px;
}

#taskbar-clock {
  font-variant-numeric: tabular-nums;
}

/* --- START MENU ----------------------------------------------- */
#start-menu {
  position: fixed;
  bottom: var(--taskbar-height);
  left: 4px;
  width: 200px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  box-shadow: inset 1px 1px 0 #fff, 4px 4px 0 rgba(0,0,0,0.3);
  z-index: 1001;
  display: flex;
}

.start-menu-sidebar {
  width: 24px;
  background: var(--win-titlebar);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 4px;
  letter-spacing: 2px;
}

.start-menu-sidebar span {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
}

#start-menu-items {
  flex: 1;
  list-style: none;
  padding: 4px 0;
}

#start-menu-items li {
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

#start-menu-items li:hover {
  background: var(--win-titlebar);
  color: #fff;
}

#start-menu-items li.menu-separator {
  height: 1px;
  background: var(--win-dark);
  margin: 4px 8px;
  padding: 0;
  cursor: default;
}

#start-menu-items li.menu-separator:hover {
  background: var(--win-dark);
  color: #000;
}

.menu-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-icon svg {
  width: 16px;
  height: 16px;
}

/* --- SCROLLBARS ----------------------------------------------- */
.window-body::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.window-body::-webkit-scrollbar-track {
  background: repeating-conic-gradient(var(--win-bg) 0% 25%, var(--win-mid) 0% 50%) 50% / 2px 2px;
}

.window-body::-webkit-scrollbar-thumb {
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
}

.window-body::-webkit-scrollbar-button {
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  width: 16px;
  height: 16px;
}

/* Desktop scrollbar */
#desktop::-webkit-scrollbar {
  width: 16px;
}

#desktop::-webkit-scrollbar-track {
  background: repeating-conic-gradient(var(--win-bg) 0% 25%, var(--win-mid) 0% 50%) 50% / 2px 2px;
}

#desktop::-webkit-scrollbar-thumb {
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
}

/* --- ERROR DIALOG --------------------------------------------- */
.error-dialog {
  text-align: center;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #000;
}

.error-dialog .error-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.error-dialog .error-message {
  margin-bottom: 16px;
  line-height: 1.5;
}

.error-dialog .error-btn {
  padding: 4px 24px;
  background: var(--win-bg);
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  color: #000;
}

.error-dialog .error-btn:active {
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
}

/* --- STATUS BAR (bottom of windows) --------------------------- */
.window-statusbar {
  background: var(--win-bg);
  border-top: 2px solid;
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #000;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.status-section {
  border: 1px solid;
  border-color: var(--win-dark) var(--win-light) var(--win-light) var(--win-dark);
  padding: 0 6px;
}

/* --- SOCIAL BAR ----------------------------------------------- */
#social-bar {
  position: fixed;
  bottom: calc(var(--taskbar-height) + 8px);
  right: 12px;
  z-index: 500;
}

#twitter-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #000;
  border: 2px solid;
  border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
  color: var(--term-green);
  font-family: var(--font-pixel);
  font-size: 9px;
  text-decoration: none;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}

#twitter-link:hover {
  background: #111;
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
}

#twitter-link svg {
  flex-shrink: 0;
}

/* --- UTILITY -------------------------------------------------- */
.text-green  { color: var(--profit); }
.text-red    { color: var(--loss); }
.text-amber  { color: var(--term-amber); }
.text-cyan   { color: var(--term-cyan); }
.text-white  { color: var(--term-white); }

/* --- MISC ANIMATIONS ------------------------------------------ */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Screen tear effect */
.screen-tear {
  position: fixed;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 255, 65, 0.1);
  z-index: 9998;
  pointer-events: none;
  transform: translateX(5px);
  animation: tear-move 0.1s linear;
}

@keyframes tear-move {
  from { transform: translateX(-5px); }
  to   { transform: translateX(5px); }
}

/* Lag simulation overlay */
#lag-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  pointer-events: all;
  cursor: wait;
  display: none;
}

#lag-overlay.active {
  display: block;
}

/* --- RESPONSIVE ----------------------------------------------- */
@media (max-width: 768px) {
  #desktop-icons {
    grid-template-columns: repeat(2, 80px);
    gap: 4px 8px;
  }

  .icon-image { width: 32px; height: 32px; font-size: 26px; }
  .icon-label { font-size: 10px; }

  #ad-banner-side { display: none; }
  #image-slots { display: none; }

  .window {
    min-width: 200px;
  }

  #boot-terminal { font-size: 14px; }
  #boot-enter { font-size: 12px; padding: 12px 32px; }
}
