/* styles.css - CyberChem Lab: Modern Scientific Tech Theme */

:root {
  /* THEME COLORS BASED ON USER'S LOGO */
  --brand-cyan: #00d2ff;
  --brand-cyan-lip: #009ecc;
  --brand-purple: #8a2be2;
  --brand-purple-lip: #6819b5;
  --brand-gradient: linear-gradient(135deg, #00d2ff 0%, #7928ca 50%, #8a2be2 100%);
  --brand-gradient-hover: linear-gradient(135deg, #26dcff 0%, #8a36dc 50%, #9b3df5 100%);

  /* ACCENT COLORS */
  --color-primary: #00d2ff;
  --color-primary-lip: #009ecc;
  --color-secondary: #8a2be2;
  --color-secondary-lip: #6819b5;
  --color-streak: #ff9600;
  --color-streak-lip: #cd7900;
  --color-danger: #ff4b4b;
  --color-danger-lip: #ea2b2b;
  --color-success: #00e676;
  --color-success-lip: #00b050;
  --color-warning: #ffc800;
  --color-warning-lip: #e7a601;

  /* NEUTRALS */
  --color-snow: #ffffff;
  --color-polar: #f8fafc;
  --color-swan: #e2e8f0;
  --color-hare: #94a3b8;
  --color-wolf: #64748b;
  --color-eel: #1e293b;
  --color-manta-ray: #0f172a;

  /* Periodic Table Categories */
  --cat-alkali: #ff4b4b;
  --cat-alkali-lip: #ea2b2b;
  --cat-alkaline: #ffc800;
  --cat-alkaline-lip: #e7a601;
  --cat-transition: #00d2ff;
  --cat-transition-lip: #009ecc;
  --cat-post-transition: #3b82f6;
  --cat-post-transition-lip: #2563eb;
  --cat-metalloid: #8a2be2;
  --cat-metalloid-lip: #6819b5;
  --cat-nonmetal: #00e676;
  --cat-nonmetal-lip: #00b050;
  --cat-noble: #f43f5e;
  --cat-noble-lip: #e11d48;
  --cat-lanthanide: #06b6d4;
  --cat-lanthanide-lip: #0891b2;
  --cat-actinide: #ec4899;
  --cat-actinide-lip: #db2777;

  --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-polar);
  color: var(--color-eel);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* GRADIENT TEXT */
.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 3D TACTILE BUTTONS */
.duo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-radius: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
  transition: filter 0.15s ease, transform 0.08s ease, box-shadow 0.08s ease;
  position: relative;
  text-decoration: none;
}

.duo-btn:hover {
  filter: brightness(1.06);
}

.duo-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 transparent !important;
}

/* Button Variants */
.duo-btn-primary {
  background: var(--brand-gradient);
  color: var(--color-snow);
  box-shadow: 0 4px 0 var(--brand-purple-lip);
}

.duo-btn-cyan {
  background-color: var(--brand-cyan);
  color: #032b38;
  box-shadow: 0 4px 0 var(--brand-cyan-lip);
}

.duo-btn-purple {
  background-color: var(--brand-purple);
  color: var(--color-snow);
  box-shadow: 0 4px 0 var(--brand-purple-lip);
}

.duo-btn-white {
  background-color: var(--color-snow);
  color: var(--brand-purple);
  border-color: var(--color-swan);
  box-shadow: 0 4px 0 var(--color-swan);
}

.duo-btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 12px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15);
}
.duo-btn-sm:active {
  transform: translateY(3px);
}

/* TOP NAVBAR */
.topbar {
  background-color: var(--color-snow);
  border-bottom: 2px solid var(--color-swan);
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  box-shadow: 0 4px 16px rgba(0, 210, 255, 0.06);
}

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

.brand-logo-img {
  height: 44px;
  width: 44px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(138, 43, 226, 0.2);
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--color-manta-ray);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.brand-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--brand-purple);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-radius: 16px;
  background: transparent;
  color: var(--color-wolf);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab-btn:hover {
  background: var(--color-polar);
  color: var(--color-eel);
}

.nav-tab-btn.active {
  background: rgba(0, 210, 255, 0.1);
  color: var(--brand-purple);
  border-color: var(--brand-purple);
  box-shadow: 0 3px 0 var(--brand-purple-lip);
}

/* User Stats Widgets */
.user-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-polar);
  border: 2px solid var(--color-swan);
  font-weight: 800;
  font-size: 14px;
}

