/* =====================================================
   开心三七坞 · 自然观察手账风样式表
   Warm Cream Botanical Picture-Book & Science Notebook
   ===================================================== */

:root {
  --bg-paper: #edf5ee;
  --bg-dot: #cfe0d2;
  --surface: #ffffff;
  --surface-tint: #f3f8f4;
  --surface-sage: #e6f3e9;
  --surface-water: #e5f3f6;
  --surface-amber: #fdf2e3;
  --surface-berry: #fcecef;

  --border: #d5e3d7;
  --border-strong: #b6ccb9;

  --ink-primary: #1a3324;
  --ink-secondary: #345240;
  --ink-muted: #3f5c4a;

  --accent-leaf: #1d6436;
  --accent-leaf-soft: #dcf0e1;
  --accent-water: #185e70;
  --accent-water-soft: #d7eef3;
  --accent-amber: #994309;
  --accent-amber-soft: #fae6cc;
  --accent-berry: #a32936;
  --accent-berry-soft: #f9dde0;
  --accent-gold: #8a5e08;

  --radius-panel: 20px;
  --radius-inner: 14px;
  --radius-pill: 999px;

  --shadow-panel: 0 6px 20px rgba(26, 51, 36, 0.06);
  --shadow-subtle: 0 2px 8px rgba(26, 51, 36, 0.05);
  --shadow-float: 0 12px 32px rgba(26, 51, 36, 0.16);

  --font-display: 'ZCOOL KuaiLe', 'Noto Sans SC', sans-serif;
  --font-body: 'Nunito', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
}

/* Reset & Browser Surface Theming */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--accent-leaf-soft);
  color: var(--ink-primary);
}

:focus-visible {
  outline: 2.5px solid var(--accent-leaf);
  outline-offset: 2px;
}

html {
  scroll-behavior: smooth;
  text-underline-offset: 3px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-paper);
  background-image: radial-gradient(var(--bg-dot) 1.1px, transparent 1.1px);
  background-size: 22px 22px;
  color: var(--ink-primary);
  min-height: 100vh;
  line-height: 1.55;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-tint);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb {
  background: #c8bca4;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a99b80;
}

.tabular-num {
  font-variant-numeric: tabular-nums;
}

/* Unified Authored SVG Icon System */
.ui-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Layout Container */
.dashboard-container {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* =====================================================
   1. 顶部自然手账横幅
   ===================================================== */
.dashboard-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
}

.header-left {
  display: flex;
  justify-content: flex-start;
}

.header-middle {
  display: flex;
  justify-content: center;
}

.header-right {
  display: flex;
  justify-content: flex-end;
}

.time-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface-sage);
  border: 1px solid #cfe3d4;
  border-radius: var(--radius-pill);
  color: var(--ink-primary);
  font-size: 13.5px;
  font-weight: 700;
}

.time-pill .ui-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-leaf);
}

.pill-sep {
  width: 1px;
  height: 14px;
  background: #bdd5c3;
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.brand-sprout {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.main-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 400;
  color: var(--ink-primary);
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.notebook-stamp {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-amber);
  background: var(--surface-amber);
  border: 1px solid #f0cfa7;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.weather-pill {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 7px 14px 7px 9px;
  background: var(--surface-amber);
  border: 1px solid #edd4b2;
  border-radius: var(--radius-pill);
}

.weather-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fffdf8;
  border: 1px solid #edd4b2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-amber);
}

.weather-city {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  line-height: 1.2;
}

.weather-detail {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.3;
}

/* =====================================================
   通用面板与分段按钮
   ===================================================== */
.panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-featured {
  border-color: #cde0d1;
}

.panel-header {
  padding: 18px 20px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-primary);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  line-height: 1.3;
}

.panel-subtitle {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 4px;
  padding-left: 39px;
}

