/* ===================================
   芯启信息 IoT 官网 - 设计系统
   Design System for Xinqi IoT
   Style: Minimalist Modern (极简现代)
   Primary Color: Tech Blue (#0080FF)
   =================================== */

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
  /* === Brand Colors (品牌色) === */
  --color-primary: #0080FF;
  --color-primary-dark: #0066CC;
  --color-primary-light: #E6F2FF;
  --color-primary-50: #E6F2FF;
  --color-primary-100: #CCE5FF;
  --color-primary-200: #99CCFF;
  
  /* === Neutral Colors (中性色) === */
  --color-white: #FFFFFF;
  --color-gray-50: #FAFAFA;
  --color-gray-100: #F5F5F5;
  --color-gray-200: #EEEEEE;
  --color-gray-300: #E0E0E0;
  --color-gray-400: #BDBDBD;
  --color-gray-500: #9E9E9E;
  --color-gray-600: #757575;
  --color-gray-700: #616161;
  --color-gray-800: #424242;
  --color-gray-900: #212121;
  --color-black: #000000;

  /* === Semantic Colors (语义色) === */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #06B6D4;

  /* === Typography (字体) === */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* === Font Size Scale (字体大小阶梯) === */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */
  --text-6xl: 3.75rem;     /* 60px */

  /* === Font Weight (字重) === */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* === Line Height (行高) === */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* === Spacing Scale (间距系统) === */
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-8: 2rem;       /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-32: 8rem;      /* 128px */

  /* === Border Radius (圆角) === */
  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* === Shadows (阴影) === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* === Transitions (过渡动画) === */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* === Z-index Scale (层级) === */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-tooltip: 600;

  /* === Layout (布局) === */
  --container-max: 1200px;
  --container-padding: var(--space-6);
  --header-height: 80px;
}

/* ---- Base Reset & Global Styles ---- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height, 80px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-relaxed);
  color: var(--color-gray-800);
  background-color: var(--color-white);
  overflow-x: hidden;
}

/* ---- Typography System ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--color-gray-900);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-4);
  color: var(--color-gray-600);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ---- Utility Classes ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.section {
  padding-top: var(--space-20);
  padding-bottom: var(--space-20);
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-16);
}

.section-label {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--color-gray-900);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-gray-600);
  line-height: var(--leading-relaxed);
}

/* ---- Button System ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

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

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-2px);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* ---- Grid System ---- */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 { grid-template-columns: 1fr; }
}

/* ---- Card Component ---- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-gray-200);
  padding: var(--space-8);
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary-200);
}

/* ---- Animation Keyframes ---- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes countUp {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
  opacity: 0;
}

/* Staggered animation delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* ---- Scroll Reveal (Intersection Observer) ---- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive Typography ---- */
@media (max-width: 768px) {
  :root {
    --text-5xl: 2.25rem;
    --text-4xl: 1.875rem;
    --text-3xl: 1.5rem;
  }

  /* Full-width safety: ensure container and sections don't shrink */
  .container {
    width: 100%;
    max-width: 100%;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .section {
    width: 100%;
    max-width: 100vw;
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }

  .section-header {
    margin-bottom: var(--space-12);
  }
}

@media (max-width: 480px) {
  :root {
    --text-5xl: 1.875rem;
    --text-4xl: 1.5rem;
    --text-3xl: 1.25rem;
  }

  :root {
    --space-6: var(--space-4);
  }
}

/* ===== Cooperation Models Section ===== */
.cooperation-section {
  background: var(--color-background);
}

.cooperation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.cooperation-card {
  background: var(--color-card-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.cooperation-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-200));
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.cooperation-card:hover::before {
  transform: scaleX(1);
}

.cooperation-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary);
}

.cooperation-number {
  font-size: var(--text-5xl);
  font-weight: 800;
  color: var(--color-primary);
  opacity: 0.15;
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  line-height: 1;
}

.cooperation-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  position: relative;
}

.cooperation-subtitle {
  font-size: 14px;
  color: #1E40AF;
  font-weight: 700;
  margin-bottom: var(--space-4);
  letter-spacing: 0.01em;
}

.cooperation-desc {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-6);
}

.cooperation-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.cooperation-feature {
  display: inline-block;
  padding: 6px 16px;
  background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
  color: #FFFFFF;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.18);
  transition: all 0.25s ease;
}

.cooperation-card:hover .cooperation-feature {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

/* ===== Advantages Section ===== */
.advantages-section {
  background: linear-gradient(180deg, var(--color-background-alt) 0%, var(--color-background) 100%);
}

.advantages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-12);
}

