:root {
  --bg: #05080f;
  --bg-alt: #07111d;
  --surface: rgba(10, 24, 38, 0.82);
  --surface-strong: rgba(11, 31, 50, 0.96);
  --line: rgba(111, 230, 255, 0.18);
  --line-strong: rgba(111, 230, 255, 0.38);
  --text: #e8f6ff;
  --muted: #9fb7c6;
  --cyan: #5ce1ff;
  --green: #41f29a;
  --red: #ff4f68;
  --amber: #ffd166;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  --topbar-height: 76px;
}

body.light-theme {
  --bg: #eef7fb;
  --bg-alt: #e6f3fa;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(0, 99, 135, 0.18);
  --line-strong: rgba(0, 128, 168, 0.34);
  --text: #10212d;
  --muted: #526b7d;
  --cyan: #008cb7;
  --green: #11875a;
  --red: #c33348;
  --shadow: 0 18px 44px rgba(14, 53, 74, 0.16);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(92, 225, 255, 0.08), transparent 34%),
    linear-gradient(240deg, rgba(65, 242, 154, 0.05), transparent 42%),
    linear-gradient(135deg, var(--bg), var(--bg-alt) 48%, #02040a);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

body.light-theme {
  background:
    linear-gradient(120deg, rgba(0, 140, 183, 0.10), transparent 34%),
    linear-gradient(240deg, rgba(65, 180, 130, 0.08), transparent 42%),
    linear-gradient(135deg, var(--bg), var(--bg-alt));
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.circuit-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(rgba(92, 225, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 225, 255, 0.04) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 88%);
}

.circuit-bg::before,
.circuit-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(92, 225, 255, 0.18) 10% 10.2%, transparent 10.2% 100%),
    linear-gradient(0deg, transparent 0 28%, rgba(65, 242, 154, 0.16) 28% 28.2%, transparent 28.2% 100%),
    linear-gradient(90deg, transparent 0 72%, rgba(255, 79, 104, 0.12) 72% 72.2%, transparent 72.2% 100%);
  animation: circuitMove 14s linear infinite;
}

.circuit-bg::after {
  opacity: 0.42;
  animation-duration: 22s;
  animation-direction: reverse;
}

@keyframes circuitMove {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(54px, 54px, 0); }
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(18px);
}

body.light-theme .topbar {
  background: rgba(238, 247, 251, 0.84);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 150px;
  font-weight: 800;
}

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(92, 225, 255, 0.22), rgba(65, 242, 154, 0.08));
  box-shadow: 0 0 24px rgba(92, 225, 255, 0.18);
}

.brand-mark span {
  width: 18px;
  height: 18px;
  border: 2px solid var(--cyan);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spinMark 5s linear infinite;
}

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

.brand-text {
  white-space: nowrap;
}

.brand-copy {
  display: grid;
  gap: 2px;
  line-height: 1.05;
}

.brand-school {
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

.main-nav a,
.side-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.main-nav a:hover,
.side-nav a:hover,
.main-nav a.is-active,
.side-nav a.is-active {
  color: var(--text);
  background: rgba(92, 225, 255, 0.10);
  box-shadow: inset 0 0 0 1px var(--line);
}

.theme-toggle,
.menu-toggle {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(92, 225, 255, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.theme-toggle:hover,
.menu-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(92, 225, 255, 0.16);
}

.theme-icon {
  width: 18px;
  height: 18px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  box-shadow: inset -6px -2px 0 rgba(65, 242, 154, 0.7);
}

.menu-toggle {
  display: none;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
}

.app-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: calc(var(--topbar-height) + 18px);
  left: 20px;
  bottom: 20px;
  z-index: 20;
  width: 244px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: transform 240ms ease, opacity 240ms ease;
  overflow-y: auto;
}

body.home-mode .sidebar {
  opacity: 0;
  transform: translateX(-110%);
  pointer-events: none;
}

.sidebar-heading,
.panel-label,
.code-label,
.eyebrow,
.node-label {
  display: block;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.status-panel {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.status-panel strong {
  display: block;
  margin: 2px 0 12px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.status-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 16px currentColor;
}

.status-dot.green { color: var(--green); background: var(--green); }
.status-dot.red { color: var(--red); background: var(--red); }
.status-dot.cyan { color: var(--cyan); background: var(--cyan); }
.status-dot.amber { color: var(--amber); background: var(--amber); }

.content {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: calc(var(--topbar-height) + 28px) 0 80px;
  transition: margin 240ms ease, width 240ms ease;
}

body:not(.home-mode) .content {
  width: min(1080px, calc(100% - 340px));
  margin-left: 300px;
  margin-right: 40px;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
  animation: pageFade 260ms ease;
}

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

.hero {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  align-items: center;
  gap: 46px;
  padding: 28px 0;
}

.hero-copy h1,
.page-header h2 {
  margin: 0;
  line-height: 1.02;
  font-size: 4.4rem;
  font-weight: 900;
}

.hero-copy h1 {
  font-size: clamp(2.8rem, 5.8vw, 4.4rem);
}

.hero-copy h2 {
  margin: 10px 0 0;
  color: var(--cyan);
  font-size: 2.15rem;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 14px;
}

.hero-text {
  max-width: 660px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  color: #031016;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  box-shadow: 0 14px 32px rgba(92, 225, 255, 0.18);
}

.btn.ghost {
  color: var(--text);
  background: rgba(92, 225, 255, 0.08);
}

.hero-visual {
  position: relative;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(92, 225, 255, 0.08), rgba(65, 242, 154, 0.04)), rgba(4, 12, 20, 0.72);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.visual-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(92, 225, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 225, 255, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.52;
}

.gate-system {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 56px;
  height: 185px;
}

.gate-rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  height: 6px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 18px rgba(92, 225, 255, 0.42);
}

.gate-post {
  position: absolute;
  bottom: 20px;
  width: 18px;
  height: 150px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(92, 225, 255, 0.18), rgba(92, 225, 255, 0.04));
}

.gate-post.left { left: 8px; }
.gate-post.right { right: 8px; }

.gate-panel {
  position: absolute;
  left: 38px;
  bottom: 32px;
  width: 58%;
  height: 122px;
  border: 2px solid var(--cyan);
  border-radius: var(--radius);
  background: repeating-linear-gradient(90deg, rgba(92, 225, 255, 0.12) 0 8px, transparent 8px 24px), rgba(2, 12, 20, 0.54);
  box-shadow: 0 0 24px rgba(92, 225, 255, 0.28);
  animation: gateSlide 5.8s ease-in-out infinite;
}

.gate-panel span {
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: var(--line-strong);
}

.gate-panel span:nth-child(1) { left: 20%; }
.gate-panel span:nth-child(2) { left: 40%; }
.gate-panel span:nth-child(3) { left: 60%; }
.gate-panel span:nth-child(4) { left: 80%; }

@keyframes gateSlide {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(44px); }
}

.motor-box {
  position: absolute;
  right: 42px;
  bottom: 32px;
  width: 90px;
  height: 74px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(92, 225, 255, 0.08));
  display: grid;
  place-items: center;
}

