@font-face {
  font-family: 'W95';
  src: local('Tahoma'), local('Arial');
}

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

html, body, #root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Tahoma', 'Arial', sans-serif;
  font-size: 11px;
  user-select: none;
}

:root {
  --win-bg: #c0c0c0;
  --win-dark: #808080;
  --win-darker: #404040;
  --win-light: #dfdfdf;
  --win-white: #ffffff;
  --win-title: #000080;
  --win-title-inactive: #808080;
  --win-desktop: #008080;
  --win-title-text: #ffffff;
}

.desktop {
  width: 100%;
  height: 100%;
  background: var(--win-desktop);
  position: relative;
  overflow: hidden;
}

.desktop-pattern {
  width: 100%;
  height: calc(100% - 28px);
  position: relative;
  background: 
    linear-gradient(135deg, #007070 25%, transparent 25%) -10px 0,
    linear-gradient(225deg, #007070 25%, transparent 25%) -10px 0,
    linear-gradient(315deg, #007070 25%, transparent 25%),
    linear-gradient(45deg, #007070 25%, transparent 25%);
  background-size: 20px 20px;
  background-color: #008080;
}

.outset {
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
}

.inset {
  border-top: 2px solid var(--win-darker);
  border-left: 2px solid var(--win-darker);
  border-bottom: 2px solid var(--win-white);
  border-right: 2px solid var(--win-white);
}

/* Taskbar */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  display: flex;
  align-items: center;
  padding: 2px;
  z-index: 9999;
}

.start-button {
  height: 22px;
  padding: 1px 6px;
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-weight: bold;
  font-size: 11px;
  font-family: 'Tahoma', sans-serif;
}

.start-button:active, .start-button.active {
  border-top: 2px solid var(--win-darker);
  border-left: 2px solid var(--win-darker);
  border-bottom: 2px solid var(--win-white);
  border-right: 2px solid var(--win-white);
}

.taskbar-windows {
  flex: 1;
  display: flex;
  gap: 2px;
  padding: 0 4px;
  overflow: hidden;
}

.taskbar-btn {
  height: 22px;
  min-width: 100px;
  max-width: 160px;
  padding: 1px 6px;
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
  cursor: pointer;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Tahoma', sans-serif;
}

.taskbar-btn.active {
  border-top: 2px solid var(--win-darker);
  border-left: 2px solid var(--win-darker);
  border-bottom: 2px solid var(--win-white);
  border-right: 2px solid var(--win-white);
  background: #b0b0b0;
}

.system-tray {
  height: 22px;
  padding: 1px 8px;
  border-top: 2px solid var(--win-darker);
  border-left: 2px solid var(--win-darker);
  border-bottom: 2px solid var(--win-white);
  border-right: 2px solid var(--win-white);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

/* Windows */
.win-window {
  position: absolute;
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 100px;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.3);
}

.win-titlebar {
  height: 18px;
  background: linear-gradient(90deg, var(--win-title), #1084d0);
  display: flex;
  align-items: center;
  padding: 1px 2px;
  cursor: move;
  flex-shrink: 0;
}

.win-titlebar.inactive {
  background: linear-gradient(90deg, var(--win-title-inactive), #b0b0b0);
}

.win-titlebar-text {
  color: var(--win-title-text);
  font-size: 11px;
  font-weight: bold;
  padding-left: 4px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-titlebar-buttons {
  display: flex;
  gap: 2px;
}

.win-titlebar-btn {
  width: 16px;
  height: 14px;
  background: var(--win-bg);
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 9px;
  font-weight: bold;
  line-height: 1;
}

.win-titlebar-btn:active {
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-white);
  border-right: 1px solid var(--win-white);
}

.win-content {
  flex: 1;
  overflow: auto;
  margin: 2px;
}

/* Start Menu */
.start-menu {
  position: fixed;
  bottom: 28px;
  left: 0;
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
  display: flex;
  z-index: 10000;
  width: 240px;
  box-shadow: 2px -2px 0px rgba(0,0,0,0.3);
}

.start-menu-sidebar {
  width: 24px;
  background: linear-gradient(0deg, var(--win-title), #1084d0);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
}

.start-menu-sidebar-text {
  color: white;
  font-size: 14px;
  font-weight: bold;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 2px;
}

.start-menu-items {
  flex: 1;
  padding: 2px 0;
}

.start-menu-item {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11px;
}

.start-menu-item:hover {
  background: var(--win-title);
  color: white;
}

.start-menu-divider {
  height: 1px;
  margin: 2px 4px;
  border-top: 1px solid var(--win-dark);
  border-bottom: 1px solid var(--win-white);
}

/* Desktop Icons */
.desktop-icon {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 4px;
  text-align: center;
}

.desktop-icon:hover .desktop-icon-label {
  background: var(--win-title);
  color: white;
}

.desktop-icon-img {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  image-rendering: pixelated;
}

.desktop-icon-label {
  color: white;
  font-size: 11px;
  margin-top: 2px;
  padding: 1px 2px;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.8);
  word-break: break-all;
}

/* Terminal */
.terminal {
  background: #0a0a0a;
  color: #00ff00;
  font-family: 'IBM Plex Mono', 'VT323', 'Courier New', monospace;
  font-size: 13px;
  padding: 8px;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.4;
}

.terminal .cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #00ff00;
  animation: blink 0.6s step-end infinite;
}

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

/* BSOD */
.bsod {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #0000aa;
  color: white;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 40px;
  line-height: 1.6;
  cursor: pointer;
}

.bsod-inner {
  max-width: 640px;
  text-align: center;
}

.bsod-title {
  background: #a0a0a0;
  color: #0000aa;
  padding: 2px 12px;
  display: inline-block;
  margin-bottom: 20px;
  font-weight: bold;
}

/* Right-click menu */
.context-menu {
  position: fixed;
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
  z-index: 10001;
  min-width: 160px;
  padding: 2px 0;
}

.context-menu-item {
  padding: 4px 20px;
  cursor: pointer;
  font-size: 11px;
}

.context-menu-item:hover {
  background: var(--win-title);
  color: white;
}

.context-menu-divider {
  height: 1px;
  margin: 2px 4px;
  border-top: 1px solid var(--win-dark);
  border-bottom: 1px solid var(--win-white);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--win-dark);
  background: white;
  padding: 24px;
  text-align: center;
  margin: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.upload-zone.dragover {
  background: #e8e8ff;
  border-color: var(--win-title);
}

/* Win95 button */
.win-btn {
  padding: 3px 16px;
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
  cursor: pointer;
  font-size: 11px;
  font-family: 'Tahoma', sans-serif;
}

.win-btn:active {
  border-top: 2px solid var(--win-darker);
  border-left: 2px solid var(--win-darker);
  border-bottom: 2px solid var(--win-white);
  border-right: 2px solid var(--win-white);
}

.win-btn:disabled {
  color: #808080;
  cursor: default;
}

/* My Computer */
.drive-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.drive-item:hover {
  background: var(--win-title);
  color: white;
}

/* Winamp */
.winamp {
  background: #232323;
  color: #00ff00;
  font-family: 'VT323', monospace;
  font-size: 12px;
}

.winamp-display {
  background: #000;
  color: #00ff00;
  padding: 4px;
  margin: 4px;
  border: 1px inset #555;
}

/* Paint */
.paint-toolbar {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--win-bg);
  border-bottom: 1px solid var(--win-dark);
}

/* WAT Editor */
.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 3px 4px;
  background: var(--win-bg);
  border-bottom: 1px solid var(--win-dark);
  align-items: center;
  flex-wrap: wrap;
}

.code-editor-wrap {
  flex: 1;
  display: flex;
  overflow: auto;
  background: #1e1e1e;
  min-height: 0;
}

.line-numbers {
  padding: 4px 0;
  background: #1a1a2e;
  color: #555570;
  text-align: right;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  padding-right: 8px;
  padding-left: 8px;
  user-select: none;
  min-width: 36px;
  border-right: 1px solid #333;
}

.code-textarea {
  flex: 1;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  border: none;
  outline: none;
  padding: 4px 8px;
  resize: none;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
  min-height: 0;
}

.code-textarea::selection {
  background: #264f78;
}

.editor-output {
  width: 240px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--win-dark);
}

/* WASM Runner */
.runner-controls {
  padding: 6px 8px;
  background: var(--win-bg);
  border-bottom: 1px solid var(--win-dark);
}

.runner-input {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  padding: 2px 4px;
  border: 2px inset var(--win-dark);
  background: white;
  width: 120px;
}

/* Scrollbar styling */
.win-content::-webkit-scrollbar,
.terminal::-webkit-scrollbar,
.code-textarea::-webkit-scrollbar,
.code-editor-wrap::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.win-content::-webkit-scrollbar-track,
.terminal::-webkit-scrollbar-track,
.code-textarea::-webkit-scrollbar-track,
.code-editor-wrap::-webkit-scrollbar-track {
  background: var(--win-bg);
  border: 1px solid var(--win-dark);
}

.win-content::-webkit-scrollbar-thumb,
.terminal::-webkit-scrollbar-thumb,
.code-textarea::-webkit-scrollbar-thumb,
.code-editor-wrap::-webkit-scrollbar-thumb {
  background: var(--win-bg);
  border-top: 2px solid var(--win-white);
  border-left: 2px solid var(--win-white);
  border-bottom: 2px solid var(--win-darker);
  border-right: 2px solid var(--win-darker);
}

/* Mobile warning */
.mobile-warning {
  display: none;
}

@media (max-width: 800px) {
  .mobile-warning {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--win-desktop);
    color: white;
    font-size: 16px;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 40px;
    text-align: center;
    flex-direction: column;
    gap: 16px;
    font-family: 'Tahoma', sans-serif;
  }
  .mobile-warning-icon {
    font-size: 64px;
  }
}