:root {
  /* BeOS Color Palette */
  --be-blue-light: #99ccff;
  --be-blue: #6699cc;
  --be-blue-dark: #336699;
  --be-blue-darker: #1a4a7a;
  --be-bg: #d4d4d4;
  --be-bg-light: #eeeeee;
  --be-bg-white: #ffffff;
  --be-gray: #a0a0a0;
  --be-gray-dark: #808080;
  --be-gray-darker: #606060;
  --be-text: #000000;
  --be-title-text: #ffffff;
  --be-highlight: #ffcc00;
  --be-selection: #336699;
  --be-border: #336699;
  --be-shadow: rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

body {
  margin: 0;
  padding: 0;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 12px;
  background: var(--be-bg);
  color: var(--be-text);
  overflow: hidden;
  user-select: none;
}

/* Toast Notifications */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.hidden {
  display: none !important;
}

/* ============================================
   BOOT SCREEN - BeOS Style
   ============================================ */
#boot-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease;
}

#boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-content {
  text-align: center;
}

.boot-logo {
  margin-bottom: 40px;
}

.boot-ascii {
  color: var(--be-blue-light);
  font-family: monospace;
  font-size: 14px;
  line-height: 1.2;
  text-shadow: 0 0 10px var(--be-blue);
  margin: 0;
}

.boot-beos-text {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 48px;
  font-weight: bold;
  color: var(--be-blue-light);
  text-shadow:
    0 0 20px var(--be-blue),
    0 0 40px var(--be-blue-dark);
  letter-spacing: 8px;
  margin-top: 20px;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    text-shadow:
      0 0 20px var(--be-blue),
      0 0 40px var(--be-blue-dark);
  }
  50% {
    text-shadow:
      0 0 30px var(--be-blue),
      0 0 60px var(--be-blue-dark),
      0 0 80px var(--be-blue-light);
  }
}

.boot-version {
  font-size: 14px;
  color: var(--be-gray);
  margin-top: 10px;
}

.boot-loading {
  margin-top: 30px;
}

.boot-bar {
  width: 300px;
  height: 8px;
  background: var(--be-gray-darker);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto;
  border: 1px solid var(--be-gray);
}

.boot-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--be-blue-dark), var(--be-blue-light));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.boot-text {
  color: var(--be-gray);
  margin-top: 10px;
  font-size: 11px;
  transition: opacity 0.3s ease;
}

/* ============================================
   DESKTOP - BeOS Replicants Style
   ============================================ */
#desktop {
  position: fixed;
  top: 32px;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    #c4d4e4 0%,
    #d4e4f4 25%,
    #e4f0f8 50%,
    #f0f4f8 75%,
    #f4f8fc 100%
  );
  background-image: url("./assets/beos.jpg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: auto auto;
  overflow: hidden;
}

/* ============================================
   REPLICANTS - BeOS Desktop Icons
   ============================================ */
.replicant {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.replicant:hover {
  background: rgba(102, 153, 204, 0.2);
  transform: translateY(-2px);
}

.replicant:active {
  background: rgba(102, 153, 204, 0.35);
  transform: translateY(0);
}

.replicant:focus-visible {
  outline: 2px solid var(--be-highlight);
  outline-offset: 2px;
}

.replicant .icon {
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  filter: drop-shadow(2px 2px 2px var(--be-shadow));
  transition: transform 0.15s ease, filter 0.15s ease;
}

.replicant:hover .icon {
  transform: scale(1.05);
  filter: drop-shadow(3px 3px 4px var(--be-shadow));
}

.replicant .icon svg {
  width: 100%;
  height: 100%;
}

.replicant .icon-label {
  font-size: 11px;
  text-align: center;
  color: var(--be-text);
  text-shadow: 1px 1px 0 var(--be-bg-white);
  word-wrap: break-word;
  max-width: 70px;
  line-height: 1.2;
  transition: color 0.15s ease;
}

.replicant:hover .icon-label {
  color: var(--be-blue-dark);
}

.replicant.selected {
  background: rgba(51, 102, 153, 0.3);
  border: 2px solid var(--be-blue);
  border-radius: 8px;
}

.replicant.selected .icon-label {
  color: var(--be-blue-dark);
  font-weight: bold;
}

/* BeOS-style Icon Shapes */
.replicant .icon {
  background: linear-gradient(
    135deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 50%,
    var(--be-blue-dark) 100%
  );
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 2px 2px 4px rgba(255, 255, 255, 0.4),
    inset -1px -1px 2px rgba(0, 0, 0, 0.2),
    2px 2px 4px var(--be-shadow);
}

/* ============================================
   WINDOW - BeOS Style with Rounded Corners
   ============================================ */
.window {
  position: absolute;
  background: var(--be-bg-light);
  border: 2px solid;
  border-color: var(--be-gray) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-gray);
  border-radius: 12px;
  box-shadow:
    4px 4px 12px var(--be-shadow),
    inset 1px 1px 0 var(--be-bg-white);
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 150px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.window.opening {
  animation: windowOpen 0.25s ease-out forwards;
}

.window.closing {
  animation: windowClose 0.15s ease-in forwards;
}

@keyframes windowOpen {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes windowClose {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.9);
  }
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
}

