/* =========================================================================
   WINDOWS 3.1 RETRO SYSTEM THEME — BEIGE EDITION
   Authentic beveled relief, classic typography, Win3.1 control styling
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=VT323&family=MS+Reference+Sans:wght@400;700&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  /* Warm Beige Palette */
  --win-desktop: #b8ac92;
  /* Warm vintage desktop beige */
  --win-face: #ded6c5;
  /* Standard Win3.1 warm grey/beige button & window face */
  --win-face-light: #ece6da;
  /* Slightly brighter surface */
  --win-highlight: #ffffff;
  /* 3D bevel top/left highlight */
  --win-shadow: #8c8270;
  /* 3D bevel bottom/right inner shadow */
  --win-dark-shadow: #3f3a32;
  /* Outer black/dark boundary */
  --win-border: #1a1815;
  /* Frame border */

  /* Title Bars */
  --win-title-active: #000080;
  /* Classic Win3.1 Navy Blue */
  --win-title-text: #ffffff;
  --win-title-inactive: #808080;
  /* Inactive grey title */

  /* Accent Colors */
  --win-accent: #c25975;
  /* Rupa Rose / Pink accent */
  --win-text: #1a1815;
  /* Dark text */
  --win-text-muted: #5a544b;
  --win-canvas-bg: #141210;
  /* Inside CRT/ASCII window */

  /* Geometry */
  --taskbar-height: 38px;
  --border-width: 2px;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: none;
  /* Authentic pixel crispness */
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'MS Reference Sans', 'Segoe UI', Tahoma, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--win-text);
  background-color: var(--win-desktop);
  user-select: none;
}

/* CRT Dither / Scanline Overlay (Toggleable) */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 6px 100%;
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

body.no-crt .crt-overlay {
  display: none;
}

/* Desktop Canvas & Area */
.desktop-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--taskbar-height);
  overflow: hidden;
  padding: 16px;
}

/* Desktop Icons Grid */
.desktop-icons {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 88px);
  gap: 16px;
  width: max-content;
  z-index: 5;
  position: relative;
}

.desktop-icon {
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  padding: 6px 4px;
  border: 1px dotted transparent;
  transition: background 0.1s;
}

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

.desktop-icon:active,
.desktop-icon.selected {
  background: var(--win-title-active);
  border-color: #ffffff;
}

.desktop-icon.selected .icon-label,
.desktop-icon:active .icon-label {
  color: #ffffff;
  background: var(--win-title-active);
}

.icon-graphic {
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-graphic img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: auto;
  border-radius: 2px;
}

.icon-label {
  font-size: 11px;
  font-weight: 600;
  color: #1a1815;
  word-break: break-word;
  padding: 1px 3px;
  line-height: 1.2;
}

/* =========================================================================
   WIN 3.1 BEVEL CLASSES
   ========================================================================= */

/* Outset Button/Panel */
.bevel-outset {
  border-top: 2px solid var(--win-highlight);
  border-left: 2px solid var(--win-highlight);
  border-right: 2px solid var(--win-shadow);
  border-bottom: 2px solid var(--win-shadow);
  box-shadow: 1px 1px 0px var(--win-dark-shadow);
  background-color: var(--win-face);
}

/* Inset Panel / Input / Content Area */
.bevel-inset {
  border-top: 2px solid var(--win-dark-shadow);
  border-left: 2px solid var(--win-dark-shadow);
  border-right: 2px solid var(--win-highlight);
  border-bottom: 2px solid var(--win-highlight);
  box-shadow: inset 1px 1px 0px var(--win-shadow);
  background-color: #ffffff;
}

/* Retro Clickable Button */
.retro-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 14px;
  background-color: var(--win-face);
  color: var(--win-text);
  border-top: 2px solid var(--win-highlight);
  border-left: 2px solid var(--win-highlight);
  border-right: 2px solid var(--win-shadow);
  border-bottom: 2px solid var(--win-shadow);
  box-shadow: 1px 1px 0px var(--win-dark-shadow);
  cursor: pointer;
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.retro-btn:active {
  border-top: 2px solid var(--win-dark-shadow);
  border-left: 2px solid var(--win-dark-shadow);
  border-right: 2px solid var(--win-highlight);
  border-bottom: 2px solid var(--win-highlight);
  box-shadow: none;
  padding: 5px 13px 3px 15px;
  /* Pressed shift effect */
}

/* =========================================================================
   WINDOW COMPONENT
   ========================================================================= */

.window {
  position: absolute;
  background-color: var(--win-face);
  border: 2px solid var(--win-border);
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 180px;
  z-index: 10;
  transition: transform 0.1s ease;
}