.stat-pill.streak { color: var(--color-streak); }
.stat-pill.xp { color: var(--brand-purple); }
.stat-pill.sound { cursor: pointer; color: var(--color-wolf); }
.stat-pill.sound:hover { border-color: var(--brand-cyan); color: var(--brand-cyan); }

/* MAIN CONTAINER */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.view-section {
  display: none;
}

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

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

/* =========================================================
   PHÂN HỆ 1: PHÒNG THÍ NGHIỆM HÓA HỌC (CHEM LAB)
   ========================================================= */
.lab-container {
  display: grid;
  grid-template-columns: 360px 1fr 340px;
  gap: 20px;
  height: calc(100vh - 120px);
  min-height: 680px;
}

/* Cột Trái: Kệ Dụng Cụ & Hóa Chất */
.shelf-panel {
  background: var(--color-snow);
  border: 2px solid var(--color-swan);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 0 var(--color-swan);
}

.shelf-header {
  padding: 16px;
  border-bottom: 2px solid var(--color-swan);
  background: var(--color-polar);
}

.omni-search-box {
  position: relative;
  margin-bottom: 12px;
}

.omni-search-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-eel);
  background: var(--color-snow);
  border: 2px solid var(--color-swan);
  border-bottom-width: 3px;
  border-radius: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.omni-search-input:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.2);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-hare);
  font-size: 16px;
  pointer-events: none;
}

.shelf-subtabs {
  display: flex;
  gap: 8px;
}

.subtab-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--color-swan);
  border-bottom-width: 3px;
  background: var(--color-snow);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 800;
  color: var(--color-wolf);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.subtab-btn.active {
  background: var(--brand-purple);
  color: var(--color-snow);
  border-color: var(--brand-purple-lip);
}

.shelf-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

/* Lưới các ô vuông chất & dụng cụ */
.shelf-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
  padding: 2px 2px 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Ô VUÔNG CHẤT / DỤNG CỤ (HIỆU ỨNG NHƯ BẢNG TUẦN HOÀN - CÂN ĐỐI 1:1) */