/* ============================================
   TITLE BAR - BeOS Blue Gradient
   ============================================ */
.title-bar {
  height: 28px;
  background: linear-gradient(
    180deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 50%,
    var(--be-blue-dark) 100%
  );
  display: flex;
  align-items: center;
  padding: 0 8px;
  cursor: default;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}

.title-bar.inactive {
  background: linear-gradient(
    180deg,
    var(--be-gray) 0%,
    var(--be-gray-dark) 100%
  );
}

.title-bar-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.title-bar-controls {
  display: flex;
  gap: 4px;
}

.title-bar-text {
  font-weight: bold;
  font-size: 12px;
  color: var(--be-title-text);
  text-shadow: 1px 1px 1px var(--be-blue-darker);
  margin-left: 8px;
}

/* ============================================
   WINDOW CONTROLS - BeOS Style (Left Side)
   ============================================ */
.system-menu-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(180deg, #ff6b6b 0%, #c0392b 100%);
  color: white;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 1px 1px 2px rgba(255, 255, 255, 0.4),
    1px 1px 2px var(--be-shadow);
}

.system-menu-btn:active {
  background: linear-gradient(180deg, #c0392b 0%, #a93226 100%);
}

.win-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(
    180deg,
    var(--be-bg-white) 0%,
    var(--be-gray) 100%
  );
  color: var(--be-text);
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 1px 1px 2px rgba(255, 255, 255, 0.5),
    1px 1px 2px var(--be-shadow);
}

.win-btn:active {
  background: linear-gradient(
    180deg,
    var(--be-gray) 0%,
    var(--be-gray-dark) 100%
  );
}

.win-btn:hover {
  background: linear-gradient(
    180deg,
    var(--be-bg-white) 0%,
    var(--be-bg-light) 100%
  );
}

/* ============================================
   MENU BAR - BeOS Style
   ============================================ */
.menu-bar {
  background: var(--be-bg);
  border-bottom: 1px solid var(--be-gray);
  padding: 2px 0;
  display: flex;
  flex-shrink: 0;
}

.menu-item {
  padding: 2px 12px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 4px;
}

.menu-item:hover {
  background: var(--be-selection);
  color: var(--be-title-text);
}

.menu-item u {
  text-decoration: underline;
}

/* ============================================
   WINDOW BODY
   ============================================ */
.window-body {
  flex: 1;
  background: var(--be-bg-light);
  overflow: auto;
  padding: 8px;
}

/* ============================================
   PROGRAM MANAGER - BeOS Style
   ============================================ */
.program-manager {
  width: 320px;
  height: 400px;
  top: 20px;
  left: 20px;
}

.pm-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--be-bg);
}

/* ============================================
   PROGRAM GROUPS - BeOS Style
   ============================================ */
.program-group {
  background: var(--be-bg-light);
  border: 2px solid;
  border-color: var(--be-gray) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-gray);
  border-radius: 8px;
  overflow: hidden;
}

.group-title-bar {
  height: 24px;
  background: linear-gradient(
    180deg,
    var(--be-gray) 0%,
    var(--be-gray-dark) 100%
  );
  display: flex;
  align-items: center;
  padding: 0 6px;
  cursor: default;
}

.group-title-bar .title-bar-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.group-title-bar .title-bar-text {
  font-size: 11px;
  color: var(--be-title-text);
  text-shadow: 1px 1px 1px #000;
  margin-left: 6px;
}

.group-title-bar .win-btn {
  width: 16px;
  height: 16px;
  font-size: 8px;
}