.motor-core {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid var(--amber);
  border-top-color: var(--cyan);
  animation: spinMark 1.6s linear infinite;
}

.limit-switch {
  position: absolute;
  bottom: 164px;
  min-width: 52px;
  padding: 5px 8px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  background: rgba(0, 0, 0, 0.32);
}

.limit-switch.open { left: 26px; color: var(--green); }
.limit-switch.close { right: 26px; color: var(--red); }

.board {
  position: absolute;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(2, 15, 24, 0.82);
  box-shadow: 0 0 24px rgba(92, 225, 255, 0.16);
}

.board-title {
  position: absolute;
  left: 12px;
  top: 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.arduino { top: 54px; left: 40px; width: 218px; height: 132px; }
.driver { top: 76px; right: 50px; width: 178px; height: 108px; }

.chip {
  position: absolute;
  left: 78px;
  top: 52px;
  width: 58px;
  height: 42px;
  border: 1px solid rgba(65, 242, 154, 0.5);
  border-radius: 4px;
  background: rgba(65, 242, 154, 0.12);
}

.wifi-ring {
  position: absolute;
  right: 24px;
  bottom: 22px;
  width: 34px;
  height: 34px;
  border: 2px solid var(--cyan);
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: wifiPulse 1.8s ease-in-out infinite;
}

@keyframes wifiPulse {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

.pin-row {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 7px;
  background: repeating-linear-gradient(90deg, var(--cyan) 0 5px, transparent 5px 13px);
  opacity: 0.72;
}

.pin-row.top { top: 36px; }
.pin-row.bottom { bottom: 12px; }

.driver-heat {
  position: absolute;
  left: 20px;
  bottom: 18px;
  width: 78px;
  height: 38px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, rgba(255, 79, 104, 0.8) 0 8px, rgba(255, 79, 104, 0.28) 8px 14px);
}

.driver-heat.small {
  left: auto;
  right: 20px;
  width: 42px;
  background: repeating-linear-gradient(90deg, rgba(92, 225, 255, 0.8) 0 6px, rgba(92, 225, 255, 0.25) 6px 12px);
}

.power-pack {
  position: absolute;
  right: 58px;
  top: 220px;
  width: 92px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(65, 242, 154, 0.52);
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(65, 242, 154, 0.08);
  font-weight: 900;
}

.wire {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  transform-origin: left center;
  box-shadow: 0 0 16px rgba(92, 225, 255, 0.35);
}

.wire-one { top: 128px; left: 258px; width: 188px; }
.wire-two { top: 220px; right: 112px; width: 138px; transform: rotate(90deg); }
.wire-three { left: 188px; bottom: 188px; width: 238px; transform: rotate(22deg); }

.pulse-node {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 20px var(--green);
  animation: nodePulse 1.5s ease-in-out infinite;
}

.pulse-node.one { top: 123px; left: 332px; }
.pulse-node.two { top: 216px; right: 134px; animation-delay: 300ms; }
.pulse-node.three { left: 280px; bottom: 156px; animation-delay: 600ms; }

@keyframes nodePulse {
  0%, 100% { transform: scale(0.72); opacity: 0.55; }
  50% { transform: scale(1.2); opacity: 1; }
}

.quick-grid,
.component-grid,
.gallery-grid,
.safety-grid,
.section-grid,
.code-grid {
  display: grid;
  gap: 18px;
}

.quick-grid {
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: 28px;
}

.quick-card,
.info-block,
.component-card,
.table-card,
.step-card,
.process-step,
.tech-widget,
.gate-simulator,
.dev-phase,
.safety-card,
.gallery-card,
.code-card,
.exam-note,
.callout,
.conclusion-panel,
.completion-card,
.cloud-dashboard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.quick-card:hover,
.info-block:hover,
.component-card:hover,
.table-card:hover,
.step-card:hover,
.process-step:hover,
.tech-widget:hover,
.gate-simulator:hover,
.dev-phase:hover,
.safety-card:hover,
.gallery-card:hover,
.code-card:hover,
.completion-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 22px 56px rgba(0, 200, 255, 0.12);
}

.quick-card,
.info-block,
.component-card,
.step-card,
.process-step,
.tech-widget,
.gate-simulator,
.dev-phase,
.safety-card,
.gallery-card,
.exam-note,
.callout,
.completion-card {
  padding: 22px;
}

.quick-card h3,
.info-block h3,
.component-card h3,
.step-card h3,
.process-step h3,
.tech-widget h3,
.gate-simulator h3,
.dev-phase h3,
.safety-card h3,
.gallery-card h3,
.exam-note h3,
.table-card h3,
.code-card h3,
.cloud-benefits h3,
.conclusion-panel h3,
.completion-card h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  line-height: 1.2;
}

.quick-card p,
.info-block p,
.component-card p,
.step-card p,
.process-step p,
.tech-widget p,
.gate-simulator p,
.dev-phase p,
.safety-card p,
.gallery-card p,
.exam-note p,
.callout p,
.page-header p,
.code-note p,
.cloud-benefits p,
.conclusion-panel p,
.completion-card p {
  margin: 0;
  color: var(--muted);
}

.quick-card p + p,
.info-block p + p,
.component-card p + p {
  margin-top: 10px;
}

.quick-icon,
.component-symbol {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(92, 225, 255, 0.08);
}

.quick-icon::before,
.quick-icon::after,
.component-symbol::before,
.component-symbol::after,
.gallery-art::before,
.gallery-art::after,
.gallery-art span {
  content: "";
  position: absolute;
}

