:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --color-primary: #3b82f6;
  --color-primary-light: #eff6ff;
  --color-success: #10b981;
  --color-success-light: #ecfdf5;
  --color-bone: #fef3c7;
  --color-muscle: #fee2e2;
  --color-eye: #e0e7ff;
  --color-ear: #fef08a;
  --accent-pink: #ec4899;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.35);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-family: 'Quicksand', 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

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

/* App Header & Top Navigation */
.app-header {
  background: #ffffff;
  border-bottom: 2px solid #eef2f6;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  z-index: 50;
  position: relative;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #60a5fa, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  box-shadow: 0 4px 10px rgba(168, 85, 247, 0.3);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-text h1 span.badge-jimena {
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  color: white;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  font-weight: 600;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Main Subject Tabs */
.subjects-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  background: #f1f5f9;
  color: #475569;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--color-primary);
  border-color: #bfdbfe;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.tab-btn .tab-badge-future {
  font-size: 0.65rem;
  background: #cbd5e1;
  color: #334155;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

/* User Progress & Score */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jimena-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid #e2e8f0;
}

.avatar-jimena {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fbcfe8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.profile-score {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
  color: #475569;
}

.btn-icon:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: scale(1.05);
}

/* Main Viewport Container */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Anatomy Layers Navigation Bar */
.layer-subnav {
  background: #ffffff;
  border-bottom: 1.5px solid #edf2f7;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  gap: 16px;
  flex-wrap: wrap;
}

.layer-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.layer-chip {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background: #f8fafc;
  color: #475569;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.layer-chip:hover {
  transform: translateY(-2px);
  background: #ffffff;
  border-color: #cbd5e1;
}

.layer-chip.active {
  background: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.layer-chip[data-layer="persona"].active {
  color: #0369a1;
  border-color: #0ea5e9;
  background: #f0f9ff;
}

.layer-chip[data-layer="huesos"].active {
  color: #b45309;
  border-color: #f59e0b;
  background: #fffbeb;
}

.layer-chip[data-layer="musculos_del"].active {
  color: #be123c;
  border-color: #f43f5e;
  background: #fff1f2;
}

.layer-chip[data-layer="musculos_tras"].active {
  color: #7c2d12;
  border-color: #ea580c;
  background: #fff7ed;
}

.layer-chip[data-layer="ojo"].active {
  color: #1d4ed8;
  border-color: #3b82f6;
  background: #eff6ff;
}

.layer-chip[data-layer="oido"].active {
  color: #047857;
  border-color: #10b981;
  background: #ecfdf5;
}

.layer-counter {
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-left: 2px;
}

/* Mode toggles & 3D Helpers */
.layer-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-toggle-group {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-full);
}

.mode-toggle-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-toggle-btn.active {
  background: #ffffff;
  color: #1e293b;
  box-shadow: var(--shadow-sm);
}

.btn-reset-layer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-layer:hover {
  background: #ffedd5;
  border-color: #fb923c;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.15);
}

/* 3D Stage & Interactive Canvas with High-Contrast Studio Gradient */
.stage-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  height: calc(100vh - 145px);
  background: radial-gradient(circle at 50% 38%, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%);
  overflow: hidden;
}

.stage-3d-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 10;
}

#three-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  touch-action: none;
}

/* Markers Layer */
#markers-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 25;
  pointer-events: none;
}

.instruction-mobile {
  display: none;
}

.instruction-desktop {
  display: inline;
}

/* SVG Line Overlay for connecting arrows */
#svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  pointer-events: none;
}

.pointer-line {
  stroke-dasharray: 4 2;
  stroke-width: 2.2;
  stroke: #94a3b8;
  opacity: 0.85;
  transition: stroke 0.3s, opacity 0.3s;
}

.pointer-line.highlight {
  stroke: #3b82f6;
  stroke-width: 3.2;
  stroke-dasharray: none;
  opacity: 1;
}

.pointer-line.success {
  stroke: #10b981;
  stroke-width: 2.8;
  stroke-dasharray: none;
  opacity: 1;
}