.advantage-card {
  background: var(--color-card-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all 0.3s ease;
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
}

.advantage-card:hover {
  transform: translateX(8px) translateY(-2px);
  border-color: var(--color-primary);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(37, 99, 235, 0.1);
}

.advantage-icon {
  width: 60px;
  height: 60px;
  min-width: 60px;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 50%, #1E40AF 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.3),
    0 2px 4px rgba(37, 99, 235, 0.15);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.advantage-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.advantage-card:hover .advantage-icon {
  transform: scale(1.1) translateY(-2px);
  box-shadow:
    0 8px 24px rgba(37, 99, 235, 0.4),
    0 4px 8px rgba(37, 99, 235, 0.2),
    0 0 20px rgba(37, 99, 235, 0.1);
}

.advantage-icon svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.advantage-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.advantage-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ===== Team Section ===== */
.team-section {
  background: var(--color-background);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-12);
}

.team-card {
  background: var(--color-card-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  text-align: center;
  transition: all 0.4s ease;
}

.team-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary);
}

.team-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-6);
  background: linear-gradient(135deg, var(--color-primary-200), rgba(0,128,255,0.05));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.team-icon svg {
  width: 32px;
  height: 32px;
}

.team-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
}

.team-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.7;
  text-align: left;
}

/* ===== Dark Theme Overrides for New Sections ===== */
[data-theme="dark"] .cooperation-card,
[data-theme="dark"] .advantage-card,
[data-theme="dark"] .team-card {
  background: var(--color-card-background);
  border-color: var(--color-border);
}

[data-theme="dark"] .cooperation-card:hover,
[data-theme="dark"] .advantage-card:hover,
[data-theme="dark"] .team-card:hover {
  border-color: var(--color-primary);
}

/* ===== Cooperation Section: Mobile Optimization ===== */
@media (max-width: 768px) {
  .cooperation-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    margin-top: var(--space-8);
  }

  /* Two-column grid layout: number | content */
  .cooperation-card {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 0 var(--space-5);
    padding: var(--space-5) var(--space-6);
    align-items: start;
  }

  /* Number: left column, vertical line separator */
  .cooperation-number {
    position: relative;
    top: auto;
    right: auto;
    font-size: 1.4rem;
    opacity: 0.18;
    grid-row: 1 / 4;
    text-align: center;
    padding-top: 2px;
    border-right: 2.5px solid #bfdbfe;
    align-self: stretch;
    display: flex;
    align-items: flex-start;
    padding-top: 3px;
  }

  /* Content column: title, subtitle, features stack vertically */
  .cooperation-title {
    font-size: 1.08rem;
    margin-bottom: 2px;
    line-height: 1.35;
  }

  .cooperation-subtitle {
    font-size: 12px;
    color: #1E40AF;
    margin-bottom: var(--space-3);
    line-height: 1.45;
  }

  .cooperation-desc {
    display: none; /* Hide long description on mobile */
  }

  /* Features: tag row, top-aligned with content */
  .cooperation-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .cooperation-feature {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 14px;
  }

  /* Remove hover transform on touch devices */
  .cooperation-card:hover {
    transform: none;
  }

  .cooperation-card::before {
    display: none;
  }
}

@media (max-width: 480px) {
  .cooperation-number {
    min-width: 48px;
    font-size: 1.25rem;
  }

  .cooperation-title {
    font-size: 1rem;
  }

  .cooperation-feature {
    font-size: 10px;
    padding: 3px 8px;
  }
}

/* ===== Advantages Section: Mobile Optimization ===== */
@media (max-width: 768px) {
  .advantages-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-top: var(--space-8);
  }

  /* Icon + text horizontal row (compact) */
  .advantage-card {
    flex-direction: row;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    gap: var(--space-4);
  }

  .advantage-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    flex-shrink: 0;
  }

  .advantage-icon svg {
    width: 22px;
    height: 22px;
  }

  .advantage-title {
    font-size: 0.95rem;
    margin-bottom: 2px;
  }

  .advantage-desc {
    font-size: 0.82rem;
    line-height: 1.55;
    /* Show first line only, truncate with ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .advantage-card:hover {
    transform: none; /* No hover transform on touch */
  }
}

@media (max-width: 480px) {
  .advantage-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 10px;
  }

  .advantage-icon svg {
    width: 19px;
    height: 19px;
  }

  .advantage-title {
    font-size: 0.88rem;
  }

  .advantage-desc {
    font-size: 0.78rem;
    -webkit-line-clamp: 1;
  }
}

