/* --- Modern Bottom Nav Bar --- */
.bottom-nav-bar {
    height: 64px;
    background: var(--color-surface);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.05);
    z-index: 1000;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════════ */
/* INTRO SCREEN (SOLARPUNK DESIGN)            */
/* ═══════════════════════════════════════════ */
.intro-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #f7f9ff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    color: #1a202c;
    font-family: var(--font-ui);
}

.intro-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.intro-logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.intro-leaf-icon {
    font-size: 1.2rem;
    color: #1a5e20;
}

.intro-logo-text {
    font-weight: 800;
    font-size: 1.1rem;
    color: #1a5e20;
    letter-spacing: 0.5px;
}

.intro-settings-icon {
    font-size: 1.2rem;
    color: #4a5568;
}

.intro-content-modern {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 20px 20px;
    text-align: center;
    overflow-y: auto;
}

.intro-badge {
    background: #e8f5e9;
    color: #1b5e20;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 24px;
    text-transform: uppercase;
}

.intro-heading {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a202c;
    line-height: 1.2;
    margin-bottom: 20px;
}

.intro-robo-highlight {
    color: #1a5e20;
    font-style: italic;
}

.intro-paragraph {
    font-size: 1rem;
    color: #4a5568;
    line-height: 1.6;
    max-width: 400px;
    margin-bottom: 30px;
}

.intro-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    margin-bottom: 40px;
}

.intro-btn-primary {
    background: #1e7b45;
    color: #ffffff;
    border: none;
    padding: 16px 24px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 12px rgba(30, 123, 69, 0.3);
}
.intro-btn-primary:active { transform: scale(0.97); }