.quick-icon.wifi::before { left: 11px; top: 14px; width: 24px; height: 24px; border: 3px solid var(--cyan); border-bottom-color: transparent; border-left-color: transparent; border-radius: 50%; transform: rotate(-45deg); }
.quick-icon.wifi::after { left: 21px; bottom: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
.quick-icon.shield::before { left: 13px; top: 9px; width: 22px; height: 28px; clip-path: polygon(50% 0, 100% 20%, 88% 75%, 50% 100%, 12% 75%, 0 20%); background: linear-gradient(135deg, var(--green), var(--cyan)); }
.quick-icon.auto::before { left: 11px; top: 16px; width: 26px; height: 16px; border: 3px solid var(--cyan); border-radius: 50%; }
.quick-icon.auto::after { left: 19px; top: 24px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.quick-icon.cloud::before { left: 9px; top: 19px; width: 30px; height: 15px; border-radius: 14px; background: var(--cyan); }
.quick-icon.cloud::after { left: 15px; top: 12px; width: 18px; height: 18px; border-radius: 50%; background: var(--cyan); }

.page-inner {
  padding-bottom: 30px;
}

.page-header {
  margin-bottom: 28px;
  padding-top: 16px;
}

.page-header h2 {
  margin-bottom: 16px;
  font-size: 3rem;
}

.section-grid.two { grid-template-columns: repeat(2, 1fr); }
.section-grid.three { grid-template-columns: repeat(3, 1fr); }

.info-block.accent {
  background: linear-gradient(135deg, rgba(92, 225, 255, 0.12), rgba(65, 242, 154, 0.08)), var(--surface);
}

.architecture-strip {
  display: grid;
  grid-template-columns: 1fr 58px 1fr 58px 1fr 58px 1fr 58px 1fr;
  align-items: center;
  gap: 10px;
  margin: 22px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(92, 225, 255, 0.06);
}

.architecture-strip div {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.14);
}

.flow-line {
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 14px rgba(92, 225, 255, 0.48);
}

.exam-note {
  margin-top: 18px;
  border-color: rgba(65, 242, 154, 0.34);
  background: linear-gradient(135deg, rgba(65, 242, 154, 0.10), transparent), var(--surface);
}

.component-grid { grid-template-columns: repeat(3, 1fr); }
.component-card strong { color: var(--text); }

.arduino-symbol::before { inset: 12px 9px; border: 2px solid var(--cyan); border-radius: 4px; }
.arduino-symbol::after { left: 18px; top: 18px; width: 12px; height: 12px; background: var(--green); }
.driver-symbol::before { left: 9px; right: 9px; top: 16px; height: 16px; background: repeating-linear-gradient(90deg, var(--red) 0 5px, rgba(255, 79, 104, 0.18) 5px 9px); }
.motor-symbol::before { left: 10px; top: 13px; width: 24px; height: 24px; border: 3px solid var(--amber); border-radius: 50%; }
.motor-symbol::after { right: 7px; top: 21px; width: 12px; height: 6px; background: var(--cyan); }
.battery-symbol::before { left: 9px; top: 15px; width: 28px; height: 18px; border: 2px solid var(--green); }
.battery-symbol::after { right: 6px; top: 21px; width: 5px; height: 7px; background: var(--green); }
.switch-symbol::before { left: 10px; top: 24px; width: 28px; height: 2px; background: currentColor; }
.switch-symbol::after { left: 17px; top: 15px; width: 20px; height: 2px; background: currentColor; transform: rotate(-25deg); }
.green-symbol { color: var(--green); }
.red-symbol { color: var(--red); }
.led-symbol::before { left: 16px; top: 10px; width: 17px; height: 17px; border-radius: 50%; background: var(--red); box-shadow: 0 0 18px var(--red); }
.led-symbol::after { left: 22px; top: 28px; width: 4px; height: 10px; background: var(--cyan); }
.cable-symbol::before { left: 10px; top: 12px; width: 28px; height: 22px; border: 3px solid var(--cyan); border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.cloud-symbol::before { left: 9px; top: 20px; width: 30px; height: 14px; border-radius: 14px; background: var(--cyan); }
.cloud-symbol::after { left: 16px; top: 13px; width: 17px; height: 17px; border-radius: 50%; background: var(--cyan); }

.schema-header {
  text-align: center;
}

.schema-official {
  margin: 0 0 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.schema-image-link {
  display: block;
  overflow: hidden;
  background: #02070d;
}

.schema-image-link img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  transition: transform 260ms ease, filter 260ms ease;
}

.schema-official:hover {
  border-color: var(--line-strong);
  box-shadow: 0 22px 70px rgba(92, 225, 255, 0.20);
}

.schema-official:hover img {
  transform: scale(1.025);
  filter: drop-shadow(0 0 22px rgba(92, 225, 255, 0.24));
}

.schema-official figcaption {
  display: flex;
  justify-content: center;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.table-card {
  overflow: hidden;
}

.table-card h3 {
  padding: 18px 18px 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 18px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--cyan);
  font-size: 0.88rem;
  background: rgba(92, 225, 255, 0.08);
}

td {
  color: var(--muted);
}

td:first-child {
  color: var(--text);
  font-weight: 800;
}

.callout {
  margin-top: 20px;
  display: grid;
  gap: 8px;
}

.callout.warning {
  border-color: rgba(255, 79, 104, 0.36);
  background: linear-gradient(135deg, rgba(255, 79, 104, 0.11), transparent), var(--surface);
}

.callout.warning strong {
  color: var(--amber);
  font-size: 1.1rem;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.step-card {
  min-height: 180px;
}

.step-card span {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 32px;
  margin-bottom: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--cyan);
  font-weight: 900;
  background: rgba(92, 225, 255, 0.08);
}

.process-timeline {
  position: relative;
  display: grid;
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
}

.process-timeline::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 30px;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--cyan), var(--green), transparent);
  box-shadow: 0 0 18px rgba(92, 225, 255, 0.42);
  animation: lineGlow 2.8s ease-in-out infinite;
}

.process-step {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 18px;
  min-height: 132px;
  overflow: hidden;
}

.process-step::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(92, 225, 255, 0.08), transparent);
  transform: translateX(-100%);
  animation: scanLine 4.2s ease-in-out infinite;
}

.process-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--cyan);
  font-weight: 900;
  background: #04101b;
  box-shadow: 0 0 0 7px rgba(92, 225, 255, 0.06), 0 0 22px rgba(92, 225, 255, 0.35);
  animation: nodePulse 1.9s ease-in-out infinite;
}

@keyframes lineGlow {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 1; }
}

@keyframes scanLine {
  0%, 60% { transform: translateX(-100%); opacity: 0; }
  72% { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

.technical-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.tech-widget {
  position: relative;
  min-height: 188px;
  overflow: hidden;
}

.tech-widget.ok { border-color: rgba(65, 242, 154, 0.28); }
.tech-widget.warn { border-color: rgba(255, 209, 102, 0.36); }
.tech-widget.error { border-color: rgba(255, 79, 104, 0.46); }

.tech-widget::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(92, 225, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 225, 255, 0.035) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.62;
}

.tech-widget > * {
  position: relative;
  z-index: 1;
}

.widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.state-pill.ok { color: var(--green); background: rgba(65, 242, 154, 0.08); }
.state-pill.warn { color: var(--amber); background: rgba(255, 209, 102, 0.09); }
.state-pill.error { color: var(--red); background: rgba(255, 79, 104, 0.09); }

.tech-widget strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
}

.tech-bar {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
}

.tech-bar span {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 18px rgba(92, 225, 255, 0.36);
  transition: width 520ms ease;
}

.tech-bar.voltage span {
  width: 84%;
  background: linear-gradient(90deg, var(--amber), var(--green));
}

.tech-widget.motor-active .rpm-ring {
  animation-duration: 0.72s;
  border-top-color: var(--green);
  box-shadow: 0 0 22px rgba(65, 242, 154, 0.16);
}

.tech-widget.motor-idle .rpm-ring {
  animation-play-state: paused;
  opacity: 0.65;
}

.rpm-ring {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(92, 225, 255, 0.28);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: motorSpin 1.1s linear infinite;
}

.rpm-ring span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(92, 225, 255, 0.16);
  box-shadow: inset 0 0 0 4px rgba(65, 242, 154, 0.18);
}

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

.gate-simulator {
  margin-top: 22px;
  padding: 22px;
  overflow: hidden;
}