/* 3D Floating Camera Toolbar */
.camera-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-full);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
}

.cam-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: #f8fafc;
  color: #334155;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cam-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.cam-btn.active {
  background: #3b82f6;
  color: white;
}

.cam-divider {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
}

/* 3D Interactive Hotspot Markers */
.scene-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
  cursor: pointer;
  z-index: 25;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.scene-marker:hover {
  transform: translate(-50%, -50%) scale(1.3);
}

.scene-marker.solved {
  background: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.7);
}

.scene-marker.active {
  background: #f59e0b;
  transform: translate(-50%, -50%) scale(1.35);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
}

/* Side Panels for Interactive Labels & Inputs */
.label-panels-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
}

.side-panel {
  position: absolute;
  top: 15px;
  bottom: 80px;
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
}

.side-panel::-webkit-scrollbar {
  width: 5px;
}
.side-panel::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.panel-left {
  left: 20px;
}

.panel-right {
  right: 20px;
}

/* Study & Input Card */
.anatomy-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
  position: relative;
  cursor: pointer;
}

.anatomy-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.anatomy-card.focused {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), var(--shadow-md);
}

.anatomy-card.pulse-card {
  animation: pulseCardGlow 0.9s cubic-bezier(0.25, 1, 0.5, 1);
  border-color: #3b82f6;
}

@keyframes pulseCardGlow {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  40% { transform: scale(1.025); box-shadow: 0 0 0 7px rgba(59, 130, 246, 0.35); }
  100% { transform: scale(1); box-shadow: var(--shadow-md); }
}

.anatomy-card.success {
  border-color: #86efac;
  background: rgba(240, 253, 244, 0.95);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-badge-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.card-hint-btn {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.card-hint-btn:hover {
  opacity: 1;
}

.card-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-input {
  flex: 1;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #cbd5e1;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  outline: none;
  background: #ffffff;
  transition: all 0.2s ease;
}

.card-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.card-input.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: #f43f5e;
  background: #fff1f2;
}

.card-solved-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: #166534;
  font-size: 0.95rem;
  padding: 4px 0;
}

.card-solved-label .check-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  font-size: 12px;
}

.card-desc {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.35;
  border-top: 1px dashed #e2e8f0;
  padding-top: 5px;
}

.card-hint-text {
  font-size: 0.74rem;
  color: #d97706;
  margin-top: 4px;
  font-style: italic;
}

/* 3D Loading Spinner */
.model-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 80;
  transition: opacity 0.4s ease;
}

.model-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: #1e293b;
  margin-bottom: 6px;
}

.loading-subtext {
  font-size: 0.85rem;
  color: #64748b;
}

