/* ===============================
   98.css Windows 98 ASCII Art Generator
   Custom styling to complement 98.css
================================= */

/* Reset for 98.css compatibility */
body {
  margin: 0;
  padding: 0;
  background: #008080; /* Windows 98 desktop teal */
  overflow: auto; /* Allow scrolling so tab content can be visible */
}

/* Desktop environment */
.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #008080;
}

/* Title Bar Icon Styling */
.title-bar-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  image-rendering: pixelated;
  vertical-align: middle;
}

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

/* Title Bar Controls Styling */
.title-bar-controls button {
  width: 16px !important;
  height: 14px !important;
  border: 1px outset #c0c0c0 !important;
  background: #c0c0c0 !important;
  color: black !important;
  font-family: 'MS Sans Serif', sans-serif !important;
  font-size: 8px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  outline: none !important;
}

.title-bar-controls button:hover {
  background: #d4d0c8 !important;
  border: 1px outset #d4d0c8 !important;
}

.title-bar-controls button:active,
.title-bar-controls button:focus {
  border: 1px inset #c0c0c0 !important;
  background: #a0a0a0 !important;
  outline: none !important;
}

/* Override any 98.css button pseudo-elements */
.title-bar-controls button::before,
.title-bar-controls button::after {
  display: none !important;
  content: none !important;
}

/* Ensure no conflicting states */
.title-bar-controls button:not(:hover):not(:active):not(:focus) {
  background: #c0c0c0 !important;
  border: 1px outset #c0c0c0 !important;
}

/* Social Media Button Styling */
.social-button:hover {
  background: #d4d0c8 !important;
  border: 1px outset #d4d0c8 !important;
}

.social-button:active {
  border: 1px inset #c0c0c0 !important;
  background: #a0a0a0 !important;
}

/* Windows 98 Taskbar Button Styling */
.taskbar-button {
  padding: 3px 8px;
  background: linear-gradient(to bottom, #e0e0e0 0%, #c0c0c0 50%, #a8a8a8 100%);
  border: 1px outset #c0c0c0;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #808080;
  cursor: pointer;
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 11px;
  font-weight: normal;
  max-width: 160px;
  min-width: 80px;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.8);
  margin-right: 1px;
}

.taskbar-button:hover {
  background: linear-gradient(to bottom, #e8e8e8 0%, #d4d0c8 50%, #b8b8b8 100%);
  border: 1px outset #d4d0c8;
}

.taskbar-button:active,
.taskbar-button.active {
  background: linear-gradient(to bottom, #a8a8a8 0%, #c0c0c0 50%, #d4d0c8 100%);
  border: 1px inset #c0c0c0;
  box-shadow: inset -1px -1px 0 #ffffff, inset 1px 1px 0 #808080;
  text-shadow: none;
}

.taskbar-button.minimized {
  font-style: italic;
  color: #666;
  background: linear-gradient(to bottom, #d0d0d0 0%, #b0b0b0 50%, #989898 100%);
}

.taskbar-button img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  margin-right: 2px;
}

/* Desktop Icon Styling */
.desktop-icon {
  position: absolute;
  width: 64px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 4px;
  border-radius: 2px;
  transition: background-color 0.1s ease;
}

.desktop-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.desktop-icon.selected {
  background-color: #0078d4;
  color: white;
}

.desktop-icon.selected .icon-label {
  background-color: #0078d4;
  color: white;
}

.icon-image {
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.3));
}

.icon-label {
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 11px;
  text-align: center;
  color: white;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
  line-height: 1.2;
  max-width: 60px;
  word-wrap: break-word;
  padding: 1px 2px;
  border-radius: 1px;
}

/* Double-click selection effect */
.desktop-icon.double-click-active {
  background-color: #0078d4;
  animation: desktopIconClick 0.15s ease;
}

@keyframes desktopIconClick {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Menu bar styling */
.menu-bar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 2px 5px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.menu > li {
  position: relative;
}

.menu-item {
  position: relative;
  cursor: pointer;
}

.menu-label {
  display: block;
  padding: 4px 8px;
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 11px;
  color: #000;
}

.menu-item:hover .menu-label,
.menu-item.active .menu-label {
  background: #0078d4;
  color: white;
}

/* Dropdown menu styling */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #c0c0c0;
  border: 1px outset #c0c0c0;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  list-style: none;
  margin: 0;
  padding: 2px;
  z-index: 1001;
  display: none;
}

.dropdown-menu.show {
  display: block;
}

