* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Roboto", sans-serif;
  background: linear-gradient(135deg, #2c1810, #4a3429);
  color: #f4f1e8;
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  border: 2px solid #8b7355;
}

h1 {
  color: #d4af37;
  font-size: 2.5em;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.subtitle {
  color: #c9b037;
  font-style: italic;
  font-size: 1.2em;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: #3a2c1f;
  border-radius: 10px;
  margin: 20px 0;
  border: 1px solid #8b7355;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4af37, #ffd700);
  transition: width 0.5s ease;
  width: 0%;
}

.game-area {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 20px;
  margin-bottom: 20px;
}

.story-panel,
.code-panel {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #8b7355;
}

.code-panel {
  background: #f8f9fa; /* Light background for better contrast with white cells */
  color: #202124;
  border: 1px solid #dadce0;
}

.code-panel h2 {
  color: #3c4043;
  margin-bottom: 20px;
  border-bottom: 1px solid #dadce0;
  padding-bottom: 8px;
  font-size: 18px;
  font-weight: 500;
}

/* Google Colab-style cell containers */
.cell-container {
  border: 1px solid #dadce0;
  border-radius: 8px;
  margin-bottom: 16px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  transition: box-shadow 0.3s ease;
}

.cell-container:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.cell-container:hover .cell-header {
  background: #f1f3f4;
}

.cell-container:hover .cell-number {
  background: rgba(66, 133, 244, 0.05);
}

.cell-container:last-child {
  margin-bottom: 0;
}

.cell-header {
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
  padding: 8px 16px;
  font-size: 13px;
  color: #5f6368;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  transition: background-color 0.2s ease;
}

.cell-header:hover {
  background: #f1f3f4;
}

.cell-title {
  font-weight: 500;
  color: #202124;
}

.cell-instruction {
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
  font-size: 14px;
  color: #3c4043;
  line-height: 1.5;
}

.cell-status {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cell-status.pending {
  background: #fef7e0;
  color: #ea8600;
  border: 1px solid #fbbc04;
}

.cell-status.completed {
  background: #e8f5e8;
  color: #137333;
  border: 1px solid #34a853;
}

.cell-status.current {
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #4285f4;
}

.cell-status.error {
  background: #fce8e6;
  color: #d93025;
  border: 1px solid #ea4335;
}

/* Code editor container with run button */
.code-editor-container {
  position: relative;
  background: #ffffff;
}

.code-editor {
  margin: 0;
  border: none;
  border-radius: 0;
  background: #ffffff;
  min-height: 120px;
}

/* Hide the separate run button - functionality moved to cell number */
.cell-run-button {
  display: none;
}

/* Cell execution indicators */
.cell-execution-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
  z-index: 10;
}

.cell-execution-indicator.successfully-executed {
  background: #34a853;
  color: white;
  border: 1px solid #137333;
}

.cell-execution-indicator.execution-failed {
  background: #ea4335;
  color: white;
  border: 1px solid #d93025;
}

/* Additional styling for cells with execution status */
.code-cell.successfully-executed {
  border-left: 3px solid #34a853;
}

.code-cell.execution-failed {
  border-left: 3px solid #ea4335;
}

/* Stage navigation (dev mode) */
.dev-nav {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #8b7355;
  z-index: 1000;
  display: none;
}

.dev-nav.active {
  display: block;
}

.dev-nav button {
  margin: 2px;
  padding: 5px 10px;
  font-size: 12px;
  min-width: 30px;
}

.dev-nav button.current-stage {
  background: #d4af37;
  color: #000;
}

.dev-nav-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: #d4af37;
  border: 1px solid #8b7355;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 16px;
  cursor: pointer;
  z-index: 1001;
}

.story-panel h2,
.code-panel h2 {
  color: #d4af37;
  margin-bottom: 15px;
  border-bottom: 1px solid #8b7355;
  padding-bottom: 5px;
}

/* Story content formatting */
.story-panel p {
  margin-bottom: 15px;
}

.story-text {
  margin-bottom: 30px;
}

.story-text p {
  margin-bottom: 15px;
}

.story-panel strong,
.story-text strong {
  color: #d4af37;
}

.story-panel em,
.story-text em {
  color: #c9b037;
}