.chem-square-tile {
  min-width: 0 !important;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  background: var(--color-snow);
  border: 2px solid var(--color-swan);
  border-bottom: 3.5px solid var(--color-swan);
  border-radius: 14px;
  padding: 6px 4px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: grab;
  position: relative;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, border-color 0.18s ease, z-index 0.1s ease;
  user-select: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

/* Hiệu ứng phóng to Scale Zoom Hover giống Bảng tuần hoàn */
.chem-square-tile:hover {
  transform: scale(1.18) translateY(-3px);
  z-index: 80;
  box-shadow: 0 8px 20px rgba(0, 210, 255, 0.3);
  border-color: var(--brand-cyan);
  border-bottom-color: var(--brand-cyan-lip);
  background: #ffffff;
}

.chem-square-tile:active {
  cursor: grabbing;
  transform: scale(1.08);
}

.chem-square-tile.is-dragging {
  opacity: 0.45;
  transform: scale(0.92);
}

/* Phần trên: Hình ảnh chất nằm ở trung tâm cân đối */
.chem-tile-visual {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 0;
  margin: 0;
}

.chem-tile-visual svg,
svg.equip-svg,
.equip-svg {
  width: 28px !important;
  height: 28px !important;
  max-width: 30px !important;
  max-height: 30px !important;
  object-fit: contain;
  display: block;
  margin: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
  transition: transform 0.18s ease;
}

.chem-square-tile:hover .chem-tile-visual svg {
  transform: scale(1.15);
}

/* Phần dưới: Công thức hóa học cân đối */
.chem-tile-formula {
  font-family: 'Nunito', monospace, sans-serif;
  font-size: 13px;
  font-weight: 900;
  color: var(--color-eel);
  line-height: 1.1;
  text-align: center;
  margin: 0;
  padding-bottom: 2px;
  pointer-events: none;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

/* Phân loại viền màu theo nhóm chất */
.chem-square-tile.cat-acid {
  border-color: rgba(255, 75, 75, 0.4);
  border-bottom-color: var(--color-danger-lip);
}
.chem-square-tile.cat-acid:hover {
  border-color: var(--color-danger);
  box-shadow: 0 10px 24px rgba(255, 75, 75, 0.35);
}
.chem-square-tile.cat-acid .chem-tile-formula {
  color: #dc2626;
}

.chem-square-tile.cat-base {
  border-color: rgba(28, 176, 246, 0.4);
  border-bottom-color: var(--brand-cyan-lip);
}
.chem-square-tile.cat-base:hover {
  border-color: var(--brand-cyan);
  box-shadow: 0 10px 24px rgba(0, 210, 255, 0.35);
}
.chem-square-tile.cat-base .chem-tile-formula {
  color: #0284c7;
}

.chem-square-tile.cat-salt {
  border-color: rgba(255, 150, 0, 0.4);
  border-bottom-color: var(--color-warning-lip);
}
.chem-square-tile.cat-salt:hover {
  border-color: var(--color-streak);
  box-shadow: 0 10px 24px rgba(255, 150, 0, 0.35);
}
.chem-square-tile.cat-salt .chem-tile-formula {
  color: #d97706;
}

.chem-square-tile.cat-metal {
  border-color: rgba(100, 116, 139, 0.4);
  border-bottom-color: var(--color-wolf);
}
.chem-square-tile.cat-metal:hover {
  border-color: var(--brand-purple);
  box-shadow: 0 10px 24px rgba(138, 43, 226, 0.35);
}
.chem-square-tile.cat-metal .chem-tile-formula {
  color: var(--brand-purple);
}

.chem-square-tile.cat-indicator {
  border-color: rgba(138, 43, 226, 0.4);
  border-bottom-color: var(--brand-purple-lip);
}
.chem-square-tile.cat-indicator:hover {
  border-color: var(--brand-purple);
  box-shadow: 0 10px 24px rgba(138, 43, 226, 0.35);
}
.chem-square-tile.cat-indicator .chem-tile-formula {
  color: var(--brand-purple);
}

.chem-square-tile.cat-solvent {
  border-color: rgba(0, 230, 118, 0.4);
  border-bottom-color: var(--color-success-lip);
}
.chem-square-tile.cat-solvent:hover {
  border-color: var(--color-success);
  box-shadow: 0 10px 24px rgba(0, 230, 118, 0.35);
}
.chem-square-tile.cat-solvent .chem-tile-formula {
  color: #059669;
}

.chem-square-tile.cat-nonmetal {
  border-color: rgba(234, 179, 8, 0.4);
  border-bottom-color: #ca8a04;
}
.chem-square-tile.cat-nonmetal:hover {
  border-color: #eab308;
  box-shadow: 0 10px 24px rgba(234, 179, 8, 0.35);
}
.chem-square-tile.cat-nonmetal .chem-tile-formula {
  color: #ca8a04;
}

.chem-square-tile.cat-oxide {
  border-color: rgba(71, 85, 105, 0.4);
  border-bottom-color: #334155;
}
.chem-square-tile.cat-oxide:hover {
  border-color: #475569;
  box-shadow: 0 10px 24px rgba(71, 85, 105, 0.35);
}
.chem-square-tile.cat-oxide .chem-tile-formula {
  color: #334155;
}

.chem-square-tile.cat-organic {
  border-color: rgba(13, 148, 136, 0.4);
  border-bottom-color: #0f766e;
}
.chem-square-tile.cat-organic:hover {
  border-color: #0d9488;
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.35);
}
.chem-square-tile.cat-organic .chem-tile-formula {
  color: #0f766e;
}

/* =========================================================
   Cột Giữa: Bàn Thí Nghiệm (Lab Bench Workspace)
   ========================================================= */
.bench-panel {
  background: var(--color-snow);
  border: 2px solid var(--color-swan);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--color-swan);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.bench-header {
  padding: 14px 20px;
  border-bottom: 2px solid var(--color-swan);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-polar);
}

.bench-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bench-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--color-eel);
}

.bench-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-wolf);
}

.bench-actions {
  display: flex;
  gap: 8px;
}

/* Workspace Canvas */
.bench-canvas {
  flex: 1;
  position: relative;
  background: radial-gradient(#cbd5e1 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  background-color: #f8fafc;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 60px;
  overflow: hidden;
}

/* Mặt bàn công nghệ hiện đại */
.bench-tabletop {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55px;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border-top: 4px solid var(--brand-cyan);
  box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bench-tabletop::after {
  content: "BÀN THÍ NGHIỆM THÔNG MINH CHEMSPACE";
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.35);
}

/* Glassware Containers trên bàn thí nghiệm */
.active-vessels-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 40px;
  z-index: 10;
  min-height: 280px;
  width: 100%;
}

/* KHU VỰC THÍ NGHIỆM TRỐNG (EMPTY BENCH DROPZONE) */
.empty-bench-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2.5px dashed rgba(0, 210, 255, 0.5);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(4px);
  border-radius: 24px;
  padding: 36px 32px;
  max-width: 520px;
  margin: 0 auto 30px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(0, 210, 255, 0.08);
  cursor: pointer;
}

