.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:rgba(0,0,0,.1);margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" stroke=\"%23666\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" viewBox=\"0 0 20 20\"><path d=\"m10 3 2 2H8l2-2v14l-2-2h4l-2 2\"/></svg>");background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px rgba(0,0,0,.2);opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}
/**
 * Tab Group Widget Styles
 * Chrome-inspired tab design for widget tab groups
 */

/* Tab Group Container */
.tab-group-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: #1e1e1e;
}

/* Tab Bar */
.tab-group-tabs {
  display: flex;
  background-color: #2d2d30;
  border-bottom: 1px solid #3e3e42;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  height: 35px;
  scrollbar-width: thin;
  scrollbar-color: #424242 #2d2d30;
}

.tab-group-tabs::-webkit-scrollbar {
  height: 6px;
}

.tab-group-tabs::-webkit-scrollbar-track {
  background: #2d2d30;
}

.tab-group-tabs::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 3px;
}

.tab-group-tabs::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

/* Individual Tab */
.tab-group-tab {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  background-color: #2d2d30;
  border-right: 1px solid #3e3e42;
  cursor: pointer;
  user-select: none;
  min-width: 120px;
  max-width: 200px;
  position: relative;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.tab-group-tab:hover {
  background-color: #3e3e42;
}

.tab-group-tab.active {
  background-color: #1e1e1e;
  border-bottom: 2px solid #007acc;
}

/* Tab Drag Handle */
.tab-drag-handle {
  cursor: grab;
  color: #808080;
  font-size: 10px;
  margin-right: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 2px;
  line-height: 1;
}

.tab-group-tab:hover .tab-drag-handle {
  opacity: 1;
}

.tab-drag-handle:hover {
  color: #cccccc;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.tab-drag-handle:active {
  cursor: grabbing;
}

/* Tab Icon */
.tab-icon {
  font-size: 14px;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Tab Title */
.tab-title {
  flex: 1;
  font-size: 13px;
  color: #cccccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tab-group-tab.active .tab-title {
  color: #ffffff;
  font-weight: 500;
}

/* Tab Close Button */
.tab-close {
  background: none;
  border: none;
  color: #808080;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  line-height: 1;
  margin-left: 6px;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
  border-radius: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-group-tab:hover .tab-close {
  opacity: 1;
}

.tab-close:hover {
  color: #ffffff;
  background-color: #f44747;
}

/* Tab Popout Button */
.tab-popout {
  background: none;
  border: none;
  color: #808080;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  line-height: 1;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
  border-radius: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-group-tab:hover .tab-popout {
  opacity: 1;
}

.tab-popout:hover {
  color: #ffffff;
  background-color: #007acc;
}

/* Tab Content Area */
.tab-group-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  background-color: #1e1e1e;
}

.tab-group-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow: auto;
}

/* Ensure direct children of tab panel fill the space */
.tab-group-panel > * {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.tab-group-panel.active {
  display: block;
}

/* Drop Zone Overlay (for future drag-drop implementation) */
.tab-group-drop-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 122, 204, 0.1);
  border: 2px dashed #007acc;
  display: none;
  z-index: 1000;
  pointer-events: none;
}

.tab-group-drop-zone.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone-center {
  background-color: rgba(0, 122, 204, 0.2);
  border: 2px solid #007acc;
  border-radius: 8px;
  padding: 24px 32px;
  text-align: center;
  pointer-events: none;
}

.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.8;
}

.drop-zone-text {
  color: #007acc;
  font-weight: bold;
  font-size: 14px;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Animations */
@keyframes tab-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-group-tab {
  animation: tab-fade-in 0.2s ease-out;
}

/* Focus state for accessibility */
.tab-group-tab:focus {
  outline: 1px solid #007acc;
  outline-offset: -1px;
}

/* Scrollbar styling for tab content */
.tab-group-panel {
  scrollbar-width: thin;
  scrollbar-color: #424242 #1e1e1e;
}

.tab-group-panel::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.tab-group-panel::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.tab-group-panel::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 5px;
}

.tab-group-panel::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

/* Empty state */
.tab-group-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #808080;
  font-size: 14px;
}

/* Tab group in GridStack - ensure proper sizing */
.grid-stack-item .tab-group-container {
  width: 100%;
  height: 100%;
}

/* Load IBM BIOS font for authentic retro text rendering */
@font-face {
  font-family: 'IBM BIOS';
  src: url(/assets/Web437_IBM_BIOS-bde4fb6491be7e095556.woff) format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: block; /* Ensure font loads before use */
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1e1e1e;
  color: #d4d4d4;
  overflow: hidden;
}

