* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #1E40AF;
  --secondary-color: #059669;
  --accent-color: #7C3AED;
  --bg-dark: #0F172A;
  --bg-light: #1E293B;
  --card-bg: #334155;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --border-color: #475569;
}

body {
  font-family: 'Inter', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  background: linear-gradient(135deg, #0F172A 0%, #1a1a2e 100%);
  color: var(--text-primary);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}

@supports (backdrop-filter: blur(10px)) {
  .navbar {
    backdrop-filter: blur(10px);
  }
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.5rem;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem;
}

.mobile-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.mobile-menu a:hover {
  color: var(--text-primary);
}

.section {
  padding: 80px 0;
}

.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 120px;
  position: relative;
  overflow: hidden;
}

.hero-content {
  text-align: center;
  z-index: 1;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, #94A3B8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 28px;
  border-radius: 30px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #2563EB);
  color: white;
  box-shadow: 0 4px 15px rgba(30, 64, 175, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.6);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  background: rgba(30, 64, 175, 0.1);
}

.hero-visual {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

.floating-icon {
  position: absolute;
  font-size: 3rem;
  animation: float 6s ease-in-out infinite;
}

.floating-icon:nth-child(1) { top: 20%; left: 10%; }
.floating-icon:nth-child(2) { top: 30%; right: 15%; animation-delay: 1s; }
.floating-icon:nth-child(3) { top: 60%; left: 20%; animation-delay: 2s; }
.floating-icon:nth-child(4) { top: 40%; right: 30%; animation-delay: 3s; }
.floating-icon:nth-child(5) { top: 70%; right: 10%; animation-delay: 4s; }

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, #fff 0%, #94A3B8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.feature-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  box-shadow: 0 10px 30px rgba(30, 64, 175, 0.2);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.code-section {
  background: var(--bg-light);
}

.code-editor-container {
  background: var(--bg-dark);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.editor-tabs {
  display: flex;
  background: var(--bg-light);
  padding: 0.5rem;
  gap: 0.5rem;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
}

.editor-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
}

.code-panel,
.preview-panel {
  padding: 1rem;
  border-right: 1px solid var(--border-color);
}

.preview-panel {
  border-right: none;
}

.code-textarea {
  width: 100%;
  height: 100%;
  min-height: 350px;
  background: #0D1117;
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  padding: 1rem;
  font-family: 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9rem;
  resize: none;
}

.code-textarea.hidden {
  display: none;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.run-btn {
  padding: 8px 16px;
  background: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.run-btn:hover {
  background: #047857;
}

.preview-frame {
  width: 100%;
  height: calc(100% - 40px);
  min-height: 310px;
  border: none;
  border-radius: 8px;
  background: white;
}

.games-grid,
.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.game-card,
.lab-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.game-card:hover,
.lab-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-color);
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.2);
}

.game-icon,
.lab-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.game-card h3,
.lab-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.game-card p,
.lab-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-light);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.sorting-game,
.maze-game,
.binary-game,
.physics-lab,
.circuit-lab,
.chemistry-lab {
  padding: 1.5rem;
}

