/* ==========================================================================
   ZAYN SCIENCE LAB - DESIGN SYSTEM & COMPONENT STYLES
   ========================================================================== */

/* Science Lab Main Container */
.science-lab-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: #f8fafc;
}

/* Science Lab Header Banner */
.science-header-banner {
  background: linear-gradient(135deg, #09203f 0%, #1e3c72 50%, #0f172a 100%);
  border: 2px solid #38bdf8;
  border-radius: 24px;
  padding: 1.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.25), 0 0 20px rgba(56, 189, 248, 0.15);
  position: relative;
  overflow: hidden;
}

.science-header-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.science-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 1;
}

.science-agency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  width: fit-content;
}

.science-main-title {
  font-family: var(--font-game);
  font-size: 2.2rem;
  color: #fff;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.science-main-desc {
  color: #cbd5e1;
  font-size: 0.95rem;
  max-width: 580px;
  line-height: 1.5;
}

/* Science HUD Stats Row */
.science-stats-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 1;
}

.science-stat-badge {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #fde047;
  font-weight: 700;
}

.science-journal-quick-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a;
  border: none;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.75rem 1.4rem;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b45309, 0 0 15px rgba(245, 158, 11, 0.4);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.science-journal-quick-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #b45309, 0 0 20px rgba(245, 158, 11, 0.6);
}

.science-journal-quick-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b45309;
}

/* Science World Cards Grid */
.science-worlds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.science-world-card {
  background: rgba(23, 31, 56, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.science-world-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.3);
}

.science-world-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.science-world-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.science-world-title {
  font-family: var(--font-game);
  font-size: 1.35rem;
  color: #fff;
}

.science-world-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
}

.science-world-desc {
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}