.main-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #1e1e1e;
}

.toolbar-container {
  flex-shrink: 0;
}

.content-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  background-color: #1e1e1e;
}

/* Gridstack container fills content area */
#grid-container {
  width: 100%;
  height: 100%;
}

.toolbar {
  background-color: #2d2d30;
  border-bottom: 1px solid #3e3e42;
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

/* Add padding for window controls in Electron */
body.electron-app .toolbar {
  padding-left: 80px; /* Space for macOS traffic lights */
  -webkit-app-region: drag; /* Make toolbar draggable */
}

/* Make buttons clickable (not draggable) */
body.electron-app .toolbar-btn {
  -webkit-app-region: no-drag;
}

.toolbar-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.toolbar-left {
  flex: 0 0 auto;
}

/* Ensure first button group doesn't overlap window controls */
body.electron-app .toolbar-left:first-child {
  margin-left: 8px; /* Additional spacing from window controls */
}

.toolbar-center {
  flex: 0 0 auto;
  margin: 0 auto;
}

.toolbar-right {
  flex: 0 0 auto;
  margin-right: 8px;
}

.toolbar-btn {
  background-color: #0e639c;
  color: white;
  border: none;
  padding: 10px 48px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  width: auto;
  text-align: center;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn:hover {
  background-color: #1177bb;
}

.toolbar-btn:disabled {
  background-color: #555;
  color: #888;
  cursor: not-allowed;
  opacity: 0.6;
}

.toolbar-btn.save-btn {
  background-color: #2564cf;
}

.toolbar-btn.save-btn:hover {
  background-color: #3b82f6;
}

.toolbar-btn.run-btn {
  background-color: #16825d;
}

.toolbar-btn.run-btn:hover {
  background-color: #1e9973;
}

.version-info {
  color: #ffd700;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  white-space: nowrap;
  user-select: none;
}

.toolbar-btn.stop-btn {
  background-color: #cc6633;
}

.toolbar-btn.stop-btn:hover {
  background-color: #dd7744;
}

/* View Menu Dropdown Styles */
.view-menu-container {
  position: relative;
}

.view-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background-color: #2d2d30;
  border: 1px solid #454545;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  min-width: 200px;
  z-index: 10000;
  padding: 4px 0;
}

.view-menu-dropdown.hidden {
  display: none;
}

.view-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  color: #d4d4d4;
  font-size: 13px;
  user-select: none;
}

.view-menu-item:hover {
  background-color: #094771;
}

.view-menu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.view-menu-label {
  flex: 1;
}

.view-menu-popup-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 14px;
  border-radius: 2px;
  opacity: 0.7;
  transition: all 0.2s;
}

.view-menu-popup-btn:hover {
  background-color: #0e639c;
  color: #fff;
  opacity: 1;
}

.view-menu-separator {
  height: 1px;
  background-color: #454545;
  margin: 4px 0;
}

/* Main Menu Dropdown Styles */
.main-menu-container {
  position: relative;
}

.main-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background-color: #2d2d30;
  border: 1px solid #454545;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  min-width: 250px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  z-index: 10000;
  padding: 4px 0;
}

.main-menu-dropdown.hidden {
  display: none;
}

/* Menu section headers */
.menu-section-header {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  padding: 8px 16px 4px 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}

/* Menu items */
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  color: #d4d4d4;
  font-size: 13px;
  user-select: none;
  transition: background 0.2s;
}

.menu-item:hover {
  background-color: #094771;
}

.menu-item[data-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.menu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.menu-label {
  flex: 1;
}

.menu-shortcut {
  font-size: 11px;
  color: #888;
  margin-left: auto;
}

.menu-separator {
  height: 1px;
  background-color: #454545;
  margin: 4px 0;
}

.editor-container {
  flex: 1;
  overflow: hidden;
  /* Removed height: 100% - it was causing editor to extend into status bar */
}

/* Graphics Modal Styles */
.game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
  outline: none;
  overflow: auto;
}

.game-canvas.hidden {
  opacity: 0;
  pointer-events: none;
}

.game-canvas:focus {
  outline: 2px solid #007acc;
  outline-offset: -2px;
}