.empty-bench-dropzone.drag-hover-active {
  border-color: var(--brand-purple);
  background: rgba(138, 43, 226, 0.1);
  transform: scale(1.04);
  box-shadow: 0 0 28px rgba(138, 43, 226, 0.35);
}

.dropzone-icon {
  font-size: 52px;
  margin-bottom: 12px;
  animation: floatIcon 2.5s infinite alternate ease-in-out;
}

@keyframes floatIcon {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.empty-bench-dropzone h3 {
  font-size: 20px;
  font-weight: 900;
  color: var(--color-eel);
  margin-bottom: 6px;
}

.empty-bench-dropzone p {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-wolf);
  line-height: 1.45;
  max-width: 420px;
}

/* Vessel Container */
.vessel-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.vessel-wrapper.hover-pour-ready {
  transform: scale(1.08);
  filter: drop-shadow(0 0 16px rgba(0, 210, 255, 0.85));
}

/* Nút đổ vào nổi lên khi kéo hóa chất gần đến */
.pour-overlay-btn-wrapper {
  position: absolute;
  top: -46px;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.85);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vessel-wrapper.hover-pour-ready .pour-overlay-btn-wrapper,
.vessel-wrapper:hover .pour-overlay-btn-wrapper {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.pour-action-btn {
  white-space: nowrap;
  animation: bouncePulse 0.9s infinite alternate ease-in-out;
  box-shadow: 0 4px 16px rgba(0, 210, 255, 0.6), 0 3px 0 var(--brand-purple-lip) !important;
}

@keyframes bouncePulse {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

/* Dòng chảy chất lỏng khi đổ vào */
.pouring-stream {
  position: absolute;
  top: -30px;
  width: 5px;
  height: 40px;
  border-radius: 3px;
  z-index: 28;
  animation: pourDown 0.6s ease;
}

@keyframes pourDown {
  0% { height: 0; opacity: 1; }
  60% { height: 40px; opacity: 1; }
  100% { height: 40px; opacity: 0; }
}

/* Container chứa các thỏi kim loại / chất rắn ở đáy bình */
.vessel-solids-container {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  z-index: 15;
  pointer-events: none;
  padding: 0 4px;
}

.solid-ingot, .solid-pebble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  animation: settleInPlace 0.3s ease-out;
  position: relative;
}

.solid-ingot svg {
  max-width: 32px;
  height: 16px;
  transition: transform 0.2s ease;
}

.solid-pebble svg {
  max-width: 22px;
  height: 15px;
  transition: transform 0.2s ease;
}

/* HIỆU ỨNG THỎI KIM LOẠI / CHẤT RẮN TAN DẦN TRONG PHẢN ỨNG HÓA HỌC */
@keyframes dissolveShrink {
  0% {
    transform: scale(1) translateY(0);
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  }
  15% {
    transform: scale(0.88, 0.9) translateY(1px);
    opacity: 0.96;
    filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.75)) brightness(1.2);
  }
  35% {
    transform: scale(0.7, 0.75) translateY(2px);
    opacity: 0.92;
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.9)) brightness(1.25);
  }
  60% {
    transform: scale(0.48, 0.52) translateY(3px);
    opacity: 0.85;
    filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.7));
  }
  80% {
    transform: scale(0.25, 0.3) translateY(4px);
    opacity: 0.6;
    filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.5));
  }
  95% {
    transform: scale(0.08, 0.1) translateY(5px);
    opacity: 0.3;
  }
  100% {
    transform: scale(0) translateY(6px);
    opacity: 0;
  }
}

.solid-ingot.is-dissolving,
.solid-pebble.is-dissolving {
  animation: dissolveShrink 5.5s cubic-bezier(0.25, 0.9, 0.35, 1) forwards !important;
  transform-origin: bottom center;
  pointer-events: none;
}

/* Lớp bọt khí sủi bùng lên ngay trên bề mặt thỏi kim loại đang tan */
.solid-dissolve-foam {
  position: absolute;
  top: -16px;
  left: -8px;
  right: -8px;
  bottom: -4px;
  pointer-events: none;
  z-index: 22;
}

.micro-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, rgba(255, 255, 255, 0.8) 60%, rgba(186, 230, 253, 0.5) 100%);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  animation: microBubblePop 0.55s infinite ease-out;
}