.group-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: var(--be-bg-light);
}

.minimized-group .group-body {
  display: none;
}

.minimized-group .group-title-bar {
  background: linear-gradient(
    180deg,
    var(--be-gray-dark) 0%,
    var(--be-gray-darker) 100%
  );
}

.minimized-group .group-title-bar .win-btn {
  transform: rotate(180deg);
}

/* ============================================
   PROGRAM ICONS - BeOS Replicant Style
   ============================================ */
.program-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 70px;
  padding: 6px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.program-icon:hover {
  background: rgba(102, 153, 204, 0.25);
}

.program-icon:active {
  background: rgba(102, 153, 204, 0.4);
}

.program-icon .icon {
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 2px 2px 4px rgba(255, 255, 255, 0.3),
    inset -1px -1px 2px rgba(0, 0, 0, 0.2),
    2px 2px 3px var(--be-shadow);
}

.program-icon .icon svg {
  width: 100%;
  height: 100%;
}

.program-icon .icon-label {
  font-size: 10px;
  text-align: center;
  color: var(--be-text);
  text-shadow: 1px 1px 0 var(--be-bg-white);
  line-height: 1.2;
}

/* ============================================
   BUTTONS - BeOS Style
   ============================================ */
.win-button {
  padding: 4px 16px;
  border: 2px solid;
  border-color: var(--be-bg-white) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-bg-white);
  border-radius: 6px;
  background: var(--be-bg);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 1px 1px 2px var(--be-shadow);
}

.win-button:active {
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
  background: var(--be-gray);
}

.win-button:focus {
  outline: 1px dotted var(--be-text);
  outline-offset: -4px;
}

.win-button.default {
  background: var(--be-selection);
  color: var(--be-title-text);
}

/* ============================================
   INPUTS - BeOS Style
   ============================================ */
.win-input {
  padding: 4px 8px;
  border: 2px solid;
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
  border-radius: 6px;
  background: var(--be-bg-white);
  font-family: inherit;
  font-size: 12px;
  box-shadow: inset 1px 1px 3px var(--be-shadow);
}

.win-input:focus {
  outline: none;
  border-color: var(--be-blue);
}

.win-textarea {
  padding: 4px 8px;
  border: 2px solid;
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
  border-radius: 6px;
  background: var(--be-bg-white);
  font-family: inherit;
  font-size: 12px;
  resize: none;
  box-shadow: inset 1px 1px 3px var(--be-shadow);
}

.win-textarea:focus {
  outline: none;
  border-color: var(--be-blue);
}

/* ============================================
   OLLAMA WINDOW - BeOS Chat Style
   ============================================ */
#ollama-window {
  width: 600px;
  height: 500px;
  top: 50px;
  left: 100px;
}

.ollama-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--be-bg-light);
  border-radius: 0 0 12px 12px;
}

.ollama-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--be-bg);
  border-bottom: 1px solid var(--be-gray);
  flex-shrink: 0;
}

.ollama-model-select {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ollama-model-select label {
  font-size: 11px;
  font-weight: bold;
  color: var(--be-text);
}

.ollama-model-select select {
  padding: 2px 4px;
  border: 1px solid var(--be-gray);
  border-radius: 4px;
  background: var(--be-bg-white);
  font-family: inherit;
  font-size: 11px;
}

.ollama-search-row {
  display: flex;
  flex: 1;
  gap: 4px;
}

.ollama-search-row .win-input {
  flex: 1;
}

.ollama-search-row .win-button {
  padding: 4px 12px;
  background: linear-gradient(
    180deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 100%
  );
  color: var(--be-title-text);
  border-color: var(--be-blue-light) var(--be-blue-dark) var(--be-blue-dark)
    var(--be-blue-light);
}

.ollama-header {
  padding: 8px;
  background: linear-gradient(
    180deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 100%
  );
  flex-shrink: 0;
}

.ollama-header-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--be-title-text);
  text-shadow: 1px 1px 1px var(--be-blue-darker);
}

.ollama-header-subtitle {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
}

.ollama-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: var(--be-bg-white);
  margin: 8px;
  border-radius: 8px;
  border: 1px solid var(--be-gray);
  box-shadow: inset 1px 1px 3px var(--be-shadow);
}

.ollama-results .message {
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  background: var(--be-bg);
}

.ollama-results .message.user {
  background: var(--be-blue-light);
  color: var(--be-blue-darker);
}

