/* Design System & Color Tokens */
:root {
  --primary-color: #01ABA8;
  --primary-hover: #018d8a;
  --bg-color: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  
  --color-success: #10B981;
  --color-danger: #EF4444;
  --color-warning: #F59E0B;
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Dark Theme Variables */
:root[data-color-mode="dark"] {
  --bg-color: #0B1120;
  --card-bg: #1E293B;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border-color: #334155;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
}

[data-color-mode="dark"] .btn-drive {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34D399;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Portrait Warning Overlay for Mobile */
.portrait-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(30, 41, 59, 0.95);
  color: white;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  backdrop-filter: blur(8px);
}

.warning-content .rotate-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse-rotate 2s infinite ease-in-out;
}

@keyframes pulse-rotate {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(90deg) scale(1.1); }
}

/*
@media (orientation: portrait) and (max-width: 768px) {
  .portrait-warning {
    display: flex;
  }
}
*/

/* Main App Layout */
#app-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Header Bar */
.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #0F172A;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-color);
  perspective: 1200px;
  container-type: inline-size;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-back-app {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-main);
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.btn-back-app:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 10px rgba(1, 171, 168, 0.3);
  transform: translateY(-1px);
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}

.badge-primary {
  background-color: rgba(1, 171, 168, 0.1);
  color: var(--primary-color);
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-badge {
  font-size: 0.85rem;
  font-weight: 500;
  background-color: var(--bg-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stat-val {
  font-weight: 700;
  color: var(--primary-color);
  margin-left: 0.25rem;
  transition: color 0.3s ease;
}

.rank-beginner {
  color: #94A3B8; /* Slate grey */
}
.rank-mofa {
  color: #38BDF8; /* Sky blue */
}
.rank-driver {
  color: #10B981; /* Emerald green */
}
.rank-mega {
  color: #EC4899; /* Neon pink */
}
.rank-instructor {
  color: #FBBF24; /* Golden yellow */
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

/* Simulator Viewport & Stage */
.sim-viewport {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .sim-viewport {
    grid-template-columns: 3fr 2fr;
  }
}

/* Responsive 2D Overlay Layout */
.diorama-board {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: none; /* Flattened for the custom 1:1 asset layout */
  perspective: 1000px; /* Perspective context for child 3D rotations */
}

.diorama-ground {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #166534; /* Green grass base */
}

/* Layer Base: main background image */
.layer-base {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill; /* Pixel-perfect stretch mapping to stage coordinate system */
  z-index: 1;
}

/* Quadrant Scenery Decorations */
.layer-decor {
  position: absolute;
  width: 50.21%; /* Match 1424px on 2836px canvas with slight overlap */
  height: 50%;
  object-fit: fill; /* Stretches decoration assets identically to background */
  z-index: 2;
  pointer-events: none;
}

.layer-decor.quadrant-leftup {
  left: 0;
  top: 0;
}

.layer-decor.quadrant-rightup {
  left: 49.79%;
  top: 0;
}

.layer-decor.quadrant-leftdown {
  left: 0;
  top: 50%;
  z-index: 12; /* Placed in front of West/East cars, behind USER car */
}

.layer-decor.quadrant-rightdown {
  left: 49.79%;
  top: 50%;
  z-index: 12; /* Placed in front of West/East cars, behind USER car */
}

/* Vehicle Containers and Positions */
.diorama-car-container {
  position: absolute;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.8s ease-in-out;
  pointer-events: auto;
}

.diorama-car-container.pos-opposite {
  left: 41.07%;
  top: -8.0%;
  width: 9.9%; /* 10% smaller */
  height: 33.3%; /* 10% smaller */
  z-index: 3; /* Behind North pole */
}

.diorama-car-container.pos-left {
  left: 17.5%; /* Shifted right (closer to intersection) */
  top: 41.5%;  /* Shifted up to align in lane and clear the bottom curb */
  width: 19.67%;
  height: 20.7%;
  z-index: 5; /* In front of North pole, behind Bottom Left decor */
}

.diorama-car-container.pos-right {
  left: 63.0%; /* Shifted left (closer to intersection) */
  top: 27.26%;
  width: 19.67%;
  height: 20.7%;
  z-index: 5; /* In front of North pole, behind Bottom Right decor */
}

.diorama-car-container.pos-user {
  left: 50.8%; /* Moved slightly left (west) to clear the pavement curb */
  top: 65.5%; /* Positioned slightly lower */
  width: 9.9%; /* 10% smaller */
  height: 33.3%; /* 10% smaller */
  z-index: 15; /* In front of everything! */
}

.diorama-car-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.45));
}

/* Driving away transitions */
.diorama-car-container.passed.pos-user {
  transform: translateY(-40%);
  opacity: 0;
}

.diorama-car-container.passed.pos-opposite {
  transform: translateY(40%);
  opacity: 0;
}

.diorama-car-container.passed.pos-left {
  transform: translateX(40%);
  opacity: 0;
}

.diorama-car-container.passed.pos-right {
  transform: translateX(-40%);
  opacity: 0;
}

/* Signposts and Poles (Proportional layout with perspective scaling) */
.diorama-pole-container {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  aspect-ratio: 357 / 992; /* Perfect vertical proportions preventing squishing */
}

.diorama-pole-container.pos-opposite {
  left: 40.20%;
  top: 33.24%;
  width: 3.5%; /* Smaller in the background */
  z-index: 4; /* In front of Opposite car, behind West/East cars */
}

.diorama-pole-container.pos-left {
  left: 40.20%;
  top: 64.49%;
  width: 5.0%; /* Larger in the foreground */
  z-index: 6; /* In front of Left car */
  transform: translate(-50%, -100%) rotateY(45deg); /* Angled for depth */
}

.diorama-pole-container.pos-right {
  left: 60.65%;
  top: 33.24%;
  width: 3.5%; /* Smaller in the background */
  z-index: 6; /* In front of Right car */
  transform: translate(-50%, -100%) rotateY(-45deg); /* Angled for depth */
}

.diorama-pole-container.pos-user {
  left: 60.65%;
  top: 64.49%;
  width: 5.0%; /* Larger in the foreground */
  z-index: 14; /* In front of Bottom decors, behind USER car */
}

.diorama-pole-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 75%; /* Thicker metal pole stick compensating for asset transparency margins */
  height: 100%; /* Spans the full height of the container, behind the signs */
  object-fit: fill;
  display: block;
  z-index: 1;
}

