@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  /* 8-bit Laboratory Color Palette - Dashboard specific variables with prefix to avoid conflicts with index.css */
  /* All variables use --dashboard- prefix to prevent conflicts with index.css variables like --text-primary, --text-secondary */
  --dashboard-bg-primary: #f8f8f8;
  --dashboard-bg-secondary: #f3f3f3;
  --dashboard-bg-tertiary: #ededed;
  --dashboard-black: #111111;
  --dashboard-yellow-pacman: #ffd83b;
  --dashboard-blue-arcade: #1f6feb;
  --dashboard-red-pixel: #e63946;
  --dashboard-text-primary: #0f172a;
  --dashboard-text-secondary: #334155;
  --dashboard-border-black: #111111;
  --dashboard-border-weight: 2px;
  --dashboard-shadow-hard: 3px 3px 0px #111111;
  --dashboard-shadow-hard-hover: 4px 4px 0px #111111;
  
  /* Local aliases for internal use only - these are scoped to replay_dashboard.html iframe */
  /* These will NOT conflict with index.css because replay_dashboard.html is in a separate iframe */
  --bg-primary: var(--dashboard-bg-primary);
  --bg-secondary: var(--dashboard-bg-secondary);
  --bg-tertiary: var(--dashboard-bg-tertiary);
  --black: var(--dashboard-black);
  --yellow-pacman: var(--dashboard-yellow-pacman);
  --blue-arcade: var(--dashboard-blue-arcade);
  --red-pixel: var(--dashboard-red-pixel);
  --text-primary: var(--dashboard-text-primary);
  --text-secondary: var(--dashboard-text-secondary);
  --border-black: var(--dashboard-border-black);
  --shadow-hard: var(--dashboard-shadow-hard);
  --shadow-hard-hover: var(--dashboard-shadow-hard-hover);
}

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

/* Dashboard-specific html styles - scoped to avoid conflicts with index.css */
html {
  font-family: 'Segoe UI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif !important;
  scroll-behavior: auto !important; /* Override index.css smooth scrolling if needed */
  height: auto !important; /* Allow html to grow with content for iframe embedding */
  min-height: 0 !important; /* Remove min-height to allow proper height calculation */
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important; /* Let content define height (parent sets iframe height) */
  overflow-x: hidden !important;
  line-height: 0 !important; /* Remove default line-height spacing */
}

/* Dashboard-specific body styles - scoped to avoid conflicts with index.css */
body {
  font-family: 'Segoe UI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif !important;
  background-color: var(--dashboard-bg-primary) !important;
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px) !important;
  background-size: 20px 20px !important;
  color: var(--dashboard-text-primary) !important;
  min-height: 0 !important; /* Remove min-height to allow proper height calculation */
  height: auto !important; /* Allow body to grow with content for iframe embedding */
  overflow: visible !important; /* Let content define height (parent sets iframe height) */
  overflow-x: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.6 !important;
  box-sizing: border-box !important;
  /* Remove any default spacing */
  border: 0 !important;
  outline: 0 !important;
}

.dashboard-shell {
  width: 100%;
  max-width: 100% !important; /* Use full width for larger display */
  margin: 0 !important; /* Remove all margins */
  padding: 0 !important; /* Remove all padding - content will handle its own spacing */
  display: flex;
  flex-direction: column;
  gap: 6px !important; /* Keep small gap between elements */
  box-sizing: border-box;
  padding-bottom: 0 !important; /* Ensure bottom is flush */
}