.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.sim-header h3 {
  margin-top: 4px;
}

.sim-lock {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(65, 242, 154, 0.38);
  border-radius: 999px;
  color: var(--green);
  background: rgba(65, 242, 154, 0.08);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.gate-simulator.blocked .sim-lock {
  border-color: rgba(255, 79, 104, 0.5);
  color: var(--red);
  background: rgba(255, 79, 104, 0.12);
  box-shadow: 0 0 24px rgba(255, 79, 104, 0.16);
}

.sim-stage {
  --gate-shift: 0%;
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(92, 225, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 225, 255, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 18% 24%, rgba(92, 225, 255, 0.13), transparent 34%),
    #02070d;
  background-size: 32px 32px, 32px 32px, auto, auto;
}

.gate-simulator.blocked .sim-stage {
  border-color: rgba(255, 79, 104, 0.58);
  box-shadow: inset 0 0 34px rgba(255, 79, 104, 0.12), 0 0 28px rgba(255, 79, 104, 0.12);
}

.sim-grid {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(92, 225, 255, 0.10), transparent);
  transform: translateX(-100%);
  animation: scanLine 4.8s ease-in-out infinite;
}

.sim-track {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 104px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(92, 225, 255, 0.28), rgba(65, 242, 154, 0.2));
  box-shadow: 0 0 18px rgba(92, 225, 255, 0.22);
}

.sim-rack {
  position: absolute;
  left: 10%;
  right: 19%;
  bottom: 128px;
  height: 22px;
  border: 1px solid rgba(92, 225, 255, 0.4);
  border-radius: 4px;
  background:
    repeating-linear-gradient(135deg, rgba(92, 225, 255, 0.75) 0 6px, transparent 6px 13px),
    linear-gradient(180deg, rgba(92, 225, 255, 0.08), rgba(65, 242, 154, 0.08));
  box-shadow: 0 0 22px rgba(92, 225, 255, 0.18);
}

.sim-rack::before {
  content: "CREMAGLIERA";
  position: absolute;
  left: 10px;
  top: -24px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.sim-post {
  position: absolute;
  bottom: 104px;
  width: 22px;
  height: 218px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(92, 225, 255, 0.22), rgba(92, 225, 255, 0.05));
}

.sim-post.left { left: 8%; }
.sim-post.right { right: 8%; }

.sim-gate-panel {
  position: absolute;
  left: 8%;
  bottom: 144px;
  width: min(58%, 600px);
  height: 176px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px 18px 28px;
  border: 2px solid var(--cyan);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent 18%, rgba(92, 225, 255, 0.10) 50%, transparent),
    linear-gradient(135deg, rgba(92, 225, 255, 0.22), rgba(65, 242, 154, 0.08)),
    rgba(3, 14, 24, 0.95);
  box-shadow: 0 0 44px rgba(92, 225, 255, 0.28), inset 0 0 26px rgba(92, 225, 255, 0.08);
  transform: translateX(var(--gate-shift));
  transition: transform 120ms linear;
}

.sim-gate-panel span {
  border: 1px solid rgba(92, 225, 255, 0.48);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(92, 225, 255, 0.14), rgba(255, 255, 255, 0.04)),
    repeating-linear-gradient(135deg, rgba(92, 225, 255, 0.18) 0 8px, transparent 8px 16px);
}

.gate-top-rail,
.gate-bottom-rail {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), rgba(65, 242, 154, 0.65), var(--cyan));
  box-shadow: 0 0 16px rgba(92, 225, 255, 0.28);
}

.gate-top-rail { top: 12px; }
.gate-bottom-rail { bottom: 16px; }

.gate-wheel {
  position: absolute;
  bottom: -19px;
  width: 31px;
  height: 31px;
  border: 4px solid rgba(92, 225, 255, 0.78);
  border-top-color: var(--green);
  border-radius: 50%;
  background: #02070d;
  box-shadow: 0 0 18px rgba(92, 225, 255, 0.22);
}

.wheel-left { left: 16%; }
.wheel-right { right: 16%; }

.sim-stage.moving .gate-wheel {
  animation: motorSpin 0.6s linear infinite;
}

.sim-stage.closing .gate-wheel {
  animation-direction: reverse;
}

.sim-motor {
  position: absolute;
  right: 7%;
  bottom: 128px;
  width: 134px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(92, 225, 255, 0.16), transparent 42%),
    rgba(8, 22, 34, 0.96);
  box-shadow: 0 0 28px rgba(92, 225, 255, 0.18), inset 0 0 18px rgba(0, 0, 0, 0.38);
}

.motor-label {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.pinion-wheel {
  position: absolute;
  left: 18px;
  bottom: -23px;
  width: 58px;
  height: 58px;
  border: 5px solid var(--amber);
  border-top-color: var(--cyan);
  border-bottom-color: var(--green);
  border-radius: 50%;
  background:
    radial-gradient(circle, #02070d 0 22%, rgba(92, 225, 255, 0.22) 23% 34%, transparent 35%),
    repeating-conic-gradient(from 0deg, rgba(255, 209, 102, 0.98) 0deg 9deg, transparent 9deg 18deg);
  box-shadow: 0 0 26px rgba(255, 209, 102, 0.24);
}

.pinion-wheel i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 26px;
  border-radius: 999px;
  background: rgba(92, 225, 255, 0.8);
  transform-origin: 50% 0;
}

.pinion-wheel i:nth-child(1) { transform: rotate(0deg) translateY(-2px); }
.pinion-wheel i:nth-child(2) { transform: rotate(60deg) translateY(-2px); }
.pinion-wheel i:nth-child(3) { transform: rotate(120deg) translateY(-2px); }
.pinion-wheel i:nth-child(4) { transform: rotate(180deg) translateY(-2px); }
.pinion-wheel i:nth-child(5) { transform: rotate(240deg) translateY(-2px); }
.pinion-wheel i:nth-child(6) { transform: rotate(300deg) translateY(-2px); }

.sim-motor::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 40px;
  width: 42px;
  height: 30px;
  border: 1px solid rgba(92, 225, 255, 0.48);
  border-radius: 6px;
  background: rgba(92, 225, 255, 0.10);
}

.sim-stage.moving .pinion-wheel {
  animation: pinionRotate 0.54s linear infinite;
}

.sim-stage.closing .pinion-wheel {
  animation-direction: reverse;
}

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

.sim-led {
  position: absolute;
  top: 32px;
  right: 34px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 209, 102, 0.52);
  border-radius: 50%;
  background: rgba(255, 209, 102, 0.18);
  box-shadow: inset 0 0 0 8px rgba(255, 209, 102, 0.05);
}

.sim-led::before {
  content: "LED";
  position: absolute;
  left: -36px;
  top: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.sim-led span {
  position: absolute;
  left: 9px;
  top: 9px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 209, 102, 0.36);
}

.sim-stage.led-active .sim-led {
  animation: ledBlink 620ms steps(2, end) infinite;
}