.game-canvas-content {
  background-color: #2d2d30;
  border: none;
  border-radius: 6px;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.game-canvas-header {
  background-color: #3c3c3c;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #555;
  border-radius: 6px 6px 0 0;
}

.graphics-title {
  color: #d4d4d4;
  font-size: 14px;
  font-weight: 500;
}

.keyboard-status {
  color: #16825d;
  font-size: 12px;
  font-weight: normal;
}

.keyboard-status.completed {
  color: #4a90e2;
  font-weight: 500;
}

.keyboard-status.stopped {
  color: #e74c3c;
  font-weight: 500;
}

.keyboard-status.hidden {
  display: none;
}

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

.modal-btn {
  background-color: #555;
  color: #d4d4d4;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 0px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-btn:hover {
  background-color: #666;
}

.modal-btn:last-child:hover {
  background-color: #cc6633;
}

/* Screenshot button - better contrast */
#graphics-screenshot {
  background-color: #0e639c;
  color: #ffffff;
  font-size: 18px;
}

#graphics-screenshot:hover {
  background-color: #1177bb;
}

.screenshot-container {
  position: relative;
  display: inline-block;
}

.screenshot-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #3c3c3c;
  border: 1px solid #555;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  margin-top: 4px;
  z-index: 1000;
  min-width: 180px;
}

.screenshot-menu.hidden {
  display: none;
}

.screenshot-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: #d4d4d4;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s;
}

.screenshot-menu-item:hover {
  background-color: #094771;
}

.screenshot-menu-item:first-child {
  border-radius: 4px 4px 0 0;
}

.screenshot-menu-item:last-child {
  border-radius: 0 0 4px 4px;
}

.game-canvas-body {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graphics-canvas-container {
  background-color: #000;
}

/* Play URL Mode - borderless fullscreen */
.game-canvas.play-url-mode {
  background-color: #000;
}

.game-canvas.play-url-mode .game-canvas-content {
  background-color: transparent;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.game-canvas.play-url-mode .game-canvas-body {
  width: 100%;
  height: 100%;
}

.game-canvas.play-url-mode .graphics-canvas-container {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.game-canvas.play-url-mode .graphics-canvas-container canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
}

/* Full Screen Mode - scale canvas to fit browser while maintaining aspect ratio */
.game-canvas.full-screen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
}

.game-canvas.full-screen-mode .game-canvas-content {
  width: 100%;
  height: 100%;
  /* Don't use flex - it interferes with Phaser's Scale Manager */
  display: block;
  padding: 0;
  margin: 0;
}

.game-canvas.full-screen-mode .game-canvas-body {
  width: 100%;
  height: 100%;
  /* Don't use flex - let Phaser manage the canvas */
  display: block;
  padding: 0;
  margin: 0;
}

.game-canvas.full-screen-mode .graphics-canvas-container {
  width: 100%;
  height: 100%;
  /* Critical: Don't interfere with Phaser's positioning */
  display: block;
  position: relative;
  padding: 0;
  margin: 0;
}

/* Full screen canvas scaling - DO NOT override Phaser's inline styles */
.game-canvas.full-screen-mode .graphics-canvas-container canvas {
  /* Let Phaser's FIT scale mode handle all sizing via inline styles */
  /* Removed !important overrides that were breaking Phaser's calculations */
  display: block;
}

/* Alternative approach using the full-screen-canvas class directly */
.full-screen-canvas {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
}

.full-screen-canvas canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: block;
}

.status-bar {
  background-color: #007acc;
  color: white;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  flex-shrink: 0;
}

.status-left, .status-right {
  display: flex;
  gap: 16px;
}

.status-item {
  padding: 0 4px;
}

#status-storage {
  cursor: pointer;
  padding: 0 8px;
  font-weight: bold;
}

#status-storage:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Debug UI Styles - toolbar styles moved to index.html to avoid conflicts */

.debug-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.debug-button {
  background-color: #0e639c;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.debug-button:hover {
  background-color: #1177bb;
}

.debug-button:disabled {
  background-color: #555;
  cursor: not-allowed;
  opacity: 0.6;
}

.debug-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.separator {
  width: 1px;
  height: 24px;
  background-color: #555;
  margin: 0 4px;
}

.debug-state {
  color: #d4d4d4;
  font-size: 12px;
  font-weight: 500;
  margin-left: auto;
}