/* Mission Data Container - Between Navigation and Dashboard */
.mission-data-container {
  width: 100%;
  padding: 8px;
  background-color: var(--bg-primary);
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 4px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  align-items: stretch;
  flex: 0 0 auto;
  min-height: auto; /* Allow content to define height */
  max-height: none; /* No cap to avoid clipping */
  height: auto;     /* Auto height for variable text */
  overflow: visible; /* Let content grow naturally */
  box-shadow: var(--shadow-hard);
  animation: slideInFromTop 0.5s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.mission-data-container[style*="display: none"] {
  animation: slideOutToTop 0.3s ease-in;
}

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

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

.dashboard-container {
  display: flex;
  flex: 0 0 auto; /* Height driven by content */
  min-height: auto;
  height: auto;
  max-height: none !important; /* No cap so bottom controls are visible */
  overflow: visible !important; /* Avoid clipping bottom controls */
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 4px;
  background-color: var(--bg-primary);
  box-shadow: var(--shadow-hard);
  animation: fadeIn 0.5s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.dashboard-container[style*="display: none"] {
  animation: fadeOut 0.3s ease-in;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Header */
.dashboard-header {
  height: auto;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: var(--shadow-hard);
}

.header-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--black);
  letter-spacing: 1px;
}

/* Environment Navigation Container */
.environment-nav-container {
  height: auto !important;
  background-color: var(--bg-secondary);
  position: relative;
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 4px;
  flex-shrink: 0;
  padding: 6px;
  box-shadow: 1px 1px 0px var(--black);
}

.environment-nav-scroll {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 0;
  height: auto; /* Changed from 100% to auto to allow full content display */
  min-height: 100%;
  overflow: visible; /* Changed from hidden to visible to show all cards */
  position: relative;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
}

.environment-nav-scroll::-webkit-scrollbar {
  display: none;
}

.environment-cards-wrapper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  width: 100%;
  flex-shrink: 0;
  animation: none; /* Remove scrolling animation */
}

/* Removed scrollEnvironments animation - not needed for 3-row layout */

.environment-nav-scroll::-webkit-scrollbar {
  height: 6px;
}

.environment-nav-scroll::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border: 1px solid var(--black);
}

.environment-nav-scroll::-webkit-scrollbar-thumb {
  background-color: var(--black);
  border-radius: 0;
}

.environment-nav-scroll::-webkit-scrollbar-thumb:hover {
  background-color: var(--blue-arcade);
}

/* Environment Card (Visual Filmstrip) */
.environment-card {
  display: flex;
  flex-direction: column;
  width: 100% !important;
  min-height: 66px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  padding: 6px;
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 5px;
  background-color: var(--bg-primary);
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.15);
}

.environment-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hard);
}

.environment-card.active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hard);
}

.card-image-wrapper {
  position: relative;
  width: 100% !important;
  aspect-ratio: 5 / 3;
  height: auto;
  min-height: 60px;
  max-height: 110px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  border: var(--dashboard-border-weight) solid var(--black);
  box-shadow: none;
  transition: all 0.2s ease;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: saturate(0.9) brightness(0.98);
  transition: filter 0.2s ease, transform 0.2s ease;
  background-color: var(--bg-tertiary);
}

.card-status-bar {
  display: none;
}

.card-label {
  margin-top: 6px !important;
  font-size: 12px !important;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
  border: var(--dashboard-border-weight) solid var(--black);
  background-color: var(--bg-primary);
  padding: 5px 8px !important;
  border-radius: 4px;
}

.environment-card:hover .card-label {
  color: var(--blue-arcade);
  border-color: var(--blue-arcade);
}

.environment-card.active .card-label {
  color: var(--black);
  border-color: var(--yellow-pacman);
  background-color: var(--yellow-pacman);
}

/* Keep ZoomIn highlight but match shape */

.environment-card.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: #d4af37;
}

.environment-card:hover .card-image {
  filter: saturate(1) brightness(1);
  transform: scale(1.01);
}

/* Easter Egg Styles for StringSight */
.environment-card.easter-egg {
  position: relative;
  animation: easterEggPulse 2s ease-in-out infinite;
}