@keyframes ledBlink {
  0%, 100% {
    background: rgba(255, 209, 102, 0.16);
    box-shadow: inset 0 0 0 8px rgba(255, 209, 102, 0.04);
  }
  50% {
    background: var(--amber);
    box-shadow: 0 0 26px rgba(255, 209, 102, 0.72);
  }
}

.sim-limit {
  position: absolute;
  bottom: 24px;
  display: grid;
  gap: 4px;
  min-width: 168px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.26);
}

.sim-limit span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.sim-limit strong {
  color: var(--muted);
  font-size: 0.9rem;
}

.sim-limit.pressed {
  border-color: rgba(65, 242, 154, 0.48);
  box-shadow: 0 0 18px rgba(65, 242, 154, 0.12);
}

.sim-limit.pressed strong {
  color: var(--green);
}

.sim-limit-open { right: 8%; }
.sim-limit-close { left: 8%; }

.sim-readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.sim-readout div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(92, 225, 255, 0.06);
}

.sim-readout span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.sim-readout strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 1.22rem;
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.sim-controls button {
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(92, 225, 255, 0.08);
  cursor: pointer;
  font-weight: 900;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.sim-controls button:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  background: rgba(92, 225, 255, 0.15);
  box-shadow: 0 0 22px rgba(92, 225, 255, 0.16);
}

.sim-controls [data-gate-action="open"] { color: var(--green); }
.sim-controls [data-gate-action="close"] { color: var(--cyan); }
.sim-controls [data-gate-action="stop"] { color: var(--red); }
.sim-controls [data-gate-action="reset"] { color: var(--amber); }

.sim-message {
  min-height: 28px;
  margin-top: 14px;
  color: var(--muted);
}

.gate-simulator.blocked .sim-message {
  color: var(--red);
  font-weight: 800;
}

.plant-map-section {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.plant-map-header {
  margin-bottom: 16px;
}

.plant-map-header h3 {
  margin: 4px 0 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.plant-map-dashboard {
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  gap: 18px;
}

.plant-map-status {
  display: grid;
  gap: 12px;
}

.plant-map-status article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(2, 10, 18, 0.74);
}

.plant-map-status span {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.plant-map-status strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 1.25rem;
}

.plant-components-mini {
  position: relative;
}

.component-icons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.component-icons button {
  position: relative;
  min-height: 38px;
  border: 1px solid rgba(92, 225, 255, 0.35);
  border-radius: 6px;
  color: var(--cyan);
  background: linear-gradient(180deg, rgba(92, 225, 255, 0.10), rgba(92, 225, 255, 0.03));
  cursor: help;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0;
}

.component-icons button::before {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(65, 242, 154, 0.7);
}

.component-icons button::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 50;
  width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: rgba(2, 8, 14, 0.98);
  box-shadow: 0 0 20px rgba(92, 225, 255, 0.22);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.component-icons button:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.plant-mini-bar {
  height: 18px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(92, 225, 255, 0.32);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.34);
}

.plant-mini-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 12px),
    linear-gradient(90deg, #00a7ff, var(--cyan), var(--green));
  box-shadow: 0 0 24px rgba(92, 225, 255, 0.68);
  transition: width 160ms linear;
}

