/* 物联网虚拟仿真系统 - 共享样式（浅色科技风） */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  font-family: "Source Han Sans CN", "Noto Sans CJK SC", sans-serif;
  background: #eef3fb;
  color: #1f2a44;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

.app {
  display: flex;
  height: 100vh;
  background:
    radial-gradient(1100px 520px at 8% 0%, #dce9ff 0%, transparent 60%),
    radial-gradient(900px 460px at 100% 100%, #d6f0ff 0%, transparent 55%),
    linear-gradient(180deg, #f5f8ff, #eef3fb);
}

/* 顶栏 */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(255,255,255,.92), rgba(235,243,255,.85));
  border-bottom: 1px solid rgba(37,99,235,.18);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 16px rgba(37,99,235,.06);
  z-index: 100;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #1e40af;
}
.topbar .brand .logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 4px 14px rgba(59,130,246,.4);
}
.topbar .crumbs {
  color: #64748b;
  font-size: 14px;
}
.topbar .crumbs a { color: #1e40af; }
.topbar .crumbs a:hover { text-decoration: underline; }
.topbar .crumbs span { color: #94a3b8; margin: 0 6px; }
.topbar .tools { display: flex; gap: 12px; }

/* 通用次按钮（重置 / 帮助） */
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(59,130,246,.08);
  border: 1px solid rgba(59,130,246,.35);
  color: #1e40af;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.btn:hover { background: rgba(59,130,246,.16); border-color: rgba(59,130,246,.55); }

/* 首页主内容顶部工具条 */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.page-toolbar .page-title { margin-bottom: 0; }
.page-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 实验页画布顶部工具条 */
.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.canvas-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* 左侧导航 */
.sidebar {
  width: 220px;
  padding-top: 16px;
  background: rgba(255,255,255,.78);
  border-right: 1px solid rgba(37,99,235,.12);
  flex-shrink: 0;
  overflow-y: auto;
  backdrop-filter: blur(8px);
}
.sidebar .menu-title {
  padding: 10px 22px;
  font-size: 14px;
  color: #64748b;
  letter-spacing: 2px;
}
.sidebar .menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  color: #475569;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .2s;
  font-size: 14px;
}
.sidebar .menu-item:hover {
  background: rgba(59,130,246,.08);
  color: #1e40af;
}
.sidebar .menu-item.active {
  background: linear-gradient(90deg, rgba(59,130,246,.18), transparent);
  color: #1e40af;
  border-left-color: #3b82f6;
  font-weight: 600;
}
.sidebar .menu-item .ico {
  width: 18px; height: 18px;
  opacity: .85;
}

/* 主内容区 */
.main {
  flex: 1;
  padding: 20px 28px;
  overflow: auto;
}
.main h1.page-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #1e293b;
}
.main .page-desc {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 20px;
}

/* 分类 & 实验卡片 */
.category {
  margin-bottom: 26px;
}
.category .cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(37,99,235,.22);
}
.category .cat-head .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 10px rgba(59,130,246,.7);
}
.category .cat-head h2 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}
.category .cat-head .count {
  font-size: 14px;
  color: #64748b;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.exp-card {
  position: relative;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #f3f7ff);
  border: 1px solid rgba(37,99,235,.14);
  cursor: pointer;
  transition: all .25s;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.exp-card:hover {
  transform: translateY(-3px);
  border-color: rgba(59,130,246,.55);
  box-shadow: 0 10px 28px rgba(59,130,246,.18);
}
.exp-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.18), transparent 70%);
}
.exp-card .icon {
  width: 44px; height: 44px;
  margin-bottom: 10px;
  background: rgba(59,130,246,.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
}
.exp-card .title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}
.exp-card .sub {
  font-size: 14px;
  color: #64748b;
}
.exp-card.disabled {
  opacity: .6;
  cursor: not-allowed;
  background: linear-gradient(135deg, #f8fafc, #eef2f7);
}
.exp-card .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 14px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(34,197,94,.15);
  color: #15803d;
  border: 1px solid rgba(34,197,94,.4);
}
.exp-card.disabled .badge {
  background: rgba(148,163,184,.18);
  color: #64748b;
  border-color: rgba(148,163,184,.4);
}
.exp-card .badge.wip-badge {
  background: rgba(245,158,11,.15);
  color: #b45309;
  border: 1px solid rgba(245,158,11,.4);
}
.exp-card.wip { opacity: .85; }
.exp-card.wip:hover { transform: none; box-shadow: 0 4px 14px rgba(0,0,0,.06); }