.environment-card.easter-egg .card-image-wrapper {
  border: var(--dashboard-border-weight) solid var(--yellow-pacman);
  animation: easterEggBorder 3s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.environment-card.easter-egg:hover .card-image-wrapper {
  border-color: var(--yellow-pacman);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 4px 4px 0px var(--black);
  animation: easterEggBorder 1s ease-in-out infinite;
}

.environment-card.easter-egg .card-label {
  background: linear-gradient(90deg, var(--yellow-pacman), #FFA500, var(--yellow-pacman));
  background-size: 200% 100%;
  animation: easterEggShine 2s linear infinite;
  border-color: var(--yellow-pacman);
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.environment-card.easter-egg:hover .card-label {
  background: linear-gradient(90deg, var(--yellow-pacman), #FFA500, var(--yellow-pacman));
  background-size: 200% 100%;
  animation: easterEggShine 1s linear infinite;
  border-color: var(--yellow-pacman);
  transform: scale(1.05);
}

.environment-card.easter-egg.active .card-image-wrapper {
  border-color: var(--yellow-pacman);
  border-width: 5px;
  box-shadow: 0 0 25px rgba(255, 215, 0, 1), 6px 6px 0px var(--black);
  animation: easterEggBorder 0.8s ease-in-out infinite;
}

.environment-card.easter-egg.active .card-label {
  background: var(--yellow-pacman);
  color: var(--black);
  border-color: var(--black);
  font-weight: 700;
  animation: none;
}

.environment-card.easter-egg .card-status-bar {
  background: linear-gradient(90deg, var(--yellow-pacman), #FFA500, var(--yellow-pacman));
  background-size: 200% 100%;
  animation: easterEggShine 2s linear infinite;
}

@keyframes easterEggPulse {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes easterEggBorder {
  0%, 100% {
    border-color: var(--yellow-pacman);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  }
  50% {
    border-color: #FFA500;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.7);
  }
}

@keyframes easterEggShine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* Left Panel - Visuals */
.left-panel {
  width: 60%;
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  padding: 10px;
  min-width: 0;
  overflow: hidden;
}

.step-indicator {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--black);
  text-align: center;
  margin-bottom: 6px;
  white-space: nowrap;
  animation: indicatorFadeIn 0.4s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  /* Double black border maze wall style */
  border: var(--dashboard-border-weight) solid var(--black);
  overflow: hidden;
  position: relative;
  box-shadow: none;
  min-height: 0;               /* Let content define */
  max-height: none;            /* No cap */
  height: auto;                /* Let content drive height */
}

.agent-view-image {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  transition: opacity 0.2s ease;
  opacity: 1;
}

.agent-view-image[src=""] {
  opacity: 0;
}

.image-placeholder {
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
  padding: 24px;
}

.loading-spinner {
  border: 4px solid var(--black);
  border-top: 4px solid var(--yellow-pacman);
  border-radius: 0;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

/* Right Panel - Data & Logic */
.right-panel {
  width: 40%;
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 8px;
  min-width: 0;
}

.info-card {
  background-color: var(--bg-primary);
  /* Double black border maze wall style */
  border: var(--dashboard-border-weight) solid var(--black);
  padding: 6px;
  margin-bottom: 6px;
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  animation: cardSlideIn 0.4s ease-out;
}

@keyframes cardSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.info-card:hover {
  box-shadow: var(--shadow-hard);
  transform: translate(-2px, -2px);
}

/* Goal card (second card) should be scrollable */
.info-card:nth-child(2) {
  flex: 1 1 auto;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.info-card:nth-child(2) .card-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--black);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.card-content {
  color: var(--text-primary);
  line-height: 1.4;
  font-size: 12px;
}

/* Mission Data Card - Pixel Blueprint Style */
.mission-data-container .mission-data-card {
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 4px;
  box-shadow: var(--shadow-hard);
}

.mission-data-container .goal-card {
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%; /* Match container height */
  max-height: 100%; /* Prevent overflow */
  padding: 0;
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 4px;
  box-shadow: var(--shadow-hard);
  overflow: hidden; /* Ensure content doesn't overflow */
}

.mission-data-container .goal-label {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: var(--bg-primary);
  background-color: var(--black);
  padding: 6px 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
  border-bottom: var(--dashboard-border-weight) solid var(--black);
}

.mission-data-container .goal-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow: hidden;
  min-height: 0;
  max-height: 100%; /* Limit height */
  position: relative;
}

.mission-data-container .goal-content {
  font-family: 'Courier New', monospace;
  font-size: 12px !important; /* Fixed font size - consistent with index.html text-base (1rem = 16px, scaled down) */
  color: #333333;
  line-height: 1.5 !important; /* Fixed line height */
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: textFadeIn 0.5s ease-out;
  transition: opacity 0.3s ease;
  /* Prevent font size from changing based on content */
  font-size-adjust: none !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

@keyframes textFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Goal Content Highlighting */
.goal-content .highlight-yellow {
  background-color: var(--yellow-pacman);
  color: var(--black);
  padding: 1px 3px;
  font-weight: 600;
}

.goal-content .highlight-blue {
  background-color: var(--blue-arcade);
  color: var(--bg-primary);
  padding: 1px 3px;
  font-weight: 600;
}

.goal-content .highlight-red {
  background-color: var(--red-pixel);
  color: var(--bg-primary);
  padding: 1px 3px;
  font-weight: 600;
}

.goal-content .highlight-code {
  background-color: #F0F0F0;
  color: #8B5CF6;
  padding: 1px 3px;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  border: 1px solid var(--black);
}

.goal-content .highlight-number {
  color: var(--red-pixel);
  font-weight: 700;
}

.mission-data-container .goal-cursor {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--black);
  animation: goalCursorBlink 1s infinite;
  margin-left: 2px;
  vertical-align: baseline;
  line-height: 1.6;
}

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

.mission-data-container .mission-header {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: var(--bg-primary);
  background-color: var(--black);
  margin: -12px -12px 10px -12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  border-bottom: var(--dashboard-border-weight) solid var(--black);
}

.mission-title {
  color: var(--bg-primary);
  font-weight: 600;
}

.cursor-blink {
  color: var(--yellow-pacman);
  animation: blink 1s infinite;
  margin-left: 2px;
}

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

.mission-data-container .mission-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.mission-data-container .mission-stats {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
}

.mission-divider {
  width: 100%;
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    var(--black) 0px,
    var(--black) 4px,
    transparent 4px,
    transparent 8px
  );
  margin: 0;
  flex-shrink: 0;
}

.mission-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--black);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.stat-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stat-label {
  font-family: 'Courier New', monospace;
  font-size: 8px;
  color: var(--black);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-bar {
  position: relative;
  height: 18px;
  background-color: var(--bg-tertiary);
  border: 2px solid var(--black);
  display: flex;
  align-items: center;
  padding: 0 6px;
}

.stat-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-arcade), var(--yellow-pacman));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
  border-right: 2px solid var(--black);
  animation: barFillPulse 0.6s ease-out;
}

@keyframes barFillPulse {
  0% {
    transform: scaleX(0);
    opacity: 0.5;
  }
  100% {
    transform: scaleX(1);
    opacity: 1;
  }
}

.stat-value {
  position: relative;
  z-index: 1;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: var(--black);
  font-weight: 600;
}

/* Design Context Card */
.design-context {
  font-size: 12px !important; /* Fixed font size to match goal-content */
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100% !important; /* Limit max height */
  width: 100%;
  color: var(--text-primary);
  line-height: 1.5 !important; /* Fixed line height */
  /* Prevent font size from changing */
  font-size-adjust: none !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

.design-context::-webkit-scrollbar {
  width: 6px;
}

.design-context::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border: 1px solid var(--black);
}

.design-context::-webkit-scrollbar-thumb {
  background-color: var(--black);
  border-radius: 0;
}

.design-context::-webkit-scrollbar-thumb:hover {
  background-color: var(--blue-arcade);
}

/* Tri-Core Console Container */
.console-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background-color: var(--black);
  padding: 6px;
  border: 2px solid var(--black);
  box-shadow: 2px 2px 0px var(--black);
}