.ollama-results .message.assistant {
  background: var(--be-bg-light);
  border: 1px solid var(--be-gray);
}

.ollama-results .cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--be-blue);
  animation: blink 1s infinite;
  vertical-align: middle;
  border-radius: 2px;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

.ollama-status {
  padding: 4px 8px;
  font-size: 10px;
  color: var(--be-gray-dark);
  background: var(--be-bg);
  border-top: 1px solid var(--be-gray);
  flex-shrink: 0;
}

.ollama-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--be-gray-dark);
}

.ollama-welcome-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  background: linear-gradient(
    135deg,
    var(--be-blue-light),
    var(--be-blue-dark)
  );
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 2px 2px 4px rgba(255, 255, 255, 0.4),
    4px 4px 8px var(--be-shadow);
}

.ollama-welcome h2 {
  font-size: 16px;
  color: var(--be-blue-dark);
  margin: 0 0 8px 0;
}

.ollama-welcome p {
  font-size: 12px;
  margin: 0;
}

.ollama-error {
  color: #c0392b;
  padding: 8px;
  background: #fdf2f2;
  border: 1px solid #e74c3c;
  border-radius: 6px;
  margin: 8px;
}

/* ============================================
   NOTEPAD WINDOW - BeOS Style
   ============================================ */
#notepad-window {
  width: 500px;
  height: 400px;
  top: 80px;
  left: 150px;
}

.notepad-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--be-bg-light);
  border-radius: 0 0 12px 12px;
}

.notepad-body .win-textarea {
  flex: 1;
  margin: 8px;
  border-radius: 8px;
  font-family: Monaco, monospace;
  font-size: 12px;
  line-height: 1.4;
}

/* ============================================
   CALCULATOR WINDOW - BeOS Style
   ============================================ */
#calculator-window {
  width: 240px;
  height: 340px;
  top: 120px;
  left: 200px;
}

.calc-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px;
  background: var(--be-bg-light);
  border-radius: 0 0 12px 12px;
  gap: 8px;
}

.calc-display {
  background: var(--be-bg-white);
  border: 2px solid;
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
  border-radius: 6px;
  padding: 8px;
  text-align: right;
  font-size: 24px;
  font-family: Monaco, monospace;
  box-shadow: inset 2px 2px 4px var(--be-shadow);
  color: var(--be-blue-dark);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex: 1;
}

.calc-btn {
  border: 2px solid;
  border-color: var(--be-bg-white) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-bg-white);
  border-radius: 8px;
  background: var(--be-bg);
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 2px 2px 4px var(--be-shadow);
  transition: all 0.1s ease;
}

.calc-btn:hover {
  background: var(--be-bg-light);
}

.calc-btn:active {
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
  box-shadow: inset 1px 1px 2px var(--be-shadow);
}

.calc-btn.op {
  background: linear-gradient(
    180deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 100%
  );
  color: var(--be-title-text);
}

.calc-btn.equals {
  background: linear-gradient(180deg, var(--be-highlight) 0%, #e6b800 100%);
}

.calc-btn.wide {
  grid-column: span 2;
}

/* ============================================
   MINESWEEPER WINDOW - BeOS Style
   ============================================ */
#minesweeper-window {
  width: 280px;
  height: 360px;
  top: 160px;
  left: 250px;
}

.mine-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px;
  background: var(--be-bg-light);
  border-radius: 0 0 12px 12px;
  gap: 8px;
}

.mine-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: linear-gradient(
    180deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 100%
  );
  border-radius: 6px;
}

.mine-counter,
.mine-timer {
  background: var(--be-bg-white);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: Monaco, monospace;
  font-size: 16px;
  font-weight: bold;
  color: #c0392b;
  min-width: 50px;
  text-align: center;
  box-shadow: inset 1px 1px 3px var(--be-shadow);
}

.mine-face-btn {
  width: 36px;
  height: 36px;
  border: 2px solid;
  border-color: var(--be-bg-white) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-bg-white);
  border-radius: 8px;
  background: var(--be-bg);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 4px var(--be-shadow);
}

.mine-face-btn:active {
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
}

.mine-grid {
  display: grid;
  gap: 2px;
  background: var(--be-gray);
  padding: 4px;
  border-radius: 8px;
  border: 2px solid;
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
  box-shadow: inset 2px 2px 4px var(--be-shadow);
}