.menu-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px 4px 20px;
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 16px;
}

.menu-option:hover:not(.disabled),
.menu-option.focused:not(.disabled) {
  background: #0078d4;
  color: white;
}

.menu-option.disabled {
  color: #808080;
  cursor: default;
}

.menu-option.disabled .menu-text,
.menu-option.disabled .menu-shortcut {
  color: #808080;
}

.menu-text {
  flex: 1;
  text-align: left;
}

.menu-shortcut {
  color: #000;
  font-size: 10px;
  margin-left: 16px;
}

.menu-option:hover:not(.disabled) .menu-shortcut,
.menu-option.focused:not(.disabled) .menu-shortcut {
  color: white;
}

.menu-arrow {
  margin-left: 8px;
  font-size: 8px;
}

.menu-separator {
  height: 1px;
  background: #808080;
  margin: 3px 8px;
  border: none;
}

/* Keyboard navigation indicators */
.menu-label::first-letter {
  text-decoration: underline;
}

/* Window positioning and sizing */
.window {
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
  transition: none; /* Disable transitions for smooth dragging */
}

.window.active {
  z-index: 999;
}

.window.active .title-bar {
  background: linear-gradient(90deg, #0078d4, #005a9e);
  color: white;
}

.window:not(.active) .title-bar {
  background: #c0c0c0;
  color: #000;
}

.control-window {
  z-index: 100;
  display: none; /* Hidden initially to prevent flash */
}

.output-window {
  z-index: 99;
  display: none; /* Hidden initially to prevent flash */
}

/* Title bar enhancements */
.title-bar {
  cursor: move;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: bold;
}

.title-bar-text {
  flex: 1;
  padding-left: 4px;
}

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

.title-bar-controls button {
  width: 16px;
  height: 14px;
  font-size: 10px;
  font-weight: bold;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.title-bar-controls button:hover {
  background: #e0e0e0;
}

.title-bar-controls button:active {
  background: #a0a0a0;
}

/* Control panel content styling */
.control-panel-content {
  padding: 4px;
  overflow-y: auto;
  max-height: 100%;
}

/* File input styling */
.file-input {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  border: 2px dashed #808080;
  background: #c0c0c0;
  position: relative;
}

.file-input:hover {
  border-color: #000080;
  background: #e0e0e0;
}

.file-input input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Image preview */
.thumb {
  margin: 10px 0;
}

.thumb canvas {
  max-width: 100%;
  border: 1px solid #808080;
  background: #c0c0c0;
}

/* ASCII Output specific styling */
.ascii-output {
  font-family: 'Courier New', 'Lucida Console', monospace;
  background: #000000 !important;
  color: #00ff00 !important;
  border: 2px inset #c0c0c0;
  white-space: pre;
  overflow: auto;
  font-size: 10px;
  line-height: 1.2;
  padding: 8px;
}

/* Toolbar styling */
.toolbar {
  background: #c0c0c0;
  border-top: 1px solid #808080;
  padding: 4px;
  display: flex;
  gap: 4px;
}

/* Status bar at bottom */
.desktop-status {
  background: #c0c0c0;
  border-top: 1px solid #808080;
  height: 22px;
  display: flex;
  align-items: center;
}

/* Field row adjustments */
.field-row {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-row label {
  min-width: 80px;
  font-size: 11px;
}

.field-row input[type="number"] {
  width: 60px;
}

.field-row input[type="range"] {
  flex: 1;
}

.field-row input[type="color"] {
  width: 32px;
  height: 22px;
  padding: 1px;
}

/* Fieldset styling */
fieldset {
  margin-bottom: 10px;
  border: 1px solid #808080;
  background: #c0c0c0;
}

legend {
  font-weight: bold;
  font-size: 11px;
  padding: 0 4px;
}

/* Button group styling */
.field-row button {
  min-width: 32px;
  font-size: 11px;
}

/* Value display for sliders */
.field-row span {
  min-width: 30px;
  text-align: right;
  font-size: 11px;
  font-family: 'MS Sans Serif', sans-serif;
}

/* Loading and error states */
.loading, .error {
  color: #ffff00;
  background: #000080;
  padding: 10px;
  text-align: center;
  font-family: 'MS Sans Serif', sans-serif;
}

.error {
  color: #ff0000;
  background: #ffffff;
}

/* Toast notifications */
#toastHost .toast {
  background: #ffffe1;
  border: 1px solid #808080;
  padding: 4px 8px;
  font-size: 11px;
  margin-left: 10px;
  font-family: 'MS Sans Serif', sans-serif;
}

/* Windows 98 Taskbar styling */
.taskbar {
  z-index: 1001;
  background: linear-gradient(to bottom, #d4d0c8 0%, #c0c0c0 50%, #a8a8a8 100%) !important;
  border-top: 2px outset #c0c0c0 !important;
  border-left: 1px solid #dfdfdf !important;
  border-right: 1px solid #404040 !important;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080 !important;
}

.start-button {
  background: linear-gradient(to bottom, #e0e0e0 0%, #c0c0c0 50%, #a8a8a8 100%) !important;
  border: 1px outset #c0c0c0 !important;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #808080 !important;
  font-family: 'MS Sans Serif', sans-serif !important;
  font-weight: bold !important;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.8) !important;
  padding: 3px 8px !important;
}

.start-button:hover {
  background: linear-gradient(to bottom, #e8e8e8 0%, #d4d0c8 50%, #b8b8b8 100%) !important;
  border: 1px outset #d4d0c8 !important;
}

.start-button:active {
  background: linear-gradient(to bottom, #a8a8a8 0%, #c0c0c0 50%, #d4d0c8 100%) !important;
  border: 1px inset #c0c0c0 !important;
  box-shadow: inset -1px -1px 0 #ffffff, inset 1px 1px 0 #808080 !important;
  text-shadow: none !important;
}

.taskbar-separator {
  background: linear-gradient(to right, #808080 0%, #404040 50%, #808080 100%) !important;
  border-left: 1px solid #404040 !important;
  border-right: 1px solid #dfdfdf !important;
  width: 2px !important;
}

.system-tray {
  background: transparent !important;
  border: 1px inset #c0c0c0 !important;
  padding: 3px 6px !important;
  font-family: 'MS Sans Serif', sans-serif !important;
  font-size: 11px !important;
  box-shadow: inset -1px -1px 0 #ffffff, inset 1px 1px 0 #808080 !important;
}

/* Adjust desktop height for taskbar */
.desktop {
  height: calc(100vh - 52px); /* Account for taskbar + status bar */
}

/* Mobile-first responsive design */
@media (max-width: 1024px) {
  .control-window {
    width: 300px !important;
    left: 10px !important;
  }
  
  .output-window {
    width: calc(100vw - 320px) !important;
    left: 320px !important;
  }
  
  /* Larger touch targets */
  button, .menu-item, .title-bar-controls button {
    min-height: 36px;
    min-width: 36px;
  }
}

@media (max-width: 768px) {
  /* Mobile layout - proper scrollable windows */
  body {
    overflow-y: auto !important;
    height: auto !important;
  }
  
  .desktop {
    min-height: 100vh !important;
    height: auto !important;
    position: relative !important;
    padding-bottom: 50px !important;
  }
  
  .control-window {
    width: calc(100vw - 16px) !important;
    left: 8px !important;
    top: 8px !important;
    height: auto !important;
    max-height: none !important;
    min-height: 400px !important;
    position: relative !important;
    margin-bottom: 16px !important;
  }
  
  .control-window .window-body {
    padding: 6px !important;
    height: auto !important;
    min-height: 350px !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
  
  .output-window {
    width: calc(100vw - 16px) !important;
    left: 8px !important;
    top: auto !important;
    bottom: auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
    position: relative !important;
    margin-bottom: 50px !important;
  }
  
  .output-window .window-body {
    padding: 4px !important;
    height: auto !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
  
  .output-window .ascii-output {
    height: 300px !important;
    max-height: 400px !important;
    overflow: auto !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    white-space: pre-wrap !important;
  }
  
  /* Hide menu bar on mobile */
  .menu-bar {
    display: none;
  }
  
  /* Adjust desktop icon for mobile */
  .desktop-icon {
    width: 72px;
    height: 88px;
  }
  
  /* Adjust positioning for mobile */
  #ascii-explorer-icon { top: 45px !important; left: 15px !important; }
  #help-topics-icon { top: 45px !important; left: 100px !important; }
  #keyboard-shortcuts-icon { top: 135px !important; left: 15px !important; }
  #character-map-icon { top: 135px !important; left: 100px !important; }
  #akhil-desai-icon { top: 225px !important; left: 15px !important; }
  
  .icon-image {
    width: 36px;
    height: 36px;
  }
  
  .icon-label {
    font-size: 12px;
    max-width: 68px;
  }
  
  /* Mobile taskbar - maintain Windows 98 styling */
  .taskbar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 32px;
    padding: 4px 8px;
    z-index: 1002;
    background: linear-gradient(to bottom, #d4d0c8 0%, #c0c0c0 50%, #a8a8a8 100%) !important;
    border-top: 2px outset #c0c0c0 !important;
    box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080 !important;
  }
  
  .mobile-device .taskbar-button {
    height: 20px;
    padding: 2px 6px;
    font-size: 10px;
    min-width: 60px;
    max-width: 120px;
  }
  
  .mobile-device .start-button {
    padding: 2px 6px !important;
    font-size: 10px !important;
  }
  
  .desktop .start-button {
    padding: 3px 8px !important;
    font-size: 11px;
    height: 26px;
    line-height: 1;
  }
  
  /* Hide desktop status bar */
  .desktop-status {
    display: none;
  }
  
  /* Touch-friendly but compact controls */
  button {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 11px;
    margin: 1px;
  }
  
  input[type="range"] {
    height: 28px;
    margin: 2px 0;
  }
  
  input, select {
    min-height: 32px;
    font-size: 12px;
    padding: 4px 6px;
  }
  
  input[type="number"] {
    width: 60px;
  }
  
  /* Compact field spacing */
  .field-row {
    margin-bottom: 8px;
    padding: 2px 0;
  }
  
  .field-row label {
    font-size: 11px;
    margin-bottom: 2px;
    display: block;
  }
  
  /* Control panel scrolling improvements */
  .control-panel-content {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
  }
  
  fieldset {
    margin-bottom: 8px;
    padding: 8px;
  }
  
  legend {
    font-size: 11px;
    padding: 0 4px;
  }
  
  /* Mobile status bar and toolbar */
  .status-bar {
    padding: 6px !important;
    font-size: 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    display: flex !important;
    align-items: center !important;
    min-height: 32px !important;
  }
  
  .status-bar-field {
    font-size: 12px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }
  
  .status-bar-field label {
    font-size: 12px !important;
    margin-bottom: 0 !important;
  }
  
  .status-bar-field select {
    min-height: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
    padding: 2px 4px !important;
    min-width: 60px !important;
    line-height: 1 !important;
  }
  
  .toolbar {
    padding: 4px !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  
  .toolbar button {
    font-size: 10px !important;
    padding: 4px 8px !important;
    min-height: 28px !important;
  }
  
  /* Fix window control buttons and title bar */
  .title-bar {
    min-height: 26px;
    padding: 3px 8px;
    line-height: 20px;
  }
  
  .title-bar-text {
    font-size: 11px;
    line-height: 20px;
  }
  
  .title-bar-controls button {
    width: 22px !important;
    height: 20px !important;
    font-size: 10px !important;
    padding: 0 !important;
    margin: 0 1px !important;
    min-height: 20px !important;
    line-height: 20px !important;
  }
  
  /* File dialogs on mobile */
  .file-dialog {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 100px) !important;
    left: 10px !important;
    top: 50px !important;
  }
  
  /* Help and shortcut dialogs */
  #help-dialog, #shortcuts-dialog {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 100px) !important;
    left: 10px !important;
    top: 50px !important;
  }
  
  /* Character map mobile adjustments */
  #character-map-dialog {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 100px) !important;
    left: 10px !important;
    top: 50px !important;
  }
  
  .character-map-body {
    font-size: 12px;
  }
  
  .character-grid {
    font-size: 14px;
  }

  .char-button {
    width: 28px;
    height: 28px;
    font-size: 12px;
    min-width: 28px;
    min-height: 28px;
  }
  
  .char-preview-box {
    width: 60px;
    min-height: 28px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  /* Very small screens - fully scrollable layout */
  body {
    overflow-y: auto !important;
    height: auto !important;
  }
  
  .desktop {
    min-height: 100vh !important;
    height: auto !important;
    position: relative !important;
    padding-bottom: 50px !important;
  }
  
  .control-window {
    width: calc(100vw - 8px) !important;
    left: 4px !important;
    top: 4px !important;
    height: auto !important;
    max-height: none !important;
    min-height: 380px !important;
    position: relative !important;
    margin-bottom: 12px !important;
  }
  
  .control-window .window-body {
    height: auto !important;
    min-height: 330px !important;
    overflow: visible !important;
    padding: 4px !important;
    box-sizing: border-box !important;
  }
  
  .output-window {
    width: calc(100vw - 8px) !important;
    left: 4px !important;
    top: auto !important;
    bottom: auto !important;
    height: auto !important;
    max-height: none !important;
    position: relative !important;
    margin-bottom: 40px !important;
  }
  
  .output-window .window-body {
    height: auto !important;
    overflow: visible !important;
    padding: 2px !important;
    box-sizing: border-box !important;
  }
  
  .output-window .ascii-output {
    height: 250px !important;
    max-height: 350px !important;
    overflow: auto !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    white-space: pre-wrap !important;
  }
  
  /* Compact touch targets for small screens */
  button {
    min-height: 32px;
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .title-bar {
    min-height: 22px;
    padding: 1px 6px;
    line-height: 20px;
  }
  
  .title-bar-text {
    font-size: 11px;
    line-height: 20px;
  }
  
  .title-bar-controls button {
    width: 18px !important;
    height: 18px !important;
    font-size: 9px !important;
    line-height: 18px !important;
  }
  
  /* Stack form elements vertically */
  .field-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-bottom: 10px;
    padding: 4px 0;
  }
  
  .field-row label {
    min-width: auto;
    margin-bottom: 4px;
    font-size: 11px;
  }
  
  input, select {
    min-height: 32px;
    font-size: 12px;
    padding: 4px 6px;
  }
  
  /* Zoom controls layout */
  .zoom-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  
  .zoom-controls input[type="range"] {
    grid-column: 1 / -1;
    height: 24px;
  }
  
  /* Compact dialogs for small screens */
  .file-dialog .field-row {
    margin-bottom: 8px;
  }
  
  .dialog-preview {
    height: 100px;
    margin: 8px 0;
  }
  
  /* Enhanced control panel for small screens */
  .control-panel-content {
    max-height: calc(100vh - 150px);
    padding: 6px;
  }
  
  fieldset {
    margin-bottom: 8px;
    padding: 8px;
  }
  
  legend {
    font-size: 10px;
    padding: 0 4px;
  }
  
  /* Enhanced status bar for very small screens */
  .status-bar {
    padding: 6px !important;
    font-size: 11px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    min-height: auto !important;
  }
  
  .status-bar-field {
    font-size: 11px !important;
    justify-content: space-between !important;
    background: rgba(255, 255, 255, 0.1) !important;
    padding: 4px 6px !important;
    border-radius: 2px !important;
  }
  
  .status-bar-field label {
    font-size: 11px !important;
    font-weight: bold !important;
  }
  
  .status-bar-field select {
    min-height: 22px !important;
    height: 22px !important;
    font-size: 11px !important;
    padding: 1px 3px !important;
    min-width: 50px !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
  }
}

/* Accessibility */
:focus-visible {
  outline: 2px dotted #000000;
  outline-offset: 2px;
}

/* Preserve Windows 98 style */
button, input, select {
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 11px;
}

/* Windows 98 Style Scrollbars */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background: #c0c0c0;
  border: 1px inset #c0c0c0;
}

::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 1px outset #c0c0c0;
  min-height: 16px;
  min-width: 16px;
}

::-webkit-scrollbar-thumb:hover {
  background: #d4d0c8;
}

::-webkit-scrollbar-thumb:active {
  border: 1px inset #c0c0c0;
  background: #a0a0a0;
}

::-webkit-scrollbar-corner {
  background: #c0c0c0;
}

::-webkit-scrollbar-button {
  background: #c0c0c0;
  border: 1px outset #c0c0c0;
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-button:hover {
  background: #d4d0c8;
}

::-webkit-scrollbar-button:active {
  border: 1px inset #c0c0c0;
  background: #a0a0a0;
}

::-webkit-scrollbar-button:vertical:start:decrement {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='m8 4-4 4h8z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px 8px;
}

::-webkit-scrollbar-button:vertical:end:increment {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='m4 8 4 4 4-4z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px 8px;
}

::-webkit-scrollbar-button:horizontal:start:decrement {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='m8 4-4 4 4 4z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px 8px;
}

::-webkit-scrollbar-button:horizontal:end:increment {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 4v8l4-4z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px 8px;
}

/* Status bar spacing */
.status-bar .status-bar-field {
  margin-right: 10px;
}

.status-bar .status-bar-field:last-child {
  margin-right: 0;
}

/* File Dialog Styling */
.file-dialog {
  z-index: 1002;
}

.file-dialog .field-row {
  margin-bottom: 8px;
  align-items: center;
}

.file-dialog .field-row label {
  min-width: 80px;
  margin-right: 8px;
}

.dialog-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  max-height: 200px;
  min-height: 150px;
}

.dialog-preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.dialog-buttons {
  border-top: 1px solid #808080;
  padding-top: 10px;
  margin-top: 10px;
}

.dialog-buttons button {
  min-width: 75px;
  padding: 4px 12px;
}


/* Character Map Comprehensive Styling */
.character-map-body {
  padding: 8px !important;
  display: flex !important;
  flex-direction: column !important;
  height: calc(100% - 32px) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.char-map-header {
  flex-shrink: 0;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #808080;
}

.char-map-header .field-row {
  margin-bottom: 6px;
}

.char-set-info {
  font-size: 10px;
  color: #606060;
  font-style: italic;
  margin-top: 4px;
}

.character-grid-container {
  flex: 1;
  overflow: hidden;
  border: 1px inset #c0c0c0;
  background: white;
  margin: 8px 0;
  min-height: 0; /* Important for flex child to shrink */
}

.character-grid {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  box-sizing: border-box;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  line-height: 1.2;
  -webkit-overflow-scrolling: touch;
}

.char-grid-content {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: flex-start;
  align-content: flex-start;
  min-height: 100%;
}

.char-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  text-align: center;
  margin: 1px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1;
  transition: all 0.1s ease;
  user-select: none;
}

.char-button:hover {
  background: #0078d4;
  color: white;
  border-color: #005a9e;
  transform: scale(1.1);
  z-index: 10;
  position: relative;
}

.char-button.selected {
  background: #ffff99;
  border-color: #cc9900;
  font-weight: bold;
}

.char-button.selected:hover {
  background: #ffff66;
  border-color: #996600;
}

.char-map-footer {
  flex-shrink: 0;
  padding-top: 8px;
  border-top: 1px solid #808080;
}

.char-map-footer .field-row {
  margin-bottom: 6px;
  align-items: center;
}

.char-preview-box {
  min-height: 32px;
  width: 100px;
  border: 1px inset #c0c0c0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  margin-left: 8px;
}


/* Dialog modal overlay */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1001;
  display: none;
}

.dialog-overlay.show {
  display: block;
}

/* File input styling for dialogs */
.dialog-file-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* Mobile-specific enhancements */
.mobile-device .window {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.mobile-device .title-bar {
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 4px 4px 0 0;
}

.mobile-device .window-body {
  border-radius: 0 0 4px 4px;
}

.mobile-device .ascii-output {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  border-radius: 2px;
}


/* Touch feedback */
.mobile-device button:active,
.mobile-device .menu-item:active,
.mobile-device .char-button:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

/* Prevent text selection on touch */
.mobile-device .title-bar,
.mobile-device button,
.mobile-device .menu-item {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Mobile scrollbar adjustments */
.mobile-device ::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

/* Mobile control panel improvements */
.mobile-device .control-panel-content {
  padding: 8px !important;
  max-height: calc(100vh - 120px) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.mobile-device .control-panel-content fieldset {
  margin-bottom: 12px !important;
  padding: 8px !important;
}

/* Window Resize Handles - Windows 98 Style */
.resizable-window {
  position: relative;
}

.resize-handle {
  position: absolute;
  z-index: 1000;
  background: transparent;
}

/* Edge handles */
.resize-n {
  top: -3px;
  left: 10px;
  right: 10px;
  height: 6px;
  cursor: n-resize;
}

.resize-s {
  bottom: -3px;
  left: 10px;
  right: 10px;
  height: 6px;
  cursor: s-resize;
}

.resize-e {
  top: 10px;
  right: -3px;
  bottom: 10px;
  width: 6px;
  cursor: e-resize;
}

.resize-w {
  top: 10px;
  left: -3px;
  bottom: 10px;
  width: 6px;
  cursor: w-resize;
}

/* Corner handles */
.resize-ne {
  top: -3px;
  right: -3px;
  width: 13px;
  height: 13px;
  cursor: ne-resize;
}

.resize-nw {
  top: -3px;
  left: -3px;
  width: 13px;
  height: 13px;
  cursor: nw-resize;
}

.resize-se {
  bottom: -3px;
  right: -3px;
  width: 13px;
  height: 13px;
  cursor: se-resize;
}

.resize-sw {
  bottom: -3px;
  left: -3px;
  width: 13px;
  height: 13px;
  cursor: sw-resize;
}

/* Resize handle hover effect */
.resize-handle:hover {
  background: rgba(0, 120, 212, 0.1);
}

/* Hide resize handles on mobile */
@media (max-width: 768px) {
  .resize-handle {
    display: none;
  }
}

/* Hide elements */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