.monitor-wrapper {
  position: relative;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.monitor-frame {
  background-color: var(--bg-primary);
  border: 1px solid var(--black);
    margin-bottom: 6px;
    box-shadow: 1px 1px 0 #000;
  }

  .monitor-header {
    background-color: var(--black);
    color: var(--bg-primary);
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier New', monospace;
    font-size: 10px !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

.monitor-label {
  color: var(--bg-primary);
}

.monitor-status {
  color: var(--yellow-pacman);
  animation: pulse 2s infinite;
  font-size: 12px !important;
}

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

.monitor-screen {
  padding: 8px;
  background-color: var(--bg-tertiary);
  min-height: 90px;
}

  .monitor-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px !important;
    color: var(--black);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .monitor-content {
    font-family: 'Courier New', monospace;
    font-size: 11px !important;
    color: var(--text-primary);
    line-height: 1.35;
  }

/* Console Cable - Connection between monitors */
.console-cable {
  height: 10px;
  background-color: var(--black);
  margin: 0;
  position: relative;
  border-left: var(--dashboard-border-weight) solid var(--black);
  border-right: var(--dashboard-border-weight) solid var(--black);
  transition: opacity 0.3s ease;
}

.console-cable::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background-color: var(--yellow-pacman);
  border: 2px solid var(--black);
  border-radius: 50%;
}

/* Feedback Monitor */
.feedback-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 150px; /* Increased from 120px */
  overflow-y: auto;
  padding: 10px; /* Increased from 8px */
  background-color: var(--bg-primary);
  border: 1px solid var(--black);
  font-size: 14px !important; /* Increased from 10px to 14px - much larger */
  line-height: 1.7; /* Increased line height for readability */
}