.window.active {
  z-index: 100;
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.55);
}

.window.minimized {
  display: none !important;
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100% - var(--taskbar-height)) !important;
  border-width: 0 0 2px 0;
}

/* Window Titlebar */
.window-titlebar {
  background-color: var(--win-title-inactive);
  color: #c0c0c0;
  padding: 3px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.window.active .window-titlebar {
  background-color: var(--win-title-active);
  color: var(--win-title-text);
}

.window-title {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding-left: 4px;
}

.window-title-icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

/* Titlebar Controls */
.window-controls {
  display: flex;
  gap: 2px;
}

.win-ctrl-btn {
  width: 18px;
  height: 16px;
  background-color: var(--win-face);
  color: var(--win-text);
  border-top: 1px solid var(--win-highlight);
  border-left: 1px solid var(--win-highlight);
  border-right: 1px solid var(--win-dark-shadow);
  border-bottom: 1px solid var(--win-dark-shadow);
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.win-ctrl-btn:active {
  border-top: 1px solid var(--win-dark-shadow);
  border-left: 1px solid var(--win-dark-shadow);
  border-right: 1px solid var(--win-highlight);
  border-bottom: 1px solid var(--win-highlight);
}

/* Menu Bar inside Window */
.window-menubar {
  background-color: var(--win-face);
  border-bottom: 1px solid var(--win-shadow);
  padding: 2px 6px;
  display: flex;
  gap: 12px;
  font-size: 11px;
}

.menu-item {
  cursor: pointer;
  padding: 1px 5px;
}

.menu-item:hover {
  background-color: var(--win-title-active);
  color: #ffffff;
}

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

/* Window Content Body */
.window-body {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  user-select: text;
  background-color: var(--win-face-light);
}

/* Window Status Bar */
.window-statusbar {
  border-top: 1px solid var(--win-shadow);
  background-color: var(--win-face);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--win-text-muted);
  display: flex;
  justify-content: space-between;
}

/* =========================================================================
   TASKBAR & START MENU
   ========================================================================= */

.taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  background-color: var(--win-face);
  border-top: 2px solid var(--win-highlight);
  box-shadow: 0 -1px 0 var(--win-shadow);
  display: flex;
  align-items: center;
  padding: 2px 6px;
  gap: 8px;
  z-index: 1000;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  font-weight: bold;
  font-size: 13px;
}

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

.taskbar-item {
  height: 28px;
  min-width: 120px;
  max-width: 170px;
  padding: 0 8px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.taskbar-item.active {
  background-color: var(--win-face-light);
  border-top: 2px solid var(--win-dark-shadow);
  border-left: 2px solid var(--win-dark-shadow);
  border-right: 2px solid var(--win-highlight);
  border-bottom: 2px solid var(--win-highlight);
  box-shadow: inset 1px 1px 0 var(--win-shadow);
  font-weight: bold;
}

.taskbar-tray {
  border-top: 1px solid var(--win-shadow);
  border-left: 1px solid var(--win-shadow);
  border-right: 1px solid var(--win-highlight);
  border-bottom: 1px solid var(--win-highlight);
  padding: 2px 8px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Quick Start Menu Popup */
.start-menu {
  position: absolute;
  bottom: calc(var(--taskbar-height) + 2px);
  left: 4px;
  width: 220px;
  background-color: var(--win-face);
  border-top: 2px solid var(--win-highlight);
  border-left: 2px solid var(--win-highlight);
  border-right: 2px solid var(--win-dark-shadow);
  border-bottom: 2px solid var(--win-dark-shadow);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  z-index: 1001;
}

.start-menu.open {
  display: flex;
}

.start-menu-banner {
  background-color: var(--win-title-active);
  color: #ffffff;
  padding: 6px 12px;
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  color: var(--win-text);
  text-decoration: none;
}

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

.start-menu-divider {
  height: 1px;
  background-color: var(--win-shadow);
  border-bottom: 1px solid var(--win-highlight);
  margin: 3px 4px;
}

/* =========================================================================
   RUPA.EXE ASCII VIEWER COMPONENT
   ========================================================================= */

.ascii-app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ascii-canvas-wrapper {
  background-color: var(--win-canvas-bg);
  border-top: 2px solid var(--win-dark-shadow);
  border-left: 2px solid var(--win-dark-shadow);
  border-right: 2px solid var(--win-highlight);
  border-bottom: 2px solid var(--win-highlight);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-height: 380px;
  flex: 1;
}

#matrixCanvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: crosshair;
}

.ascii-controls {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  align-items: center;
}

/* =========================================================================
   PROJECTS (FILE MANAGER STYLE)
   ========================================================================= */

.file-manager {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 8px;
  height: 100%;
}

.fm-tree {
  padding: 8px;
  font-size: 12px;
}

.tree-node {
  padding: 3px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-node:hover {
  background-color: rgba(0, 0, 128, 0.15);
}

.tree-node.active {
  background-color: var(--win-title-active);
  color: #ffffff;
}

.fm-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
}

.project-card-win {
  padding: 10px;
  display: flex;
  gap: 12px;
  background-color: #ffffff;
}

.project-img-preview {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border: 1px solid var(--win-shadow);
  image-rendering: auto;
}

.project-details h4 {
  font-size: 13px;
  margin-bottom: 4px;
}

.project-details p {
  font-size: 11px;
  color: #333;
  margin-bottom: 6px;
}

.badge-tag {
  display: inline-block;
  background-color: var(--win-face);
  border: 1px solid var(--win-shadow);
  padding: 1px 5px;
  font-size: 10px;
  margin-right: 4px;
}

.skill-category {
  margin-bottom: 12px;
}

.skill-category-title {
  font-size: 11.5px;
  font-weight: bold;
  color: #000080;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.skill-category-title::before {
  content: "►";
  font-size: 9px;
  color: var(--win-shadow);
}

.skill-tags-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--win-face-light);
  border-top: 1px solid var(--win-highlight);
  border-left: 1px solid var(--win-highlight);
  border-right: 1px solid var(--win-dark-shadow);
  border-bottom: 1px solid var(--win-dark-shadow);
  padding: 2px 7px;
  font-size: 11px;
  color: var(--win-text);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