.science-world-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.science-topic-pill {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.science-enter-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid #38bdf8;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.7rem;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.science-world-card:hover .science-enter-btn {
  background: #0284c7;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

/* ==========================================================================
   INTERACTIVE LAB WORKBENCH STYLES
   ========================================================================== */
.science-workbench {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 24px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

.science-workbench-title-box {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.science-workbench-title {
  font-family: var(--font-game);
  font-size: 1.6rem;
  color: #fde047;
}

.science-workbench-subtitle {
  color: #94a3b8;
  font-size: 0.9rem;
}

.science-back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.science-back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

/* --------------------------------------------------------------------------
   1. STATES OF MATTER LAB
   -------------------------------------------------------------------------- */
.matter-stage-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
}

@media (max-width: 850px) {
  .matter-stage-layout {
    grid-template-columns: 1fr;
  }
}

.matter-canvas-container {
  background: #020617;
  border: 2px solid #1e293b;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

#matter-particle-canvas {
  width: 100%;
  height: 100%;
  max-width: 600px;
  max-height: 360px;
}

.matter-controls-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.matter-temp-card {
  background: #1e293b;
  border: 2px solid #475569;
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-align: center;
}

.matter-temp-gauge {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: #38bdf8;
  text-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.matter-slider {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #38bdf8 0%, #3b82f6 30%, #f59e0b 70%, #ef4444 100%);
  outline: none;
  cursor: pointer;
}

.matter-state-badge {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #fde047;
  border-radius: 10px;
  padding: 0.5rem;
  color: #fde047;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
}

.matter-explanation-box {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 1rem;
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   2. SKELETON BUILDER LAB
   -------------------------------------------------------------------------- */
.skeleton-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.25rem;
}

@media (max-width: 850px) {
  .skeleton-layout {
    grid-template-columns: 1fr;
  }
}

.skeleton-silhouette-stage {
  background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #090d16 100%);
  border: 2px solid #6366f1;
  border-radius: 18px;
  min-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#skeleton-canvas {
  width: 100%;
  height: 100%;
  max-width: 500px;
  max-height: 440px;
}

.skeleton-inventory-panel {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 18px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.skeleton-bones-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.bone-token-btn {
  background: #0f172a;
  border: 2px solid #475569;
  border-radius: 12px;
  padding: 0.6rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #f8fafc;
}

.bone-token-btn:hover {
  border-color: #fde047;
  transform: scale(1.04);
}

.bone-token-btn.selected {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.bone-token-btn.placed {
  opacity: 0.4;
  pointer-events: none;
  border-color: #10b981;
}

.bone-token-icon {
  font-size: 1.5rem;
}

.bone-token-name {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

/* --------------------------------------------------------------------------
   3. ELEMENT LAB & ATOM VIEWER
   -------------------------------------------------------------------------- */
.element-lab-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.element-filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  overflow-x: auto;
  padding-bottom: 4px;
}

.elem-cat-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.elem-cat-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.periodic-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 0.5rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 16px;
}

.elem-tile {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 10px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.elem-tile:hover {
  transform: scale(1.08);
  border-color: #38bdf8;
  z-index: 2;
}

.elem-tile.selected {
  border-color: #fde047;
  background: rgba(253, 224, 71, 0.2);
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.4);
}

.elem-tile-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #94a3b8;
  align-self: flex-start;
}

.elem-tile-sym {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.elem-tile-name {
  font-size: 0.65rem;
  color: #cbd5e1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Atom Detail Inspector & Canvas */
.atom-inspector-box {
  background: #1e293b;
  border: 2px solid #38bdf8;
  border-radius: 20px;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 768px) {
  .atom-inspector-box {
    grid-template-columns: 1fr;
  }
}

.atom-canvas-wrap {
  width: 100%;
  height: 260px;
  background: #020617;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid #334155;
}

#atom-viewer-canvas {
  width: 260px;
  height: 260px;
}

.atom-info-details {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.atom-info-title {
  font-family: var(--font-game);
  font-size: 1.6rem;
  color: #fde047;
}

.atom-particles-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.atom-part-badge {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #38bdf8;
  font-weight: 700;
}

/* ==========================================================================
   SCIENCE JOURNAL MODAL
   ========================================================================== */
.science-journal-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1400;
  padding: 1.5rem;
}

.science-journal-dossier {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 3px solid #f59e0b;
  border-radius: 24px;
  max-width: 880px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.3);
  overflow: hidden;
}

.science-journal-header {
  background: #1e1b4b;
  padding: 1.25rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #f59e0b;
}

.science-journal-title {
  font-family: var(--font-game);
  font-size: 1.5rem;
  color: #fde047;
}

.science-journal-body {
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.science-journal-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.journal-tab-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  cursor: pointer;
}

.journal-tab-btn.active {
  background: #f59e0b;
  border-color: #fde047;
  color: #0f172a;
}

.journal-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.journal-entry-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.journal-entry-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.journal-entry-icon {
  font-size: 1.6rem;
}

.journal-entry-name {
  font-family: var(--font-game);
  font-size: 1.1rem;
  color: #fde047;
}

.journal-entry-def {
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.journal-entry-why {
  font-size: 0.8rem;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.4rem;
}

/* ==========================================================================
   DISCOVERY POPUP ALERT MODAL
   ========================================================================== */
.science-discovery-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: 1rem;
}

.science-discovery-card {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  border: 3px solid #38bdf8;
  border-radius: 24px;
  padding: 2.25rem 2rem;
  max-width: 520px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 20px 60px rgba(56, 189, 248, 0.3);
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.discovery-badge-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle, #38bdf8 0%, #0284c7 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.6);
}

/* ==========================================================================
   MOBILE RESPONSIVE STYLES FOR SCIENCE LAB
   ========================================================================== */
@media (max-width: 768px) {
  .science-lab-container {
    padding: 0.75rem 0.6rem 5rem;
    gap: 1rem;
  }

  .science-header-banner {
    flex-direction: column;
    padding: 1.25rem 1rem;
    gap: 1rem;
    text-align: center;
  }

  .science-agency-badge {
    align-self: center;
  }

  .science-main-title {
    font-size: 1.6rem;
  }

  .science-main-desc {
    font-size: 0.85rem;
  }

  .science-stats-row {
    justify-content: center;
    width: 100%;
  }

  .science-stat-badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
  }

  .science-journal-quick-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
  }

  .science-worlds-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .science-world-card {
    padding: 1.1rem;
  }

  .science-workbench {
    padding: 1rem;
  }

  .science-workbench-title {
    font-size: 1.3rem;
  }

  .matter-canvas-container {
    min-height: auto;
    max-height: 220px;
  }

  #matter-particle-canvas {
    max-height: 220px;
    height: auto;
  }

  .skeleton-silhouette-stage {
    min-height: auto;
    max-height: 280px;
  }

  #skeleton-canvas {
    max-height: 280px;
    height: auto;
  }

  .atom-inspector-box {
    grid-template-columns: 1fr;
    padding: 0.8rem;
  }

  .atom-canvas-wrap {
    height: 200px;
  }

  #atom-viewer-canvas {
    width: 200px;
    height: 200px;
  }
}
