/* ==========================================================================
   第三章 有線區域網路 (Wired LAN) - 專業現代互動學習介面樣式表
   設計風格：專業簡潔、現代白/淺色主題、科技藍主色調、高度響應式
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --secondary: #475569;
  --secondary-light: #f1f5f9;
  
  --accent: #0ea5e9;
  --accent-purple: #8b5cf6;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --font-sans: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, "Courier New", monospace;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

html, body {
  font-family: var(--font-sans);
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Utility Layouts */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-end { align-items: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.hidden { display: none !important; }

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

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

/* Header Banner */
.site-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  color: #ffffff;
  padding: 2.5rem 1.5rem 2rem;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
}

.header-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.header-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.header-title span {
  font-size: 1.15rem;
  font-weight: 400;
  opacity: 0.85;
  display: inline-block;
  margin-left: 0.5rem;
  font-family: var(--font-mono);
}

.header-desc {
  font-size: 1.05rem;
  opacity: 0.92;
  max-width: 880px;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.header-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Sticky Navigation Bar */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}

.nav-wrapper {
  max-width: 1360px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
}

.nav-container {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.25rem;
}

.nav-container::-webkit-scrollbar {
  height: 4px;
}

.nav-container::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.nav-container::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.nav-tab {
  flex: 1 0 auto;
  background: transparent;
  border: none;
  padding: 0.85rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.91rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: #ffffff;
  font-weight: 700;
}

.nav-tab.highlight-tab {
  position: relative;
}

.nav-tab.highlight-tab::after {
  content: '核心';
  position: absolute;
  top: 4px;
  right: 4px;
  background: #f43f5e;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
}

.nav-scroll-btn {
  background: #ffffff;
  border: 1px solid var(--gray-300);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gray-700);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 10;
  transition: all 0.2s ease;
  margin: 0 4px;
  flex-shrink: 0;
  user-select: none;
}

.nav-scroll-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  box-shadow: var(--shadow);
}

.nav-scroll-btn.hidden {
  display: none !important;
}

/* Main Content Area */
.main-container {
  max-width: 1280px;
  margin: 2rem auto 4rem;
  padding: 0 1.5rem;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-pane.active {
  display: block;
}

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

/* Section Intros */
.section-intro {
  margin-bottom: 1.75rem;
}

.section-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.badge-accent {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.section-intro h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 0.35rem;
}

.section-intro p {
  color: var(--gray-600);
  font-size: 1.05rem;
  max-width: 960px;
}

/* Content Cards */
.content-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 0.85rem;
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
}

.card-header h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Button & Form Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background: var(--secondary);
  color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-700);
}

.btn-outline {
  background: #ffffff;
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-input, .form-select {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-300);
  background: #ffffff;
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-600);
}

.tag-blue {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

/* ==========================================================================
   MODULE 1: 3-1 傳輸媒介卡片與剖面模擬
   ========================================================================== */

.media-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.media-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

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

.media-card.active-card {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-border);
}

.media-card-header {
  padding: 1.25rem 1.25rem 0.5rem;
}

.media-card-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.media-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.35rem;
}