.title-badge {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.badge-sun { background: var(--surface-amber); color: var(--accent-amber); }
.badge-berry { background: var(--surface-berry); color: var(--accent-berry); }
.badge-leaf { background: var(--surface-sage); color: var(--accent-leaf); }
.badge-water { background: var(--surface-water); color: var(--accent-water); }
.badge-amber { background: var(--surface-amber); color: var(--accent-amber); }
.badge-chip { background: var(--surface-sage); color: var(--accent-leaf); }

.panel-body {
  padding: 8px 20px 20px;
  flex: 1;
  min-width: 0;
}

.segmented-control {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.seg-btn:hover {
  color: var(--ink-primary);
  background: rgba(255, 253, 248, 0.7);
}

.seg-btn.active {
  background: var(--surface);
  color: var(--accent-leaf);
  box-shadow: 0 1px 4px rgba(34, 59, 44, 0.1);
}

/* =====================================================
   2. 中部核心三栏布局
   ===================================================== */
.dashboard-middle {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(420px, 1.45fr) minmax(300px, 0.95fr);
  gap: 20px;
  align-items: stretch;
}

.chart-container {
  width: 100%;
  height: 360px;
}

.chart-tall {
  height: 330px;
}

/* =====================================================
   成长影集轮播（全部 77 项图片+视频）
   ===================================================== */
.carousel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.counter-pill {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent-berry);
  background: var(--surface-berry);
  border: 1px solid #efc9ce;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.icon-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.icon-action-btn:hover {
  background: var(--surface-sage);
  border-color: #b7d4be;
  color: var(--accent-leaf);
}

.icon-action-btn.is-paused {
  background: var(--surface-amber);
  border-color: #ebd0ac;
  color: var(--accent-amber);
}

.media-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 10px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
}

.filter-chip.active {
  background: var(--accent-leaf);
  border-color: var(--accent-leaf);
  color: #fffdf8;
}

.chip-count {
  font-size: 11px;
  opacity: 0.85;
}

.carousel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.carousel-stage {
  position: relative;
  border-radius: var(--radius-inner);
  background: #f2ede1;
  border: 1.5px solid var(--border);
  overflow: hidden;
  height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-media-frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.carousel-media-frame img,
.carousel-media-frame video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  background: #1b2820;
  box-shadow: 0 4px 14px rgba(34, 59, 44, 0.12);
}

.carousel-media-frame img {
  background: transparent;
  cursor: zoom-in;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: rgba(255, 253, 248, 0.94);
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.carousel-nav:hover {
  background: var(--accent-leaf);
  border-color: var(--accent-leaf);
  color: #fffdf8;
  transform: translateY(-50%) scale(1.06);
}

.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }

.media-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent-berry);
  color: #fffdf8;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  z-index: 4;
}

.carousel-caption-bar {
  background: var(--surface-tint);
  border-radius: 12px;
  padding: 10px 14px;
}

.caption-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.stage-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.file-date-label {
  font-size: 11.5px;
  color: var(--ink-muted);
  font-weight: 600;
}

.carousel-description {
  font-size: 13px;
  color: var(--ink-primary);
  line-height: 1.5;
}

/* Filmstrip Thumbnails */
.filmstrip-wrapper {
  overflow: hidden;
  border-radius: 10px;
}

.filmstrip-track {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 6px;
  scroll-behavior: smooth;
}

.film-thumb {
  flex: 0 0 54px;
  height: 42px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--surface-tint);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.film-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.film-thumb.is-video {
  background: #223b2c;
  color: #fffdf8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  gap: 1px;
}

.film-thumb:hover {
  border-color: var(--border-strong);
}

.film-thumb.active {
  border-color: var(--accent-leaf);
  transform: translateY(-1px);
}

/* =====================================================
   土壤湿度与肥力面板
   ===================================================== */
.soil-status-container {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 18px;
}

.soil-metrics-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.soil-meter-well {
  background: var(--surface-tint);
  border-radius: var(--radius-inner);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.meter-label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-primary);
}

.icon-water { color: var(--accent-water); }
.icon-leaf { color: var(--accent-leaf); }