.plant-alert {
  color: var(--green);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.plant-alert.blocked {
  color: var(--red);
  border-color: rgba(255, 74, 92, 0.55);
  background: rgba(255, 74, 92, 0.10);
  box-shadow: 0 0 22px rgba(255, 74, 92, 0.18);
}

.plant-map-scene {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background:
    linear-gradient(rgba(92, 225, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 225, 255, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, #09131e 0%, #040910 68%, #03070b 100%);
  background-size: 38px 38px, 38px 38px, auto;
  box-shadow: inset 0 0 46px rgba(0, 0, 0, 0.58), 0 0 34px rgba(92, 225, 255, 0.15);
}

.plant-wall {
  position: absolute;
  top: 118px;
  width: 17%;
  height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(145deg, #2a3340, #111923);
  background-size: 54px 38px, 54px 38px, auto;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.wall-left { left: 2.8%; }
.wall-right { right: 2.8%; }

.plant-pillar {
  position: absolute;
  top: 86px;
  z-index: 6;
  width: 92px;
  height: 235px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(145deg, #444c55, #1b242d);
  background-size: 100% 34px, auto;
  box-shadow: 0 18px 24px rgba(0, 0, 0, 0.34);
}

.pillar-left { left: 12%; }
.pillar-right { right: 14%; }

.plant-gate {
  position: absolute;
  top: 148px;
  left: 13.5%;
  z-index: 5;
  width: clamp(340px, 58vw, 690px);
  height: 158px;
  border: 3px solid rgba(150, 220, 235, 0.76);
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14), transparent 10%, transparent 88%, rgba(255, 255, 255, 0.13)),
    repeating-linear-gradient(0deg, #2c3b4d 0 16px, #162434 16px 30px);
  box-shadow: 0 0 32px rgba(92, 225, 255, 0.24), inset 0 0 28px rgba(0, 0, 0, 0.30);
  transition: transform 80ms linear;
}

.plant-gate span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(120, 190, 210, 0.55);
}

.plant-gate span:nth-child(1) { left: 20%; }
.plant-gate span:nth-child(2) { left: 40%; }
.plant-gate span:nth-child(3) { left: 60%; }
.plant-gate span:nth-child(4) { left: 80%; }

.plant-gate i {
  position: absolute;
  bottom: -22px;
  width: 32px;
  height: 32px;
  border: 4px solid #0c1118;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(92, 225, 255, 0.45);
}

.plant-gate i:nth-of-type(1) { left: 18%; }
.plant-gate i:nth-of-type(2) { right: 18%; }

.plant-map-scene.moving .plant-gate {
  filter: drop-shadow(0 0 18px rgba(92, 225, 255, 0.55));
}

.plant-rack {
  position: absolute;
  top: 338px;
  left: 12%;
  z-index: 4;
  width: 77%;
  height: 28px;
  border-bottom: 4px solid rgba(255, 214, 64, 0.88);
  background: repeating-linear-gradient(90deg, rgba(255, 214, 64, 0.98) 0 10px, transparent 10px 20px);
  filter: drop-shadow(0 0 14px rgba(255, 214, 64, 0.44));
}

.plant-pinion-unit {
  position: absolute;
  top: 318px;
  left: 7%;
  z-index: 14;
  width: 92px;
  height: 92px;
}

.plant-pinion {
  position: absolute;
  inset: 0;
  width: 86px;
  height: 86px;
  border: 6px solid var(--cyan);
  border-radius: 50%;
  background:
    radial-gradient(circle, #dce8ee 0 14%, #324557 15% 36%, #07101b 37%),
    repeating-conic-gradient(from 0deg, var(--cyan) 0deg 9deg, transparent 9deg 18deg);
  box-shadow: 0 0 34px rgba(92, 225, 255, 0.48);
}

.plant-pinion i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 96px;
  margin: -48px 0 0 -4px;
  background: var(--cyan);
  border-radius: 999px;
  opacity: 0.7;
}

.plant-pinion i:nth-child(2) { transform: rotate(30deg); }
.plant-pinion i:nth-child(3) { transform: rotate(60deg); }
.plant-pinion i:nth-child(4) { transform: rotate(90deg); }
.plant-pinion i:nth-child(5) { transform: rotate(120deg); }
.plant-pinion i:nth-child(6) { transform: rotate(150deg); }

.plant-map-scene.moving .plant-pinion {
  animation: plantPinionSpin 420ms linear infinite;
}

.plant-map-scene.closing .plant-pinion {
  animation-direction: reverse;
}

.plant-limit {
  position: absolute;
  z-index: 10;
  width: 190px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(3, 11, 19, 0.92);
  box-shadow: 0 0 18px rgba(92, 225, 255, 0.10);
}

.plant-limit strong {
  display: block;
  color: var(--text);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.plant-limit span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.plant-limit.open { right: 6%; top: 398px; }
.plant-limit.close { left: 6%; top: 398px; }

.plant-limit.pressed {
  border-color: rgba(71, 255, 126, 0.75);
  background: rgba(65, 242, 154, 0.10);
  box-shadow: 0 0 28px rgba(71, 255, 126, 0.30), inset 0 0 20px rgba(71, 255, 126, 0.08);
}

.plant-limit.pressed span {
  color: var(--green);
  font-weight: 900;
}

.plant-wire {
  position: absolute;
  z-index: 3;
  height: 3px;
  border-radius: 999px;
  background-size: 220% 100%;
  filter: drop-shadow(0 0 8px currentColor);
  animation: plantWireFlow 2.4s linear infinite;
}

.wire-power {
  left: 49%;
  bottom: 70px;
  width: 35%;
  color: var(--red);
  background-image: linear-gradient(90deg, transparent, var(--red), transparent);
}

.wire-signal {
  left: 43%;
  top: 428px;
  width: 25%;
  color: var(--cyan);
  background-image: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.wire-encoder {
  left: 22%;
  top: 418px;
  width: 29%;
  color: #7a48ff;
  background-image: linear-gradient(90deg, transparent, #9c6bff, transparent);
}

.wire-motor {
  left: 19%;
  top: 318px;
  width: 17%;
  color: var(--amber);
  background-image: linear-gradient(90deg, transparent, var(--amber), transparent);
}

.wire-cloud {
  right: 11%;
  top: 282px;
  width: 22%;
  color: var(--green);
  transform: rotate(-16deg);
  transform-origin: right center;
  background-image: linear-gradient(90deg, transparent, var(--green), transparent);
}

.wifi-pulse {
  position: absolute;
  right: 14%;
  top: 208px;
  z-index: 2;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(92, 225, 255, 0.65);
  border-radius: 50%;
  opacity: 0;
  animation: plantWifiPulse 2.2s ease-out infinite;
}

.wifi-pulse.two { animation-delay: 0.45s; }
.wifi-pulse.three { animation-delay: 0.9s; }

.plant-map-scene.blocked::after {
  content: "BLOCCO SICUREZZA";
  position: absolute;
  inset: 24px;
  z-index: 30;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 74, 92, 0.65);
  border-radius: var(--radius);
  color: var(--red);
  background: rgba(12, 3, 7, 0.72);
  box-shadow: inset 0 0 36px rgba(255, 74, 92, 0.20), 0 0 34px rgba(255, 74, 92, 0.22);
  font-size: clamp(1.8rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: 0;
}

.plant-map-scene.blocked .plant-wire,
.plant-map-scene.blocked .wifi-pulse {
  animation-play-state: paused;
  opacity: 0.18;
}

.plant-map-scene.blocked .plant-led span {
  animation: none;
  filter: saturate(0.5);
  box-shadow: 0 0 8px rgba(255, 190, 48, 0.16);
}

.plant-map-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.plant-map-controls button {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(92, 225, 255, 0.08);
  cursor: pointer;
  font-weight: 900;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.plant-map-controls button:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  background: rgba(92, 225, 255, 0.15);
  box-shadow: 0 0 22px rgba(92, 225, 255, 0.16);
}

#plant-open { color: var(--green); }
#plant-close { color: var(--cyan); }
#plant-stop { color: var(--red); }
#plant-reset { color: var(--amber); }

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

@keyframes plantLedBlink {
  50% {
    filter: brightness(1.85);
    box-shadow: 0 0 34px rgba(255, 190, 48, 0.9);
  }
}

@keyframes plantWireFlow {
  to { background-position: -220% 0; }
}

@keyframes plantWifiPulse {
  0% {
    opacity: 0.85;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(2.2);
  }
}

@media (max-width: 980px) {
  .plant-map-dashboard {
    grid-template-columns: 1fr;
  }

  .plant-map-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plant-map-scene {
    min-height: 720px;
  }
}

@media (max-width: 680px) {
  .plant-map-section {
    padding: 16px;
  }

  .plant-map-status,
  .plant-map-controls {
    grid-template-columns: 1fr;
  }

  .plant-map-scene {
    min-height: 610px;
  }

  .plant-gate {
    top: 132px;
    left: 7%;
    width: min(74vw, 410px);
    height: 126px;
  }

  .plant-rack {
    top: 292px;
    left: 7%;
    width: 86%;
  }

  .plant-pinion-unit {
    top: 274px;
    left: 5%;
    width: 74px;
    height: 74px;
  }

  .plant-pinion {
    width: 72px;
    height: 72px;
  }

  .plant-pinion i {
    height: 82px;
    margin-top: -41px;
  }

  .plant-limit {
    width: min(42vw, 190px);
  }

  .plant-limit.close {
    left: 6%;
    top: 402px;
  }

  .plant-limit.open {
    right: 6%;
    left: auto;
    top: 402px;
  }

  .component-icons {
    grid-template-columns: repeat(5, 1fr);
  }
}

.legend-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.legend-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.legend-strip .status-dot {
  position: static;
  display: inline-block;
}

.development-timeline {
  position: relative;
  display: grid;
  gap: 28px;
  padding-left: 34px;
}

.development-timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(92, 225, 255, 0.88), rgba(65, 242, 154, 0.62), transparent);
  box-shadow: 0 0 22px rgba(92, 225, 255, 0.42);
}

.dev-phase {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: center;
  overflow: hidden;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(92, 225, 255, 0.08), transparent 36%),
    rgba(6, 17, 27, 0.78);
}

.dev-phase::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 42px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  background: #02070d;
  box-shadow: 0 0 18px rgba(92, 225, 255, 0.65);
}

.dev-phase::after {
  content: "";
  position: absolute;
  left: -13px;
  top: 51px;
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, rgba(92, 225, 255, 0.8), transparent);
}

.dev-phase figure {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(260px, 28vw, 340px);
  max-height: 340px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #02070d;
}

.dev-phase figure::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 62%, rgba(2, 7, 13, 0.60)),
    linear-gradient(90deg, rgba(92, 225, 255, 0.12), transparent 28%);
}

.dev-phase img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #02070d;
  filter: saturate(1.08) contrast(1.02);
  transition: transform 220ms ease, filter 220ms ease;
}