.micro-bubble.mb1 { left: 8%; bottom: 3px; width: 4px; height: 4px; animation-delay: 0s; }
.micro-bubble.mb2 { left: 24%; bottom: 5px; width: 5px; height: 5px; animation-delay: 0.1s; }
.micro-bubble.mb3 { left: 42%; bottom: 3px; width: 6px; height: 6px; animation-delay: 0.22s; }
.micro-bubble.mb4 { left: 58%; bottom: 6px; width: 4px; height: 4px; animation-delay: 0.08s; }
.micro-bubble.mb5 { left: 74%; bottom: 4px; width: 5px; height: 5px; animation-delay: 0.18s; }
.micro-bubble.mb6 { left: 88%; bottom: 3px; width: 4px; height: 4px; animation-delay: 0.3s; }
.micro-bubble.mb7 { left: 34%; bottom: 8px; width: 5px; height: 5px; animation-delay: 0.38s; }
.micro-bubble.mb8 { left: 66%; bottom: 7px; width: 4px; height: 4px; animation-delay: 0.14s; }

@keyframes microBubblePop {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  35% { opacity: 0.95; }
  100% { transform: translateY(-22px) scale(1.2); opacity: 0; }
}

@keyframes settleInPlace {
  0% { transform: scale(1.15) translateY(-6px); }
  60% { transform: scale(0.95) translateY(1px); }
  100% { transform: scale(1) translateY(0); }
}

/* Thỏi kim loại rơi từ trên miệng bình xuống đáy */
.falling-solid-item {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  pointer-events: none;
  animation: fallIntoVessel 0.45s cubic-bezier(0.5, 0, 0.8, 0.4) forwards;
}

@keyframes fallIntoVessel {
  0% {
    top: 5px;
    transform: translateX(-50%) rotate(0deg) scale(0.9);
    opacity: 1;
  }
  65% {
    top: 60%;
    transform: translateX(-50%) rotate(18deg) scale(1);
    opacity: 1;
  }
  100% {
    top: 86%;
    transform: translateX(-50%) rotate(0deg) scale(1);
    opacity: 0;
  }
}

.vessel-label-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.vessel-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-eel);
  background: var(--color-snow);
  padding: 4px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--color-swan);
  box-shadow: 0 2px 0 var(--color-swan);
}

.vessel-wrapper.selected .vessel-label {
  border-color: var(--brand-purple);
  color: var(--brand-purple);
  box-shadow: 0 2px 0 var(--brand-purple-lip);
}

/* Huy hiệu nhiệt độ điện tử trên từng bình */
.vessel-temp-badge {
  font-family: 'Nunito', monospace, sans-serif;
  font-size: 12px;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  cursor: default;
}

/* Mức nhiệt mát (<= 35°C) */
.vessel-temp-badge.temp-cool {
  background: #f0fdf4;
  color: #15803d;
  border: 1.5px solid #bbf7d0;
  box-shadow: 0 2px 0 #bbf7d0;
}

/* Mức nhiệt ấm (36°C - 65°C) */
.vessel-temp-badge.temp-warm {
  background: #fff7ed;
  color: #c2410c;
  border: 1.5px solid #fed7aa;
  box-shadow: 0 2px 0 #fed7aa;
}

/* Mức nhiệt nóng (66°C - 99°C) */
.vessel-temp-badge.temp-hot {
  background: #fef2f2;
  color: #b91c1c;
  border: 1.5px solid #fca5a5;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  animation: heatPulse 1s infinite alternate ease-in-out;
}

/* Mức nhiệt sôi / nung nóng (>= 100°C) */
.vessel-temp-badge.temp-boiling {
  background: #450a0a;
  color: #fef08a;
  border: 1.5px solid #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.85);
  animation: heatPulse 0.45s infinite alternate ease-in-out;
}

@keyframes heatPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

/* Hơi nước bốc lên khi sôi (>= 100°C) */
.steam-vapor-container {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 38;
}

.steam-puff {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  filter: blur(5px);
  animation: riseSteam 1.5s infinite ease-out;
}

.steam-puff:nth-child(1) { left: 8px; width: 16px; height: 16px; animation-delay: 0s; }
.steam-puff:nth-child(2) { left: 20px; width: 20px; height: 20px; animation-delay: 0.45s; }
.steam-puff:nth-child(3) { left: 14px; width: 24px; height: 24px; animation-delay: 0.9s; }

@keyframes riseSteam {
  0% { transform: translateY(0) scale(0.6); opacity: 0.85; }
  50% { opacity: 0.5; }
  100% { transform: translateY(-48px) scale(1.6); opacity: 0; }
}

/* Nhiệt kế giám sát tổng quan bàn thí nghiệm */
.bench-temp-gauge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 2px solid var(--color-swan);
  border-radius: 12px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--color-eel);
  box-shadow: 0 2px 0 var(--color-swan);
  user-select: none;
  transition: all 0.25s ease;
}
.bench-temp-gauge.heating {
  background: #fff7ed;
  border-color: #fb923c;
  color: #c2410c;
  box-shadow: 0 2px 0 #fb923c;
}

