/* ==========================================================================
   Simulador de rotondas DGT y laboratorio de atascos fantasma
   Estilos canónicos para fijate.com/tools/simulador-trafico-rotondas/
   ========================================================================== */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores tema claro */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-text: #ffffff;

  --accent-red: #ef4444;
  --accent-red-light: #fef2f2;
  --accent-blue: #3b82f6;
  --accent-blue-light: #eff6ff;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131b2a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #334155;
  --border-color: #1e293b;
  --border-focus: #60a5fa;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-text: #ffffff;

  --accent-red: #f87171;
  --accent-red-light: rgba(239, 68, 68, 0.15);
  --accent-blue: #60a5fa;
  --accent-blue-light: rgba(59, 130, 246, 0.15);
  --accent-amber: #fbbf24;
  --accent-green: #34d399;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.5);
}

/* Reseteo canónico seguro */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mono {
  font-family: var(--font-mono);
}

/* Layout acotado */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjeta principal */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

/* Conmutador de modo (tabs) */
.mode-tabs-wrapper {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.75rem;
  border: 1px solid var(--border-color);
}

.mode-tab {
  flex: 1 1 0%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.mode-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Secciones de simulación */
.simulation-view {
  display: none;
}

.simulation-view.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

.view-intro {
  margin-bottom: 1.5rem;
}

.view-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-main);
}

.view-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ================= GRID DE ROTONDAS ================= */
.roundabout-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

.canvas-container {
  position: relative;
  background: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
}

.canvas-container-3d {
  min-height: 440px;
}

.three-viewport {
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  position: relative;
  outline: none;
  cursor: grab;
}

.three-viewport:active {
  cursor: grabbing;
}