.mine-cell {
  width: 24px;
  height: 24px;
  border: 2px solid;
  border-color: var(--be-bg-white) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-bg-white);
  border-radius: 4px;
  background: var(--be-bg);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1px 1px 2px var(--be-shadow);
}

.mine-cell:hover:not(.revealed):not(.flagged) {
  background: var(--be-bg-light);
}

.mine-cell:active:not(.revealed):not(.flagged) {
  border-color: var(--be-gray-dark);
  box-shadow: none;
}

.mine-cell.revealed {
  border: none;
  background: var(--be-bg-light);
  border-radius: 2px;
  box-shadow: none;
}

.mine-cell.exploded {
  background: #e74c3c;
}

.mine-cell.flagged {
  background: var(--be-highlight);
}

.mine-cell[data-num="1"] {
  color: #0000ff;
}
.mine-cell[data-num="2"] {
  color: #008000;
}
.mine-cell[data-num="3"] {
  color: #ff0000;
}
.mine-cell[data-num="4"] {
  color: #000080;
}
.mine-cell[data-num="5"] {
  color: #800000;
}
.mine-cell[data-num="6"] {
  color: #008080;
}
.mine-cell[data-num="7"] {
  color: #000000;
}
.mine-cell[data-num="8"] {
  color: #808080;
}

/* ============================================
   DIALOGS - BeOS Style
   ============================================ */
.dialog {
  width: 360px;
  min-height: 200px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 16px;
}

.dialog-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--be-bg-light);
  border-radius: 0 0 16px 16px;
}

.dialog-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-top: 8px;
}

#about-dialog {
  width: 400px;
  min-height: 280px;
}

.about-body {
  align-items: center;
}

.about-icon-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.about-icon-row svg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 4px 4px 8px var(--be-shadow);
}

.about-text {
  font-size: 12px;
  line-height: 1.5;
}

.about-text strong {
  font-size: 14px;
  color: var(--be-blue-dark);
}

.about-separator {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--be-blue), transparent);
  border-radius: 1px;
}

.about-memory {
  font-size: 11px;
  color: var(--be-gray-dark);
  text-align: center;
}

/* ============================================
   DESKBAR - BeOS Style (Bottom)
   ============================================ */
.win31-footer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(
    180deg,
    var(--be-gray-dark) 0%,
    var(--be-gray) 100%
  );
  border-bottom: 2px solid;
  border-color: var(--be-gray-darker) var(--be-gray) var(--be-bg-white)
    var(--be-gray);
  display: flex;
  align-items: center;
  padding: 0 4px;
  z-index: 9999;
  box-shadow: inset 0 -1px 0 var(--be-bg-white);
}

.win31-footer-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.start-button {
  height: 24px;
  padding: 0 12px;
  border: 2px solid;
  border-color: var(--be-bg-white) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-bg-white);
  border-radius: 8px;
  background: linear-gradient(
    180deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 100%
  );
  color: var(--be-title-text);
  font-weight: bold;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 1px 1px 2px var(--be-shadow);
}

.start-button:active {
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
}

.start-button:hover {
  background: linear-gradient(
    180deg,
    var(--be-bg-white) 0%,
    var(--be-blue-light) 100%
  );
  color: var(--be-blue-dark);
}

.start-button .beos-icon {
  width: 16px;
  height: 16px;
  background: linear-gradient(
    135deg,
    var(--be-blue-light),
    var(--be-blue-dark)
  );
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: var(--be-title-text);
}

.win31-footer-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  overflow: hidden;
}

.win31-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
}

.tray-clock {
  font-size: 11px;
  font-weight: bold;
  color: var(--be-title-text);
  text-shadow: 1px 1px 1px var(--be-blue-darker);
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ============================================
   TASKBAR ITEMS (Window buttons in deskbar)
   ============================================ */
.taskbar-item {
  height: 24px;
  min-width: 120px;
  max-width: 160px;
  padding: 0 8px;
  border: 2px solid;
  border-color: var(--be-bg-white) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-bg-white);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--be-bg-light) 0%, var(--be-bg) 100%);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 1px 1px 2px var(--be-shadow);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskbar-item:hover {
  background: linear-gradient(
    180deg,
    var(--be-bg-white) 0%,
    var(--be-bg-light) 100%
  );
}

.taskbar-item:active {
  border-color: var(--be-gray-dark) var(--be-bg-white) var(--be-bg-white)
    var(--be-gray-dark);
}

