/* ==========================================================================
   STEM DETECTIVE AGENCY - STYLES
   ========================================================================== */

.stem-detective-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: #f8fafc;
}

/* Header & Banner */
.stem-header-banner {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.95), rgba(49, 46, 129, 0.9), rgba(15, 23, 42, 0.95));
  border: 2px solid rgba(99, 102, 241, 0.4);
  border-radius: 20px;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.stem-header-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.stem-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stem-agency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  width: fit-content;
}

.stem-main-title {
  font-family: 'Fredoka', cursive;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  text-shadow: 0 2px 10px rgba(99, 102, 241, 0.5);
}

.stem-main-desc {
  font-size: 0.95rem;
  color: #cbd5e1;
  margin: 0;
}

.stem-top-controls {
  display: flex;
  gap: 0.8rem;
}

.stem-notebook-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #0f172a;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  transition: all 0.2s ease;
}

.stem-notebook-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.stem-back-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-weight: 700;
  padding: 0.75rem 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stem-back-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #fff;
}

/* Case Selection Roster View */
.stem-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.stem-case-card {
  background: #1e293b;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.stem-case-card:hover {
  transform: translateY(-4px);
  border-color: #6366f1;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.25);
}

.stem-case-card.active-case {
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.stem-case-icon-box {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.stem-case-title {
  font-family: 'Fredoka', cursive;
  font-size: 1.35rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.stem-case-stem-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stem-topic-pill {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.stem-case-desc {
  font-size: 0.9rem;
  line-height: 1.45;
  color: #94a3b8;
  margin: 0;
  flex: 1;
}

.stem-case-start-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.stem-case-start-btn:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

/* Active Investigation Arena */
.stem-investigation-arena {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Investigation Progress Bar */
.stem-progress-bar-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stem-clue-stepper {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.stem-step-node {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  transition: all 0.2s ease;
}

.stem-step-node.completed {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #34d399;
}

.stem-step-node.current {
  background: rgba(99, 102, 241, 0.25);
  border-color: #6366f1;
  color: #fde047;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

/* Crime Scene Main Interactive Board */
.stem-scene-board {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.stem-scene-header {
  background: rgba(30, 41, 59, 0.9);
  padding: 0.8rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stem-scene-location {
  font-weight: 800;
  font-size: 1rem;
  color: #fde047;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stem-scene-content {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  justify-content: center;
}

/* Crime Scene Hotspots Grid */
.stem-hotspots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.stem-hotspot-card {
  background: #1e293b;
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stem-hotspot-card:hover {
  background: #312e81;
  border-color: #818cf8;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.stem-hotspot-card.inspected {
  border-style: solid;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.stem-hotspot-icon {
  font-size: 2.5rem;
}

.stem-hotspot-title {
  font-weight: 800;
  font-size: 1.1rem;
  color: #f8fafc;
}

.stem-hotspot-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

/* Science Experiment Interactive Bench */
.stem-experiment-bench {
  background: #1e1b4b;
  border: 2px solid #6366f1;
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stem-experiment-title {
  font-family: 'Fredoka', cursive;
  font-size: 1.4rem;
  color: #fde047;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.stem-experiment-tools-row {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1rem;
}

.stem-sample-flask {
  background: rgba(15, 23, 42, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  width: 150px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stem-sample-flask:hover {
  border-color: #38bdf8;
  transform: scale(1.04);
}

.stem-sample-flask.tested {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.15);
}

.stem-test-result-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #38bdf8;
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.5;
}

/* Suspect Deduction Logic Board */
.stem-deduction-board {
  background: #0f172a;
  border: 2px solid #f59e0b;
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stem-matrix-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.stem-matrix-table th {
  background: #1e293b;
  color: #fde047;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.75rem 0.5rem;
  border: 1px solid #334155;
  text-align: center;
}

.stem-matrix-table td {
  padding: 0.75rem 0.5rem;
  border: 1px solid #334155;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.stem-matrix-table tr:nth-child(even) {
  background: rgba(30, 41, 59, 0.5);
}

.stem-matrix-match {
  color: #22c55e;
  font-weight: 900;
  font-size: 1.1rem;
}

.stem-matrix-mismatch {
  color: #ef4444;
  font-weight: 900;
  font-size: 1.1rem;
}

.stem-suspect-pick-btn {
  background: linear-gradient(135deg, #4338ca, #6366f1);
  color: #fff;
  border: 1px solid #818cf8;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stem-suspect-pick-btn:hover {
  background: #f59e0b;
  color: #0f172a;
  border-color: #fbbf24;
}

/* Detective Notebook Modal / Drawer */
.stem-notebook-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 1rem;
}

.stem-notebook-dossier {
  background: #fef3c7;
  color: #451a03;
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  border-radius: 20px;
  border: 8px solid #78350f;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Space Grotesk', sans-serif;
}

.stem-notebook-header {
  background: #78350f;
  color: #fde68a;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stem-notebook-title {
  font-family: 'Fredoka', cursive;
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0;
}

.stem-notebook-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stem-notebook-section-title {
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #92400e;
  border-bottom: 2px solid #b45309;
  padding-bottom: 0.3rem;
  margin: 0;
}

.stem-evidence-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stem-evidence-item {
  background: rgba(255, 255, 255, 0.7);
  border-left: 4px solid #b45309;
  padding: 0.6rem 0.8rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.stem-evidence-item.red-herring {
  border-left-color: #dc2626;
  background: rgba(254, 226, 226, 0.8);
  color: #991b1b;
}

.stem-notebook-modal.hidden,
.stem-solved-modal.hidden {
  display: none !important;
}

/* Case Solved Victory Modal */
.stem-solved-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 20, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: 1rem;
}

.stem-solved-card {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  border: 3px solid #f59e0b;
  border-radius: 24px;
  padding: 2.5rem 2rem;
  max-width: 580px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 20px 60px rgba(245, 158, 11, 0.3);
}

.stem-badge-award {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, #fde047 0%, #d97706 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: 0 0 25px rgba(253, 224, 71, 0.6);
  animation: pulseBadge 2s infinite ease-in-out;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@media (max-width: 768px) {
  .stem-header-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .stem-top-controls {
    width: 100%;
    justify-content: space-between;
  }
}