.canvas-toolbar-3d {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.camera-btn-group {
  display: inline-flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: auto;
}

.btn-cam {
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cam:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.btn-cam.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-cam-reset {
  padding: 0 8px;
}

.badge-3d-indicator {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  letter-spacing: 0.02em;
}

.canvas-overlay-badges {
  position: absolute;
  bottom: 50px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  z-index: 5;
}

.badge-lane {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  color: #fff;
  letter-spacing: 0.02em;
  width: fit-content;
}

.badge-lane-outer {
  background: rgba(59, 130, 246, 0.85);
  backdrop-filter: blur(4px);
}

.badge-lane-inner {
  background: rgba(168, 85, 247, 0.85);
  backdrop-filter: blur(4px);
}

.canvas-legend {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-around;
  font-size: 0.75rem;
  color: #f1f5f9;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-car-a { background: #38bdf8; }
.dot-car-b { background: #f87171; }
.dot-collision { background: #eab308; box-shadow: 0 0 6px #eab308; }

/* Controles de rotondas */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.scenario-selector-box {
  background: var(--bg-surface);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.control-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 42px;
  padding: 0 2.25rem 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.car-settings-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.car-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.car-card-a { border-left: 4px solid #38bdf8; }
.car-card-b { border-left: 4px solid #f87171; }

.car-card-title {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}

.car-badge-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.car-pill-blue { background: rgba(56, 189, 248, 0.2); color: #0284c7; }
.car-pill-red { background: rgba(248, 113, 113, 0.2); color: #dc2626; }
[data-theme="dark"] .car-pill-blue { color: #38bdf8; }
[data-theme="dark"] .car-pill-red { color: #f87171; }

.car-inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.input-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

/* Control de línea temporal interactiva */
.timeline-control-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 9999px;
}

.form-range {
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: var(--bg-surface-hover);
  outline: none;
  cursor: pointer;
  appearance: none;
}

.form-range::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.playback-speed-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.speed-btn-group {
  display: inline-flex;
  gap: 4px;
}

.btn-speed {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-speed:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.btn-speed.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  font-weight: 700;
}

/* Botones de acción */
.simulation-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-primary, .btn-secondary, .btn-danger {
  height: 44px;
  min-height: 44px;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  flex: 2 1 0%;
  background: var(--primary);
  color: var(--primary-text);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-surface-hover);
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Veredicto jurídico / CIDE */
.verdict-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  transition: all 0.25s ease;
}

.verdict-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.verdict-icon {
  font-size: 1.3rem;
}

.verdict-heading {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.verdict-body p {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 0.85rem 0;
}

.cide-verdict-tag {
  background: var(--accent-red-light);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cide-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.cide-guilty-text {
  font-size: 0.95rem;
  color: #dc2626;
  font-weight: 700;
}
[data-theme="dark"] .cide-guilty-text {
  color: #f87171;
}

/* Reglas de oro DGT */
.dgt-rules-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.rules-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--text-main);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.rule-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
}

.rule-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

.rule-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.35rem 0;
  color: var(--text-main);
}

.rule-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* ================= ATASCOS FANTASMA ================= */
.phantom-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.phantom-canvas-wrap {
  position: relative;
  background: #0d131f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

#phantom-canvas {
  width: 100%;
  height: 360px;
  display: block;
}

.phantom-overlay-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 1.25rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-value {
  font-size: 1.05rem;
  color: #ffffff;
}

.flow-status {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
}

.status-smooth { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-congested { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.status-jammed { background: rgba(239, 68, 68, 0.25); color: #f87171; }

.phantom-controls-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.phantom-action-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.btn-brake-trigger {
  flex: 2 1 240px;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.35);
  animation: pulseBrake 2s infinite;
}

@keyframes pulseBrake {
  0%, 100% { box-shadow: 0 0 10px rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 22px rgba(220, 38, 38, 0.65); }
}

.sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.slider-control {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-header label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.slider-val {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.form-range {
  width: 100%;
  height: 6px;
  background: var(--bg-surface-hover);
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
}

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

.shockwave-info-box h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  color: var(--text-main);
}

.shockwave-info-box p {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}

/* ================= FAQ ACCORDION ================= */
.tool-faq-section {
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}

.faq-section-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-item[open] {
  border-color: var(--border-focus);
}

.faq-question {
  padding: 1rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-muted);
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 1.25rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.faq-answer p {
  margin: 0;
}

/* ================= MODAL ACCESIBLE ================= */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.app-modal-backdrop.active {
  display: flex;
  animation: modalFadeIn 0.2s ease-out;
}

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

.app-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.app-modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-modal-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.app-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.app-modal-body {
  padding: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.app-modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* ================= RESPONSIVO MOBILE ================= */
@media (max-width: 900px) {
  .roundabout-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .tool-layout {
    margin: 1rem auto 2rem;
    padding: 0 0.75rem;
  }

  .card-main {
    padding: 1rem;
  }

  .mode-tabs-wrapper {
    flex-direction: column;
    gap: 0.25rem;
  }

  .mode-tab {
    width: 100%;
  }

  .simulation-actions {
    flex-direction: column;
  }

  .btn-primary, .btn-secondary, .btn-danger {
    width: 100%;
    min-height: 44px;
  }

  .phantom-action-bar {
    flex-direction: column;
  }

  .phantom-overlay-panel {
    top: 8px;
    right: 8px;
    left: 8px;
    justify-content: space-around;
  }

  #phantom-canvas {
    height: 300px;
  }
}

@media (max-width: 520px) {
  .canvas-container-3d {
    min-height: 380px;
  }

  .badge-3d-indicator {
    display: none;
  }

  .canvas-toolbar-3d {
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .camera-btn-group {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .btn-cam {
    height: 36px;
    padding: 0 10px;
    justify-content: center;
    flex: 1 1 0%;
  }

  .btn-cam span {
    display: none;
  }

  .canvas-overlay-badges {
    bottom: 54px;
    left: 8px;
  }

  .canvas-legend {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 6px 8px;
    font-size: 0.7rem;
  }
}