.taskbar-item.active {
  background: linear-gradient(
    180deg,
    var(--be-blue-light) 0%,
    var(--be-blue) 100%
  );
  color: var(--be-title-text);
  border-color: var(--be-blue-light) var(--be-blue-dark) var(--be-blue-dark)
    var(--be-blue-light);
}

.taskbar-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.taskbar-item .icon svg {
  width: 100%;
  height: 100%;
}

/* ============================================
   MINIMIZED TRAY
   ============================================ */
#minimized-tray {
  display: none;
}

.minimized-icon {
  width: 48px;
  height: 48px;
  padding: 4px;
  border-radius: 8px;
  background: var(--be-bg);
  border: 2px solid var(--be-gray);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 4px var(--be-shadow);
}

.minimized-icon:hover {
  background: var(--be-bg-light);
  border-color: var(--be-blue);
}

.minimized-icon:active {
  border-color: var(--be-gray-dark);
}

.minimized-icon svg {
  width: 32px;
  height: 32px;
}

/* ============================================
   DROPDOWN MENU - BeOS Style
   ============================================ */
.dropdown-menu {
  position: fixed;
  background: var(--be-bg-light);
  border: 2px solid;
  border-color: var(--be-gray) var(--be-gray-dark) var(--be-gray-dark)
    var(--be-gray);
  border-radius: 8px;
  box-shadow: 4px 4px 12px var(--be-shadow);
  padding: 4px 0;
  min-width: 180px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 999999;
  animation: dropdownOpen 0.15s ease-out;
}

@keyframes dropdownOpen {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 6px 16px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 4px;
  margin: 0 4px;
  transition: background 0.1s ease, color 0.1s ease;
}

.dropdown-item:hover {
  background: var(--be-selection);
  color: var(--be-title-text);
}

.dropdown-item:focus-visible {
  outline: 2px solid var(--be-highlight);
  outline-offset: -2px;
}

.dropdown-item.disabled {
  color: var(--be-gray);
  cursor: default;
}

.dropdown-item.disabled:hover {
  background: none;
  color: var(--be-gray);
}

.shutdown-item {
  background: #c0392b;
  color: #fff !important;
  font-weight: bold;
  border-radius: 4px;
  margin: 4px;
  border: 2px solid #a93226;
}

.shutdown-item:hover {
  background: #e74c3c;
  border-color: #c0392b;
}

.shutdown-item:active {
  background: #a93226;
}

.dropdown-separator {
  height: 1px;
  background: var(--be-gray);
  margin: 4px 8px;
}

.waiting,
.waiting * {
  cursor: wait !important;
}

/* ============================================
   RESIZE HANDLE
   ============================================ */
.window .resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  background: linear-gradient(135deg, transparent 50%, var(--be-gray) 50%);
  border-radius: 0 0 12px 0;
}

/* ============================================
   SCROLLBARS - BeOS Style
   ============================================ */
.ollama-results::-webkit-scrollbar,
.win-textarea::-webkit-scrollbar {
  width: 14px;
}

.ollama-results::-webkit-scrollbar-track,
.win-textarea::-webkit-scrollbar-track {
  background: var(--be-bg);
  border-radius: 7px;
  border: 1px solid var(--be-gray);
}

.ollama-results::-webkit-scrollbar-thumb,
.win-textarea::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    var(--be-gray) 0%,
    var(--be-gray-dark) 100%
  );
  border-radius: 7px;
  border: 2px solid var(--be-bg);
}

.ollama-results::-webkit-scrollbar-button,
.win-textarea::-webkit-scrollbar-button {
  background: var(--be-bg);
  border-radius: 4px;
  border: 1px solid var(--be-gray);
  width: 12px;
  height: 12px;
}

/* ============================================
   FOOTER LINKS
   ============================================ */
.win31-footer a {
  color: var(--be-title-text);
  text-decoration: none;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

.win31-footer a:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   SELECTION HIGHLIGHT
   ============================================ */
::selection {
  background: var(--be-selection);
  color: var(--be-title-text);
}

/* ============================================
   ACCESSIBILITY - Screen Reader Only
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for keyboard navigation */
.replicant:focus-visible,
.program-icon:focus-visible,
.menu-item:focus-visible,
.win-button:focus-visible,
.calc-btn:focus-visible,
.mine-cell:focus-visible,
.taskbar-item:focus-visible {
  outline: 2px solid var(--be-highlight);
  outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--be-blue-dark);
  color: var(--be-title-text);
  padding: 8px 16px;
  z-index: 100000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .boot-bar-fill {
    transition: none;
  }
  
  .replicant:hover,
  .program-icon:hover {
    background: transparent;
  }
  
  .win-btn:hover {
    background: linear-gradient(
      180deg,
      var(--be-bg-white) 0%,
      var(--be-gray) 100%
    );
  }
}