/* ===== Team Section: Mobile Optimization ===== */
@media (max-width: 768px) {
  .team-grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: var(--space-6);
  }

  /* Premium horizontal row: icon | content stacked */
  .team-card {
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    column-gap: 14px;
    align-items: start;
    padding: 15px 20px;
    text-align: left;
    border-radius: 0;
    border: none;
    background: transparent;
    position: relative;
    border-bottom: 1px solid #eef3f8;
    transition: background 0.25s ease;
  }

  .team-card:last-child {
    border-bottom: none;
  }

  /* Subtle highlight on active/hover */
  .team-card:hover,
  .team-card:active {
    background: linear-gradient(135deg, #f8faff 0%, #f0f5ff 100%);
  }

  /* Icon spans both rows on the left */
  .team-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    margin-bottom: 0;
    margin-right: 0;
    border-radius: 11px;
    background: linear-gradient(145deg, #eff6ff, #dbeafe);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.10),
                inset 0 1px 0 rgba(255,255,255,0.7);
    color: #2563eb;
    grid-row: 1 / 3;
    grid-column: 1 / 2;
    place-self: start center;
  }

  .team-icon svg {
    width: 20px;
    height: 20px;
  }

  /* Name: row 1, col 2 */
  .team-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #1e293b;
    letter-spacing: -0.01em;
    grid-row: 1;
    grid-column: 2;
    line-height: 1.35;
  }

  /* Desc: row 2, col 2 */
  .team-desc {
    font-size: 12.5px;
    line-height: 1.55;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    grid-row: 2;
    grid-column: 2;
  }

  .team-card:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  .team-grid {
    gap: 0;
    margin-top: var(--space-5);
  }

  .team-card {
    padding: 12px 16px;
    column-gap: 12px;
  }

  .team-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
  }

  .team-icon svg {
    width: 18px;
    height: 18px;
  }

  .team-name {
    font-size: 14px;
    margin-bottom: 3px;
  }

  .team-desc {
    font-size: 12px;
    -webkit-line-clamp: 1;
  }
}

/* ===== Data Visualization Section: Mobile Optimization ===== */
@media (max-width: 768px) {
  /* 3D Charts: stack vertically on mobile */
  .chart-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-5) !important;
    margin-top: var(--space-6);
  }

  /* Each chart card gets compact padding */
  .chart-grid > div {
    padding: var(--space-4) var(--space-4) !important;
    border-radius: var(--radius-xl) !important;
  }

  .chart-grid > div h3 {
    font-size: 15px !important;
    margin-bottom: var(--space-3) !important;
  }

  /* Chart canvas: reduce height for mobile to save vertical space */
  .chart-grid #bar-chart-3d,
  .chart-grid #pie-chart-3d,
  #bar-chart-3d,
  #pie-chart-3d {
    height: 280px !important;
    min-height: 280px;
  }

  /* Stats cards: 2x2 grid on tablet, 1-column stack on phone */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-4) !important;
    margin-top: var(--space-8);
  }

  /* Compact stat cards */
  .stats-grid > div {
    padding: var(--space-5) var(--space-4) !important;
    border-radius: var(--radius-lg) !important;
  }

  .stats-grid > div > div:first-child {
    font-size: 22px !important;
    margin-bottom: var(--space-1) !important;
  }

  .stats-grid > div > div:last-child {
    font-size: 11px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 480px) {
  /* Stats: single column on small phones */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-3) !important;
  }

  .stats-grid > div {
    padding: var(--space-4) var(--space-3) !important;
  }

  .stats-grid > div > div:first-child {
    font-size: 20px !important;
  }

  .stats-grid > div > div:last-child {
    font-size: 10.5px !important;
  }

  /* Charts even more compact */
  .chart-grid > div {
    padding: var(--space-3) !important;
  }

  .chart-grid > div h3 {
    font-size: 14px !important;
  }

  .chart-grid #bar-chart-3d,
  .chart-grid #pie-chart-3d,
  #bar-chart-3d,
  #pie-chart-3d {
    height: 240px !important;
    min-height: 240px;
  }
}

/* 内部入口（装配演示 / 3D 模型）：默认隐藏，仅 dev 模式（?dev=1 或 localStorage）可见 */
.footer-dev {
  display: none;
  margin-top: var(--space-4, 1.5rem);
  padding-top: var(--space-3, 1rem);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  text-align: center;
}
.footer-dev .footer-dev-link {
  display: inline-block;
  margin: 0 var(--space-3, 1rem);
  font-size: 12px;
  color: #9ca3af;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.footer-dev .footer-dev-link:hover { color: #6b7280; text-decoration: underline; }
body.dev-on .footer-dev { display: block; }