/* Nút xóa bỏ dụng cụ khỏi bàn */
.vessel-remove-btn {
  position: absolute;
  top: -6px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-danger);
  color: #fff;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  z-index: 30;
}
.vessel-remove-btn:hover {
  transform: scale(1.25);
  background: #d80000;
}

.glass-vessel {
  position: relative;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.glass-vessel:hover {
  filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.6));
}


/* Ống nghiệm kính */
.glass-test-tube {
  width: 44px;
  height: 180px;
  border: 3px solid rgba(0, 210, 255, 0.45);
  border-top: none;
  border-radius: 0 0 22px 22px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 2px 0 5px rgba(255, 255, 255, 0.9), inset -2px 0 5px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.glass-test-tube::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  right: -4px;
  height: 8px;
  background: rgba(0, 210, 255, 0.5);
  border-radius: 4px;
}

/* Cốc Beaker kính */
.glass-beaker {
  width: 120px;
  height: 160px;
  border: 3px solid rgba(0, 210, 255, 0.45);
  border-top: none;
  border-radius: 0 0 16px 16px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 2px 0 6px rgba(255, 255, 255, 0.9), inset -2px 0 6px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Bình tam giác Erlenmeyer kính */
.glass-erlenmeyer {
  width: 130px;
  height: 170px;
  border: 3px solid rgba(0, 210, 255, 0.45);
  border-top: none;
  border-radius: 0 0 16px 16px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 2px 0 6px rgba(255, 255, 255, 0.9), inset -2px 0 6px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  clip-path: polygon(36% 0%, 64% 0%, 64% 22%, 98% 88%, 90% 100%, 10% 100%, 2% 88%, 36% 22%);
}

/* Thang đo ml trên bình */
.vessel-ticks {
  position: absolute;
  top: 15px;
  left: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: none;
  z-index: 5;
}
.tick {
  width: 10px;
  height: 1.5px;
  background: var(--color-hare);
}

/* Chất lỏng */
.liquid-body {
  width: 100%;
  background: rgba(0, 210, 255, 0.4);
  height: 0%;
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 2.8s ease;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.liquid-meniscus {
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 8px;
  border-radius: 50%;
  background: inherit;
  filter: brightness(1.15);
  opacity: 0.85;
}

/* Bọt khí sủi bọt cuồn cuộn & sôi động */
.gas-bubbles-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  overflow: hidden;
  pointer-events: none;
}

.bubble {
  position: absolute;
  bottom: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6) 60%, rgba(200, 240, 255, 0.4) 100%);
  border-radius: 50%;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
  animation: bubbleRiseWobble 1.1s infinite linear;
}

/* Khí NO2 màu nâu đỏ đặc trưng */
.bubble.bubble-no2 {
  background: radial-gradient(circle at 30% 30%, rgba(251, 146, 60, 0.95), rgba(234, 88, 12, 0.75) 60%, rgba(180, 83, 9, 0.5) 100%);
  box-shadow: 0 0 5px rgba(234, 88, 12, 0.6);
}

@keyframes bubbleRiseWobble {
  0% {
    transform: translateY(0) translateX(0) scale(0.6);
    opacity: 0;
  }
  20% {
    transform: translateY(-25px) translateX(-2px) scale(0.85);
    opacity: 0.95;
  }
  50% {
    transform: translateY(-70px) translateX(2px) scale(1);
    opacity: 0.9;
  }
  80% {
    transform: translateY(-115px) translateX(-1px) scale(1.1);
    opacity: 0.85;
  }
  100% {
    transform: translateY(-155px) translateX(2px) scale(1.2);
    opacity: 0;
  }
}

/* Khói khí NO2 bốc lên ngùn ngụt ở miệng ống nghiệm */
.no2-vapor-cloud {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 32px;
  pointer-events: none;
  display: none;
  z-index: 24;
}

.no2-vapor-cloud.active {
  display: block;
}

.no2-puff {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 88, 12, 0.78) 0%, rgba(194, 65, 12, 0.5) 55%, transparent 75%);
  filter: blur(3px);
  animation: no2FumeRise 1.8s infinite ease-out;
}

.no2-puff.p1 { left: 4px; width: 18px; height: 18px; animation-delay: 0s; }
.no2-puff.p2 { left: 16px; width: 22px; height: 22px; animation-delay: 0.55s; }
.no2-puff.p3 { left: 10px; width: 20px; height: 20px; animation-delay: 1.15s; }