.diorama-signs-wrapper {
  position: absolute;
  top: 5%; /* Position signs near the top of the pole */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 2; /* In front of the pole stick */
}

/* Position and scale signs wrapper below the traffic light box when active */
.diorama-pole-container.has-trafficlight .diorama-signs-wrapper {
  top: 30%; /* Position below traffic light head and higher from the ground */
  width: 50%; /* Scale down signs to original size since container width is doubled */
}

.diorama-sign-img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.3));
}

/* Grey backside representation */
.diorama-sign-img.backside {
  filter: contrast(0) brightness(0.5) drop-shadow(0 4px 8px rgba(15, 23, 42, 0.3));
}

/* Mirrored sign for bottom-to-left abknickende Vorfahrt */
.diorama-sign-img.mirrored-sign {
  transform: scaleX(-1);
}

/* User Label Arrow Tag ("Das bist Du!") */
.user-label-tag {
  position: absolute;
  bottom: 102%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color);
  color: white;
  font-size: clamp(0.40rem, 1.18cqi, 0.56rem);
  font-weight: 700;
  padding: 2px 3px;
  border-radius: 8px;
  white-space: normal;
  width: max-content;
  max-width: 110%;
  text-align: center;
  line-height: 1.1;
  box-sizing: border-box;
  box-shadow: 0 4px 10px rgba(1, 171, 168, 0.4);
  pointer-events: none;
  z-index: 50;
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: float-arrow 2.5s infinite ease-in-out;
}

@container (min-width: 550px) {
  .user-label-tag {
    font-size: clamp(0.55rem, 1.3cqi, 0.65rem);
    line-height: 1.2;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
    max-width: none;
  }
}

@keyframes float-arrow {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

/* Emergency Vehicle Label Tag ("Tatütata!") */
.emergency-label-tag {
  position: absolute;
  bottom: 102%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #dc2626; /* emergency red */
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.4);
  pointer-events: none;
  z-index: 50;
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: float-arrow-emergency 1.5s infinite ease-in-out;
}