.feedback-text::-webkit-scrollbar {
  width: 4px;
}

.feedback-text::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

.feedback-text::-webkit-scrollbar-thumb {
  background: var(--black);
}

/* Action Terminal Monitor */
.action-terminal {
  font-family: 'Courier New', monospace;
  font-size: 16px !important; /* Increased from 11px to 16px - much larger */
  color: var(--black);
  padding: 12px; /* Increased from 8px */
  background-color: var(--bg-primary);
  border: 2px solid var(--black);
  min-height: 60px; /* Increased from 50px */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-align: center;
  word-break: break-all;
  position: relative;
  animation: actionPulse 0.5s ease-out;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.6; /* Added line height for readability */
}

.action-terminal:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

.action-terminal::before {
  content: '>';
  color: var(--blue-arcade);
  margin-right: 6px;
  font-weight: 600;
}

/* Hide Feedback Monitor when stepId === 1 */
#feedbackMonitor[style*="display: none"] {
  display: none !important;
}

/* Ensure console cable is hidden when feedback monitor is hidden */
#feedbackMonitor[style*="display: none"] + .console-cable {
  display: none;
}

/* Bottom Player Controls */
.bottom-player-controls {
  height: auto !important;
  min-height: auto !important;
  background-color: var(--bg-secondary);
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 8px 10px 8px !important; /* Ensure padding is visible */
  margin-bottom: 0 !important;
  margin-top: 0 !important;
  border: var(--dashboard-border-weight) solid var(--black);
  border-radius: 4px;
  box-shadow: var(--shadow-hard);
  flex-shrink: 0 !important; /* Prevent shrinking */
  flex-grow: 0 !important; /* Don't grow */
  box-sizing: border-box;
  position: sticky !important; /* Keep visible at bottom of content */
  bottom: 0 !important;
  visibility: visible !important; /* Ensure it's visible */
  opacity: 1 !important; /* Ensure it's not transparent */
  z-index: 200 !important; /* Ensure it's above other elements */
}

.player-controls-container {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.player-buttons-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  background-color: var(--bg-primary);
  color: var(--black);
  border: var(--dashboard-border-weight) solid var(--black);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Segoe UI', sans-serif;
  min-width: 34px;
  width: 34px;
  height: 34px;
  box-shadow: none;
}

.player-nav-button:hover:not(:disabled) {
  background-color: var(--black);
  color: var(--bg-primary);
  box-shadow: 4px 4px 0px var(--black);
  transform: translate(-2px, -2px);
}

.player-nav-button:disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.player-nav-button:active:not(:disabled) {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0px var(--black);
}

.player-play-button {
  background-color: var(--yellow-pacman) !important;
  border-color: var(--black) !important;
  color: var(--black) !important;
  min-width: 40px;
  width: 40px;
}

.player-play-button:hover:not(:disabled) {
  background-color: var(--black) !important;
  color: var(--yellow-pacman) !important;
  box-shadow: 6px 6px 0px var(--black) !important;
}

.player-button-icon {
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-progress-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.progress-bar-container {
  width: 100%;
  max-width: 600px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--bg-primary);
  border: 2px solid var(--black);
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    var(--black) 8px,
    var(--black) 9px
  );
}