@keyframes no2FumeRise {
  0% { transform: translateY(0) scale(0.7); opacity: 0; }
  35% { opacity: 0.85; }
  100% { transform: translateY(-50px) scale(1.9); opacity: 0; }
}

/* Lớp kết tủa lắng xuống đáy */
.precipitate-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 18px;
  background: #00d2ff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.5s ease, transform 2s cubic-bezier(0.2, 0.8, 0.4, 1), height 1.5s ease;
  border-radius: 0 0 16px 16px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.precipitate-layer.active {
  opacity: 0.95;
  transform: translateY(0);
}

/* Đèn cồn & Ngọn lửa */
.burner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease;
}
.burner-wrapper:hover {
  transform: scale(1.05);
}

.burner-flame {
  width: 24px;
  height: 38px;
  background: radial-gradient(circle, #00d2ff 20%, #8a2be2 70%, transparent 100%);
  border-radius: 50% 50% 20% 20% / 70% 70% 30% 30%;
  animation: flicker 0.12s infinite alternate ease-in-out;
  transform-origin: bottom center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.burner-flame.active {
  opacity: 1;
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-1deg); }
  100% { transform: scale(1.1, 0.95) rotate(1deg); }
}

.burner-body {
  width: 60px;
  height: 50px;
  background: var(--color-swan);
  border: 2px solid var(--color-eel);
  border-radius: 12px 12px 6px 6px;
  box-shadow: 0 3px 0 var(--color-hare);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--color-wolf);
}

/* Giấy quỳ tím */
.litmus-tester-strip {
  width: 18px;
  height: 90px;
  border-radius: 4px;
  background: #a7a0ff;
  border: 2px solid #6f4ea1;
  position: absolute;
  top: 40px;
  right: 40px;
  cursor: grab;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  transition: background 0.3s ease;
  z-index: 20;
}

.litmus-tip {
  width: 100%;
  height: 30px;
  border-radius: 0 0 2px 2px;
  background: inherit;
  transition: background 0.3s ease;
}

/* Assistant Card */
.lab-mascot-card {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--color-snow);
  border: 2px solid var(--brand-purple);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.15);
  max-width: 340px;
  z-index: 20;
}

.mascot-avatar-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.mascot-speech-bubble {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-eel);
  line-height: 1.35;
}

/* =========================================================
   Cột Phải: Bảng Nhật Ký Phản Ứng & XP
   ========================================================= */
.log-panel {
  background: var(--color-snow);
  border: 2px solid var(--color-swan);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--color-swan);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-header {
  padding: 16px;
  border-bottom: 2px solid var(--color-swan);
  background: var(--color-polar);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.log-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--color-eel);
}

.log-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reaction-card {
  background: var(--color-polar);
  border: 2px solid var(--color-swan);
  border-left: 6px solid var(--brand-cyan);
  border-radius: 14px;
  padding: 12px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.reaction-card.new {
  border-left-color: var(--brand-purple);
  background: #fbf8ff;
}

.reaction-equation {
  font-family: 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--brand-purple);
  margin-bottom: 4px;
}

.reaction-equation sub,
.mascot-speech-bubble sub,
.chem-equation sub {
  font-size: 0.74em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
  bottom: -0.25em;
  font-weight: 700;
}

.chem-equation {
  font-family: 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--brand-purple);
  display: inline-block;
  line-height: 1.4;
}

.mascot-speech-bubble .chem-equation {
  font-family: 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
  padding: 1px 7px;
  border-radius: 6px;
  margin: 0 2px;
  border: 1px solid rgba(124, 58, 237, 0.15);
}

.reaction-desc {
  font-size: 12px;
  color: var(--color-wolf);
  line-height: 1.4;
}

.reaction-xp-gain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-cyan-lip);
  margin-top: 6px;
}

/* Empty Log State */
.empty-log {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--color-wolf);
}

.empty-log-icon {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.6;
}

/* =========================================================
   PHÂN HỆ 2: BẢNG TUẦN HOÀN 118 NGUYÊN TỐ (PERIODIC TABLE)
   ========================================================= */
.periodic-container {
  background: var(--color-snow);
  border: 2px solid var(--color-swan);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--color-swan);
  padding: 24px;
}

.periodic-top-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--color-swan);
}

.legend-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  border: 2px solid var(--color-swan);
  background: var(--color-snow);
  transition: all 0.15s ease;
}

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

.legend-tag.active {
  border-color: var(--brand-purple);
  color: var(--brand-purple);
  box-shadow: 0 2px 0 var(--brand-purple);
}