/* ============================================
   RESPONSIVE DESIGN - Tablet (768px - 1024px)
   ============================================ */
@media screen and (max-width: 1024px) {
  .program-manager {
    width: 280px;
    height: 350px;
  }
  
  .program-icon {
    width: 60px;
    padding: 4px;
  }
  
  .program-icon .icon {
    width: 28px;
    height: 28px;
  }
  
  .replicant {
    width: 70px;
    padding: 6px;
  }
  
  .replicant .icon {
    width: 40px;
    height: 40px;
  }
  
  .replicant .icon-label {
    font-size: 10px;
  }
  
  #ollama-window {
    width: 500px;
    height: 450px;
    top: 40px;
    left: 50px;
  }
  
  #notepad-window {
    width: 420px;
    height: 350px;
  }
  
  .boot-ascii {
    font-size: 10px;
  }
  
  .boot-beos-text {
    font-size: 36px;
  }
}

/* ============================================
   RESPONSIVE DESIGN - Mobile (< 768px)
   ============================================ */
@media screen and (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  #desktop {
    top: 40px;
  }
  
  /* Hide desktop icons on mobile, show simplified view */
  .replicant:not(#replicant-panda) {
    width: 60px;
    padding: 4px;
  }
  
  .replicant .icon {
    width: 36px;
    height: 36px;
  }
  
  .replicant .icon-label {
    font-size: 9px;
    max-width: 56px;
  }
  
  /* Adjust icon positions for mobile */
  #replicant-ollama { top: 10px; left: 10px; }
  #replicant-notepad { top: 90px; left: 10px; }
  #replicant-calculator { top: 170px; left: 10px; }
  #replicant-minesweeper { top: 250px; left: 10px; }
  #replicant-quarto { top: 330px; left: 10px; }
  #replicant-biorhythm { top: 410px; left: 10px; }
  
  /* Program Manager takes full screen on mobile */
  .program-manager {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
    z-index: 1000;
  }
  
  /* Windows default to larger size on mobile */
  .window {
    min-width: 280px;
    min-height: 200px;
  }
  
  #ollama-window {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 60px) !important;
    top: 40px !important;
    left: 10px !important;
    max-width: 600px;
  }
  
  #notepad-window {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 60px) !important;
    top: 40px !important;
    left: 10px !important;
  }
  
  #calculator-window {
    width: 200px !important;
    height: 280px !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
  }
  
  #minesweeper-window {
    width: 260px !important;
    height: 320px !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
  }
  
  .calc-display {
    font-size: 20px;
  }
  
  .calc-btn {
    font-size: 12px;
  }
  
  /* Taskbar on mobile */
  .win31-footer {
    height: 40px;
  }
  
  .taskbar-item {
    min-width: 80px;
    max-width: 100px;
    font-size: 10px;
  }
  
  /* Dialog centered on mobile */
  .dialog {
    width: calc(100vw - 40px) !important;
    max-width: 360px;
  }
  
  /* Boot screen text */
  .boot-ascii {
    font-size: 7px;
    line-height: 1.1;
  }
  
  .boot-beos-text {
    font-size: 28px;
    letter-spacing: 4px;
  }
  
  .boot-bar {
    width: 200px;
  }
  
  /* About dialog on mobile */
  #about-dialog {
    width: calc(100vw - 40px) !important;
    max-width: 400px;
  }
  
  .about-icon-row {
    flex-direction: column;
    text-align: center;
  }
  
  /* Menu bar items */
  .menu-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .menu-item {
    padding: 4px 8px;
    font-size: 11px;
  }
  
  /* Program groups on mobile */
  .group-body {
    gap: 6px;
    padding: 6px;
  }
  
  .program-icon {
    width: 55px;
    padding: 4px;
  }
  
  .program-icon .icon {
    width: 24px;
    height: 24px;
  }
  
  .program-icon .icon-label {
    font-size: 9px;
  }
  
  /* Hide some replicants on very small screens */
  #replicant-biorhythm {
    display: none;
  }
}