.intro-btn-secondary {
    background: #e3f2fd;
    color: #1a202c;
    border: none;
    padding: 16px 24px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.intro-btn-secondary:active { transform: scale(0.97); }

.intro-image-container {
    margin-top: auto;
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.intro-hero-image {
    width: 100%;
    height: auto;
    display: block;
}

/* ═══════════════════════════════════════════ */
/* MISSION HUB (SOLARPUNK DESIGN)             */
/* ═══════════════════════════════════════════ */
.mission-hub-modern {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #f7f9ff;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    font-family: var(--font-ui);
    color: #1a202c;
}

.hub-modern-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.hub-modern-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.1;
}

.hub-leaf { font-size: 1.2rem; color: #1a5e20; }
.hub-logo-text { font-weight: 800; font-size: 0.9rem; color: #1a5e20; }

.hub-modern-score {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.hub-modern-actions {
    display: flex;
    gap: 8px;
}

.hub-icon-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.hub-modern-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.hub-zone-info {
    padding: 0 20px;
    margin-bottom: 30px;
}

.hub-zone-label {
    color: #2e7d32;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.hub-zone-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 16px;
}

.hub-eco-status {
    background: #ffffff;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e2e8f0;
}

.hub-eco-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 8px;
}
#hub-eco-percent { color: #2e7d32; }

.hub-eco-bar-bg {
    height: 8px;
    background: #e3f2fd;
    border-radius: 4px;
    overflow: hidden;
}

.hub-eco-bar-fill {
    height: 100%;
    background: #1e7b45;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.hub-path-container {
    position: relative;
    padding: 20px 0 60px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hub-path-line {
    position: absolute;
    top: 0; bottom: 0; left: 50%;
    width: 3px;
    background: linear-gradient(to bottom, #dcedc8, #1e7b45, #1e7b45, rgba(30,123,69,0.2));
    transform: translateX(-50%);
    z-index: 1;
}

.hub-stations-modern {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    z-index: 2;
    position: relative;
}

/* Zig-Zag Item */
.hub-station-row {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    position: relative;
}

.hub-station-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    width: 140px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}
.hub-station-card:active { transform: scale(0.95); }

.hub-station-card.completed { border-color: #a5d6a7; }
.hub-station-card.next { 
    background: #e8f5e9; 
    border-color: #81c784; 
}
.hub-station-card.locked {
    opacity: 0.6;
    background: rgba(255,255,255,0.5);
    cursor: not-allowed;
}
.hub-station-card.locked:active { transform: none; }

.hub-station-stars {
    font-size: 0.7rem;
    color: #f59e0b;
    margin-bottom: 4px;
}
.hub-station-card.locked .hub-station-stars { opacity: 0; }

.hub-station-name {
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 2px;
}

.hub-station-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a202c;
}
.hub-station-card.next .hub-station-name { color: #1b5e20; font-weight: 700;}
.hub-station-card.next .hub-station-title { color: #1a202c; }

/* The circle icon on the line */
.hub-station-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #1e7b45;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    color: #1e7b45;
    z-index: 3;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.hub-station-icon.completed { background: #ffffff; color: #1e7b45; border-color: #1e7b45; }
.hub-station-icon.next { background: #2ecc71; color: #ffffff; border-color: #1a5e20; box-shadow: 0 4px 10px rgba(46, 204, 113, 0.4); cursor: pointer; }
.hub-station-icon.locked { border-color: #cbd5e1; color: #94a3b8; }

/* Zig-Zag Positioning */
.hub-station-row.left .hub-station-card { margin-right: 180px; }
.hub-station-row.right .hub-station-card { margin-left: 180px; }

.hub-path-end-image {
    margin-top: 40px;
    z-index: 2;
    border-radius: 12px;
    overflow: hidden;
    width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.hub-path-end-image img { width: 100%; display: block; }

/* Bottom Nav */
.hub-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 10px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #64748b;
    padding: 8px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn.active {
    background: #1a202c;
    color: #ffffff;
    border-radius: 16px;
}

.nav-icon { font-size: 1.3rem; }
.nav-label { font-size: 0.75rem; font-weight: 600; }

/* Custom Settings & Active Camera State overrides */
#dpad.hidden-by-setting, #minimap-container.hidden-by-setting {
  display: none !important;
}

body.editor-mode-a .dpad {
  bottom: 150px !important;
}
body.editor-mode-b .dpad {
  bottom: calc(50vh + 30px) !important;
}

body.editor-mode-a .sensor-overlay {
  bottom: 150px !important;
}
body.editor-mode-b .sensor-overlay {
  bottom: calc(50vh + 30px) !important;
}

.top-bar-icon-btn.active {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: rgba(16, 185, 129, 0.6) !important;
  color: #10b981 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.nav-tab {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--color-text-muted);
    font-family: var(--font-main);
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.nav-tab.active {
    color: var(--color-primary);
}

.nav-tab.active .nav-icon {
    transform: translateY(-2px);
    background: rgba(46, 204, 113, 0.1);
    border-radius: var(--radius-md);
}

.nav-icon {
    font-size: 20px;
    padding: 4px 12px;
    transition: all 0.2s ease;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
}

/* Modifizierter Code-Editor für die Bottom NavBar Integration */
#simple-coding-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    background: var(--color-surface, rgba(12, 20, 39, 0.95));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

:root {
  --font-ui: 'Inter', sans-serif;
  --sidebar-w: 60px;
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-bg: rgba(16, 32, 58, 0.85);
  --accent-green: #4ade80;
  --accent-blue: #3b82f6;
  --accent-gold: #fbbf24;
}

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

body {
  font-family: var(--font-ui);
  overflow: hidden;
  background: #111;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: #2c3e50;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0,0,0,0.5);
  z-index: 25;
}

.nav-btn {
  width: 100%;
  height: var(--sidebar-w);
  border: none;
  background: transparent;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  border-left: 4px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.nav-btn:hover {
  filter: brightness(1.15);
  border-left-color: rgba(255,255,255,0.5);
}

.nav-btn.active {
  border-left-color: white;
  filter: brightness(1.2);
}

/* Category-specific colors */
#cat-bewegung  { background: #27ae60; }
#cat-schleifen { background: #e67e22; }
#cat-logik     { background: #2980b9; }
#cat-warten    { background: #f1c40f; color: #333; }
#cat-aktionen  { background: #8e44ad; }
#cat-sensoren  { background: #16a085; }

/* Viewport */
.viewport {
  flex: 1;
  position: relative;
}

#canvas-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #2a110e; /* Fallback */
}

/* ═══════════════════════════════════════════ */
/* FOG OF WAR                                 */
/* ═══════════════════════════════════════════ */
#fog-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.45;
  transition: opacity 0.5s;
}

/* Glass panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* ═══════════════════════════════════════════ */
/* HUD: Score + Quest (Solarpunk)             */
/* ═══════════════════════════════════════════ */
.hud-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: #f0fdf4;
  border-bottom: 2px solid #bbf7d0;
  z-index: 100;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.hud-top-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hud-logo {
  font-weight: 800;
  font-size: 1.1rem;
  color: #047857;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-score-inline {
  font-weight: 700;
  color: #15803d;
  font-size: 1.1rem;
  background: rgba(255,255,255,0.6);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #bbf7d0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-icon-btn {
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #064e3b;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.hud-icon-btn:active {
  transform: scale(0.9);
  background: #dcfce7;
}

.hud-icon-btn.active {
  background: #dcfce7;
  border-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.hud-dropdown {
  position: absolute;
  top: 60px; /* Below the top bar */
  left: 16px;
  z-index: 90;
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  animation: dropdown-slide-down 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dropdown-slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hud-score {
  font-size: 1.1rem;
  font-weight: 800;
  color: #064e3b;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.multiplier-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  animation: pulseBadge 0.8s ease-in-out infinite alternate;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.multiplier-badge.hidden { display: none !important; }

@keyframes pulseBadge {
  from { transform: scale(1); box-shadow: 0 0 8px rgba(245,158,11,0.4); }
  to   { transform: scale(1.08); box-shadow: 0 0 18px rgba(245,158,11,0.8); }
}

.hud-btns {
  display: flex;
  gap: 6px;
}

.hud-action-btn {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #064e3b;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.2s;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-action-btn:hover {
  background: #dcfce7;
  transform: translateY(-1px);
}

.hud-action-btn:active {
  transform: translateY(0);
}

/* ═══════════════════════════════════════════ */
/* STORY PANEL                                */
/* ═══════════════════════════════════════════ */
.story-panel {
  position: absolute;
  top: 80px; /* Unter dem HUD */
  left: 20px;
  width: 280px;
  padding: 15px;
  z-index: 900;
  pointer-events: none;
}

.hud-quest {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #064e3b;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
}

@keyframes blinkCrit {
  from { opacity: 1; }
  to { opacity: 0.5; }
}

@keyframes pulseCharge {
  from { color: #22d3ee; text-shadow: 0 0 4px rgba(34, 211, 238, 0.3); }
  to { color: #67e8f9; text-shadow: 0 0 12px rgba(34, 211, 238, 0.6); }
}


.level-badge {
  background: #3b82f6;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 800;
  pointer-events: none;
  border-left: 3px solid #fbbf24;
}

.story-act {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.story-objectives {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.story-obj {
  font-size: 0.82rem;
  color: #cbd5e1;
  padding: 3px 0;
  transition: color 0.3s;
}

.story-obj.done {
  color: #4ade80;
  text-decoration: line-through;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════ */
/* ZONE DISCOVERY POPUP                       */
/* ═══════════════════════════════════════════ */
.zone-discovery {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: 420px;
  text-align: center;
  padding: 36px 44px;
  border: 2px solid #a78bfa;
  box-shadow: 0 0 40px rgba(167, 139, 250, 0.4), 0 0 80px rgba(167, 139, 250, 0.15);
  background: linear-gradient(135deg, #1e1b4b 0%, #0f0c29 100%);
  border-radius: 24px;
  animation: zonePopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.zone-icon {
  font-size: 4.5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px rgba(167,139,250,0.8));
  animation: floatIcon 2s ease-in-out infinite;
}

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

.zone-title {
  color: #a78bfa;
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.zone-story {
  font-size: 1rem;
  color: #e2e8f0;
  margin-bottom: 16px;
  line-height: 1.6;
  font-style: italic;
}

.zone-reward {
  font-size: 1rem;
  color: #fbbf24;
  font-weight: 700;
  margin-bottom: 24px;
  padding: 8px 16px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 8px;
}

@keyframes zonePopIn {
  from { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════ */
/* D-Pad Controls                             */
/* ═══════════════════════════════════════════ */
.dpad {
  position: absolute;
  bottom: 130px;
  left: 80px;
  z-index: 15;
  display: grid;
  grid-template-areas:
    ".    up    ."
    "left center right"
    ".    down  .";
  grid-template-columns: 62px 62px 62px;
  grid-template-rows: 62px 62px 62px;
  gap: 4px;
}

.dpad-btn {
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  background: rgba(16, 32, 58, 0.7);
  backdrop-filter: blur(6px);
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active, .dpad-btn.pressed {
  background: rgba(74, 222, 128, 0.5);
  transform: scale(0.92);
  border-color: var(--accent-green);
}

.dpad-up    { grid-area: up; }
.dpad-left  { grid-area: left; }
.dpad-center { grid-area: center; font-size: 1.1rem; opacity: 0.5; cursor: default; }
.dpad-right { grid-area: right; }
.dpad-down  { grid-area: down; }

/* Sensor Overlay */
.sensor-overlay {
  position: absolute;
  right: 24px;
  bottom: 130px;
  width: 300px;
  z-index: 10;
  pointer-events: none;
}

.overlay-header {
  background: #5c6c80;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.95rem;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2);
}

.overlay-body {
  padding: 12px 14px;
  font-size: 0.85rem;
  min-height: 70px;
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  white-space: pre-line;
  line-height: 1.6;
  font-family: 'Inter', monospace;
}

/* Bottom Bar */
.bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 20px;
  pointer-events: none;
}

.action-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 3px solid #4a5a70;
  background: #2c3e50;
  color: white;
  font-size: 22px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  margin: 0 8px;
  transition: transform 0.1s;
}
.action-btn:active { transform: scale(0.95); }
.action-btn.stop { background: #34495e; border-color: #5c6c80; color: #fff; }

/* ═══════════════════════════════════════════ */
/* Success Overlay                            */
/* ═══════════════════════════════════════════ */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.success-overlay.hidden {
  display: none !important;
}

.success-content {
  text-align: center;
  padding: 40px 50px;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-emoji {
  font-size: 4rem;
  margin-bottom: 8px;
}

.success-content h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.success-content p {
  font-size: 1.3rem;
  color: #fbbf24;
  font-weight: 700;
  margin-bottom: 20px;
}

.success-btn {
  background: var(--accent-green);
  color: #111;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

.success-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════ */
/* Reward / Upgrade Popup                     */
/* ═══════════════════════════════════════════ */
.reward-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: 400px;
  text-align: center;
  padding: 40px;
  border: 2px solid #fbbf24;
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 24px;
  display: none; /* Controlled by JS */
  animation: slideUp 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.reward-icon {
  font-size: 5rem;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 10px #fbbf24);
}

.reward-title {
  color: #fbbf24;
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.reward-desc {
  font-size: 1.1rem;
  color: #e2e8f0;
  margin-bottom: 30px;
  line-height: 1.5;
}

@keyframes slideUp {
  from { transform: translate(-50%, 0); opacity: 0; }
  to { transform: translate(-50%, -50%); opacity: 1; }
}

/* ═══════════════════════════════════════════ */
/* IDE Panel                                  */
/* ═══════════════════════════════════════════ */
#code-ide {
  position: absolute;
  left: 80px; top: 20px;
  width: 850px;
  height: 600px;
  min-width: 400px;
  min-height: 400px;
  resize: both;
  overflow: hidden;
  z-index: 20;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s;
}
#code-ide.hidden { display: none; }

#ide-header {
  background: rgba(30, 41, 59, 1);
  padding: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  flex-shrink: 0;
  height: 48px;
  position: relative;
}

#ide-header h3 {
  padding-left: 14px;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #fbbf24;
}

.sync-indicator {
  font-size: 0.8rem;
  color: #4ade80;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: auto;
  margin-left: 15px;
}

.sync-indicator.active {
  opacity: 1;
}

.sync-indicator.warning {
  color: #fbbf24;
}

.ide-tabs {
  display: flex;
  height: 100%;
}

.ide-tab-btn {
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 0 20px;
  height: 100%;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-ui);
}

.ide-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.ide-tab-btn.active {
  background: rgba(15, 23, 42, 0.9);
  color: #4ade80;
  border-bottom: 3px solid #4ade80;
}

.ide-body {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

#blocklyDiv {
  width: 100%;
  height: 100%;
  background: transparent !important;
  display: none;
}
#blocklyDiv.active {
  display: block;
}

#live-code-panel {
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 0 0 8px 8px;
  display: none;
  flex-direction: column;
}
#live-code-panel.active {
  display: flex;
}

.live-panel-header {
  background: rgba(30, 41, 59, 1);
  padding: 10px 14px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fbbf24;
}

#live-code-panel pre {
  padding: 14px;
  margin: 0;
  overflow: auto;
  flex: 1;
}

#live-code-content {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #e2e8f0;
}

/* Syntax Highlighting */
.sync-keyword { color: #c678dd; font-weight: bold; }
.sync-function { color: #61afef; }
.sync-string { color: #98c379; }
.sync-number { color: #d19a66; }
.sync-comment { color: #5c6370; font-style: italic; }

/* Hide Blockly's default border and background */
.blocklyMainBackground {
  fill: transparent !important;
}
.blocklySvg {
  background-color: transparent !important;
}

/* ═══════════════════════════════════════════ */
/* Item Glow (collectibles in 3D hint)        */
/* ═══════════════════════════════════════════ */
.item-pickup-flash {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  pointer-events: none;
  z-index: 30;
  animation: pickupFlash 1s ease forwards;
}
@keyframes pickupFlash {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50%  { opacity: 1; transform: translate(-50%, -80%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1.2); }
}

/* ═══════════════════════════════════════════ */
/* Responsive                                 */
/* ═══════════════════════════════════════════ */
@media (max-width: 600px) {
  /* --- Sidebar: schmal --- */
  .sidebar { width: 36px; }
  .nav-btn { height: 36px; font-size: 0.9rem; }

  /* --- HUD: kompakt mit Zeilenumbruch --- */
  .hud-panel {
    top: 0; left: 0; right: 0;
    max-width: 100vw;
  }
  .hud-score { font-size: 0.85rem; padding: 5px 10px; }
  .hud-quest { font-size: 0.72rem; padding: 4px 8px; }
  .hud-energy { font-size: 0.72rem; padding: 3px 8px; }
  .hud-vitality { font-size: 0.72rem; padding: 3px 8px; }
  .hud-map-coverage { font-size: 0.7rem; padding: 3px 8px; }
  .hud-btns {
    flex-wrap: wrap;
    gap: 3px;
  }
  .hud-action-btn {
    font-size: 0.65rem;
    padding: 3px 6px;
  }
  .level-badge { font-size: 0.6rem; padding: 1px 5px; }

  /* --- D-Pad: links unten, daumenfreundlich --- */
  .dpad {
    grid-template-columns: 46px 46px 46px;
    grid-template-rows: 46px 46px 46px;
    bottom: 130px; left: 42px;
    gap: 2px;
  }
  .dpad-btn { width: 46px; height: 46px; font-size: 1rem; }

  /* --- Sensor Overlay: minimal, unten rechts --- */
  .sensor-overlay {
    width: 160px; right: 4px; bottom: 130px;
  }
  .overlay-header {
    font-size: 0.7rem; padding: 4px 6px;
  }
  .overlay-body {
    font-size: 0.65rem; padding: 4px 6px;
    min-height: 30px; line-height: 1.3;
  }

  /* --- Bottom Bar: kompakter --- */
  .bottom-bar {
    height: 56px;
    padding-bottom: 8px;
  }
  .action-btn {
    width: 44px; height: 44px;
    font-size: 16px;
    margin: 0 4px;
  }

  /* --- Ausblenden --- */
  .story-panel { display: none; }
  #minimap-container { display: none !important; }
  
  /* IDE Fullscreen on Mobile */
  #code-ide {
    left: 0; top: 0;
    width: 100vw; height: 100vh;
    min-width: unset; min-height: unset;
    border-radius: 0;
    z-index: 100;
  }
  
  /* Handbook Mobile Layout */
  .handbook-modal {
    width: 100%; height: 100%;
    max-width: none; max-height: none;
    border-radius: 0;
  }
  .handbook-body {
    flex-direction: column;
  }
  .handbook-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .hb-tab-btn {
    white-space: nowrap;
    padding: 10px 15px;
    border-left: none !important;
    border-bottom: 3px solid transparent;
  }
  .hb-tab-btn.active {
    border-left: none !important;
    border-bottom: 3px solid #4ade80;
  }
}

/* ═══════════════════════════════════════════ */
/* MINI MAP                                   */
/* ═══════════════════════════════════════════ */
#minimap-container {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  z-index: 10;
  border: 4px solid var(--glass-border);
  box-shadow: 0 0 20px rgba(0,0,0,0.5), inset 0 0 15px rgba(0,0,0,0.3);
  pointer-events: none;
}

#minimap-canvas {
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
}

/* ═══════════════════════════════════════════ */
/* CODE ANALYSIS                              */
/* ═══════════════════════════════════════════ */
.hud-energy, .hud-cargo {
  font-weight: 600;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hud-cargo {
  border-color: rgba(251, 191, 36, 0.4); /* Amber border for cargo */
}

.hidden {
  display: none !important;
}

.code-analysis-results {
  margin: 15px 0;
  padding: 15px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
}

#code-result-blocks {
  font-size: 1.1rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 5px;
}

.stars {
  font-size: 1.8rem;
  margin-bottom: 10px;
  letter-spacing: 4px;
}

#code-result-msg {
  font-size: 0.9rem;
  color: #4ade80;
  font-weight: 600;
  opacity: 0.9;
}

/* ═══════════════════════════════════════════ */
/* UPGRADE ANIMATIONS                         */
/* ═══════════════════════════════════════════ */
.upgrade-unlocked {
  animation: upgradeGlow 2s ease-in-out infinite alternate;
}

@keyframes upgradeGlow {
  from { filter: drop-shadow(0 0 5px #fbbf24); }
}

/* ═══════════════════════════════════════════ */
/* ACE HOVER TOOLTIP UND DOCS                 */
/* ═══════════════════════════════════════════ */
.ace-hover-tooltip {
  position: fixed; /* fix position related to viewport */
  z-index: 99999;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-left: 3px solid #4ade80;
  border-radius: 8px;
  padding: 12px;
  color: #e2e8f0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: tooltippop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ace-hover-tooltip h4 {
  color: #4ade80;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.ace-hover-tooltip p {
  line-height: 1.4;
}

.ace-hover-tooltip .doc-returns {
  color: #a78bfa;
  font-size: 0.8rem;
  margin-top: 8px;
  font-weight: 600;
  background: rgba(167, 139, 250, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

@keyframes tooltippop {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Override Ace editor defaults for the autocomplete popup */
.ace_tooltip.ace_doc-tooltip {
  background: rgba(15, 23, 42, 0.95) !important;
  background-image: none !important;
  border: 1px solid rgba(74, 222, 128, 0.4) !important;
  border-left: 3px solid #4ade80 !important;
  color: #e2e8f0 !important;
  font-family: var(--font-ui) !important;
  padding: 12px !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
}

.ace_tooltip.ace_doc-tooltip h4 {
  color: #4ade80 !important;
  margin-bottom: 6px !important;
  margin-top: 0 !important;
  font-size: 0.95rem !important;
  border-bottom: none !important;
}

.ace_tooltip.ace_doc-tooltip p {
  line-height: 1.4 !important;
}

.ace_tooltip.ace_doc-tooltip .doc-returns {
  color: #a78bfa !important;
  font-size: 0.8rem !important;
  margin-top: 8px !important;
  font-weight: 600 !important;
  background: rgba(167, 139, 250, 0.1) !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
}

/* ═══════════════════════════════════════════ */
/* HANDBOOK / CODEX                           */
/* ═══════════════════════════════════════════ */
.handbook-modal {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(240, 253, 244, 0.98);
  backdrop-filter: blur(10px);
  border: 2px solid #bbf7d0;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  animation: modalPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  z-index: 10000;
  color: #1e293b;
  width: 500px;
  max-width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.handbook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(187, 247, 208, 0.6);
}

.handbook-header h2 {
  font-size: 1.2rem;
  margin: 0;
  color: #1b5e20;
}

.handbook-body {
  flex: 1;
  overflow-y: auto;
}

.handbook-content {
  width: 100%;
  padding: 24px;
}

.hb-tab-content h3 {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 12px;
  color: #1b5e20;
}

.hb-tab-content p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 12px;
  color: #334155;
}

.hb-tab-content strong {
  color: #166534;
}

.close-btn {
  background: rgba(30, 41, 59, 0.08);
  border: none;
  color: #334155;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.close-btn:hover {
  background: rgba(30, 41, 59, 0.15);
  color: #0f172a;
}

.close-btn:active {
  transform: scale(0.92);
}

@keyframes modalPopIn {
  0% { opacity: 0; transform: translate(-50%, -55%) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 📱 Mobile UI – Comprehensive Smartphone Optimization */
@media (max-width: 480px) {

  /* --- Sidebar: schmaler & kompakter --- */
  .sidebar {
    width: 36px !important;
  }
  .nav-btn {
    height: 36px !important;
    font-size: 0.9rem !important;
    padding: 0 !important;
  }

  /* --- HUD: kompakt, kleiner Text, weniger Padding --- */
  .hud-panel {
    top: 4px !important;
    left: 4px !important;
    gap: 3px !important;
    max-width: calc(100vw - 80px);
  }
  .hud-score {
    font-size: 0.8rem !important;
    padding: 4px 8px !important;
  }
  .hud-quest {
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
  }
  .hud-energy {
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
  }
  .hud-vitality {
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
  }
  .hud-btns {
    gap: 4px !important;
  }
  .hud-action-btn {
    font-size: 0.65rem !important;
    padding: 3px 6px !important;
  }
  .level-badge {
    font-size: 0.6rem !important;
    padding: 1px 5px !important;
  }
  .multiplier-badge {
    font-size: 0.6rem !important;
    padding: 2px 6px !important;
  }

  /* --- D-Pad: links unten, kompakter --- */
  .dpad {
    bottom: 130px !important;
    left: 44px !important;
    right: auto !important;
    grid-template-columns: 44px 44px 44px !important;
    grid-template-rows: 44px 44px 44px !important;
    gap: 2px !important;
  }
  .dpad-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 1rem !important;
    border-radius: 8px !important;
  }

  /* --- Sensor Overlay: unten rechts, minimal --- */
  .sensor-overlay {
    right: 4px !important;
    bottom: 130px !important;
    width: 180px !important;
  }
  .overlay-header {
    font-size: 0.75rem !important;
    padding: 5px 8px !important;
  }
  .overlay-body {
    font-size: 0.7rem !important;
    padding: 6px 8px !important;
    min-height: 40px !important;
    line-height: 1.4 !important;
  }

  /* --- Bottom Bar: Play/Stop kleiner --- */
  .bottom-bar {
    height: 60px !important;
    padding-bottom: 10px !important;
  }
  .action-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
    margin: 0 4px !important;
  }

  /* --- Story Panel: verstecken auf Mobile --- */
  .story-panel {
    display: none !important;
  }

  /* --- Minimap: verstecken --- */
  #minimap-container {
    display: none !important;
  }

  /* --- Handbook: Vollbild --- */
  .handbook-modal {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
  }

  /* --- Map Coverage: kleiner --- */
  .hud-map-coverage {
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
  }
}

/* ═══════════════════════════════════════════════════════
   BLOCK EDITOR – Tap-based (Light Theme)
   ═══════════════════════════════════════════════════════ */

/* Editor Container – Modus A (collapsed) / Modus B (expanded) */
#simple-coding-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    color: #1f2937;
}

/* Modus A: Kompakte Vorschau */
#simple-coding-bar.mode-a {
    height: 110px;
}

/* Modus B: Editor dominiert */
#simple-coding-bar.mode-b {
    height: 55vh;
}

/* Toggle-Handle oben am Editor */
.editor-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    cursor: pointer;
    flex-shrink: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.editor-toggle .handle {
    width: 40px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 3px;
    transition: background 0.2s;
}
.editor-toggle:hover .handle,
.editor-toggle:active .handle {
    background: #94a3b8;
}

/* ─── Code-Bereich (vertikaler Programmcode) ─── */
.code-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
}

.code-area-empty {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
    font-size: 14px;
}

/* Einzelner Block im Code-Bereich & Palette */
.code-line, .palette-block {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 6px 0;
    border-radius: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #064e3b;
    font-weight: 600;
    font-size: 16px;
    user-select: none;
    transition: transform 0.12s, opacity 0.12s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    position: relative;
}
.code-line:active, .palette-block:active {
    transform: scale(0.98);
    opacity: 0.9;
}
.code-line.executing {
    outline: 2px solid #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}
.code-line.removing {
    animation: removeBlock 0.25s ease-in forwards;
}

/* Block Internals */
.block-icon {
    font-size: 18px;
    flex-shrink: 0;
    color: #166534;
    margin-right: 12px;
}
.block-label {
    flex: 1;
}
.block-index {
    font-size: 12px;
    color: #94a3b8;
    margin-right: 8px;
}

/* UI Controls innerhalb des Blocks (Screenshot 2 Fixes) */
.block-drag-handle {
    cursor: grab;
    margin-right: 12px;
    color: #9ca3af;
    font-size: 18px;
    padding: 0 4px;
}
.block-delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 8px;
    padding: 0 8px;
}
.block-move-btns {
    display: flex;
    flex-direction: column;
    margin: 0 8px;
}
.block-move-btn {
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    color: #64748b;
    padding: 2px;
}
.block-move-btn:disabled {
    opacity: 0.2;
}

/* Stepper für Parameter */
.block-stepper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 2px;
    margin: 0 10px;
}
.stepper-btn {
    background: #f0fdf4;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    color: #166534;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stepper-btn:active {
    background: #dcfce7;
}
.stepper-value {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    width: 36px;
    text-align: center;
    color: #064e3b;
}

/* ─── Einfügemarke (blinkender Cursor) ─── */
.insertion-cursor {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 14px;
    margin: 0;
    cursor: pointer;
    position: relative;
    min-height: 8px;
}
.insertion-cursor .cursor-line {
    width: 100%;
    height: 3px;
    background: #22c55e;
    border-radius: 2px;
    animation: cursorBlink 1s ease-in-out infinite;
}
.insertion-cursor.active .cursor-line {
    height: 3px;
    animation: cursorBlink 1s ease-in-out infinite;
}
.insertion-cursor:not(.active) .cursor-line {
    height: 2px;
    background: #e2e8f0;
    animation: none;
}
.insertion-cursor:not(.active):hover .cursor-line {
    height: 3px;
    background: #86efac;
}

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

/* ─── Palette-Leiste (unten, horizontal scrollbar) ─── */
.palette-categories {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    background: #e2e8f0;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}
.palette-categories::-webkit-scrollbar {
    display: none; /* Hide scrollbar for tabs */
}
.palette-category-tab {
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    border: none;
    border-right: 1px solid rgba(255,255,255,0.2);
    border-radius: 0 8px 0 0;
    margin-right: 2px;
    transition: opacity 0.2s, filter 0.2s;
    opacity: 0.6;
    filter: brightness(0.9);
}
.palette-category-tab.active {
    opacity: 1;
    filter: brightness(1.1);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2);
}
.palette-bar {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    overflow-x: auto;
    flex-shrink: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    -webkit-overflow-scrolling: touch;
}
.palette-bar::-webkit-scrollbar {
    height: 4px;
}
.palette-bar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}
.palette-block {
    margin: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.palette-block.locked {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1);
}
.palette-block.locked::after {
    content: "🔒";
    margin-left: 8px;
    font-size: 14px;
}

/* ─── Editor-Aktionen (Play + Clear) ─── */
.editor-actions {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    flex-shrink: 0;
    justify-content: center;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}
.editor-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.1s;
}
.editor-btn:active {
    transform: scale(0.96);
}
.editor-btn.btn-play {
    background: #22c55e;
    color: white;
    box-shadow: 0 4px 6px rgba(34, 197, 94, 0.2);
    flex: 1;
}
.editor-btn.btn-stop {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}
.editor-btn.btn-clear {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* ─── Animationen ─── */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Mode A overrides */
#simple-coding-bar.mode-a .code-area .code-line {
    padding: 8px 12px;
    font-size: 14px;
    margin: 2px 0;
    flex-shrink: 0;
}
#simple-coding-bar.mode-a .code-area .code-line .block-delete-btn,
#simple-coding-bar.mode-a .code-area .code-line .block-move-btns,
#simple-coding-bar.mode-a .code-area .code-line .block-drag-handle {
    display: none;
}
#simple-coding-bar.mode-a .code-area .code-line .block-stepper {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}
#simple-coding-bar.mode-a .code-area .code-line .stepper-btn {
    display: none;
}
#simple-coding-bar.mode-a .code-area .code-line .stepper-value {
    font-size: 12px;
    min-width: 0;
    margin-left: 4px;
}

/* SortableJS Styles */
.sortable-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sortable-ghost {
  opacity: 0.4;
  background-color: #f8fafc;
  border: 2px dashed #cbd5e1;
}
.sortable-drag {
  opacity: 1 !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  transform: scale(1.02);
  z-index: 1000;
}

/* ADA Feature Toast */
.ada-feature-toast {
  position: absolute;
  top: 80px; /* Below HUD */
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #86efac;
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ada-feature-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.ada-feature-toast.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
}

.toast-avatar {
  font-size: 2.5rem;
  background: #dcfce7;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.toast-content h4 {
  margin: 0 0 4px 0;
  color: #064e3b;
  font-size: 1.1rem;
}

.toast-content p {
  margin: 0;
  color: #047857;
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 300px;
}

/* ADA Question Overlay (Quiz) */
.ada-question-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 20000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ada-question-card {
  background: rgba(10, 30, 20, 0.95);
  border: 2px solid #34d399;
  border-radius: 15px;
  padding: 30px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
}

.ada-question-avatar {
  font-size: 60px;
  margin-bottom: 15px;
}

.ada-question-text {
  font-size: 24px;
  color: #fff;
  font-weight: bold;
  margin-bottom: 25px;
}

.ada-question-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.ada-option-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 15px 20px;
  font-size: 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.ada-option-btn:hover {
  background: rgba(52, 211, 153, 0.3);
  border-color: #34d399;
}

.ada-option-btn.correct {
  background: #059669;
  border-color: #34d399;
}

/* High Contrast Overrides for Worlds Preview Modal (Dark Theme Glassmorphism) */
#worlds-preview-modal {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#worlds-preview-modal .modal-title {
  color: #ffffff !important;
}

#worlds-preview-modal .world-preview-card p {
  color: #e2e8f0 !important;
}

#worlds-preview-modal p {
  color: #cbd5e1 !important;
}

#worlds-preview-modal .close-btn {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

#worlds-preview-modal .close-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

/* World Separators in Mission Hub */
.world-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 15px 0;
  position: relative;
  z-index: 2;
}

.world-separator-badge {
  background: linear-gradient(135deg, #0f172a, #065f46); /* Dark slate to emerald */
  border: 2px solid #10b981; /* Green/mint border */
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
  user-select: none;
}

.world-separator-icon {
  font-size: 1.1rem;
}

/* Live Sensor Dashboard */
.sensor-dashboard-panel {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 320px;
    background: rgba(11, 35, 48, 0.95);
    border: 1px solid rgba(9, 216, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(9, 216, 255, 0.1);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s, transform 0.3s;
}

.sensor-dashboard-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.sensor-dash-header {
    background: rgba(4, 15, 26, 0.9);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(9, 216, 255, 0.2);
}

.sensor-dash-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #09d8ff;
    letter-spacing: 0.5px;
}

.btn-close-dash {
    background: transparent;
    border: none;
    color: #8fa8cc;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close-dash:hover {
    color: #fff;
}

.sensor-dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 15px;
}

/* Letzte Karte geht über die volle Breite, da es 5 sind */
.sensor-dash-grid .sensor-card:last-child {
    grid-column: span 2;
}

.sensor-card {
    background: rgba(6, 14, 31, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 0.2s, background 0.2s;
}

.sensor-card:hover {
    background: rgba(9, 216, 255, 0.05);
    border-color: rgba(9, 216, 255, 0.3);
}

.sensor-icon {
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sensor-info {
    display: flex;
    flex-direction: column;
}

.sensor-name {
    font-size: 0.75rem;
    color: #8fa8cc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sensor-val {
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    font-family: monospace;
}