.dev-phase:hover img {
  transform: scale(1.025);
  filter: saturate(1.2) contrast(1.06) drop-shadow(0 0 18px rgba(92, 225, 255, 0.18));
}

.dev-content {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: clamp(6px, 1.8vw, 18px);
}

.dev-phase span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 2px;
  padding: 7px 10px;
  border: 1px solid rgba(92, 225, 255, 0.34);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(92, 225, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dev-phase h3 {
  max-width: 760px;
  color: var(--text);
  font-size: clamp(1.28rem, 2vw, 2rem);
  letter-spacing: 0;
}

.dev-phase h4 {
  margin: 4px 0 -2px;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dev-phase p {
  max-width: 760px;
  font-size: 1rem;
}

.phase-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.phase-list li {
  position: relative;
  padding: 9px 10px 9px 28px;
  border: 1px solid rgba(92, 225, 255, 0.18);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(92, 225, 255, 0.045);
  font-weight: 700;
}

.phase-list li::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(65, 242, 154, 0.52);
  transform: translateY(-50%);
}

.final-phase {
  border-color: rgba(65, 242, 154, 0.34);
  background:
    linear-gradient(135deg, rgba(65, 242, 154, 0.10), transparent 34%),
    rgba(6, 17, 27, 0.82);
}

.final-phase::before {
  border-color: var(--green);
  box-shadow: 0 0 22px rgba(65, 242, 154, 0.65);
}

.final-badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.final-badges strong {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(65, 242, 154, 0.34);
  border-radius: 999px;
  color: var(--green);
  background: rgba(65, 242, 154, 0.08);
  box-shadow: 0 0 18px rgba(65, 242, 154, 0.12);
  font-size: 0.92rem;
}

.code-grid { grid-template-columns: 1fr; }
.code-card { overflow: hidden; }

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.copy-btn {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(92, 225, 255, 0.10);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.copy-btn.is-copied {
  color: #031016;
  background: var(--green);
}

.code-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, 0.55fr);
}

pre {
  margin: 0;
  max-height: 560px;
  overflow: auto;
  padding: 20px;
  color: #d7f9ff;
  background: #02070d;
  font-size: 0.86rem;
  line-height: 1.55;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.code-note {
  padding: 20px;
  border-left: 1px solid var(--line);
  background: rgba(92, 225, 255, 0.05);
}

.safety-grid { grid-template-columns: repeat(4, 1fr); }
.safety-card { min-height: 190px; }
.safety-card .status-dot { display: block; margin-bottom: 16px; }
.safety-card.important { border-color: rgba(255, 79, 104, 0.44); }

.cloud-dashboard {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  margin-top: 20px;
  padding: 22px;
  align-items: center;
}

.dash-screen {
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(92, 225, 255, 0.10), rgba(65, 242, 154, 0.06)), rgba(0, 0, 0, 0.24);
}

.dash-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dash-top span { color: var(--muted); }
.dash-top strong { color: var(--green); }

.dash-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.dash-buttons button {
  min-height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(92, 225, 255, 0.08);
  font-weight: 900;
}

.dash-meter {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.dash-meter span {
  height: 12px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--cyan), transparent);
  animation: meterPulse 2.2s ease-in-out infinite;
}

.dash-meter span:nth-child(2) { width: 72%; background: linear-gradient(90deg, var(--green), transparent); animation-delay: 240ms; }
.dash-meter span:nth-child(3) { width: 52%; background: linear-gradient(90deg, var(--red), transparent); animation-delay: 480ms; }

@keyframes meterPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

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

.gallery-art {
  position: relative;
  height: 190px;
  margin: -2px -2px 18px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(rgba(92, 225, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 225, 255, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, rgba(92, 225, 255, 0.12), rgba(65, 242, 154, 0.06));
  background-size: 26px 26px, 26px 26px, auto;
}

.gate-art::before { left: 28px; right: 28px; bottom: 38px; height: 74px; border: 2px solid var(--cyan); background: repeating-linear-gradient(90deg, rgba(92, 225, 255, 0.16) 0 8px, transparent 8px 22px); }
.gate-art::after { right: 24px; bottom: 28px; width: 54px; height: 46px; border-radius: var(--radius); background: rgba(255, 209, 102, 0.25); border: 1px solid var(--amber); }
.arduino-art::before, .driver-art::before { left: 38px; right: 38px; top: 42px; bottom: 42px; border: 2px solid var(--cyan); border-radius: var(--radius); background: rgba(4, 24, 35, 0.74); }
.arduino-art::after { left: 90px; top: 74px; width: 54px; height: 36px; background: rgba(65, 242, 154, 0.22); border: 1px solid var(--green); }
.driver-art::after { left: 70px; right: 70px; top: 82px; height: 26px; background: repeating-linear-gradient(90deg, var(--red) 0 8px, rgba(255, 79, 104, 0.22) 8px 14px); }
.motor-art::before { left: 74px; top: 52px; width: 82px; height: 82px; border-radius: 50%; border: 8px solid var(--amber); border-top-color: var(--cyan); }
.motor-art::after { left: 154px; top: 88px; width: 70px; height: 10px; background: var(--cyan); }
.wiring-art::before { left: 40px; top: 46px; width: 72px; height: 82px; border: 2px solid var(--cyan); border-radius: var(--radius); }
.wiring-art::after { right: 44px; top: 60px; width: 90px; height: 54px; border: 2px solid var(--green); border-radius: var(--radius); }
.wiring-art span { left: 112px; right: 134px; top: 82px; height: 3px; background: linear-gradient(90deg, var(--cyan), var(--green)); box-shadow: 0 0 14px rgba(92, 225, 255, 0.5); }
.cloud-art::before { left: 50px; right: 50px; top: 42px; height: 105px; border: 2px solid var(--cyan); border-radius: var(--radius); background: rgba(0, 0, 0, 0.18); }
.cloud-art::after { left: 76px; right: 76px; top: 76px; height: 22px; background: linear-gradient(90deg, var(--green), var(--cyan), var(--red)); }
.sim-art::before { left: 54px; top: 48px; width: 82px; height: 82px; border: 3px solid var(--cyan); border-radius: 50%; }
.sim-art::after { left: 118px; top: 86px; width: 94px; height: 3px; background: var(--green); transform: rotate(-18deg); }

.conclusion-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 22px;
  padding: 24px;
}

.quote {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 1.38rem;
  line-height: 1.35;
  font-weight: 800;
}

.contact-card {
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(92, 225, 255, 0.07);
}

.contact-card strong {
  display: block;
  margin-top: 2px;
  font-size: 1.25rem;
}

.contact-card .btn {
  width: 100%;
  margin-top: 18px;
}

.pdf-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-top: 22px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 79, 104, 0.10), transparent 30%),
    linear-gradient(90deg, rgba(92, 225, 255, 0.09), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.pdf-card:hover {
  transform: translateY(-4px);
  border-color: rgba(92, 225, 255, 0.74);
  box-shadow: 0 22px 56px rgba(0, 200, 255, 0.14);
}

.pdf-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 88px;
  border: 2px solid var(--red);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 79, 104, 0.10);
  box-shadow: 0 0 24px rgba(255, 79, 104, 0.20);
}