/* Shake Animation */
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Toast Message Notifications */
.toast-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.toast {
  background: #ffffff;
  border: 2px solid #10b981;
  color: #065f46;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.25);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes toastPop {
  0% { transform: scale(0.7) translateY(-20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* 3D Layer Instruction & Helper Pill */
.instruction-pill {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  padding: 6px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: #475569;
  z-index: 25;
  pointer-events: none;
}

.instruction-pill span.bold {
  font-weight: 700;
  color: #1e293b;
}

/* Celebration Modal (When all items in a layer are completed!) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.celebration-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(0.85);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .celebration-box {
  transform: scale(1);
}

.celebration-icon {
  font-size: 58px;
  margin-bottom: 12px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.celebration-box h2 {
  font-size: 1.6rem;
  color: #0f172a;
  margin-bottom: 8px;
}

.celebration-box p {
  color: #64748b;
  font-size: 0.95rem;
  margin-bottom: 24px;
  line-height: 1.4;
}

.btn-celebrate {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
  transition: transform 0.2s;
}

.btn-celebrate:hover {
  transform: scale(1.04);
}

/* Reset Modal Styles */
.reset-modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 480px;
  width: 92%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-overlay.active .reset-modal-box {
  transform: scale(1);
}

.reset-modal-header {
  text-align: center;
}

.reset-modal-icon {
  font-size: 38px;
  display: block;
  margin-bottom: 6px;
}

.reset-modal-header h3 {
  font-size: 1.3rem;
  color: #0f172a;
  margin-bottom: 4px;
}

.reset-modal-header p {
  font-size: 0.86rem;
  color: #64748b;
}

.reset-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.reset-opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.reset-opt-btn:hover {
  background: #fff7ed;
  border-color: #fb923c;
  transform: translateX(4px);
}

.reset-opt-btn.danger {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.reset-opt-btn.danger:hover {
  background: #ffe4e6;
  border-color: #f43f5e;
}

.reset-opt-btn .opt-icon {
  font-size: 20px;
}

.reset-opt-btn .opt-label {
  flex: 1;
}

.reset-opt-btn .opt-badge {
  font-size: 0.75rem;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.btn-cancel-reset {
  padding: 9px 18px;
  border-radius: var(--radius-full);
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  align-self: center;
}

.btn-cancel-reset:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* Other Subject Pages (Matemáticas, Lengua, Inglés) */
.subject-page {
  display: none;
  padding: 40px 24px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.subject-page.active {
  display: block;
}

.subject-hero {
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1.5px solid #dbeafe;
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  margin-bottom: 30px;
}

.subject-hero h2 {
  font-size: 1.8rem;
  color: #1e3a8a;
  margin-bottom: 8px;
}

.subject-hero p {
  color: #475569;
  font-size: 1rem;
}

.future-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.future-topic-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.future-topic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}

.future-topic-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.future-topic-card h3 {
  font-size: 1.15rem;
  color: #1e293b;
  margin-bottom: 8px;
}

.future-topic-card p {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 16px;
}

.future-status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Medals Trophy Room */
.medals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.medal-card {
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  opacity: 0.6;
  transition: all 0.3s;
}

.medal-card.unlocked {
  border: 2px solid #f59e0b;
  background: #fffbeb;
  opacity: 1;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.medal-icon {
  font-size: 46px;
  margin-bottom: 10px;
}

.medal-card h4 {
  font-size: 1rem;
  color: #1e293b;
  margin-bottom: 4px;
}

.medal-card p {
  font-size: 0.8rem;
  color: #64748b;
}

/* ==========================================================================
   Responsive Mobile & Tablet Optimization
   ========================================================================== */

/* Tablets / Medium Screens (iPad, surface, small laptops) */
@media (max-width: 1024px) {
  .side-panel {
    width: 250px;
    padding: 6px;
  }
  .panel-left {
    left: 10px;
  }
  .panel-right {
    right: 10px;
  }
}

/* Mobile Devices & Small Tablets (Portrait) */
@media (max-width: 860px) {
  /* Compact App Header */
  .app-header {
    padding: 8px 12px;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
  }
  .brand-logo {
    font-size: 20px;
  }
  .brand-text h1 {
    font-size: 1.02rem;
  }
  .brand-text p {
    display: none;
  }
  .subjects-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }
  .subjects-nav::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    padding: 5px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .tab-badge-future {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  .jimena-profile {
    padding: 4px 8px;
    gap: 5px;
  }
  .avatar-jimena {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }
  .profile-score {
    font-size: 0.78rem;
  }
  .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  /* Layer Subnav: Horizontal swipeable chips */
  .layer-subnav {
    padding: 6px 10px;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
  }
  .layer-chips {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .layer-chips::-webkit-scrollbar {
    display: none;
  }
  .layer-chip {
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .layer-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 6px;
  }
  .mode-toggle-group {
    padding: 2px;
  }
  .mode-toggle-btn {
    padding: 4px 8px;
    font-size: 0.74rem;
  }
  .btn-reset-layer {
    padding: 4px 9px;
    font-size: 0.74rem;
  }

  /* 3D Interactive Stage Split View */
  .stage-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 115px);
    height: calc(100vh - 115px); /* Fallback */
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f8fafc 60%, #e2e8f0 100%);
  }

  /* 3D Viewport on Top */
  .stage-3d-viewport {
    position: relative;
    width: 100%;
    height: 46vh;
    min-height: 250px;
    max-height: 400px;
    flex-shrink: 0;
    overflow: hidden;
  }

  /* Hide diagonal SVG lines on mobile so they don't clutter the screen */
  #svg-overlay {
    display: none !important;
  }

  /* Compact Camera Toolbar at bottom of 3D viewport */
  .camera-toolbar {
    bottom: 8px;
    padding: 3px 8px;
    gap: 4px;
    max-width: 95%;
    transform: translateX(-50%) scale(0.92);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  }
  .cam-btn {
    padding: 4px 8px;
    font-size: 0.74rem;
    gap: 4px;
  }
  .cam-divider {
    height: 14px;
  }

  /* Mobile Instruction Pill */
  .instruction-pill {
    top: 6px;
    padding: 3px 10px;
    font-size: 0.72rem;
    max-width: 94%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .instruction-desktop {
    display: none;
  }
  .instruction-mobile {
    display: inline;
  }

  /* 3D Markers: Touch-friendly targets */
  .scene-marker {
    width: 24px;
    height: 24px;
    font-size: 11px;
    font-weight: 800;
    border-width: 2.5px;
  }

  /* Bottom Cards Section */
  .label-panels-layer {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px 60px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
    pointer-events: auto;
    touch-action: pan-y;
  }

  /* Unwrap left and right side panels so cards flow in natural numerical order */
  .side-panel {
    display: contents;
    position: static;
    width: auto;
    padding: 0;
    overflow: visible;
  }

  /* Anatomy Cards on Mobile */
  .anatomy-card {
    width: 100%;
    padding: 10px 12px;
    margin: 0;
    border-radius: var(--radius-md);
  }
  .card-header {
    margin-bottom: 5px;
  }
  .card-badge-num {
    font-size: 0.75rem;
    padding: 2px 8px;
  }
  .card-input-row {
    gap: 6px;
  }
  .card-input {
    font-size: 16px !important; /* Strictly prevents iOS Safari auto-zoom */
    padding: 8px 12px;
    border-radius: var(--radius-sm);
  }
  .card-input-row .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
    flex-shrink: 0;
  }
  .card-solved-label {
    font-size: 0.95rem;
  }
  .card-desc {
    font-size: 0.8rem;
  }

  /* Responsive Dialogs & Modals */
  .celebration-box {
    width: 92%;
    max-width: 380px;
    padding: 24px 18px;
  }
  .celebration-icon {
    font-size: 46px;
  }
  .celebration-box h2 {
    font-size: 1.35rem;
  }
  .celebration-box p {
    font-size: 0.88rem;
    margin-bottom: 18px;
  }
  .btn-celebrate {
    padding: 10px 22px;
    font-size: 0.92rem;
  }

  .reset-modal-box {
    width: 92%;
    max-width: 400px;
    padding: 20px 14px;
    max-height: 85vh;
  }
  .reset-modal-icon {
    font-size: 32px;
  }
  .reset-modal-header h3 {
    font-size: 1.15rem;
  }
  .reset-modal-header p {
    font-size: 0.8rem;
  }
  .reset-options-list {
    max-height: 48vh;
    gap: 6px;
  }
  .reset-opt-btn {
    padding: 8px 10px;
    font-size: 0.84rem;
  }

  /* Future subjects & Medals mobile view */
  .subject-page {
    padding: 16px 12px;
  }
  .subject-hero {
    padding: 20px 14px;
    margin-bottom: 18px;
  }
  .subject-hero h2 {
    font-size: 1.35rem;
  }
  .future-cards-grid,
  .medals-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Mobile Landscape Orientation */
@media (max-width: 860px) and (orientation: landscape) {
  .stage-wrapper {
    flex-direction: row;
    height: calc(100vh - 80px);
  }
  .stage-3d-viewport {
    height: 100%;
    width: 54%;
    max-height: none;
  }
  .label-panels-layer {
    height: 100%;
    width: 46%;
    padding: 6px 10px 30px;
  }
  .camera-toolbar {
    bottom: 4px;
    transform: translateX(-50%) scale(0.85);
  }
  .layer-subnav {
    flex-direction: row;
    padding: 4px 8px;
  }
}