@keyframes float-arrow-emergency {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -8px); }
}

/* Position label below the car for the opposite (North) lane so it is not cut off by the top boundary */
.diorama-car-container.pos-opposite .emergency-label-tag {
  bottom: auto;
  top: 102%;
}

/* Glowing Indicator Blinker Arrows */
.diorama-blinker {
  position: absolute;
  width: 22px;
  height: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translate(-50%, -50%);
  animation: blinker-pulse 0.5s infinite alternate;
  z-index: 20;
  pointer-events: none;
  filter: drop-shadow(0 0 3px #F59E0B) drop-shadow(0 0 6px #D97706);
}

.diorama-blinker svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes blinker-pulse {
  0% { opacity: 0.15; transform: translate(-50%, -50%) scale(0.85); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

/* Traffic Light Glow Overlays */
.diorama-trafficlight-glow {
  position: absolute;
  width: 14%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3; /* On top of the pole image */
}

.diorama-trafficlight-glow.red {
  background-color: #FF5D5D; /* slightly lighter red for core brightness */
  box-shadow: 0 0 12px #EF4444, 0 0 24px #EF4444, 0 0 48px rgba(239, 68, 68, 0.7);
}

.diorama-trafficlight-glow.green {
  background-color: #34D399; /* slightly lighter green for core brightness */
  box-shadow: 0 0 14px #10B981, 0 0 28px #10B981, 0 0 55px rgba(16, 185, 129, 0.75);
  animation: green-glow-pulse 1.2s infinite alternate ease-in-out;
}

@keyframes green-glow-pulse {
  from {
    opacity: 0.85;
    box-shadow: 0 0 12px #10B981, 0 0 24px #10B981, 0 0 45px rgba(16, 185, 129, 0.65), 0 0 70px rgba(16, 185, 129, 0.2);
  }
  to {
    opacity: 1.0;
    box-shadow: 0 0 18px #10B981, 0 0 38px #10B981, 0 0 85px rgba(16, 185, 129, 0.95), 0 0 120px rgba(16, 185, 129, 0.45);
  }
}

/* Stage Layer 4: Star Wars Warp Speed Hyperdrive Transition */
.speedlines-layer {
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 10%, rgba(255, 255, 255, 0.95) 90%),
              repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,0.9) 0deg 3deg, transparent 3deg 12deg);
  z-index: 30;
}

.speedlines-layer.active {
  animation: hyperdrive 0.6s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes hyperdrive {
  0% { transform: scale(0.3); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: scale(3.5); opacity: 0; }
}

/* Sleek Floating HUD Panel (Proportional and responsive scaling) */
.hud-panel {
  position: absolute;
  bottom: clamp(4px, 1.8cqi, 14px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: clamp(3px, 0.8cqi, 8px) clamp(10px, 2.5cqi, 20px);
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5cqi, 14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 100;
  max-width: min(82%, 460px);
  max-height: min(15%, 46px);
  pointer-events: auto;
}

.hud-blinker {
  font-size: clamp(0.8rem, 2.5cqi, 1.25rem);
  font-weight: 700;
  color: #475569;
  cursor: default;
  transition: all 0.25s ease;
  user-select: none;
  line-height: 1;
}

.hud-blinker.active {
  color: #FBBF24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.7);
  animation: hud-blinker-pulse 0.6s infinite alternate;
}

@keyframes hud-blinker-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.3); }
}

.hud-intention {
  color: #F1F5F9;
  font-size: clamp(0.68rem, 2.1cqi, 0.9rem);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}

/* Gamification Rank-Up Dialog Modal */
.rankup-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.rankup-card {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  text-align: center;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  position: relative;
  overflow: hidden;
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.rankup-badge-container {
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.rankup-badge-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(1, 171, 168, 0.35) 0%, rgba(1, 171, 168, 0) 70%);
  animation: pulse-glow 2s infinite ease-in-out;
  z-index: 1;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
}

.rankup-badge-svg {
  width: 95px;
  height: 95px;
  z-index: 2;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

.rankup-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 0.5rem;
}