.sorting-controls,
.maze-controls,
.physics-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.sorting-controls button,
.maze-controls button,
.physics-controls button {
  padding: 8px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sorting-controls button:hover,
.maze-controls button:hover,
.physics-controls button:hover {
  background: #1D4ED8;
}

.sorting-controls select {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.sorting-visualization {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 1rem;
}

.sorting-bar {
  width: 30px;
  background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
  border-radius: 4px 4px 0 0;
  transition: all 0.3s ease;
}

.sorting-bar.comparing {
  background: #F59E0B;
}

.sorting-bar.swapping {
  background: #EF4444;
}

.sorting-bar.sorted {
  background: var(--secondary-color);
}

.sorting-info {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  color: var(--text-secondary);
}

.maze-container {
  display: grid;
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 1rem;
  gap: 0;
}

.maze-cell {
  width: var(--cell-size, 25px);
  height: var(--cell-size, 25px);
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.maze-cell.wall {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.maze-cell.path {
  background: transparent;
}

.maze-cell.start {
  background: var(--secondary-color);
}

.maze-cell.end {
  background: #EF4444;
}

.maze-cell.player {
  background: #3B82F6;
}

.maze-cell.visited {
  background: rgba(59, 130, 246, 0.3);
}

.binary-question {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
}

.binary-input {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.binary-input input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.binary-input button {
  padding: 10px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.binary-feedback {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  text-align: center;
}

.binary-feedback.correct {
  background: rgba(5, 150, 105, 0.2);
  color: var(--secondary-color);
}

.binary-feedback.incorrect {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
}

.physics-canvas {
  width: 100%;
  height: 300px;
  background: var(--bg-dark);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.physics-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.physics-info {
  display: flex;
  gap: 2rem;
  color: var(--text-secondary);
}

.circuit-components {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
}

.circuit-component {
  cursor: pointer;
  padding: 0.5rem;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: var(--bg-dark);
}

.circuit-component:hover {
  border-color: var(--primary-color);
}

.circuit-component.selected {
  border-color: var(--secondary-color);
  background: rgba(5, 150, 105, 0.1);
}

.circuit-component .component-svg {
  width: 120px;
  height: 45px;
  display: block;
}

.circuit-canvas {
  position: relative;
  width: 100%;
  height: 350px;
  background: var(--bg-dark);
  background-image: 
    linear-gradient(rgba(71, 85, 105, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71, 85, 105, 0.3) 1px, transparent 1px);
  background-size: 20px 20px;
  border-radius: 8px;
  cursor: crosshair;
  border: 1px solid var(--border-color);
}

.circuit-canvas .placed-component {
  position: absolute;
  cursor: move;
}

.circuit-canvas .placed-component svg {
  width: 80px;
  height: 30px;
  display: block;
}

.periodic-table {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 4px;
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.element-cell {
  width: 100%;
  padding-bottom: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.3s ease;
  position: relative;
}

.element-cell::before {
  content: '';
  display: block;
  padding-bottom: 100%;
}

.element-cell > * {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.element-cell:hover {
  transform: scale(1.1);
  background: var(--primary-color);
}

.element-cell.hydrogen { background: #A78BFA; }
.element-cell.alkali { background: #FCA5A5; }
.element-cell.alkaline { background: #FCD34D; }
.element-cell.transition { background: #94A3B8; }
.element-cell.metalloid { background: #A3E635; }
.element-cell.nonmetal { background: #67E8F9; }
.element-cell.halogen { background: #F472B6; }
.element-cell.noble { background: #C4B5FD; }

.element-info {
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 1rem;
}

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

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.stat-icon {
  font-size: 2.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.chart-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
}

.chart-card h3 {
  margin-bottom: 1rem;
}

.path-section {
  background: var(--bg-light);
}

.learning-path-container {
  max-width: 800px;
  margin: 0 auto;
}

.path-step {
  display: flex;
  gap: 2rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 1rem;
  border-left: 4px solid var(--border-color);
  opacity: 0.5;
}

.path-step.active {
  border-left-color: var(--primary-color);
  opacity: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.step-content h3 {
  margin-bottom: 0.5rem;
}

.step-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.step-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 12px;
  background: var(--bg-dark);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.badge.completed {
  background: rgba(5, 150, 105, 0.2);
  color: var(--secondary-color);
}

.footer {
  background: var(--bg-dark);
  padding: 3rem 0;
  border-top: 1px solid var(--border-color);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-section a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .editor-panels {
    grid-template-columns: 1fr;
  }
  
  .code-panel,
  .preview-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .preview-panel {
    border-bottom: none;
  }
  
  .charts-container {
    grid-template-columns: 1fr;
  }
  
  .path-step {
    flex-direction: column;
  }
  
  .periodic-table {
    grid-template-columns: repeat(9, 1fr);
  }
  
  .features-grid,
  .games-grid,
  .lab-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .section-title {
    font-size: 1.75rem;
  }
  
  .floating-icon {
    font-size: 2rem;
  }
  
  .periodic-table {
    grid-template-columns: repeat(6, 1fr);
  }
}