/* ============================================
   RESPONSIVE DESIGN - Extra Small (< 480px)
   ============================================ */
@media screen and (max-width: 480px) {
  .boot-logo {
    margin-bottom: 20px;
  }
  
  .boot-ascii {
    display: none;
  }
  
  .boot-beos-text {
    font-size: 24px;
    letter-spacing: 2px;
  }
  
  .replicant {
    width: 52px;
    padding: 3px;
  }
  
  .replicant .icon {
    width: 32px;
    height: 32px;
  }
  
  .replicant .icon-label {
    font-size: 8px;
    max-width: 48px;
  }
  
  #replicant-ollama { top: 8px; left: 8px; }
  #replicant-notepad { top: 80px; left: 8px; }
  #replicant-calculator { top: 152px; left: 8px; }
  #replicant-minesweeper { top: 224px; left: 8px; }
  #replicant-quarto { top: 296px; left: 8px; }
  
  .start-button {
    padding: 0 8px;
    font-size: 10px;
  }
  
  .start-button span:last-child {
    display: none;
  }
  
  /* Stack calculator buttons */
  .calc-buttons {
    gap: 4px;
  }
  
  /* Minesweeper smaller cells */
  .mine-cell {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
  
  .mine-face-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .mine-counter,
  .mine-timer {
    font-size: 12px;
    padding: 2px 4px;
    min-width: 40px;
  }
  
  /* Ollama toolbar responsive */
  .ollama-toolbar {
    flex-wrap: wrap;
  }
  
  .ollama-model-select {
    width: 100%;
  }
  
  .ollama-search-row {
    width: 100%;
  }
}

/* ============================================
   HIGH CONTRAST MODE SUPPORT
   ============================================ */
@media (prefers-contrast: high) {
  :root {
    --be-blue-light: #ffffff;
    --be-blue: #0000ff;
    --be-blue-dark: #0000aa;
    --be-bg: #ffffff;
    --be-bg-light: #ffffff;
    --be-text: #000000;
    --be-title-text: #ffffff;
    --be-gray: #808080;
    --be-gray-dark: #000000;
    --be-border: #000000;
    --be-shadow: none;
  }
  
  .window {
    border-width: 3px;
  }
  
  .win-button,
  .calc-btn,
  .mine-cell {
    border-width: 3px;
  }
}

/* ============================================
   LANDSCAPE ORIENTATION ON MOBILE
   ============================================ */
@media screen and (max-height: 500px) and (orientation: landscape) {
  #desktop {
    top: 28px;
  }
  
  .replicant {
    width: 50px;
    padding: 2px;
  }
  
  .replicant .icon {
    width: 28px;
    height: 28px;
  }
  
  .replicant .icon-label {
    display: none;
  }
  
  .win31-footer {
    height: 28px;
  }
  
  .taskbar-item {
    height: 20px;
  }
  
  .start-button {
    height: 20px;
    padding: 0 6px;
  }
}

/* ============================================
   CLIPPY ASSISTANT
   ============================================ */
.clippy {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
  animation: clippyAppear 0.4s ease;
}

.clippy.hidden {
  display: none !important;
}

.clippy-body {
  cursor: grab;
  animation: clippyBounce 2s ease-in-out infinite;
  filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
}

.clippy-body:hover {
  animation: none;
  transform: scale(1.05);
}

.clippy-speech {
  background: #fffef0;
  border: 2px solid #333;
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 250px;
  position: relative;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.2);
  animation: speechAppear 0.3s ease;
}

.clippy-speech::before {
  content: "";
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid #333;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.clippy-speech::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid #fffef0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.clippy-content {
  font-size: 12px;
  color: #333;
  line-height: 1.4;
}

.clippy-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #c0392b;
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clippy-close:hover {
  background: #e74c3c;
}

@keyframes clippyAppear {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.5);
  }
  50% {
    transform: translateY(-10px) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes clippyBounce {
  0%, 100% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-8px);
  }
  75% {
    transform: translateY(4px);
  }
}

@keyframes speechAppear {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes clippyWave {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-15deg);
  }
  75% {
    transform: rotate(15deg);
  }
}

.clippy.waving .clippy-body {
  animation: clippyWave 0.5s ease-in-out 3;
}