.progress-fill {
  height: 100%;
  background-color: var(--yellow-pacman);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
  position: relative;
  z-index: 1;
  border-right: 2px solid var(--black);
  animation: progressFillAnimation 0.5s ease-out;
}

@keyframes progressFillAnimation {
  0% {
    opacity: 0.5;
    transform: scaleX(0);
  }
  100% {
    opacity: 1;
    transform: scaleX(1);
  }
}

/* Scrollbar Styling */
.right-panel::-webkit-scrollbar,
.prompt-text::-webkit-scrollbar {
  width: 8px;
}

.right-panel::-webkit-scrollbar-track,
.prompt-text::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border: 1px solid var(--black);
}

.right-panel::-webkit-scrollbar-thumb,
.prompt-text::-webkit-scrollbar-thumb {
  background: var(--black);
  border-radius: 0;
}

.right-panel::-webkit-scrollbar-thumb:hover,
.prompt-text::-webkit-scrollbar-thumb:hover {
  background: var(--blue-arcade);
}

/* Loading State */
.loading {
  opacity: 0.5;
  pointer-events: none;
}

.error-message {
  color: var(--black);
  background-color: var(--bg-primary);
  border: var(--dashboard-border-weight) solid var(--red-pixel);
  padding: 12px;
  margin: 10px 0;
  font-size: 13px;
  box-shadow: var(--shadow-hard);
}