/* =========================================================================
   VINTAGE POST-IT / STICKY NOTE GADGET
   Classic 3M 90s desktop utility with slight tilt and tape accent
   ========================================================================= */

.sticky-note {
  position: absolute;
  width: 260px;
  background: #fbf59a;
  /* Classic Post-it pale canary yellow */
  color: #2b2613;
  border: 1px solid #d4c86a;
  box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.22), 1px 1px 0 rgba(0, 0, 0, 0.1);
  font-family: 'MS Reference Sans', Tahoma, 'Segoe UI', sans-serif;
  z-index: 15;
  user-select: text;
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sticky-note:hover {
  transform: rotate(0deg) scale(1.02);
  box-shadow: 4px 6px 14px rgba(0, 0, 0, 0.28);
  z-index: 99;
}

.sticky-header {
  background: #ede47b;
  border-bottom: 1px dashed #d1c456;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: bold;
  cursor: move;
  user-select: none;
}

.sticky-pin {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #635717;
}

.sticky-lang-toggle {
  background: #fbf59a;
  border: 1px solid #b8ab42;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 6px;
  cursor: pointer;
  color: #2b2613;
  border-radius: 2px;
}

.sticky-lang-toggle:hover {
  background: #ffffff;
}

.sticky-body {
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.5;
}

.sticky-body h4 {
  font-size: 12px;
  margin-bottom: 6px;
  color: #614e0f;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 3px;
}

.sticky-body ul {
  padding-left: 14px;
  margin-top: 4px;
}

.sticky-body li {
  margin-bottom: 4px;
}

.sticky-body a {
  color: #000080;
  text-decoration: underline;
  cursor: pointer;
}

.sticky-tape {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 16px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border-left: 1px dashed rgba(0, 0, 0, 0.15);
  border-right: 1px dashed rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

/* =========================================================================
   MICROSOFT BOB / MS AGENT DESKTOP COMPANION & CHAT
   ========================================================================= */

.desktop-agent {
  position: fixed;
  bottom: calc(var(--taskbar-height) + 4px);
  left: 120px;
  width: 68px;
  height: 84px;
  z-index: 450;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: transform 0.15s ease;
}

.desktop-agent:hover {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

.agent-sprite {
  width: 58px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  display: block;
  transform-origin: center bottom;
  animation: agentBobIdle 2.5s ease-in-out infinite;
  image-rendering: auto;
}

.agent-sprite.walking {
  animation: agentBobWalk 0.6s steps(4, end) infinite;
}

@keyframes agentBobIdle {
  0%, 100% {
    transform: translateY(0) scaleY(1);
  }
  50% {
    transform: translateY(-3px) scaleY(1.02);
  }
}

@keyframes agentBobWalk {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-4px) rotate(2deg);
  }
  50% {
    transform: translateY(-1px) rotate(0deg);
  }
  75% {
    transform: translateY(-4px) rotate(-2deg);
  }
}