.state-idle { color: #888; }
.state-running { color: #16825d; }
.state-paused { color: #cc6633; }
.state-stepping { color: #0e639c; }

.debug-panels-container {
  display: none;
  background-color: #1e1e1e;
  border-top: 1px solid #3e3e42;
  height: 300px;
  min-height: 200px;
  flex-shrink: 0;
  overflow: hidden;
  width: 100%;
}

.debug-panels-container.visible {
  display: block;
}

.debug-panels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 100%;
  gap: 1px;
  background-color: #3e3e42;
}

.debug-panel {
  background-color: #252526;
  border: 1px solid #3e3e42;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100px;
}

.debug-panel.debug-console {
  grid-column: 1 / -1;
}

.debug-panel-header {
  background-color: #2d2d30;
  color: #d4d4d4;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #3e3e42;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.debug-panel-content {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  font-size: 12px;
  color: #d4d4d4;
}

.panel-placeholder {
  color: #888;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.panel-button {
  background-color: #0e639c;
  color: white;
  border: none;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
}

.panel-button:hover {
  background-color: #1177bb;
}

/* Variable panel styles */
.debug-variable {
  display: flex;
  padding: 4px 0;
  border-bottom: 1px solid #333;
  gap: 8px;
  align-items: center;
}

.debug-variable-name {
  font-weight: 500;
  color: #9cdcfe;
  min-width: 80px;
}

.debug-variable-value {
  color: #ce9178;
  flex: 1;
  font-family: 'Courier New', monospace;
}

.debug-variable-type {
  color: #4ec9b0;
  font-size: 10px;
}

.debug-variable-scope {
  color: #888;
  font-size: 10px;
}

/* Watch panel styles */
.watch-input {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.watch-input input {
  flex: 1;
  background-color: #3c3c3c;
  color: #d4d4d4;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 12px;
}

.watch-input button {
  background-color: #0e639c;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
}

.debug-watch {
  display: flex;
  padding: 4px 0;
  border-bottom: 1px solid #333;
  align-items: center;
  gap: 8px;
}

.debug-watch-expression {
  font-weight: 500;
  color: #9cdcfe;
  flex: 1;
}

.debug-watch-value {
  color: #ce9178;
  font-family: 'Courier New', monospace;
}

.debug-watch-error {
  color: #f44747;
  font-style: italic;
}

.debug-watch-remove {
  color: #f44747;
  cursor: pointer;
  font-weight: bold;
  padding: 0 4px;
}

/* Breakpoints panel styles */
.debug-breakpoint {
  display: flex;
  padding: 4px 0;
  border-bottom: 1px solid #333;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}

.debug-breakpoint:hover {
  background-color: #2d2d30;
}

.debug-breakpoint-line {
  font-weight: 500;
  color: #9cdcfe;
  min-width: 60px;
}

.debug-breakpoint-condition {
  color: #ce9178;
  flex: 1;
  font-style: italic;
}

.debug-breakpoint-remove {
  color: #f44747;
  cursor: pointer;
  background: none;
  border: none;
  font-weight: bold;
  padding: 2px 4px;
}

/* Console styles */
.debug-console-output {
  flex: 1;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 8px;
  background-color: #0c0c0c;
}

.debug-console-input {
  display: flex;
  align-items: center;
  padding: 8px;
  border-top: 1px solid #3e3e42;
  background-color: #1e1e1e;
}

.debug-console-prompt {
  color: #9cdcfe;
  margin-right: 8px;
  font-family: 'Courier New', monospace;
}

.debug-console-input-field {
  flex: 1;
  background-color: #3c3c3c;
  color: #d4d4d4;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

.debug-console-entry {
  margin-bottom: 4px;
}

.debug-console-input-echo {
  color: #9cdcfe;
}

.debug-console-output-value {
  color: #ce9178;
}

.debug-console-error {
  color: #f44747;
}

/* Call stack styles */
.debug-stack-frame {
  display: flex;
  padding: 4px 0;
  border-bottom: 1px solid #333;
  cursor: pointer;
  gap: 8px;
}

.debug-stack-frame:hover {
  background-color: #2d2d30;
}

.debug-stack-frame.active {
  background-color: #0e639c;
  color: white;
}

.debug-stack-frame-name {
  font-weight: 500;
  flex: 1;
}

.debug-stack-frame-line {
  color: #888;
  font-size: 11px;
}

@media (max-width: 768px) {
  .content-container {
    flex-direction: column;
  }

  .canvas-container {
    width: 100%;
    height: 300px;
  }

  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .debug-panels {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, 1fr);
  }
}

/* Modal Styles */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

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

.modal-dialog {
  background-color: #2d2d30;
  border: 1px solid #555;
  border-radius: 4px;
  min-width: 400px;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.2s ease-out;
  pointer-events: auto;
  overflow: hidden;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #555;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #3c3c3c;
}

.modal-header h3 {
  margin: 0;
  color: #d4d4d4;
  font-size: 14px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  flex-shrink: 0;
}

.modal-body label {
  display: block;
  margin-bottom: 8px;
  color: #d4d4d4;
  font-size: 12px;
  font-weight: 500;
}

.modal-body input[type="text"],
.modal-body input[type="file"] {
  width: 100%;
  padding: 8px 12px;
  background-color: #3c3c3c;
  border: 1px solid #555;
  border-radius: 3px;
  color: #d4d4d4;
  font-size: 13px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.modal-body input:focus {
  outline: none;
  border-color: #0e639c;
  box-shadow: 0 0 0 2px rgba(14, 99, 156, 0.3);
}

.input-hint {
  font-size: 11px;
  color: #999;
  margin-bottom: 0;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #555;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background-color: #333;
}

.modal-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  min-width: fit-content;
  white-space: nowrap;
}

.modal-btn.primary {
  background-color: #0e639c;
  color: white;
}

.modal-btn.primary:hover {
  background-color: #1177bb;
}

.modal-btn.secondary {
  background-color: #555;
  color: #d4d4d4;
}

.modal-btn.secondary:hover {
  background-color: #666;
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #444 !important;
}

/* Import Modal Styles */
.import-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.import-option {
  text-align: center;
}

.import-option h4 {
  margin: 0 0 12px 0;
  color: #d4d4d4;
  font-size: 14px;
}

.import-divider {
  text-align: center;
  color: #888;
  font-size: 12px;
  padding: 8px 0;
}

.drop-zone {
  border: 2px dashed #555;
  border-radius: 4px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #2a2a2a;
  color: #999;
  font-size: 13px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #0e639c;
  background-color: #2a3a4a;
  color: #d4d4d4;
}

/**
 * Main styles for CrashBasic IDE
 * Extracted from index.html inline styles
 */

/* ===== Base Styles ===== */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1e1e1e;
    color: #d4d4d4;
    overflow: hidden;
}

/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-logo {
    font-size: 48px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.loading-text {
    font-size: 18px;
    color: #ddd;
    margin-bottom: 30px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #ffffff40;
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-progress {
    width: 300px;
    height: 6px;
    background-color: #ffffff20;
    border-radius: 3px;
    margin-top: 20px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background-color: #ffffff;
    border-radius: 3px;
    width: 0%;
    animation: progress 3s ease-out forwards;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes progress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ===== Main Container ===== */
.main-container {
    display: none;
    flex-direction: column;
    height: 100vh;
}

.content-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Gridstack container fills content area */
#grid-container {
    width: 100%;
    height: 100%;
}

/* ===== Error Overlay ===== */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.error-dialog {
    background-color: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    padding: 20px;
    max-width: 500px;
    max-height: 300px;
    overflow-y: auto;
}

.error-title {
    color: #f44747;
    font-weight: bold;
    margin-bottom: 10px;
}

.error-message {
    color: #cccccc;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.error-close {
    margin-top: 15px;
    text-align: right;
}

.error-close button {
    background-color: #0e639c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
}

.error-close button:hover {
    background-color: #1177bb;
}

/* ===== Status Bar ===== */
#status-bar-container {
    flex-shrink: 0;
    flex-grow: 0;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Gridstack Widget Styles ===== */
.grid-stack {
    background-color: #1e1e1e;
}

.grid-stack-item {
    background-color: transparent;
}

.grid-stack-item-content {
    background-color: #252526;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Widget Header */
.widget-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    flex-shrink: 0;
    cursor: move;
}

.widget-icon {
    font-size: 16px;
    margin-right: 8px;
}

.widget-title {
    flex: 1;
    font-weight: bold;
    font-size: 12px;
    color: #cccccc;
}

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

.widget-control-btn {
    background: none;
    border: none;
    color: #cccccc;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
    border-radius: 2px;
    transition: background-color 0.2s;
}

.widget-control-btn:hover {
    background-color: #3e3e42;
}

/* Widget Body */
.widget-body {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Toolbar Icon Buttons */
.toolbar-icons {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.toolbar-icon-btn {
    background: none;
    border: 1px solid #3e3e42;
    color: #cccccc;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 16px;
    border-radius: 3px;
    transition: all 0.2s;
}

.toolbar-icon-btn:hover {
    background-color: #3e3e42;
    border-color: #007acc;
}

.toolbar-icon-btn.active {
    background-color: #0e639c;
    border-color: #007acc;
}

.toolbar-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