/* Bảng lưới 18 cột x 7 hàng */
.periodic-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  grid-template-rows: repeat(10, auto);
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
}

/* Ô Nguyên Tố (Element Tile) */
.element-tile {
  aspect-ratio: 1 / 1.15;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, z-index 0.1s ease;
  color: var(--color-snow);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

/* Phóng to khi trỏ chuột vào (Scale Zoom Hover) */
.element-tile:hover {
  transform: scale(1.38);
  z-index: 100;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  border-color: #ffffff;
}

.element-tile:active {
  transform: scale(1.28);
}

.el-atomic-number {
  font-size: 10px;
  font-weight: 800;
  align-self: flex-start;
  opacity: 0.9;
}

.el-symbol {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.el-name-vi {
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Category Colors */
.element-tile.alkali-metal { background-color: var(--cat-alkali); border-color: var(--cat-alkali-lip); }
.element-tile.alkaline-earth { background-color: var(--cat-alkaline); border-color: var(--cat-alkaline-lip); color: #443000; }
.element-tile.transition-metal { background-color: var(--cat-transition); border-color: var(--cat-transition-lip); color: #032b38; }
.element-tile.post-transition { background-color: var(--cat-post-transition); border-color: var(--cat-post-transition-lip); }
.element-tile.metalloid { background-color: var(--cat-metalloid); border-color: var(--cat-metalloid-lip); }
.element-tile.reactive-nonmetal { background-color: var(--cat-nonmetal); border-color: var(--cat-nonmetal-lip); color: #023315; }
.element-tile.noble-gas { background-color: var(--cat-noble); border-color: var(--cat-noble-lip); }
.element-tile.lanthanide { background-color: var(--cat-lanthanide); border-color: var(--cat-lanthanide-lip); }
.element-tile.actinide { background-color: var(--cat-actinide); border-color: var(--cat-actinide-lip); }

/* Mờ khi bị bộ lọc loại trừ */
.element-tile.dimmed {
  opacity: 0.18;
  filter: grayscale(0.8);
  pointer-events: none;
}

/* Spacer cho hàng Lanthanide và Actinide */
.grid-gap-row {
  grid-column: 1 / -1;
  height: 16px;
}

/* =========================================================
   MODAL CHI TIẾT NGUYÊN TỐ (ELEMENT DETAIL MODAL)
   ========================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.duo-modal-card {
  width: 90%;
  max-width: 580px;
  background: var(--color-snow);
  border: 3px solid var(--brand-purple);
  border-bottom: 6px solid var(--brand-purple-lip);
  border-radius: 28px;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .duo-modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--color-swan);
  position: relative;
  background: #fbf8ff;
}

.modal-header-hero {
  display: flex;
  align-items: center;
  gap: 20px;
}

.modal-big-symbol {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-snow);
  font-weight: 900;
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.2);
}

.modal-big-symbol span:first-child { font-size: 13px; opacity: 0.9; }
.modal-big-symbol span:last-child { font-size: 34px; line-height: 1; }

.modal-title-text h2 {
  font-size: 26px;
  font-weight: 900;
  color: var(--color-eel);
  line-height: 1.1;
}

.modal-title-text h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-purple);
}

.modal-close-btn {
  background: var(--color-polar);
  border: 2px solid var(--color-swan);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-wolf);
  font-weight: 900;
}
.modal-close-btn:hover { background: var(--color-swan); color: var(--color-eel); }

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-props-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.prop-box {
  background: var(--color-polar);
  border: 2px solid var(--color-swan);
  border-radius: 14px;
  padding: 10px 14px;
}

.prop-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-wolf);
  text-transform: uppercase;
}

.prop-val {
  font-size: 15px;
  font-weight: 900;
  color: var(--color-eel);
}

.fun-fact-card {
  background: #fbf8ff;
  border: 2px solid #e9d5ff;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.fun-fact-icon {
  font-size: 24px;
  line-height: 1;
}

.fun-fact-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-purple);
  line-height: 1.4;
}

/* =========================================================
   RESPONSIVE DESIGN
   ========================================================= */
@media (max-width: 1150px) {
  .lab-container {
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto auto;
    height: auto;
  }
  .log-panel {
    grid-column: 1 / -1;
    height: 300px;
  }
}

@media (max-width: 820px) {
  .lab-container {
    grid-template-columns: 1fr;
  }
  .shelf-panel {
    height: 380px;
  }
  .topbar {
    padding: 10px 16px;
  }
  .nav-tab-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
}