.agent-shadow {
  width: 44px;
  height: 7px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 50%;
  margin-top: -3px;
}

/* Comic Speech Bubble (MS Agent Style) */
.agent-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 270px;
  min-width: 140px;
  background: #fffee4;
  color: #1a1815;
  border: 2px solid #1a1815;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  font-size: 11px;
  font-family: 'MS Reference Sans', Tahoma, sans-serif;
  line-height: 1.35;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 500;
  box-sizing: border-box;
}

.agent-bubble.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.agent-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: #1a1815 transparent transparent transparent;
}

.agent-bubble::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px 4px 0 4px;
  border-style: solid;
  border-color: #fffee4 transparent transparent transparent;
  z-index: 1;
}

/* =========================================================================
   AI ASSISTANT WINDOW (#win-agent)
   ========================================================================= */

#win-agent {
  width: 460px;
  height: 520px;
  min-width: 320px;
  min-height: 400px;
}

.agent-intro-banner {
  background: #fbf8ee;
  border-bottom: 2px solid var(--win-shadow);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar-mini {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  border: 1px solid var(--win-shadow);
  background: #fff;
  object-fit: cover;
  flex-shrink: 0;
}

.agent-intro-text {
  font-size: 11px;
  color: var(--win-text);
  line-height: 1.4;
}

.agent-chips-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  background: var(--win-face-light);
  border-bottom: 1px solid var(--win-shadow);
}

.agent-chip {
  font-size: 10px !important;
  padding: 2px 7px !important;
  border-radius: 2px;
  cursor: pointer;
  background: #fff !important;
  white-space: nowrap;
}

.agent-chip:hover {
  background: #ded6c5 !important;
}

/* Chat Message Log Area */
.chat-log {
  flex: 1;
  background: #ffffff;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: 'MS Reference Sans', Tahoma, sans-serif;
  font-size: 11px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 90%;
}

.chat-msg.user {
  align-self: flex-end;
  background: #eef2fb;
  border: 1px solid #b3c2e6;
  padding: 6px 9px;
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.1);
}

.chat-msg.agent {
  align-self: flex-start;
  background: #fcf9f2;
  border: 1px solid #d5cbba;
  padding: 6px 9px;
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.1);
}

.chat-msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
  font-size: 10px;
}

.sender-name {
  font-weight: bold;
}

.sender-name.user {
  color: #000080;
}

.sender-name.agent {
  color: #c25975;
}

.chat-time {
  color: #8c8270;
  font-size: 9px;
}

.chat-msg-body {
  line-height: 1.45;
  color: #1a1815;
  word-break: break-word;
}

.chat-msg-body code {
  background: #ece6da;
  padding: 1px 4px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 10px;
  border: 1px solid #d5cbba;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fff;
  font-size: 11px;
  color: #8c8270;
  font-style: italic;
  border-top: 1px dashed #d5cbba;
}

.typing-dots span {
  display: inline-block;
  animation: typingBlink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBlink {
  0%, 80%, 100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}

/* Chat Input Row */
.agent-input-row {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--win-face);
  border-top: 2px solid var(--win-highlight);
}

.agent-input-box {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  background: #fff;
}

/* API Key Drawer */
.agent-key-drawer {
  display: none;
  padding: 8px 10px;
  background: #ece6da;
  border-bottom: 2px solid var(--win-shadow);
  font-size: 11px;
}