.story-panel code,
.story-text code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
  color: #ffd700;
}

.story-panel ul,
.story-text ul {
  margin-left: 20px;
  margin-bottom: 15px;
}

.story-panel li,
.story-text li {
  margin-bottom: 5px;
}

.challenge-text {
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 20px;
  border-left: 3px solid #d4af37;
}

/* Legacy run button (for single cell stages) - hidden by default */
.run-button {
  display: none;
}

/* Legacy code editor styling - updated for Colab compatibility */
.code-editor {
  margin-bottom: 0;
  height: auto;
  min-height: 120px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dadce0;
  background: #ffffff;
}

/* Collapsible output area (Google Colab style) */
.output-container {
  border-top: 1px solid #e8eaed;
  background: #ffffff;
}

.output-header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.output-header:hover {
  background: #f1f3f4;
}

.output-toggle {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  transition: transform 0.2s ease;
}

.output-toggle.collapsed {
  transform: rotate(-90deg);
}

.output-label {
  font-size: 13px;
  font-weight: 500;
  color: #5f6368;
  flex-grow: 1;
}

.output-counter {
  font-size: 12px;
  color: #80868b;
  font-family: "Roboto Mono", monospace;
}

.output-area {
  background: #ffffff;
  padding: 12px 16px;
  font-family: "Roboto Mono", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.4;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #202124;
  border: none;
  margin: 0;
  display: block;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.output-area.collapsed {
  display: none;
  max-height: 0;
  padding: 0 16px;
}

.output-area.empty {
  display: none;
}

.output-area.error {
  color: #d93025;
  background: #fef7f0;
}

.output-area.success {
  color: #137333;
}

/* CodeMirror adjustments for Colab style */
.CodeMirror {
  height: auto;
  min-height: 120px;
  font-family: "Roboto Mono", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.4;
  border: none;
  background: #ffffff;
  color: #202124;
  padding-left: 12px; /* Reduced left padding */
  padding-top: 8px;
  padding-bottom: 8px;
  padding-right: 8px;
}

.CodeMirror-focused {
  border: none;
  outline: none;
  background: #ffffff;
}

.CodeMirror-cursor {
  border-left: 2px solid #1a73e8;
}

.CodeMirror-selected {
  background: #e8f0fe;
}

.CodeMirror-gutters {
  background: #ffffff;
  border-right: none;
  padding-left: 12px; /* Reduced left padding */
}

.CodeMirror-linenumber {
  color: #80868b;
  font-size: 12px;
  padding-right: 8px;
}

/* Auto-completion hint styling */
.CodeMirror-hints {
  position: absolute !important;
  z-index: 1000 !important;
  background: #ffffff !important;
  border: 1px solid #d0d7de !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
  font-family: "Roboto Mono", "Consolas", monospace !important;
  font-size: 14px !important;
  max-height: 300px !important;
  overflow-y: auto !important;
  padding: 4px 0 !important;
}

.CodeMirror-hint {
  color: #202124 !important;
  cursor: pointer !important;
  padding: 6px 12px !important;
  border-radius: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.CodeMirror-hint-active {
  background: #e8f0fe !important;
  color: #1a73e8 !important;
}

.CodeMirror-hint:hover {
  background: #f8f9fa !important;
}

/* Line wrapping improvements */
.CodeMirror-wrap pre {
  word-wrap: break-word;
  word-break: break-word;
}

.CodeMirror-wrap .CodeMirror-line {
  word-wrap: break-word;
  word-break: break-all;
}

.hint-section {
  margin-top: 20px;
  border-top: 1px dashed #8b7355;
  padding-top: 15px;
}

.hint-button {
  background: transparent;
  color: #c9b037;
  border: 1px solid #8b7355;
  padding: 5px 15px;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.hint-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hint-text {
  display: none;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 5px;
  margin-top: 10px;
  font-style: italic;
  color: #e6d19a;
}

.hint-text.active {
  display: block;
}

/* Runtime controls */
.runtime-controls {
  margin: 15px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.restart-runtime-button {
  background: #ea4335;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.3s ease;
  border: 1px solid transparent;
}

.restart-runtime-button:hover {
  background: #d93025;
  border-color: #d93025;
}

.restart-runtime-button:active {
  background: #b52d20;
}

/* Tooltip styling for restart button */
.restart-runtime-button:hover::after {
  content: attr(title);
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  transform: translateY(-100%) translateX(-50%);
  margin-top: -8px;
  margin-left: 50%;
}

.clear-progress-button {
  background: #f44336;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.3s ease;
  border: 1px solid transparent;
}

.clear-progress-button:hover {
  background: #d32f2f;
  border-color: #d32f2f;
}

.clear-progress-button:active {
  background: #b71c1c;
}

/* Tooltip styling for clear progress button */
.clear-progress-button:hover::after {
  content: attr(title);
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  transform: translateY(-100%) translateX(-50%);
  margin-top: -8px;
  margin-left: 50%;
}

.next-button {
  background: #d4af37;
  color: #2c1810;
  border: none;
  padding: 15px 30px;
  border-radius: 5px;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
  width: 100%;
  display: none;
  transition: background 0.3s;
}

.next-button.active {
  display: block;
}

.next-button:hover {
  background: #ffd700;
}

.celebration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

.celebration.active {
  display: block;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #ffd700;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(100vh);
  }
}

/* Cell number styling with circular play button on hover */
.cell-number {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 24px;
  padding: 4px 8px;
  font-family: "Roboto Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  color: #5f6368;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  user-select: none;
}

/* Play and stop icons within cell number */
.cell-number .play-icon,
.cell-number .stop-icon {
  width: 16px;
  height: 16px;
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  fill: #5f6368;
  opacity: 0;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show play icon on hover */
.cell-number:hover .play-icon {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* Circular background on hover */
.cell-number:hover {
  background: rgba(66, 133, 244, 0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  min-width: 32px;
  color: #1a73e8;
  font-size: 0; /* Hide the bracket text on hover */
}

.cell-number:hover .play-icon {
  fill: #1a73e8;
  right: 50%;
  transform: translateY(-50%) translateX(50%) scale(1.2);
}

/* Running state */
.cell-number.running {
  background: #1a73e8;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  min-width: 32px;
  color: white;
  font-size: 0; /* Hide bracket text when running */
  animation: pulse 1.5s ease-in-out infinite;
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.3);
}

.cell-number.running .play-icon {
  display: none;
}

.cell-number.running .stop-icon {
  display: block;
  opacity: 1;
  fill: white;
  right: 50%;
  transform: translateY(-50%) translateX(50%);
  animation: rotate 2s linear infinite;
}

/* Executed state */
.cell-number.executed {
  color: #1a73e8;
  font-weight: 600;
}

.cell-number.executed:not(.running) {
  background: rgba(52, 168, 83, 0.1);
  border-radius: 4px;
}

.cell-number.executed:not(.running):hover {
  background: rgba(52, 168, 83, 0.15);
}

/* Animations */
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
  }
}

@keyframes rotate {
  from {
    transform: translateY(-50%) translateX(50%) rotate(0deg);
  }
  to {
    transform: translateY(-50%) translateX(50%) rotate(360deg);
  }
}

/* Enhanced hover effect for better visibility */
.cell-number:hover {
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
}

/* Focus state for accessibility */
.cell-number:focus {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .cell-number {
    min-width: 36px;
    height: 22px;
  }

  .cell-number:hover,
  .cell-number.running {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .cell-number .play-icon,
  .cell-number .stop-icon {
    width: 14px;
    height: 14px;
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .game-area {
    grid-template-columns: 1fr;
  }

  .header {
    padding: 15px;
  }

  h1 {
    font-size: 2em;
  }

  .code-editor {
    height: auto;
    min-height: 120px;
  }

  /* Mobile-specific CodeMirror improvements */
  .CodeMirror {
    font-size: 13px; /* Slightly smaller font for mobile */
    padding-left: 8px;
    padding-right: 8px;
  }

  .CodeMirror-gutters {
    padding-left: 8px;
  }

  .CodeMirror-linenumber {
    font-size: 11px;
    padding-right: 6px;
  }

  /* Better hint styling for mobile */
  .CodeMirror-hints {
    font-size: 13px !important;
    max-height: 200px !important;
    z-index: 1000;
  }

  .CodeMirror-hint {
    padding: 8px 12px !important;
    font-family: "Roboto Mono", "Consolas", monospace !important;
  }

  /* Mobile-friendly button and panel adjustments */
  .story-panel,
  .code-panel {
    padding: 15px;
    margin-bottom: 15px;
  }

  .hint-section {
    margin-top: 15px;
    padding-top: 10px;
  }

  .hint-button,
  .llm-query-button {
    padding: 8px 12px;
    font-size: 13px;
    margin: 4px;
    min-height: 44px; /* Touch target size */
  }
}

/* Additional mobile improvements for smaller screens */
@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .header {
    padding: 10px;
  }

  h1 {
    font-size: 1.8em;
  }

  .subtitle {
    font-size: 1em;
  }

  .CodeMirror {
    font-size: 12px;
    padding: 6px;
  }

  .CodeMirror-linenumber {
    font-size: 10px;
  }

  /* Improved text wrapping for very small screens */
  .story-text,
  .challenge-text,
  .cell-instruction {
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Better spacing for mobile interaction */
  .cell-number {
    min-width: 32px;
    height: 20px;
    font-size: 10px;
  }

  .cell-number:hover,
  .cell-number.running {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }

  /* Better mobile buttons */
  .next-button,
  .restart-runtime-button,
  .clear-progress-button {
    min-height: 44px;
    font-size: 14px;
    padding: 12px 16px;
    margin: 8px 4px;
  }

  /* LLM Footer mobile improvements */
  .llm-footer {
    padding: 12px;
  }

  .llm-toggle-container {
    margin-bottom: 8px;
  }

  .llm-label {
    font-size: 14px;
  }
}

/* Cell feedback styling */
.cell-feedback {
  margin-top: 12px;
  padding: 12px;
  background: rgba(234, 67, 53, 0.1);
  border: 1px solid #ea4335;
  border-radius: 6px;
  color: #d93025;
  font-size: 13px;
  line-height: 1.4;
}

.cell-feedback strong {
  color: #b52d20;
}

.cell-feedback code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.cell-feedback ul {
  margin: 8px 0 4px 0;
  padding-left: 20px;
}

.cell-feedback li {
  margin: 4px 0;
}

/* Auto-hint styling */
.auto-hint {
  margin-top: 8px !important;
}

.auto-hint .hint-text {
  background: rgba(255, 193, 7, 0.1) !important;
  border-color: #ffc107 !important;
}

/* LLM Footer Controls */
.llm-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(139, 115, 85, 0.3);
  padding: 8px 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.llm-footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.llm-footer .llm-toggle-container {
  margin: 0;
}

.llm-footer .llm-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: #e6d19a;
  user-select: none;
  font-size: 12px;
}

.llm-footer .llm-toggle input {
  display: none;
}

.llm-footer .llm-slider {
  position: relative;
  width: 32px;
  height: 16px;
  background: #555;
  border-radius: 8px;
  margin-right: 8px;
  transition: background 0.3s;
}

.llm-footer .llm-slider:before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.llm-footer .llm-toggle input:checked + .llm-slider {
  background: #c9b037;
}

.llm-footer .llm-toggle input:checked + .llm-slider:before {
  transform: translateX(16px);
}

.llm-footer .llm-settings {
  display: flex;
  align-items: center;
  gap: 8px;
}

.llm-footer .llm-model-info {
  color: #c9b037;
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(201, 176, 55, 0.1);
  border-radius: 4px;
  border: 1px solid rgba(201, 176, 55, 0.3);
}

.llm-footer .change-model-btn {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid #8b7355;
  border-radius: 4px;
  color: #c9b037;
  cursor: pointer;
  font-size: 10px;
  transition: background 0.2s;
}

.llm-footer .change-model-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.llm-footer .model-selection {
  display: flex;
  align-items: center;
  gap: 4px;
}

.llm-footer .model-selection select {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #8b7355;
  border-radius: 4px;
  color: #e6d19a;
  font-size: 10px;
  max-width: 150px;
}

.llm-footer .model-selection select option {
  background: #2a2a2a;
  color: #e6d19a;
}

.llm-footer .refresh-btn {
  padding: 2px 6px;
  background: transparent;
  border: 1px solid #8b7355;
  border-radius: 4px;
  color: #c9b037;
  cursor: pointer;
  font-size: 10px;
  transition: background 0.2s;
}

.llm-footer .refresh-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.llm-footer .llm-status {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
  transition: all 0.3s;
}

.llm-footer .llm-status.connecting {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid #ffc107;
}

.llm-footer .llm-status.connected {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid #28a745;
}

.llm-footer .llm-status.error {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: 1px solid #dc3545;
}

.llm-footer .llm-status.disconnected {
  background: rgba(108, 117, 125, 0.2);
  color: #6c757d;
  border: 1px solid #6c757d;
}

/* Hide footer when disabled */
.llm-footer.hidden {
  transform: translateY(100%);
}

/* Adjust body padding to account for footer */
body {
  padding-bottom: 50px;
}

/* Legacy LLM controls - hide the old prominent version */
.llm-controls {
  margin-bottom: 15px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid #8b7355;
}

.llm-toggle-container {
  margin-bottom: 10px;
}

.llm-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #e6d19a;
  user-select: none;
}

.llm-toggle input {
  display: none;
}

.llm-slider {
  position: relative;
  width: 50px;
  height: 24px;
  background: #555;
  border-radius: 12px;
  margin-right: 10px;
  transition: background 0.3s;
}

.llm-slider:before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.llm-toggle input:checked + .llm-slider {
  background: #c9b037;
}

.llm-toggle input:checked + .llm-slider:before {
  transform: translateX(26px);
}

.llm-settings {
  margin-top: 10px;
}

.model-selection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.model-selection label {
  color: #e6d19a;
  font-size: 12px;
  min-width: 45px;
}

.model-selection select {
  flex: 1;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #8b7355;
  border-radius: 4px;
  color: #e6d19a;
  font-size: 12px;
}

.model-selection select option {
  background: #2a2a2a;
  color: #e6d19a;
}

.refresh-btn {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid #8b7355;
  border-radius: 4px;
  color: #c9b037;
  cursor: pointer;
  font-size: 11px;
  transition: background 0.2s;
}

.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.llm-status {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  transition: all 0.3s;
}

.llm-status.connecting {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid #ffc107;
}

.llm-status.connected {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid #28a745;
}

.llm-status.error {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: 1px solid #dc3545;
}

.llm-status.disconnected {
  background: rgba(108, 117, 125, 0.2);
  color: #6c757d;
  border: 1px solid #6c757d;
}

/* LLM hint styling */
.llm-hint {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #4682b4;
  border-radius: 6px;
  padding: 12px;
  margin: 8px 0;
  color: #87ceeb;
  font-style: normal;
}

.llm-hint .llm-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-weight: bold;
  color: #ffffff;
}

.llm-hint .llm-content {
  line-height: 1.4;
}

/* Enhanced formatting for LLM HTML content */
.llm-hint .llm-content h1,
.llm-hint .llm-content h2,
.llm-hint .llm-content h3 {
  color: #ffffff;
  margin: 12px 0 8px 0;
  font-weight: bold;
}

.llm-hint .llm-content h1 {
  font-size: 1.2em;
  border-bottom: 1px solid #87ceeb;
  padding-bottom: 4px;
}

.llm-hint .llm-content h2 {
  font-size: 1.1em;
}

.llm-hint .llm-content h3 {
  font-size: 1.05em;
}

.llm-hint .llm-content p {
  margin: 8px 0;
  color: #e6f3ff;
}

.llm-hint .llm-content strong {
  color: #ffffff;
  font-weight: bold;
}

.llm-hint .llm-content em {
  color: #d4edff;
  font-style: italic;
}

.llm-hint .llm-content code {
  background: rgba(0, 0, 0, 0.4);
  color: #ffd700;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
}

.llm-hint .llm-content pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #4682b4;
  border-radius: 4px;
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
}

.llm-hint .llm-content pre code {
  background: none;
  padding: 0;
  color: #f0f8ff;
  display: block;
  white-space: pre;
}

.llm-hint .llm-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.llm-hint .llm-content li {
  margin: 4px 0;
  color: #e6f3ff;
}

.llm-hint .llm-content br {
  line-height: 1.6;
}

.llm-hint.loading {
  background: rgba(255, 193, 7, 0.1);
  border-color: #ffc107;
  color: #ffc107;
}

.llm-hint.error {
  background: rgba(220, 53, 69, 0.1);
  border-color: #dc3545;
  color: #dc3545;
}

/* LLM query button styling */
.llm-query-button {
  background: linear-gradient(135deg, #4682b4, #87ceeb);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s;
}

.llm-query-button:hover {
  background: linear-gradient(135deg, #5a9bd4, #a0d4f0);
  transform: translateY(-1px);
}

.llm-query-button:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

/* Provider selection and API key styling */
.provider-selection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.provider-selection label {
  color: #e6d19a;
  font-size: 12px;
  min-width: 60px;
}

.provider-selection select {
  flex: 1;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #8b7355;
  border-radius: 4px;
  color: #e6d19a;
  font-size: 12px;
}

.provider-selection select option {
  background: #2a2a2a;
  color: #e6d19a;
}

.api-key-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.api-key-container input {
  flex: 1;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #8b7355;
  border-radius: 4px;
  color: #e6d19a;
  font-size: 12px;
}

.api-key-container input::placeholder {
  color: #999;
}

.save-key-btn {
  padding: 4px 12px;
  background: #c9b037;
  border: none;
  border-radius: 4px;
  color: #2a2a2a;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  transition: background 0.2s;
}

.save-key-btn:hover {
  background: #e6d19a;
}

/* Help button styling */
.help-btn {
  background: transparent;
  border: 1px solid #8b7355;
  border-radius: 50%;
  color: #c9b037;
  cursor: pointer;
  font-size: 10px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  transition: all 0.2s;
}

.help-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.1);
}

/* Modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: linear-gradient(135deg, #2c1810, #4a3429);
  border: 2px solid #8b7355;
  border-radius: 15px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px 15px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

.modal-header h3 {
  color: #d4af37;
  font-size: 1.4em;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: #c9b037;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 20px 25px 25px;
  color: #f4f1e8;
  line-height: 1.6;
}

.help-section {
  margin-bottom: 25px;
}

.help-section h4 {
  color: #d4af37;
  font-size: 1.1em;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.3);
  padding-bottom: 5px;
}

.help-section h5 {
  color: #c9b037;
  font-size: 1em;
  margin: 15px 0 8px 0;
}

.help-section p {
  margin-bottom: 12px;
}

.help-section ul,
.help-section ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.help-section li {
  margin-bottom: 6px;
}

.help-section a {
  color: #c9b037;
  text-decoration: none;
  border-bottom: 1px dotted #c9b037;
}

.help-section a:hover {
  color: #d4af37;
  border-bottom-color: #d4af37;
}

.code-block {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(139, 115, 85, 0.5);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  font-family: "Roboto Mono", monospace;
  font-size: 0.9em;
  overflow-x: auto;
}

.code-block code {
  color: #e6d19a;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.code-block strong {
  color: #c9b037;
  display: block;
  margin-bottom: 5px;
}

.platform-tabs {
  display: flex;
  gap: 10px;
  margin: 15px 0 10px 0;
}

.tab-btn {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #8b7355;
  border-radius: 6px;
  color: #c9b037;
  cursor: pointer;
  padding: 8px 16px;
  font-size: 0.9em;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(201, 176, 55, 0.2);
  border-color: #c9b037;
  color: #d4af37;
}

.platform-content {
  margin-top: 10px;
}

.help-section.warning {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 8px;
  padding: 15px;
}

.help-section.warning h4 {
  color: #ffc107;
  border-bottom-color: rgba(255, 193, 7, 0.3);
}

/* Responsive design for modal */
@media (max-width: 768px) {
  .modal-content {
    margin: 10px;
    max-height: 95vh;
  }

  .modal-header {
    padding: 15px 20px 10px;
  }

  .modal-body {
    padding: 15px 20px 20px;
  }

  .code-block {
    font-size: 0.8em;
    padding: 10px;
  }

  .platform-tabs {
    flex-direction: column;
    gap: 5px;
  }
}