.badge-copper { background: #ffedd5; color: #c2410c; }
.badge-coax { background: #f1f5f9; color: #475569; }
.badge-fiber { background: #e0f2fe; color: #0284c7; }

/* CSS Cross-section Visuals */
.cable-visual-container {
  height: 140px;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

/* Twisted Pair CSS Art */
.visual-twisted-pair {
  display: flex;
  align-items: center;
  width: 90%;
  max-width: 280px;
  position: relative;
}

.jacket-cutaway {
  width: 90px;
  height: 38px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  border-radius: 8px 0 0 8px;
  position: relative;
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.jacket-label {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.twisted-wires {
  flex: 1;
  height: 34px;
  position: relative;
}

.wire-pair {
  position: absolute;
  height: 10px;
  width: 100%;
  border-radius: 5px;
}

.wire-1 {
  background: repeating-linear-gradient(45deg, #10b981, #10b981 12px, #ffffff 12px, #ffffff 24px);
  top: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wire-2 {
  background: repeating-linear-gradient(45deg, #f97316, #f97316 12px, #ffffff 12px, #ffffff 24px);
  top: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wire-3 {
  background: repeating-linear-gradient(45deg, #3b82f6, #3b82f6 12px, #ffffff 12px, #ffffff 24px);
  top: 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Coaxial Cable CSS Art */
.visual-coaxial {
  display: flex;
  align-items: center;
  width: 90%;
  max-width: 280px;
}

.coax-outer-jacket {
  width: 70px;
  height: 48px;
  background: #1e293b;
  border-radius: 8px 0 0 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.coax-braid {
  width: 55px;
  height: 38px;
  background: repeating-linear-gradient(45deg, #94a3b8, #94a3b8 4px, #64748b 4px, #64748b 8px);
}

.coax-dielectric {
  width: 55px;
  height: 26px;
  background: #e2e8f0;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}

.coax-core {
  width: 60px;
  height: 12px;
  background: linear-gradient(180deg, #f59e0b, #b45309);
  border-radius: 0 6px 6px 0;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

/* Fiber Cable CSS Art */
.visual-fiber {
  display: flex;
  align-items: center;
  width: 90%;
  max-width: 280px;
  position: relative;
}

.fiber-jacket {
  width: 70px;
  height: 42px;
  background: #facc15;
  border-radius: 8px 0 0 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.fiber-cladding {
  width: 70px;
  height: 28px;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
}

.fiber-core {
  width: 80px;
  height: 10px;
  background: #0284c7;
  position: relative;
  overflow: hidden;
  border-radius: 0 5px 5px 0;
  box-shadow: 0 0 12px #38bdf8;
}

.light-ray {
  position: absolute;
  top: 0;
  left: -50px;
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, transparent, #ffffff, transparent);
  animation: fiberGlow 1.8s infinite linear;
}

@keyframes fiberGlow {
  0% { left: -40px; }
  100% { left: 100%; }
}

.media-card-body {
  padding: 1.25rem;
  flex: 1;
}

.media-card-body p {
  font-size: 0.92rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
}

.media-spec-list {
  list-style: none;
  font-size: 0.85rem;
  border-top: 1px dashed var(--gray-200);
  padding-top: 0.75rem;
}

.media-spec-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
}

.media-spec-list span:first-child {
  color: var(--gray-500);
}

.media-spec-list span:last-child {
  font-weight: 600;
  color: var(--gray-800);
}

/* Accordion Standard */
.accordion-toggle {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.accordion-toggle:hover {
  background-color: var(--gray-50);
}

.toggle-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
  font-size: 0.85rem;
  color: var(--primary);
}

.accordion-toggle.expanded .toggle-arrow {
  transform: rotate(90deg);
}

.standards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.standard-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.standard-box h4 {
  font-size: 1.1rem;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.bullet-list {
  padding-left: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.bullet-list li {
  margin-bottom: 0.4rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.data-table tbody tr:hover {
  background: var(--primary-light);
}

.data-table tbody tr.row-active {
  background: #dbeafe;
  font-weight: 600;
}

/* ==========================================================================
   MODULE 2: 3-3 乙太網路規格解密與表格
   ========================================================================== */

.spec-selector-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.spec-breakdown-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.breakdown-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.spec-chunk {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spec-chunk span.chunk-sub {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.8;
  margin-top: 2px;
}

.chunk-speed { background: #dbeafe; color: #1e40af; }
.chunk-base { background: #fef3c7; color: #92400e; }
.chunk-distance { background: #dcfce7; color: #166534; }
.chunk-media { background: #f3e8ff; color: #6b21a8; }

.spec-chunk:hover, .spec-chunk.active {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
  border-color: currentColor;
}

.chunk-detail-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--primary);
}

.chunk-detail-card h4 {
  color: var(--gray-900);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.filter-btn-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--gray-200);
}

.filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==========================================================================
   MODULE 3: 3-4 MAC 位址格式解析器
   ========================================================================== */

.mac-input-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.mac-input-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.mac-input-prefix {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  color: var(--gray-700);
}

.mac-input-group .form-input {
  flex: 1;
  min-width: 280px;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.mac-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #b91c1c;
}

.mac-visual-display {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mac-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.mac-block-oui {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.mac-block-nic {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.mac-block-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.mac-block-oui .mac-block-value { color: #1d4ed8; }
.mac-block-nic .mac-block-value { color: #047857; }

.mac-block-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 0.25rem;
  color: var(--gray-600);
}

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

.mac-info-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.mac-info-item .item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.mac-info-item .item-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mac-info-item .item-desc {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-top: 0.35rem;
}

.mac-info-item .item-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.oui-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.65rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem 0.2rem;
}

.oui-chip {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.oui-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.oui-chip-mac {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
}

.oui-chip-vendor {
  font-size: 0.8rem;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   MODULE 4: 3-4 乙太網路訊框 (Frame) 圖解
   ========================================================================== */

.frame-toggle-bar {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.btn-toggle {
  background: transparent;
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.2s ease;
}

.btn-toggle.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.frame-visual-bar {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
}

.frame-block {
  padding: 1rem 0.75rem;
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  min-width: 90px;
  border: 2px solid transparent;
  position: relative;
}

.frame-block:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.frame-block.active {
  transform: translateY(-3px);
  border-color: #1e293b;
  box-shadow: var(--shadow-lg);
}

.frame-block.active::after {
  content: '▼';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  color: #1e293b;
  font-size: 0.75rem;
}

.block-name {
  font-weight: 700;
  font-size: 0.85rem;
  display: block;
}

.block-size {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 4px;
  display: block;
}

.f-preamble { background: #e2e8f0; color: #334155; }
.f-sfd { background: #ffedd5; color: #9a3412; }
.f-dest { background: #dbeafe; color: #1e40af; }
.f-src { background: #dcfce7; color: #166534; }
.f-type { background: #f3e8ff; color: #6b21a8; }
.f-data { background: #cffafe; color: #155e75; flex: 2; min-width: 140px; }
.f-fcs { background: #fee2e2; color: #991b1b; }

.frame-total-meter {
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: 1.5rem;
}

.frame-field-detail {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  border-left: 5px solid var(--primary);
}

.frame-field-detail h4 {
  font-size: 1.2rem;
  color: var(--gray-900);
  margin-bottom: 0.4rem;
}

.info-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.info-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.info-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.info-card p {
  font-size: 0.9rem;
  color: var(--gray-600);
  line-height: 1.6;
}

/* ==========================================================================
   MODULE 5: 3-4 CSMA/CD 碰撞模擬器
   ========================================================================== */

.csmacd-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  cursor: pointer;
}

.node-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.node-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-top: 0.35rem;
  white-space: nowrap;
}

.step-node.active .node-circle {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 0 4px var(--primary-border);
}

.step-node.active .node-label {
  color: var(--primary);
  font-weight: 700;
}

.step-node.completed .node-circle {
  background: var(--success);
  color: #ffffff;
}

.step-line {
  flex: 1;
  height: 3px;
  background: var(--gray-200);
  margin: 0 8px -18px;
}

.csmacd-canvas-wrapper {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

.bus-line-indicator {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-tag {
  display: inline-block;
  white-space: nowrap;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.status-idle { background: #064e3b; color: #34d399; }
.status-busy { background: #78350f; color: #fbbf24; }
.status-collision { background: #7f1d1d; color: #f87171; animation: pulseRed 0.8s infinite; }

@keyframes pulseRed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.csmacd-scene {
  height: 240px;
  position: relative;
  margin-top: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.csmacd-scene svg {
  min-width: 600px;
  height: 240px;
  display: block;
}

/* Scene SVG Elements */
.svg-bus-wire {
  stroke: #475569;
  stroke-width: 6;
  stroke-linecap: round;
}

.svg-bus-wire.busy {
  stroke: #f59e0b;
  stroke-dasharray: 8;
  animation: wireFlow 1s infinite linear;
}

.svg-bus-wire.collision {
  stroke: #ef4444;
  filter: drop-shadow(0 0 8px #ef4444);
}

@keyframes wireFlow {
  to { stroke-dashoffset: -16; }
}

.csmacd-narrative {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  border-left: 4px solid var(--primary);
}

.csmacd-narrative h4 {
  font-size: 1.15rem;
  color: var(--gray-900);
  margin-bottom: 0.4rem;
}

.csmacd-narrative p {
  color: var(--gray-700);
  line-height: 1.6;
}

.csmacd-controls {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.formula-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.formula-box h4 {
  font-size: 1rem;
  color: var(--gray-900);
  margin-bottom: 0.4rem;
}

.math-callout {
  background: #ffffff;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--primary);
  text-align: center;
}

/* ==========================================================================
   MODULE 6: 3-4 Switch MAC 學習轉發 (雙 Switch 模擬器)
   ========================================================================== */

.mode-switcher-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mode-tabs {
  display: inline-flex;
  background: var(--gray-200);
  border-radius: var(--radius);
  padding: 3px;
}

.mode-tab {
  background: transparent;
  border: none;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-700);
  transition: all 0.2s ease;
}

.mode-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tutorial-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.tutorial-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.tutorial-step-tag {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.tutorial-header h4 {
  font-size: 1.15rem;
  color: #1e3a8a;
}

.tutorial-banner p {
  color: #1e40af;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.tutorial-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.free-control-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.free-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) auto;
  gap: 1rem;
  align-items: flex-end;
}

.control-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.control-group select {
  width: 100%;
}

.topology-split-container {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.25rem;
}

@media (max-width: 1140px) {
  .topology-split-container {
    grid-template-columns: 1fr;
  }
}

.topology-canvas-panel {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

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

.topology-legend {
  display: flex;
  gap: 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-blue { background: #3b82f6; }
.dot-orange { background: #f59e0b; }
.dot-green { background: #10b981; }

.svg-viewport {
  width: 100%;
  background: #0f172a;
  border-radius: var(--radius);
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.svg-viewport svg {
  min-width: 680px;
  height: 380px;
  display: block;
}

.packet-info-banner {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  margin-top: 0.85rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  font-weight: 500;
}

/* Dual MAC Tables */
.mac-tables-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mac-table-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mac-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.device-badge {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.badge {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
}

.mac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 440px;
}

.mac-table th,
.mac-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--gray-100);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.mac-table th {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
  font-weight: 700;
  color: var(--gray-600);
  font-family: var(--font-sans);
}

.mac-table th:last-child,
.mac-table td:last-child {
  text-align: center;
  width: 90px;
  min-width: 85px;
}

.mac-table tr.flash-row {
  animation: flashYellow 1.5s ease-out;
}

@keyframes flashYellow {
  0% { background: #fef08a; }
  100% { background: transparent; }
}

.empty-row td {
  text-align: center;
  color: var(--gray-400);
  font-family: var(--font-sans);
  font-style: italic;
  padding: 1.5rem !important;
}

/* Event Log */
.event-log-container {
  background: #0f172a;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-entry {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.log-time { color: var(--gray-400); margin-right: 6px; }
.log-learn { color: #60a5fa; }
.log-flood { color: #fbbf24; }
.log-fwd { color: #34d399; }
.log-drop { color: #f87171; }
.log-system { color: var(--gray-400); font-style: italic; }

/* ==========================================================================
   MODULE 7: 3-5 VLAN 虛擬區域網路模擬
   ========================================================================== */

.vlan-toggle-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.segmented-control {
  display: inline-flex;
  background: var(--gray-200);
  border-radius: var(--radius);
  padding: 3px;
}

.seg-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-700);
  transition: all 0.2s ease;
}

.seg-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.vlan-topology-area {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.vlan-topology-area svg {
  min-width: 680px;
  height: 280px;
  display: block;
}

.vlan-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.vlan-bucket {
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.vlan-bucket.vlan-10 { border-color: #3b82f6; background: #eff6ff; }
.vlan-bucket.vlan-20 { border-color: #10b981; background: #ecfdf5; }
.vlan-bucket.vlan-30 { border-color: #f59e0b; background: #fffbeb; }

.vlan-bucket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.vlan-bucket-header h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.vlan-port-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.port-chip {
  background: #ffffff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
  cursor: grab;
}

.stat-comparison-box {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-blue { color: var(--primary); }

.vlan-tag-strip {
  display: flex;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.tag-part {
  padding: 0.5rem 0.25rem;
  color: #ffffff;
}

.tag-tpid { background: #3b82f6; flex: 2; }
.tag-pri { background: #8b5cf6; flex: 1; }
.tag-cfi { background: #ec4899; flex: 1; }
.tag-vid { background: #10b981; flex: 3; }

/* ==========================================================================
   QUIZ ENGINE COMPONENT (21 題統一測驗模組樣式)
   ========================================================================== */

.quiz-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 0.85rem;
  margin-bottom: 1.25rem;
}

.quiz-title-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-title-area h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gray-900);
}

.quiz-nav-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-600);
}

.quiz-q-body {
  margin-bottom: 1.5rem;
}

.quiz-q-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  user-select: none;
}

.quiz-option:hover:not(.locked) {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.quiz-option.selected {
  background: #dbeafe;
  border-color: var(--primary);
  font-weight: 600;
}

.quiz-option.opt-correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: #065f46 !important;
  font-weight: 700 !important;
}

.quiz-option.opt-wrong {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
  color: #991b1b !important;
  text-decoration: line-through;
}

.opt-prefix {
  font-weight: 800;
  margin-right: 0.75rem;
  font-family: var(--font-mono);
}

.quiz-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.quiz-feedback-box {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.25rem;
  animation: fadeIn 0.25s ease;
}

.feedback-status {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.feedback-status.correct { color: var(--success); }
.feedback-status.wrong { color: var(--danger); }

.feedback-explanation {
  font-size: 0.92rem;
  color: var(--gray-700);
  line-height: 1.6;
}

.quiz-stats-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--gray-500);
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Footer */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--gray-800);
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-info h4 {
  color: #ffffff;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.footer-info p {
  font-size: 0.9rem;
}

.footer-copy {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--gray-500);
}

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

.footer-badges .tag {
  background: var(--gray-800);
  color: var(--gray-300);
  border: 1px solid var(--gray-700);
}

/* Responsive Breakpoints & Anti-Overflow Protection */
@media (max-width: 1140px) {
  .topology-split-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .site-header { padding: 1.5rem 1rem; }
  .header-title { font-size: 1.5rem; word-break: break-word; }
  .header-title span { display: block; margin-left: 0; margin-top: 0.35rem; font-size: 0.95rem; }
  .header-desc { font-size: 0.95rem; }
  .main-container { padding: 0 0.75rem; margin-top: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  
  .nav-wrapper { padding: 0 0.25rem; }
  .nav-tab { padding: 0.75rem 0.65rem; font-size: 0.86rem; }
  .nav-scroll-btn { width: 26px; height: 26px; font-size: 1.05rem; }
  
  .content-card, .info-card { padding: 1.15rem; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  
  .mac-input-section { padding: 1rem; }
  .mac-input-group .form-input { min-width: 0; width: 100%; font-size: 1.05rem; }
  .mac-visual-display { gap: 0.35rem; }
  .mac-block { padding: 0.6rem 0.75rem; }
  .mac-block-value { font-size: 1.2rem; }
  .oui-chips-grid { grid-template-columns: 1fr; }
  
  .csmacd-stepper { 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    padding-bottom: 0.75rem;
    justify-content: flex-start;
    gap: 0.5rem;
  }
  .step-node { flex-shrink: 0; min-width: 64px; }
  .step-line { flex-shrink: 0; min-width: 24px; margin: 0 4px -18px; }
  
  .free-control-grid { grid-template-columns: 1fr; }
  .mode-switcher-bar { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .mode-tabs { width: 100%; display: flex; }
  .mode-tab { flex: 1; text-align: center; padding: 0.5rem; font-size: 0.85rem; }
  
  .segmented-control { width: 100%; display: flex; }
  .seg-btn { flex: 1; text-align: center; padding: 0.45rem; font-size: 0.85rem; }
  
  .quiz-card { padding: 1.25rem 1rem; }
  .quiz-title { font-size: 1.15rem; }
  .quiz-option { padding: 0.75rem 0.85rem; font-size: 0.9rem; }
  
  .footer-container { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
}

@media (max-width: 480px) {
  .site-header { padding: 1.25rem 0.75rem; }
  .header-badge { font-size: 0.75rem; }
  .header-title { font-size: 1.25rem; }
  .nav-tab { padding: 0.65rem 0.6rem; font-size: 0.82rem; }
  .btn { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
  .card-header h3 { font-size: 1.1rem; }
  .stat-pill { font-size: 0.8rem; padding: 0.3rem 0.65rem; }
  .mac-quick-actions { flex-direction: column; width: 100%; }
  .mac-quick-actions .btn { width: 100%; }
}