/* 网络安全规划入口 */
.security-catalog .catalog-desc {
  max-width: 960px;
  margin: -2px 0 14px 18px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
}
.security-catalog-wifi .cat-head .dot {
  background: #0891b2;
  box-shadow: 0 0 10px rgba(8,145,178,.55);
}
.security-catalog-rfid .cat-head .dot {
  background: #ea580c;
  box-shadow: 0 0 10px rgba(234,88,12,.5);
}
.security-track + .security-track {
  margin-top: 20px;
}
.security-track-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding-left: 14px;
  border-left: 3px solid #ea580c;
}
.security-track-head h3 {
  color: #334155;
  font-size: 15px;
  font-weight: 600;
}
.security-track-head span {
  color: #64748b;
  font-size: 14px;
}
.planned-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
}
.planned-card:focus-visible {
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}
.security-catalog-wifi .planned-card .icon {
  color: #0e7490;
  background: rgba(8,145,178,.12);
}
.security-catalog-rfid .planned-card .icon {
  color: #c2410c;
  background: rgba(234,88,12,.12);
}
.planned-card .sub {
  line-height: 1.65;
  flex: 1;
}
.experiment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.experiment-code,
.experiment-type {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}
.experiment-code {
  color: #475569;
  background: #eef2f7;
  border: 1px solid #d8e0ea;
}
.experiment-type {
  color: #b91c1c;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}
.experiment-type.is-comprehensive {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

@media (max-width: 760px) {
  .security-catalog .catalog-desc {
    margin-left: 0;
  }
  .planned-card {
    min-height: 0;
  }
}

/* 通用按钮 */
.btn-primary {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
  box-shadow: 0 4px 12px rgba(59,130,246,.3);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 6px 18px rgba(59,130,246,.45); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.btn-primary.running {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 12px rgba(239,68,68,.35);
}
.btn-primary.running:hover { box-shadow: 0 6px 18px rgba(239,68,68,.5); }
.btn-ghost {
  padding: 8px 14px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(37,99,235,.35);
  color: #1e40af;
  cursor: pointer;
  font-size: 14px;
}
.btn-ghost:hover { background: rgba(59,130,246,.08); }

/* Toast / 提示 */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(37,99,235,.35);
  color: #1e293b;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, top .25s;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
}
.toast.show { opacity: 1; top: 72px; }
.toast.error { border-color: #ef4444; color: #b91c1c; background: #fff1f2; }
.toast.success { border-color: #22c55e; color: #15803d; background: #f0fdf4; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(59,130,246,.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(59,130,246,.45); }

/* 返回按钮 */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(37,99,235,.3);
  color: #1e40af;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-back:hover { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.55); }
.btn-back svg { width: 14px; height: 14px; }

/* 实验介绍按钮 */
.btn-intro {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.4);
  color: #4338ca;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.btn-intro:hover { background: rgba(99,102,241,.2); }
.btn-intro svg { width: 14px; height: 14px; }

/* 画布工具条左侧的实验介绍按钮（醒目主色） */
.btn-intro.btn-intro-canvas {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(99,102,241,.95), rgba(59,130,246,.95));
  border: 1px solid rgba(99,102,241,.6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,.3);
}
.btn-intro.btn-intro-canvas:hover {
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  box-shadow: 0 6px 20px rgba(99,102,241,.5);
}
.btn-intro.btn-intro-canvas svg { width: 15px; height: 15px; stroke: #fff; }

/* 模态框 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}
.modal-mask.show { display: flex; }
.modal {
  width: min(640px, 92vw);
  max-height: 85vh;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(37,99,235,.18);
  box-shadow: 0 24px 60px rgba(15,23,42,.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn .25s ease;
}
.modal.modal-lg { width: min(1320px, 96vw); max-height: 92vh; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-hd {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(37,99,235,.12);
  background: linear-gradient(90deg, rgba(59,130,246,.06), transparent);
}
.modal-hd .title {
  font-size: 15px;
  font-weight: 700;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-hd .title::before {
  content: "";
  width: 4px; height: 15px;
  background: linear-gradient(180deg, #3b82f6, #6366f1);
  border-radius: 2px;
}
.modal-hd .close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(239,68,68,.1);
  color: #b91c1c;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: all .2s;
}
.modal-hd .close:hover { background: rgba(239,68,68,.2); }
.modal-bd {
  padding: 16px 20px 20px;
  overflow-y: auto;
  color: #334155;
  font-size: 14px;
  line-height: 1.85;
}
.modal-bd h3 {
  font-size: 14px;
  color: #1e40af;
  margin: 10px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-bd h3::before {
  content: "";
  width: 3px; height: 12px;
  background: #3b82f6;
  border-radius: 2px;
}
.modal-bd h3:first-child { margin-top: 0; }
.modal-bd ol, .modal-bd ul {
  padding-left: 22px;
  margin-bottom: 4px;
}
.modal-bd li {
  margin-bottom: 4px;
}
.modal-bd p { margin-bottom: 6px; }
.modal-bd strong { color: #1e293b; }

/* 二级分类样式 */
.subcategory {
  margin-bottom: 2rem;
}

.subcat-title {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 1rem 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 8px;
  border-left: 4px solid #dc2626;
}

.subcat-icon {
  font-size: 1.3rem;
  margin-right: 0.5rem;
}

.subcategory .grid {
  margin-left: 1rem;
}