.rankup-subtitle {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1.25rem;
}

.rankup-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #94A3B8;
  margin-bottom: 1.75rem;
}

.rankup-share-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  margin-bottom: 0.75rem;
}

.rankup-share-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid #334155;
  background-color: #1E293B;
  color: #F1F5F9;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-share:hover {
  background-color: #334155;
  border-color: #475569;
  transform: translateY(-2px);
}

.btn-share.whatsapp:hover {
  color: #25D366;
  border-color: #25D366;
}

.btn-share.twitter:hover {
  color: #1DA1F2;
  border-color: #1DA1F2;
}

.rankup-arnold-logo {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 45px;
  height: auto;
  border-radius: 4px;
  background-color: white;
  padding: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  opacity: 0.85;
}

/* Controls Panel */
.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prompt-box {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.prompt-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.prompt-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.buttons-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.btn {
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-action {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  justify-content: flex-start;
  text-align: left;
}

.btn-action:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-drive {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
  color: #065F46;
}

.btn-drive:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--color-success);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-color);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
}

/* Feedback Card */
.feedback-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 2px solid var(--border-color);
  animation: fadeInUp 0.3s ease;
}

.feedback-card.correct {
  border-color: var(--color-success);
  background-color: rgba(16, 185, 129, 0.04);
}

.feedback-card.incorrect {
  border-color: var(--color-danger);
  background-color: rgba(239, 68, 68, 0.04);
}

.feedback-head {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.correct .feedback-head {
  color: var(--color-success);
}

.incorrect .feedback-head {
  color: var(--color-danger);
}

.feedback-card.warning {
  border-color: #F59E0B;
  background-color: rgba(245, 158, 11, 0.04);
}

.warning .feedback-head {
  color: #D97706;
}

.feedback-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Success Gold Star Animation */
.success-star {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0) rotate(0deg);
  font-size: 6rem;
  color: #F59E0B;
  text-shadow: 0 0 25px rgba(254, 240, 138, 0.85);
  z-index: 35;
  pointer-events: none;
  display: none;
}

.success-star.animate {
  display: block;
  animation: star-fly-in 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes star-fly-in {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.8) rotate(360deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0) rotate(720deg); opacity: 0; }
}

/* Floating Debug Button */
.btn-debug-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  color: #F8FAFC;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-debug-toggle:hover {
  background: rgba(30, 41, 59, 0.98);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.btn-debug-toggle:active {
  transform: translateY(1px);
}

/* Debug Slide-Out Panel */
.debug-panel {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 380px;
  max-width: 90vw;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  z-index: 1001;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  padding: 1.25rem;
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  animation: debug-slide-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes debug-slide-in {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.debug-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: #F1F5F9;
  margin: 0;
}

.debug-header .btn-close {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.debug-header .btn-close:hover {
  color: #EF4444;
}

.debug-body h5 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #38BDF8; /* Premium Sky Blue */
  margin: 1rem 0 0.4rem 0;
}

.debug-body h5:first-of-type {
  margin-top: 0;
}

.debug-body pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #AEF35A; /* Light Neon Green */
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* Double the size of the traffic light poles for high visibility */
.diorama-pole-container.has-trafficlight.pos-opposite {
  width: 7.0%;
}
.diorama-pole-container.has-trafficlight.pos-left {
  width: 10.0%;
}
.diorama-pole-container.has-trafficlight.pos-right {
  width: 7.0%;
}
.diorama-pole-container.has-trafficlight.pos-user {
  width: 10.0%;
}

.diorama-pole-container.has-trafficlight {
  aspect-ratio: 357 / 794; /* 20% shorter height than regular poles for optimal proportions */
}

/* Welcome Dialog Modal CSS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}

.welcome-dialog-card {
  max-width: 480px;
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
  padding: 2.25rem 2rem;
  text-align: center;
  animation: fadeInUp 0.4s ease;
}

.welcome-dialog-card .dialog-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.welcome-dialog-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.welcome-dialog-card p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.dialog-tips {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  text-align: left;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tip-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.45;
}

.tip-bullet {
  color: var(--primary-color);
  font-weight: 700;
}

.welcome-dialog-card .dialog-footer-text {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

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