/* Mobile Responsive Styles - Arcade layout */
@media screen and (max-width: 768px) {
  /* 确保 html 和 body 不限制高度 */
  html, body {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .dashboard-shell {
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    border: 3px solid #000;
    border-radius: 10px;
    box-shadow: 2px 2px 0 #000;
    background: var(--bg-secondary);
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
  }
  
  /* 所有子元素正常显示，不限制高度 */
  .dashboard-shell > * {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
  }

  .dashboard-header {
    height: auto !important;
    min-height: 52px !important;
    padding: 8px 10px !important;
    border: 3px solid #000;
    border-radius: 8px;
    background: var(--yellow-pacman);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 2px 2px 0 #000;
  }
  .dashboard-header::before,
  .dashboard-header::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 2px solid #000;
    border-radius: 50%;
    background: var(--yellow-pacman);
  }
  .dashboard-header::before { left: 10px; transform: translateY(-50%); }
  .dashboard-header::after  { right: 10px; transform: translateY(-50%); }
  .header-title { 
    font-size: 11px !important; 
    letter-spacing: 1px; 
    text-transform: uppercase; 
    line-height: 1.3 !important;
  }

  .environment-nav-container {
    padding: 6px !important;
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
    background: #f5f5f5;
    overflow: visible !important;
    min-height: auto !important;
    height: auto !important;
  }
  .environment-nav-scroll { 
    padding: 0; 
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
  }

  /* Featured carousel (manual swipe, no animation) */
  .featured-carousel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px 4px 8px 4px;
    overflow: hidden;
  }
  .featured-card {
    flex: 0 0 auto;
    height: 130px;
    border: 2px solid #000;
    border-radius: 6px;
    box-shadow: 1px 1px 0 #000;
    background: #fff;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: none;
  }
  .featured-card .featured-thumb {
    flex: 1;
    border: 1px solid #000;
    border-radius: 4px;
    overflow: hidden;
    background: #ddd;
  }
  .featured-card .featured-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .featured-card .featured-label {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
  }

  /* All envs grid: two rows, compact */
  .environment-cards-wrapper {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px !important;
    padding: 0 2px 6px 2px !important;
    overflow: visible !important;
    height: auto !important;
  }
  .environment-card {
    min-height: 80px !important;
    height: auto !important;
    padding: 6px !important;
    gap: 4px !important;
    border: 2px solid #000;
    border-radius: 4px;
    box-shadow: 1px 1px 0 #000;
    background: #fff;
    position: relative;
  }
  .environment-card.active {
    border-color: #d4af37;
    animation: selected-wobble 1.2s ease-in-out infinite;
  }
  .card-image-wrapper {
    display: block !important;
    width: 100%;
    height: auto !important;
    min-height: 40px !important;
    aspect-ratio: 5 / 3 !important;
    border: 1px solid #000;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px !important;
  }
  .card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    display: block !important;
  }
  .card-label {
    font-size: 10px !important;
    padding: 4px 6px !important;
    margin-top: 0 !important;
    white-space: nowrap;
    text-align: center;
    border: 1px solid #000 !important;
    box-shadow: none;
    line-height: 1.2 !important;
  }
  .environment-card.active { border-color: #d4af37; }
  .environment-card.active::after {
    content: '▲';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #000;
  }

  @keyframes selected-wobble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
  }

  .dashboard-container { 
    flex-direction: column !important; 
    min-height: auto !important; 
    height: auto !important;
    max-height: none !important;
    gap: 8px !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
    flex: 0 0 auto !important; /* Override desktop flex: 1 1 auto */
  }
  .left-panel {
    width: 100%;
    padding: 8px;
    border: 3px solid #000;
    border-radius: 8px;
    background: #111;
    box-shadow: 2px 2px 0 #000;
    min-height: auto !important;
    height: auto !important;
  }
  .image-container {
    min-height: 0 !important;
    max-height: none !important; /* No cap on mobile */
    height: auto !important; /* Let content adjust height */
    border: 3px solid #000 !important;
    padding: 8px !important;
    box-shadow: none !important;
    background: #222;
  }
  .image-container .agent-view-image {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }
  .image-container .agent-view-image,
  .image-container .image-placeholder {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100%;
    height: auto;
  }
  .main-screen {
    border: 2px solid #000;
    border-radius: 4px;
    background: #111;
    aspect-ratio: 16 / 9;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .screen-hud {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    background: #000;
    color: #fff;
    font-size: 11px;
    border: 1px solid #fff;
  }

  .hud-bar {
    width: 100%;
    height: 36px;
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
    background: #f3f3f3;
    padding: 6px 8px;
    font-size: 11px;
    overflow-x: auto;
    white-space: nowrap;
    box-shadow: 1px 1px 0 #000;
  }

  .info-panel {
    border: 2px solid #000;
    border-radius: 4px;
    background: #f4f4f4;
    padding: 8px;
    margin-top: 8px;
  }
  .info-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
  .info-tabs .tab {
    padding: 4px 6px;
    font-size: 11px;
    border: 1px solid #000;
    background: #fff;
    cursor: pointer;
  }
  .info-tabs .tab.active { background: var(--yellow-pacman); }
  .info-content {
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid #000;
    padding: 6px;
    background: #fff;
  }

  .right-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px !important;
    gap: 6px !important;
    border: 1px solid #000 !important;
    border-radius: 3px;
    background: #f4f4f4;
    box-shadow: 1px 1px 0 #000;
    min-height: auto !important;
    height: auto !important;
  }

  .bottom-player-controls {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 200 !important;
    width: 100% !important;
    background: #f3f3f3 !important;
    border-top: 2px solid #000;
    padding: 10px 12px !important;
    margin: 0 !important;
    box-shadow: 1px -1px 0 #000;
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
    order: 999 !important; /* Ensure it's last in flex order */
  }
  .player-controls-container { 
    flex-direction: column; 
    gap: 8px !important; 
  }
  .player-progress-section { 
    width: 100%; 
  }
  .progress-bar { 
    height: 8px !important; 
  }
  .player-buttons-group { 
    width: 100%; 
    display: flex; 
    justify-content: space-between; 
    gap: 8px !important; 
  }
  .player-nav-button,
  .player-play-button {
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 8px !important;
    border: 2px solid #000;
    border-radius: 5px;
    box-shadow: 2px 2px 0 #000;
    font-size: 16px !important;
  }
  .player-play-button { background: var(--yellow-pacman); }
  .step-indicator {
    font-size: 10px !important;
    padding: 4px 0 !important;
  }

  /* Compact monitors / mission cards on mobile */
  .console-container {
    gap: 4px !important;
    padding: 6px !important;
    border: 1px solid #000;
    box-shadow: 1px 1px 0 #000;
    min-height: auto !important;
    height: auto !important;
  }
  .monitor-frame {
    border: 1px solid #000;
    margin-bottom: 4px !important;
    box-shadow: none;
    min-height: auto !important;
    height: auto !important;
  }
  .monitor-header {
    padding: 4px 6px !important;
    font-size: 9px !important;
  }
  .monitor-status { font-size: 10px !important; }
  .monitor-screen {
    padding: 6px !important;
    min-height: 60px !important;
    height: auto !important;
  }
  .monitor-title {
    font-size: 10px !important;
    margin-bottom: 4px !important;
  }
  .monitor-content {
    font-size: 10px !important;
    line-height: 1.4 !important;
    min-height: auto !important;
    height: auto !important;
  }
  .mission-data-container {
    padding: 6px !important;
    gap: 6px !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
  }
  .mission-data-container .mission-data-card,
  .mission-data-container .goal-card {
    min-height: 100% !important;
    max-height: 100% !important;
    height: 100% !important;
  }
  .mission-data-container .mission-header,
  .mission-data-container .goal-label {
    padding: 4px 6px !important;
    font-size: 9px !important;
    flex-shrink: 0 !important;
  }
  .mission-data-container .goal-content-wrapper {
    padding: 6px !important;
    max-height: calc(100% - 30px) !important; /* Account for label height */
  }
  .mission-data-container .goal-content {
    padding: 0 !important;
    font-size: 10px !important; /* Fixed smaller font for mobile */
    line-height: 1.4 !important;
    font-size-adjust: none !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }
  .design-context {
    font-size: 10px !important; /* Match goal-content on mobile */
    line-height: 1.4 !important;
    font-size-adjust: none !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }
  /* Show small thumbnails in the arcade strip */
  .card-image-wrapper {
    display: block !important;
    width: 100%;
    aspect-ratio: 5 / 3 !important;
    height: auto !important;
    min-height: 60px !important;
    max-height: 110px !important;
    border: 1px solid #000;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
  }
  .card-image,
  .environment-card img {
    display: block !important;
    width: 100%;
    height: 100% !important;
    object-fit: contain !important;
    background-color: var(--bg-tertiary, #f3f3f3) !important;
  }

/* ============================================
 * Thumbnail aspect & fit fixes (prevent stretch)
 * ============================================ */
.card-image-wrapper {
  aspect-ratio: 5 / 3 !important;
  height: auto !important;
  max-height: 80px !important;
}

.card-image,
.card-image-wrapper img,
.environment-card img {
  height: 100% !important;
  object-fit: contain !important;
  background-color: var(--bg-tertiary, #f3f3f3) !important;
}
  
  /* Monitor 区域优化 - 保持可读性的同时压缩空间 */
  .monitor-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    height: auto !important;
  }
  
  .monitor-frame {
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    height: auto !important;
    border-width: 1px !important;
  }
  
  .monitor-header {
    padding: 4px 6px !important;
    margin: 0 !important;
    min-height: auto !important;
    height: auto !important;
    font-size: 9px !important;
    line-height: 1.2 !important;
  }
  
  .monitor-label,
  .monitor-status {
    font-size: 9px !important;
    line-height: 1.2 !important;
  }
  
  .monitor-screen {
    padding: 6px !important;
    margin: 0 !important;
    min-height: 60px !important;
    height: auto !important;
    max-height: none !important;
  }
  
  .monitor-title {
    font-size: 10px !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
  }
  
  .monitor-content {
    font-size: 10px !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    height: auto !important;
  }
  
  .feedback-text {
    padding: 6px 8px !important;
    margin: 0 !important;
    font-size: 10px !important;
    line-height: 1.4 !important;
    max-height: 120px !important;
    min-height: auto !important;
    height: auto !important;
    overflow-y: auto !important;
  }
  
  .action-terminal {
    padding: 8px 10px !important;
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    min-height: 50px !important;
    height: auto !important;
  }
  
  .action-terminal::before {
    font-size: 8px !important;
    margin-right: 2px !important;
  }
  
  .console-cable {
    height: 2px !important;
    margin: 1px 0 !important;
    padding: 0 !important;
  }
}
  @keyframes auto-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
  }
