/* =============================================================================
   Wie-geht-es-weiter-Checker - Stylesheet
   Recycled 2.5D Diorama Visual Engine from Vorfahrts-Checker
   ============================================================================= */

: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);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#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);
}

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

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

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

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

.btn-back-app:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateX(-2px);
}

.debug-btn {
  display: none; /* Endanwender-Sicht: Debug-Button ausgeblendet */
  background: #0F172A;
  color: #38BDF8;
  border: 1px solid #334155;
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.debug-btn:hover {
  background: #1E293B;
  color: white;
}

.debug-box {
  background: #0F172A;
  color: #F8FAFC;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: monospace;
  box-shadow: var(--shadow-md);
}

.active-vehicle-badge {
  background: rgba(1, 171, 168, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(1, 171, 168, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.active-vehicle-badge:hover {
  background: rgba(1, 171, 168, 0.2);
}

/* Lang selector */
.lang-selector {
  display: flex;
  gap: 0.25rem;
}

.lang-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.lang-btn.active, .lang-btn:hover {
  opacity: 1;
  border-color: var(--primary-color);
}

.flag-icon {
  width: 20px;
  height: 14px;
  display: block;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  justify-content: space-around;
  background: var(--card-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-value.highlight-best {
  color: var(--primary-color);
}

/* 2.5D Diorama Stage Container (16:9 Aspect Ratio) */
.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;
}

/* Success Star Overlay */
.success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(16, 185, 129, 0.28);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeInOverlay 0.25s ease-out;
}

.success-star-icon {
  font-size: 4.5rem;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.3));
  animation: popStar 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-text {
  font-size: 1.8rem;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  margin-top: 0.25rem;
  letter-spacing: 0.5px;
}

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

@keyframes popStar {
  0% { transform: scale(0.2); opacity: 0; }
  70% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.diorama-board {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  perspective: 1000px;
}

.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;
  z-index: 1;
}

/* Quadrant Scenery Decorations */
.layer-decor {
  position: absolute;
  width: 50.21%;
  height: 50%;
  object-fit: fill;
  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; }
.layer-decor.quadrant-rightdown { left: 49.79%; top: 50%; z-index: 12; }

/* 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-user {
  left: 50.8%;
  top: 65.5%;
  width: 9.9%;
  height: 33.3%;
  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));
}

/* User Label Arrow Tag */
.user-label-tag {
  position: absolute;
  bottom: 102%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color);
  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(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;
}

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

/* Signposts and Poles */
.diorama-pole-container {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  aspect-ratio: 357 / 992;
}

.diorama-pole-container.pos-opposite {
  left: 40.20%;
  top: 33.24%;
  width: 3.5%;
  z-index: 4;
}

/* West Sign Pole Position (shifted westwards onto the West road curb) */
.diorama-pole-container.pos-left {
  left: 28.0%;
  top: 39.0%;
  width: 4.2%;
  z-index: 6;
  transform: translate(-50%, -100%) rotateY(25deg);
}

/* East Sign Pole Position (shifted lower and eastwards onto the East road curb) */
.diorama-pole-container.pos-right {
  left: 72.0%;
  top: 65.0%;
  width: 4.2%;
  z-index: 6;
  transform: translate(-50%, -100%) rotateY(-25deg);
}

.diorama-pole-container.pos-user {
  left: 60.65%;
  top: 67%;
  width: 5.0%;
  z-index: 14;
}

.diorama-pole-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 75%;
  height: 100%;
  object-fit: fill;
  display: block;
  z-index: 1;
}

/* Sign 222 Container (Placed directly on Concrete Divider, without pole.webp) */
.diorama-sign222-container {
  position: absolute;
  pointer-events: none;
  z-index: 10;
}

.diorama-sign222-container.pos-222-north {
  left: 25.2%;
  top: 32.0%;
  width: 3.5%;
  transform: translate(-50%, -50%);
}

.diorama-sign222-container.pos-222-west {
  left: 35.0%;
  top: 49.0%;
  width: 4.5%;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.diorama-sign222-container.pos-222-east {
  left: 60.0%;
  top: 49.0%;
  width: 3.8%;
  transform: translate(-50%, -50%) rotate(90deg);
}

.diorama-signs-wrapper {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 2;
}

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

.diorama-sign-img.mirrored-sign {
  transform: scaleX(-1);
}

/* Rule Reminder Banner */
.rule-reminder-banner {
  background: #EFF6FF;
  border-left: 4px solid var(--primary-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: #1E3A8A;
}

/* Decision Action Controls */
.actions-container {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.action-btn {
  flex: 1;
  padding: 1rem 0.5rem;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  box-shadow: var(--shadow-sm);
}

.action-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

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

.btn-straight { background: linear-gradient(135deg, #01ABA8, #018D8A); }
.btn-left { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.btn-right { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }

/* Feedback Box (Used only on Incorrect answers) */
.feedback-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--color-danger);
  display: none;
  animation: slideUp 0.3s ease;
}

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

.feedback-header {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-danger);
}

.feedback-body {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.btn-next {
  width: 100%;
  padding: 0.8rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

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

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  text-align: center;
}

.modal-card h2 {
  font-size: 1.6rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.modal-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.vehicle-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.vehicle-card {
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.vehicle-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  background: rgba(1, 171, 168, 0.04);
}

.vehicle-card.selected {
  border-color: var(--primary-color);
  background: rgba(1, 171, 168, 0.1);
  box-shadow: 0 0 0 3px rgba(1, 171, 168, 0.2);
}

.vehicle-icon { font-size: 2.2rem; }
.vehicle-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
}
.vehicle-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 600px) {
  .sim-header {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
  }
  .header-title {
    width: 100%;
  }
  .header-title h1 {
    font-size: 1.1rem;
  }
  .header-title p {
    font-size: 0.75rem !important;
  }
  .header-controls {
    width: 100%;
    justify-content: space-between;
  }
  .vehicle-options-grid { grid-template-columns: 1fr; }
  .actions-container { flex-direction: column; }
}