.water-drop-gauge {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid #b5dbe3;
  background: #fffdf8;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.water-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #6cc1d4 0%, #3a96ad 100%);
  transition: height 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-value {
  position: relative;
  z-index: 2;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-primary);
  background: rgba(255, 253, 248, 0.85);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.fertility-column-gauge {
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.fertility-tube {
  width: 34px;
  height: 66px;
  border-radius: 10px;
  background: #e6efe8;
  border: 2px solid #bdd8c4;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.fertility-fill {
  width: 100%;
  background: linear-gradient(180deg, #5eb277 0%, #2f7d4b 100%);
  border-radius: 6px 6px 0 0;
  transition: height 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.fertility-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-primary);
}

.fertility-num small {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}

.meter-status-pill {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.status-good {
  background: var(--accent-water-soft);
  color: var(--accent-water);
}

.status-rich {
  background: var(--accent-leaf-soft);
  color: var(--accent-leaf);
}

.soil-spec-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-sage);
  border-radius: var(--radius-inner);
  padding: 12px 14px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
}

.spec-row dt {
  color: var(--ink-secondary);
  font-weight: 700;
}

.spec-row dd {
  color: var(--ink-primary);
  font-weight: 800;
  text-align: right;
}

/* =====================================================
   3. 浇灌分析与观察日记两栏区
   ===================================================== */
.dashboard-bottom {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
}

.timeline-wrapper {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 12px;
}

.timeline {
  position: relative;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #d3dfc9;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -22px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--accent-leaf);
}

.timeline-item.active-item .timeline-dot {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
}

.timeline-content {
  background: var(--surface-tint);
  border-radius: 13px;
  padding: 12px 14px;
}

.timeline-item.active-item .timeline-content {
  background: var(--surface-amber);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 5px;
}

.timeline-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-primary);
}

.timeline-date {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.timeline-body {
  font-size: 12.8px;
  color: var(--ink-secondary);
  line-height: 1.55;
  margin-bottom: 8px;
}

.timeline-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stat-item {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 7px;
}

.stat-tag {
  color: var(--accent-leaf);
  font-weight: 800;
}

/* =====================================================
   4. 首页下部：STM32 智能自动灌溉系统成果展示
   ===================================================== */
.showcase-panel {
  background: transparent;
  border: none;
  box-shadow: none;
}

.showcase-header {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 18px 22px;
}

.showcase-body {
  padding: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.showcase-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent-leaf);
  background: var(--surface-sage);
  border: 1px solid #c3dec9;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.status-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-leaf);
}

.group-sync-badge {
  font-size: 12.5px;
  color: var(--ink-secondary);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
}

.showcase-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 18px;
}

/* 上半：架构图 + OLED 模拟器 */
.showcase-top-grid {
  display: grid;
  grid-template-columns: 1.55fr minmax(290px, 0.85fr);
  gap: 20px;
  align-items: stretch;
}

.arch-stage {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.arch-columns {
  display: grid;
  grid-template-columns: 1fr 64px 0.95fr 64px 1fr;
  align-items: center;
  gap: 6px;
}

.arch-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arch-col-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-secondary);
  text-align: center;
  margin-bottom: 2px;
}

.hw-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-tint);
  border: 1px solid transparent;
  border-radius: 12px;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.hw-node-muted {
  background: var(--surface-tint);
}

.actuator-btn {
  cursor: pointer;
  border-color: var(--border);
  background: var(--surface);
}

.actuator-btn:hover {
  border-color: var(--accent-leaf);
}

.actuator-btn.is-active {
  background: var(--surface-sage);
  border-color: var(--accent-leaf);
}

.actuator-btn.is-alarm {
  background: var(--surface-berry);
  border-color: var(--accent-berry);
}

.hw-node-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-bg-amber { background: var(--surface-amber); color: var(--accent-amber); }
.icon-bg-water { background: var(--surface-water); color: var(--accent-water); }
.icon-bg-leaf { background: var(--surface-sage); color: var(--accent-leaf); }
.icon-bg-berry { background: var(--surface-berry); color: var(--accent-berry); }