.pdf-icon::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-left: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  background: var(--surface);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.pdf-icon span {
  margin-top: 16px;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 900;
}

.pdf-card-copy h3 {
  margin: 5px 0 8px;
  color: var(--text);
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.pdf-card-copy p {
  margin: 0;
  color: var(--muted);
}

.pdf-actions {
  display: grid;
  gap: 10px;
  min-width: 220px;
}

.pdf-actions .btn {
  width: 100%;
  text-align: center;
}

.completion-card {
  margin-top: 22px;
  border-color: rgba(65, 242, 154, 0.30);
  background:
    linear-gradient(135deg, rgba(65, 242, 154, 0.11), transparent 36%),
    linear-gradient(90deg, rgba(92, 225, 255, 0.08), transparent 46%),
    rgba(6, 17, 27, 0.82);
}

.completion-card h3 {
  color: var(--text);
  font-size: clamp(1.35rem, 2vw, 2rem);
  text-transform: uppercase;
}

.project-credit {
  margin-top: 18px;
  color: var(--text);
  font-size: 1.05rem;
}

.project-credit strong {
  color: var(--cyan);
}

.school-year {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  padding: 20px 24px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(2, 7, 13, 0.80);
}

.site-footer strong {
  color: var(--text);
  letter-spacing: 0;
}

.site-footer span:nth-child(2) {
  color: var(--cyan);
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 560ms ease, transform 560ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1320px) {
  .menu-toggle { display: inline-grid; order: 3; }
  .theme-toggle { order: 2; margin-left: auto; }
  .main-nav {
    position: fixed;
    left: 16px;
    right: 16px;
    top: calc(var(--topbar-height) + 10px);
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
  }
  .main-nav.is-open { display: grid; }
  .main-nav a { justify-content: center; }
  body:not(.home-mode) .content { width: calc(100% - 310px); margin-left: 286px; margin-right: 24px; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .quick-grid, .component-grid, .safety-grid, .gallery-grid, .technical-dashboard { grid-template-columns: repeat(2, 1fr); }
  .section-grid.three { grid-template-columns: repeat(2, 1fr); }
  .development-timeline::before { left: 10px; }
}

@media (max-width: 900px) {
  :root { --topbar-height: 68px; }
  .topbar { padding: 0 16px; }
  .brand-text,
  .brand-school { display: none; }
  .sidebar {
    position: static;
    width: calc(100% - 32px);
    margin: calc(var(--topbar-height) + 16px) auto 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  body.home-mode .sidebar { display: none; }
  body:not(.home-mode) .content, .content { width: calc(100% - 32px); margin: 0 auto; padding-top: 28px; }
  body.home-mode .content { padding-top: calc(var(--topbar-height) + 22px); }
  .side-nav { grid-template-columns: repeat(3, 1fr); }
  .status-panel { display: none; }
  .hero-copy h1, .page-header h2 { font-size: 3rem; }
  .hero-copy h2 { font-size: 1.8rem; }
  .architecture-strip, .section-grid.two, .section-grid.three, .timeline, .cloud-dashboard, .code-layout, .conclusion-panel, .pdf-card, .sim-readout { grid-template-columns: 1fr; }
  .pdf-icon { width: 60px; height: 74px; }
  .pdf-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
  .process-timeline::before { left: 21px; }
  .process-step { grid-template-columns: 48px minmax(0, 1fr); }
  .dev-phase { grid-template-columns: 1fr; }
  .dev-phase figure {
    height: clamp(260px, 48vw, 340px);
    max-height: 340px;
  }
  .final-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-stage { min-height: 300px; }
  .sim-gate-panel { left: 7%; width: 62%; height: 140px; }
  .sim-motor { right: 5%; width: 116px; height: 98px; }
  .pinion-wheel { width: 50px; height: 50px; }
  .flow-line { height: 24px; width: 2px; justify-self: center; }
  .code-note { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .main-nav, .quick-grid, .component-grid, .safety-grid, .gallery-grid, .side-nav, .technical-dashboard { grid-template-columns: 1fr; }
  .pdf-actions { grid-template-columns: 1fr; }
  .hero-copy h1, .page-header h2 { font-size: 2.45rem; }
  .hero-copy h2 { font-size: 1.45rem; }
  .hero-text { font-size: 1rem; }
  .hero-actions, .dash-buttons, .sim-controls { display: grid; grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .hero-visual { min-height: 390px; }
  .arduino, .driver { transform: scale(0.78); transform-origin: top left; }
  .driver { transform-origin: top right; }
  .gate-panel { width: 50%; height: 106px; }
  .motor-box { right: 18px; width: 72px; height: 62px; }
  .limit-switch, .wire, .pulse-node { display: none; }
  .quick-card, .info-block, .component-card, .step-card, .process-step, .tech-widget, .gate-simulator, .dev-phase, .safety-card, .gallery-card, .exam-note, .callout { padding: 18px; }
  .development-timeline {
    gap: 22px;
    padding-left: 24px;
  }
  .development-timeline::before {
    left: 7px;
  }
  .dev-phase::before {
    left: -25px;
    top: 34px;
    width: 14px;
    height: 14px;
  }
  .dev-phase::after {
    left: -11px;
    top: 42px;
    width: 18px;
  }
  .dev-phase figure {
    height: clamp(220px, 58vw, 280px);
    max-height: 280px;
  }
  .phase-list,
  .final-badges {
    grid-template-columns: 1fr;
  }
  .code-header, .dash-top, .sim-header { display: grid; }
  .widget-head { align-items: flex-start; }
  .process-step { min-height: auto; gap: 12px; }
  .process-dot { width: 36px; height: 36px; font-size: 0.82rem; }
  .sim-stage { min-height: 360px; }
  .sim-gate-panel {
    left: 10%;
    bottom: 160px;
    width: 70%;
    height: 110px;
    gap: 6px;
    padding: 8px;
  }
  .sim-rack {
    left: 10%;
    right: 10%;
    bottom: 146px;
  }
  .sim-track { bottom: 146px; }
  .sim-post { bottom: 146px; height: 124px; }
  .sim-motor {
    right: 7%;
    bottom: 72px;
    width: 86px;
    height: 70px;
  }
  .motor-label { display: none; }
  .pinion-wheel {
    left: 10px;
    bottom: -17px;
    width: 40px;
    height: 40px;
    border-width: 4px;
  }
  .sim-led { top: 22px; right: 22px; }
  .sim-limit {
    left: 18px;
    right: 18px;
    min-width: 0;
  }
  .sim-limit-open { bottom: 20px; }
  .sim-limit-close { bottom: 88px; }
  .copy-btn { width: 100%; }
  pre { font-size: 0.78rem; }
  .gallery-art { height: 160px; }
  .quote { font-size: 1.12rem; }
}

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