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

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

body {
  font-family: 'Tahoma', 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #3a6d3a 0%, #5a9a5a 20%, #78b478 40%, #87ceeb 60%, #6db3d6 80%, #4a90b8 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* XP Title Bar */
.xp-titlebar {
  background: linear-gradient(180deg, #0a246a 0%, #3a6ea5 8%, #4a86c8 20%, #3a6ea5 50%, #225ea8 80%, #0a246a 100%);
  border-radius: 8px 8px 0 0;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  color: white;
  font-size: 13px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
  min-height: 30px;
}

.xp-titlebar-btn {
  width: 21px;
  height: 21px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin-left: 2px;
  cursor: default;
  border: 1px solid rgba(255,255,255,0.3);
}

.xp-btn-minimize {
  background: linear-gradient(180deg, #3c8ee8 0%, #2568c4 100%);
}
.xp-btn-maximize {
  background: linear-gradient(180deg, #3c8ee8 0%, #2568c4 100%);
}
.xp-btn-close {
  background: linear-gradient(180deg, #e88c6c 0%, #c4442a 100%);
}

/* XP Window Body */
.xp-window {
  background: #ece9d8;
  border: 2px solid #0a246a;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 2px 4px 16px rgba(0,0,0,0.4);
}

/* XP Button */
.xp-button {
  background: linear-gradient(180deg, #fff 0%, #ece9d8 45%, #d6d0c4 100%);
  border: 1px solid #003c74;
  border-radius: 3px;
  padding: 4px 16px;
  font-family: 'Tahoma', 'Segoe UI', sans-serif;
  font-size: 12px;
  cursor: pointer;
  color: #000;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 -1px 0 rgba(0,0,0,0.1) inset;
  transition: all 0.1s;
}
.xp-button:hover {
  background: linear-gradient(180deg, #fff 0%, #e8e4d8 45%, #d0cab8 100%);
}
.xp-button:active {
  background: linear-gradient(180deg, #d0cab8 0%, #ece9d8 100%);
  box-shadow: 1px 1px 2px rgba(0,0,0,0.2) inset;
}

/* Notepad Textarea */
.notepad-textarea {
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: 14px;
  background: #fff;
  border: 2px solid #7f9db9;
  border-top-color: #a0a0a0;
  border-left-color: #a0a0a0;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.15);
  resize: vertical;
  outline: none;
  padding: 4px 6px;
  width: 100%;
  min-height: 120px;
}
.notepad-textarea:focus {
  border-color: #316ac5;
}

/* Terminal Panel */
.terminal-panel {
  background: #0c0c0c;
  border: 2px solid #333;
  border-radius: 4px;
  font-family: 'VT323', 'Courier New', monospace;
  color: #33ff33;
  padding: 12px;
  box-shadow: inset 0 0 30px rgba(0, 255, 0, 0.03);
}

/* Byte grid */
.byte-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  border: 1px solid #1a3a1a;
  transition: all 0.3s ease;
  cursor: crosshair;
}
.byte-cell:hover, .byte-cell.highlighted {
  background: rgba(51, 255, 51, 0.2);
  border-color: #33ff33;
  transform: scale(1.1);
  z-index: 10;
}

.byte-pair-a { border-bottom: 2px solid #ff6644; }
.byte-pair-b { border-bottom: 2px solid #44aaff; }

/* Bug animation */
@keyframes crawlBug {
  0% { left: -20px; transform: scaleX(1); }
  48% { left: calc(100% - 20px); transform: scaleX(1); }
  50% { left: calc(100% - 20px); transform: scaleX(-1); }
  98% { left: -20px; transform: scaleX(-1); }
  100% { left: -20px; transform: scaleX(1); }
}
.crawling-bug {
  position: absolute;
  animation: crawlBug 12s linear infinite;
  font-size: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Bug-o-meter */
.bugometer-track {
  background: linear-gradient(90deg, #1a3a1a 0%, #33ff33 50%, #ff3333 100%);
  height: 20px;
  border-radius: 10px;
  border: 2px solid #444;
  position: relative;
  overflow: hidden;
}
.bugometer-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
}
.bugometer-needle {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 28px;
  background: white;
  border-radius: 2px;
  transition: left 0.5s ease;
  box-shadow: 0 0 6px rgba(255,255,255,0.8);
}

/* Conspiracy board */
.conspiracy-board {
  background: #3d2b1f;
  border: 4px solid #5a3d2b;
  position: relative;
}
.conspiracy-card {
  background: #ffffdd;
  border: 1px solid #ccc;
  padding: 8px 12px;
  font-size: 12px;
  transform: rotate(var(--rot, 0deg));
  box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
  position: relative;
}
.conspiracy-card::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: #cc3333;
  border-radius: 50%;
  transform: translateX(-50%);
}

/* XP Taskbar */
.xp-taskbar {
  background: linear-gradient(180deg, #1f53c9 0%, #245edb 3%, #3474e8 6%, #3f80eb 10%, #245edb 90%, #1f53c9 100%);
  border-top: 2px solid #5a8fef;
  padding: 3px 8px;
  color: white;
  font-size: 12px;
}

.xp-start-btn {
  background: linear-gradient(180deg, #3c9a3c 0%, #2d7c2d 50%, #1e5e1e 100%);
  border: 1px solid #1a4a1a;
  border-radius: 6px 0 0 6px;
  padding: 4px 14px 4px 8px;
  color: white;
  font-weight: bold;
  font-size: 13px;
  font-style: italic;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 4px;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
}

/* Garbled text display */
.garbled-display {
  font-size: 28px;
  color: #ffcc00;
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.4);
  letter-spacing: 4px;
  font-family: 'VT323', monospace;
}

/* Flow arrow */
.flow-arrow {
  color: #33ff33;
  font-size: 20px;
  animation: pulse-arrow 1.5s ease-in-out infinite;
}
@keyframes pulse-arrow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Collapsible */
.collapsible-header {
  cursor: pointer;
  user-select: none;
}
.collapsible-header:hover {
  opacity: 0.85;
}

/* Scrollbar XP style */
.notepad-textarea::-webkit-scrollbar {
  width: 17px;
}
.notepad-textarea::-webkit-scrollbar-track {
  background: #ece9d8;
  border-left: 1px solid #a0a0a0;
}
.notepad-textarea::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ece9d8, #c8c0b0);
  border: 1px solid #999;
  border-radius: 0;
}

/* Gallery chip */
.gallery-chip {
  background: #1a3a1a;
  border: 1px solid #33ff33;
  color: #33ff33;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 14px;
  transition: all 0.2s;
}
.gallery-chip:hover {
  background: #33ff33;
  color: #0c0c0c;
}

/* Step boxes in encoding visualization */
.step-box {
  border: 1px solid #1a3a1a;
  border-radius: 4px;
  padding: 8px;
  background: rgba(0, 20, 0, 0.3);
}
.step-label {
  font-size: 13px;
  color: #66ff66;
  font-weight: bold;
  margin-bottom: 4px;
  font-family: 'VT323', monospace;
}

/* API call box */
.api-call-box {
  display: inline-block;
  background: #1a0a0a;
  border: 2px solid #ff4444;
  border-radius: 6px;
  padding: 8px 16px;
  box-shadow: 0 0 12px rgba(255, 68, 68, 0.15);
}
.api-function {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 16px;
  color: #ff6666;
  margin: 4px 0;
  letter-spacing: 0.5px;
}
.api-result {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #ff3333;
  font-weight: bold;
}

/* UTF-16 char box */
.utf16-char-box {
  text-align: center;
  padding: 4px 8px;
  border: 1px solid #1a3a1a;
  border-radius: 4px;
  min-width: 56px;
  transition: all 0.3s ease;
  cursor: crosshair;
}
.utf16-char-highlighted {
  border-color: #ffcc00 !important;
  background: rgba(255, 204, 0, 0.1);
  transform: scale(1.08);
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.2);
}
.byte-math {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
  font-family: 'VT323', monospace;
}

/* Pipeline boxes */
.pipeline-box {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid;
  min-width: 80px;
}
.pipeline-title { font-weight: bold; font-size: 11px; }
.pipeline-value { font-size: 12px; margin-top: 2px; }
.pipeline-note { font-size: 10px; opacity: 0.7; margin-top: 1px; }
.pipeline-green { border-color: #2a6e2a; background: rgba(42, 110, 42, 0.2); }
.pipeline-green .pipeline-title { color: #66cc66; }
.pipeline-green .pipeline-value { color: #88ee88; }
.pipeline-blue { border-color: #2a4e8e; background: rgba(42, 78, 142, 0.2); }
.pipeline-blue .pipeline-title { color: #6699cc; }
.pipeline-blue .pipeline-value { color: #88bbee; }
.pipeline-orange { border-color: #8e6e2a; background: rgba(142, 110, 42, 0.2); }
.pipeline-orange .pipeline-title { color: #ccaa44; }
.pipeline-orange .pipeline-value { color: #eebb66; }
.pipeline-red { border-color: #8e2a2a; background: rgba(142, 42, 42, 0.2); }
.pipeline-red .pipeline-title { color: #cc4444; }
.pipeline-red .pipeline-value { color: #ff6666; }
.pipeline-yellow { border-color: #8e8e2a; background: rgba(142, 142, 42, 0.2); }
.pipeline-yellow .pipeline-title { color: #cccc44; }
.pipeline-yellow .pipeline-value { color: #eeee66; }
.pipeline-purple { border-color: #6e2a8e; background: rgba(110, 42, 142, 0.2); }
.pipeline-purple .pipeline-title { color: #aa66cc; }
.pipeline-purple .pipeline-value { color: #cc88ee; }

/* BOM explainer */
.bom-explainer {
  border: 1px dashed #ffaa33;
  border-radius: 4px;
  padding: 8px 12px;
  background: rgba(255, 170, 51, 0.05);
}
.bom-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #444;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 12px;
  color: #aaa;
  font-family: 'VT323', monospace;
}
.bom-chip-missing {
  border-color: #ff4444;
  background: rgba(255, 0, 0, 0.08);
  color: #ff8888;
}
.bom-bytes {
  color: #66ccff;
  font-weight: bold;
}

/* IsTextUnicode check rows */
.check-row {
  background: rgba(0, 20, 0, 0.3);
  border: 1px solid #1a3a1a;
  border-radius: 3px;
  padding: 4px 8px;
}
.check-pass { color: #33ff33; font-weight: bold; font-size: 14px; width: 16px; text-align: center; }
.check-fail { color: #ff4444; font-weight: bold; font-size: 14px; width: 16px; text-align: center; }
.check-name { font-family: 'VT323', monospace; font-size: 13px; color: #aaaaff; min-width: 180px; }
.check-result { font-family: 'VT323', monospace; font-size: 12px; font-weight: bold; }
.check-detail { font-size: 11px; color: #888; margin-top: 2px; margin-left: 24px; line-height: 1.3; }

/* Morphing animation */
@keyframes morphByte {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}
.byte-morphing {
  animation: morphByte 0.6s ease;
}

/* Responsive */
@media (max-width: 768px) {
  .garbled-display {
    font-size: 20px;
    letter-spacing: 2px;
  }
  .byte-cell {
    width: 28px;
    height: 26px;
    font-size: 13px;
  }
}