.hw-node-text {
  min-width: 0;
}

.hw-node-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-primary);
  line-height: 1.25;
}

.hw-node-spec {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.hw-node-val {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-leaf);
  margin-top: 2px;
}

.hw-node-status {
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
}

.hw-node-status.status-on { color: var(--accent-leaf); }
.hw-node-status.status-off { color: var(--ink-muted); }
.hw-node-status.status-alert { color: var(--accent-berry); }

.icon-spin svg {
  animation: spin 1.4s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* SVG Flow Connectors */
.arch-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.conn-svg {
  width: 64px;
  height: 210px;
}

.conn-path {
  fill: none;
  stroke: #cfc4ad;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 5 5;
}

.conn-path.active {
  stroke: var(--accent-leaf);
  animation: dashMove 1.4s linear infinite;
}

.conn-path.alert {
  stroke: var(--accent-berry);
  animation: dashMove 0.8s linear infinite;
}

@keyframes dashMove {
  to { stroke-dashoffset: -20; }
}

.conn-caption {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* STM32 MCU Center Card */
.stm32-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mcu-chip-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chip-pins-top,
.chip-pins-bottom {
  display: flex;
  gap: 10px;
}

.chip-pins-top span,
.chip-pins-bottom span {
  width: 6px;
  height: 7px;
  background: #b8ac95;
  border-radius: 2px;
}

.chip-core {
  width: 100%;
  background: #233c2e;
  color: #f6f2e8;
  border: 2px solid #355844;
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(35, 60, 46, 0.18);
}

.chip-brand {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fffdf8;
}

.chip-os {
  font-size: 11.5px;
  color: #c2e0cc;
  margin-top: 2px;
}

.chip-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}

.chip-tag {
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  color: #eef8f1;
  padding: 2px 8px;
  border-radius: 6px;
}

.chip-leds {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #deece2;
}

.led-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.led-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #556b5e;
}

.led-green { background: #65d68a; }
.led-amber { background: #f4c95d; }
.led-red { background: #ff6b78; }

.blinking {
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.software-layers-mini {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sw-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  background: var(--surface-tint);
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
}

.arch-hint {
  font-size: 12.5px;
  color: var(--ink-muted);
  text-align: center;
}

/* =====================================================
   0.96寸 OLED 四页交互模拟器
   ===================================================== */
.oled-simulator {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.oled-sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.oled-sim-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-primary);
}

.oled-page-badge {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-water);
  background: var(--surface-water);
  border: 1px solid #c3dfe6;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.oled-bezel {
  background: #1a2420;
  border: 3px solid #35473e;
  border-radius: 14px;
  padding: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.45);
}

.oled-screen {
  background: #0d161a;
  border: 1px solid #243840;
  border-radius: 8px;
  padding: 12px 13px;
  min-height: 136px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #7ee8fa;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.oled-line-head {
  color: #f4d35e;
  font-weight: 700;
  border-bottom: 1px dashed rgba(126, 232, 250, 0.3);
  padding-bottom: 3px;
  margin-bottom: 3px;
}

.oled-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.oled-cursor {
  color: #ffde7d;
  font-weight: 700;
}

.oled-keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.key-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 4px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.14s ease, transform 0.12s ease, border-color 0.14s ease;
}

.key-btn:hover {
  background: var(--surface-sage);
  border-color: var(--accent-leaf);
}

.key-btn:active {
  transform: translateY(1px);
}

.key-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-primary);
}

.key-fn {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}

.oled-tip {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.45;
}

/* =====================================================
   工程资料选项卡（PCB / 流程图 / BOM）
   ===================================================== */
.engineering-tabs-section {
  padding-top: 4px;
}

.eng-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.eng-tab {
  border: 1.5px solid var(--border);
  background: var(--surface-tint);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 11px;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.eng-tab:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
}

.eng-tab.active {
  background: var(--accent-leaf);
  border-color: var(--accent-leaf);
  color: #fffdf8;
}