.agent-key-drawer.open {
  display: block;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-dot.online {
  background: #008000;
  box-shadow: 0 0 4px #008000;
}

.status-dot.offline {
  background: #808080;
}

/* =========================================================================
   MOBILE & PDA / WINDOWS CE RESPONSIVE SYSTEM
   Only applies on screens <= 768px (Handheld touch devices).
   Desktop experience (> 768px) is 100% preserved and untouched.
   ========================================================================= */

@media (max-width: 768px) {
  /* Scrollable Workspace for Handheld screens */
  .desktop-area {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px 60px 10px !important;
  }

  /* Ergonomic 3-Column Touch Grid for Desktop Icons */
  .desktop-icons {
    display: grid !important;
    grid-auto-flow: row !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: none !important;
    gap: 14px 6px !important;
    width: 100% !important;
    max-width: 360px !important;
    margin: 0 auto 16px auto !important;
    justify-items: center !important;
    position: relative !important;
    z-index: 10 !important;
  }

  .desktop-icon {
    width: 88px !important;
    padding: 6px 4px !important;
    touch-action: manipulation;
  }

  .desktop-icon:active {
    transform: scale(0.96);
  }

  .icon-graphic {
    width: 40px !important;
    height: 40px !important;
    margin-bottom: 3px !important;
  }

  .icon-graphic img,
  .icon-graphic svg {
    width: 34px !important;
    height: 34px !important;
  }

  .icon-label {
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  /* Sticky Note in PDA Mode: Sits cleanly below icons */
  .sticky-note {
    position: relative !important;
    top: 0 !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 10px auto 20px auto !important;
    width: 100% !important;
    max-width: 340px !important;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.25) !important;
    z-index: 12 !important;
  }

  .sticky-note:hover {
    transform: none !important;
  }

  .sticky-header {
    cursor: default !important;
  }

  .sticky-tape {
    display: none !important;
  }

  /* Windows CE Pocket PC Window: Fullscreen Touch Modal Card */
  .window {
    position: fixed !important;
    top: 4px !important;
    left: 4px !important;
    right: 4px !important;
    bottom: calc(var(--taskbar-height) + 4px) !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    border-width: 2px !important;
    z-index: 100;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5) !important;
  }

  .window.active {
    z-index: 500 !important;
  }

  .window-titlebar {
    padding: 5px 6px !important;
    min-height: 30px !important;
    cursor: default !important;
  }

  /* Hide minimize & maximize buttons on mobile; close [×] is the primary action */
  .win-btn-min,
  .win-btn-max {
    display: none !important;
  }

  .win-btn-close {
    width: 28px !important;
    height: 22px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    line-height: 1 !important;
    touch-action: manipulation;
  }

  .window-menubar {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding: 4px 6px !important;
    display: flex !important;
    gap: 10px !important;
  }

  .window-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .window-statusbar {
    font-size: 10px !important;
    padding: 3px 6px !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* File Manager / Projects Window on PDA */
  .file-manager {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }

  .fm-tree {
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    border-bottom: 2px solid var(--win-shadow) !important;
    border-right: none !important;
    padding: 4px 6px !important;
    -webkit-overflow-scrolling: touch;
  }

  .fm-file-list {
    padding: 6px !important;
  }

  .project-card-win {
    flex-direction: column !important;
    padding: 8px !important;
  }

  .project-img-preview {
    width: 100% !important;
    height: 135px !important;
    object-fit: cover !important;
  }

  /* RUPA.EXE ASCII Art Window on Mobile */
  #win-rupa .window-body {
    padding: 4px !important;
  }

  .ascii-canvas-wrapper {
    min-height: 200px !important;
    height: auto !important;
    max-height: 48vh !important;
    aspect-ratio: 140 / 84;
  }

  #matrixCanvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .ascii-controls {
    flex-wrap: wrap !important;
    padding: 6px 2px !important;
    font-size: 10px !important;
  }

  /* AI Assistant (Pocket Messenger) on Mobile */
  #win-agent {
    width: auto !important;
    height: auto !important;
  }

  .agent-intro-banner {
    padding: 6px 8px !important;
    gap: 8px !important;
  }

  .agent-avatar-mini {
    width: 36px !important;
    height: 36px !important;
  }

  .agent-chips-wrapper {
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    padding: 6px 8px !important;
    -webkit-overflow-scrolling: touch;
  }

  .agent-chip {
    flex-shrink: 0 !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  .chat-log {
    padding: 8px !important;
    font-size: 11.5px !important;
  }

  .agent-input-row {
    padding: 6px !important;
  }

  .agent-input-box {
    font-size: 12px !important;
    padding: 6px 8px !important;
  }

  /* Chibi Rupa Companion Scaling */
  .desktop-agent {
    bottom: calc(var(--taskbar-height) + 2px) !important;
    transform: scale(0.85);
    transform-origin: bottom center;
    z-index: 40 !important;
  }

  .agent-bubble {
    max-width: 200px !important;
    font-size: 10px !important;
    padding: 4px 8px !important;
  }

  /* Handheld Taskbar & Start Menu */
  .taskbar-windows {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    gap: 4px !important;
    padding: 0 4px !important;
  }

  .taskbar-item {
    min-width: 80px !important;
    max-width: 120px !important;
    height: 26px !important;
    padding: 0 6px !important;
    font-size: 10px !important;
  }

  .taskbar-tray {
    padding: 2px 6px !important;
    font-size: 10px !important;
  }

  .start-menu {
    width: calc(100% - 16px) !important;
    max-width: 270px !important;
    bottom: calc(var(--taskbar-height) + 2px) !important;
    max-height: 75vh !important;
    overflow-y: auto !important;
  }
}