.eng-pane[hidden] {
  display: none;
}

/* Tab 1: PCB Showcase */
.pcb-showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.95fr;
  gap: 18px;
  align-items: stretch;
}

.pcb-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pcb-img-wrap {
  position: relative;
  height: 220px;
  background: #1c2721;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  overflow: hidden;
}

.pcb-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  transition: transform 0.25s ease;
}

.pcb-img-wrap:hover img {
  transform: scale(1.03);
}

.zoom-pill {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink-primary);
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.pcb-caption {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pcb-caption strong {
  font-size: 13.5px;
  color: var(--ink-primary);
}

.pcb-caption span {
  font-size: 12.2px;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.pcb-highlights {
  background: var(--surface-sage);
  border: 1.5px solid #cfe3d4;
  border-radius: 14px;
  padding: 16px;
}

.pcb-highlights h3,
.sub-section-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-primary);
  margin-bottom: 12px;
}

.highlight-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.highlight-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.hl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-leaf);
  margin-top: 6px;
  flex-shrink: 0;
}

.highlight-list strong {
  display: block;
  font-size: 13px;
  color: var(--ink-primary);
  margin-bottom: 2px;
}

.highlight-list p {
  font-size: 12.2px;
  color: var(--ink-secondary);
  line-height: 1.5;
}

/* Tab 2: Flow & Rules */
.flow-showcase-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: start;
}

.flowchart-box,
.rules-table-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 18px;
}

.flow-diagram-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Spec & BOM Tables */
.bom-table-wrap {
  overflow-x: auto;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
  padding: 12px 16px;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.8px;
}

.spec-table th,
.spec-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.spec-table thead th {
  background: var(--surface-tint);
  color: var(--ink-primary);
  font-weight: 800;
}

.spec-table tbody tr:last-child td {
  border-bottom: none;
}

.spec-table code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-tint);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--ink-primary);
}

.num-col {
  text-align: right;
  white-space: nowrap;
}

.action-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
}

.tag-water { background: var(--accent-water-soft); color: var(--accent-water); }
.tag-leaf { background: var(--accent-leaf-soft); color: var(--accent-leaf); }
.tag-amber { background: var(--accent-amber-soft); color: var(--accent-amber); }
.tag-berry { background: var(--accent-berry-soft); color: var(--accent-berry); }
.tag-off { background: #e8e4da; color: var(--ink-secondary); }

/* =====================================================
   Lightbox Modal
   ===================================================== */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 40, 30, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.lightbox-backdrop[hidden] {
  display: none;
}

.lightbox-dialog {
  width: min(920px, 100%);
  max-height: 90vh;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-float);
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.lightbox-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lightbox-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-primary);
}

.lightbox-content {
  background: #1b2820;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 68vh;
  min-height: 260px;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
}

.lightbox-caption {
  font-size: 13px;
  color: var(--ink-secondary);
}

/* =====================================================
   响应式适配
   ===================================================== */
@media (max-width: 1280px) {
  .dashboard-middle {
    grid-template-columns: 1fr 1fr;
  }
  .middle-center {
    grid-column: 1 / -1;
    order: -1;
  }
  .showcase-top-grid {
    grid-template-columns: 1fr;
  }
  .pcb-showcase-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pcb-highlights {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .dashboard-header {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .header-left,
  .header-right {
    justify-content: center;
  }
  .dashboard-middle,
  .dashboard-bottom,
  .flow-showcase-grid,
  .pcb-showcase-grid {
    grid-template-columns: 1fr;
  }
  .arch-columns {
    grid-template-columns: 1fr;
  }
  .arch-connector {
    display: none;
  }
}

@media (max-width: 560px) {
  body {
    padding: 12px;
  }
  .panel-header {
    padding: 14px 14px 10px;
  }
  .panel-body {
    padding: 6px 14px 14px;
  }
  .soil-metrics-pair {
    grid-template-columns: 1fr;
  }
  .carousel-stage {
    height: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
