:root {
  --primary-blue: #0066cc;
  --primary-dark: #004499;
  --primary-light: #3388dd;
  --accent-teal: #00a693;
  --accent-orange: #ff6b35;
  --bg-primary: #fafbfc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f9fa;
  --text-primary: #1a1a1a;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --header-height: 90px;
  --sidebar-width: 280px;
  --sidebar-width-mobile: 320px;
  --sidebar-width-tablet: 250px;
}

[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --text-primary: #f0f6fc;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --border-light: #30363d;
  --border-medium: #21262d;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
  position: relative;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1000;
  background-color: var(--border-light);
}

.scroll-progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary-blue), var(--accent-teal));
  transition: width 0.1s ease;
}

.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
}

.header-container {
  padding: 0 24px;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  gap: 20px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
}

.icon-container {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.header-text {
  min-width: 0;
  flex: 1;
}

.header-text h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-text p {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 2px 0 0 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.tag {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag i {
  font-size: 8px;
}

.header-search {
  flex: 1;
  max-width: 400px;
  margin: 0 20px;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: all 0.2s ease;
  height: 40px;
}

.search-container:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.search-container i {
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 14px;
  flex-shrink: 0;
}

.search-container input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  min-width: 0;
}

.search-container input::placeholder {
  color: var(--text-muted);
}

.search-shortcut {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 8px;
  font-family: monospace;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-link {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  height: 36px;
}

.nav-link:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.nav-link i {
  font-size: 12px;
}

.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

.theme-toggle:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

@media (max-width: 1200px) {
  .header-search {
    max-width: 300px;
    margin: 0 16px;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 12px;
  }

  .header-tags .tag:nth-child(n + 3) {
    display: none;
  }
}

@media (max-width: 992px) {
  .header-search {
    max-width: 250px;
    margin: 0 12px;
  }

  .main-nav .nav-link:not(:first-child) {
    display: none;
  }

  .header-tags {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 16px;
  }

  .header-content {
    gap: 12px;
  }

  .header-search {
    display: none;
  }

  .main-nav {
    display: none;
  }

  .header-text h1 {
    font-size: 18px;
  }

  .header-text p {
    font-size: 11px;
  }

  .icon-container {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .mobile-menu-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 12px;
  }

  .header-content {
    gap: 8px;
  }

  .header-logo {
    gap: 8px;
  }

  .header-text h1 {
    font-size: 16px;
  }

  .header-text p {
    display: none;
  }

  .icon-container {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

.main-container {
  padding: 0;
  max-width: 100%;
  width: 100%;
}

.three-column-wrapper {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
  grid-template-rows: 1fr;
  height: calc(100vh - var(--header-height));
  max-width: 100%;
  width: 100%;
}

.left-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  height: 100%;
  overflow-y: auto;
  width: var(--sidebar-width);
  position: relative;
  z-index: 10;
}

.sidebar-inner {
  padding: 32px 0 24px 0;
  min-height: 100%;
  position: relative;
}


.nav-category {
  margin-bottom: 40px;
}

.category-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 24px;
  margin-bottom: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-left-color: var(--border-medium);
}

.nav-item.active {
  background-color: rgba(0, 102, 204, 0.08);
  color: var(--primary-blue);
  border-left-color: var(--primary-blue);
  font-weight: 600;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-icon.red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.nav-icon.orange {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
}

.nav-icon.blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.nav-icon.green {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.nav-icon-emoji {
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ---- Document-type switcher — lives inside .header-content ---- */
.doc-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 3px;
}

.doc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.18s ease;
  white-space: nowrap;
  line-height: 1;
}

.doc-tab:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--border-light);
}

.doc-tab--active {
  color: var(--primary-blue);
  background: var(--bg-secondary);
  border-color: rgba(0, 102, 204, 0.2);
  box-shadow: var(--shadow-sm);
}

.doc-tab--active:hover {
  color: var(--primary-blue);
  background: var(--bg-secondary);
}

[data-theme="dark"] .doc-tab--active {
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.25);
  background: var(--bg-tertiary);
}

/* On small screens collapse labels, keep icons + title tooltip */
@media (max-width: 900px) {
  .doc-tab-label { display: none; }
  .doc-tab { padding: 6px 10px; }
}

.center-content {
  background: var(--bg-primary);
  padding: 40px;
  overflow-y: auto;
  height: 100%;
  width: 100%;
  position: relative;
}

.breadcrumb {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.breadcrumb-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.breadcrumb-item:hover {
  color: var(--primary-blue);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-separator {
  margin: 0 16px;
  color: var(--text-muted);
}

.content-section {
  margin-bottom: 48px;
  animation: slideInUp 0.6s ease-out;
}

.section-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 2px solid var(--border-light);
}

.section-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  margin-right: 24px;
  flex-shrink: 0;
  box-shadow: var(--shadow-lg);
}

.section-title h2 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  letter-spacing: -0.025em;
}

.section-title p {
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.5;
  margin: 0;
}

.rules-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.rule-card {
  border-radius: var(--radius-lg);
  padding: 40px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.rule-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.rule-card:hover::before {
  opacity: 1;
}

.rule-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
  color: white;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.rule-content h3 {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.025em;
}

.rule-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  font-size: 16px;
}

.rule-content ul {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  font-size: 16px;
  padding-left: 20px;
}

.rule-content li {
  margin-bottom: 8px;
}

.rule-examples {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.rule-examples h4 {
  color: var(--primary-blue);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rule-examples ul {
  list-style: none;
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
  padding: 0;
}

.rule-examples li {
  margin-bottom: 10px;
  padding-left: 20px;
  position: relative;
}

.rule-examples li::before {
  content: "•";
  color: var(--accent-teal);
  font-weight: bold;
  position: absolute;
  left: 0;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.sub-rule {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
}

.sub-rule::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-orange);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sub-rule h4 {
  color: var(--accent-orange);
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 16px;
}

.sub-rule p {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.sub-rule ul {
  list-style: none;
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0;
  padding: 0;
}

.sub-rule li {
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
}

.sub-rule li::before {
  content: "→";
  color: var(--accent-orange);
  position: absolute;
  left: 0;
}

.rule-notice {
  background: linear-gradient(135deg, rgba(0, 166, 147, 0.1), rgba(0, 166, 147, 0.05));
  border: 1px solid var(--accent-teal);
  border-radius: var(--radius-md);
  padding: 24px;
  position: relative;
  margin-bottom: 20px;
}

.rule-notice::before {
  content: "ℹ";
  position: absolute;
  top: 24px;
  left: 24px;
  color: var(--accent-teal);
  font-size: 20px;
  font-weight: bold;
}

.rule-notice p {
  color: var(--accent-teal);
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 0 40px;
}

.rule-notice ul {
  color: var(--accent-teal);
  font-weight: 500;
  font-size: 15px;
  margin: 12px 0 0 40px;
  padding: 0;
}

.rule-notice li {
  margin-bottom: 8px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.rule-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  padding: 24px;
  border-radius: var(--radius-md);
  text-align: center;
  transition: all 0.2s ease;
}

.rule-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.rule-box h4 {
  color: var(--primary-blue);
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 12px;
}

.rule-box p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

.right-sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-light);
  height: 100%;
  overflow-y: auto;
  width: var(--sidebar-width);
  position: relative;
  padding: 24px;
}

.sidebar-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.sidebar-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header h3::before {
  content: "💡";
  font-size: 16px;
}

.help-content {
  line-height: 1.6;
}

.help-content h4 {
  color: var(--primary-blue);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-content h4::before {
  content: "📋";
  font-size: 14px;
}

.help-content ul {
  margin: 0 0 16px 0;
  padding-left: 20px;
}

.help-content li {
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.help-content li::marker {
  color: var(--accent-teal);
}

.help-content p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-teal);
}

.right-sidebar .sidebar-header {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 10;
  margin: -24px -24px 24px -24px;
  padding: 24px 24px 20px 24px;
}

.right-sidebar::-webkit-scrollbar {
  width: 6px;
}

.right-sidebar::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.right-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

.right-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

@media (max-width: 1200px) {
  .right-sidebar {
    width: var(--sidebar-width-tablet);
    padding: 20px;
  }
}

@media (max-width: 992px) {
  .right-sidebar {
    display: none;
  }
}

.help-content {
  animation: fadeInContent 0.3s ease-in-out;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.help-tip {
  background: linear-gradient(135deg, rgba(0, 166, 147, 0.1), rgba(0, 166, 147, 0.05));
  border: 1px solid var(--accent-teal);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--accent-teal);
}

.help-tip::before {
  content: "💡 ";
  font-weight: bold;
}

.toc-container {
  padding: 32px 0 24px 0;
}


.toc-nav {
  padding: 0 24px;
}

.toc-item,
.toc-subitem {
  display: flex;
  align-items: flex-start;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border-left: 2px solid transparent;
  font-size: 14px;
}

.toc-item:hover,
.toc-subitem:hover {
  background-color: var(--bg-tertiary);
  border-left-color: var(--border-medium);
}

.toc-item.active,
.toc-subitem.active {
  background-color: rgba(0, 102, 204, 0.08);
  border-left-color: var(--primary-blue);
}

.toc-subitem {
  margin-left: 20px;
  font-size: 13px;
}

.toc-number {
  color: var(--accent-orange);
  font-weight: 600;
  margin-right: 12px;
  flex-shrink: 0;
  font-size: 13px;
  min-width: 24px;
}

.toc-text {
  line-height: 1.4;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.active {
  opacity: 1;
}

@media (max-width: 1200px) {
  .three-column-wrapper {
    grid-template-columns: var(--sidebar-width-tablet) 1fr var(--sidebar-width-tablet);
  }

  .left-sidebar,
  .right-sidebar {
    width: var(--sidebar-width-tablet);
  }

  .center-content {
    padding: 32px 24px;
  }

  .section-title h2 {
    font-size: 32px;
  }

  .rule-card {
    padding: 32px;
  }
}

@media (max-width: 992px) {
  .three-column-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .right-sidebar {
    display: none;
  }

  .left-sidebar {
    position: fixed;
    top: var(--header-height);
    left: -100%;
    width: var(--sidebar-width-mobile);
    height: calc(100vh - var(--header-height));
    z-index: 999;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
  }

  .left-sidebar.mobile-visible {
    left: 0;
  }

  .center-content {
    padding: 24px 20px;
    grid-column: 1;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header-search {
    max-width: 300px;
    margin: 0 16px;
  }

  .main-nav .nav-link {
    padding: 8px 12px;
    font-size: 13px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .section-icon {
    width: 56px;
    height: 56px;
    font-size: 24px;
    margin-right: 0;
    margin-bottom: 16px;
  }

  .section-title h2 {
    font-size: 28px;
  }

  .section-title p {
    font-size: 16px;
  }

  .rule-card {
    padding: 24px;
  }

  .rule-content h3 {
    font-size: 24px;
  }

  .rules-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 12px 16px;
  }

  .header-content {
    gap: 12px;
  }

  .header-search {
    display: none;
  }

  .main-nav {
    display: none;
  }

  .header-text h1 {
    font-size: 18px;
  }

  .header-text p {
    font-size: 12px;
  }

  .header-tags {
    display: none;
  }

  .icon-container {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .center-content {
    padding: 20px 16px;
  }

  .breadcrumb {
    font-size: 12px;
    margin-bottom: 24px;
    padding: 12px 0;
  }

  .breadcrumb-separator {
    margin: 0 8px;
  }

  .section-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
  }

  .section-icon {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .section-title h2 {
    font-size: 24px;
  }

  .section-title p {
    font-size: 15px;
  }

  .rules-container {
    gap: 24px;
  }

  .rule-card {
    padding: 20px;
  }

  .rule-number {
    width: 32px;
    height: 32px;
    font-size: 14px;
    margin-bottom: 16px;
  }

  .rule-content h3 {
    font-size: 20px;
    margin-bottom: 16px;
  }

  .rule-content p {
    font-size: 15px;
    margin-bottom: 20px;
  }

  .rule-examples,
  .sub-rule,
  .rule-notice {
    padding: 20px;
    margin-bottom: 16px;
  }

  .examples-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .left-sidebar {
    width: 85%;
  }

  .sidebar-inner {
    padding: 24px 0;
  }


  .nav-category {
    margin-bottom: 32px;
  }

  .category-header {
    padding: 0 20px;
    margin-bottom: 12px;
  }

  .nav-item {
    padding: 10px 20px;
    font-size: 15px;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 10px 12px;
  }

  .center-content {
    padding: 16px 12px;
  }

  .rule-card {
    padding: 16px;
  }

  .rule-content h3 {
    font-size: 18px;
  }

  .section-title h2 {
    font-size: 20px;
  }

  .left-sidebar {
    width: 90%;
  }
}

@media print {
  .header,
  .left-sidebar,
  .right-sidebar,
  .mobile-menu-btn,
  .scroll-indicator {
    display: none !important;
  }

  .three-column-wrapper {
    grid-template-columns: 1fr;
  }

  .center-content {
    padding: 0;
    overflow: visible;
    height: auto;
  }

  .rule-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  body {
    overflow: visible;
    height: auto;
  }
}

.nav-item:focus,
.toc-item:focus,
.toc-subitem:focus,
.mobile-menu-btn:focus,
.theme-toggle:focus,
.nav-link:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --border-light: #000;
    --border-medium: #000;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  }
}

.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.search-modal.active {
  opacity: 1;
  visibility: visible;
}

.search-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.search-modal-content {
  position: relative;
  max-width: 600px;
  width: 90%;
  margin: 80px auto 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.search-modal.active .search-modal-content {
  transform: translateY(0);
}

.search-modal-header {
  padding: 20px 20px 0 20px;
  border-bottom: 1px solid var(--border-light);
}

.search-modal-input-container {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: border-color 0.2s ease;
  margin-bottom: 15px;
}

.search-modal-input-container:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.search-modal-input-container i.fa-search {
  color: var(--text-muted);
  margin-right: 12px;
  font-size: 16px;
}

.search-modal-input-container input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  font-weight: 500;
}

.search-modal-input-container input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.search-modal-close:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.search-modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.search-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-placeholder i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.search-placeholder p {
  font-size: 16px;
  margin-bottom: 20px;
}

.search-tips {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.search-tip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.search-tip kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: monospace;
}

.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-no-results i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.search-no-results p {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.search-no-results small {
  font-size: 14px;
}

.search-results-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.search-results-count {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: var(--bg-tertiary);
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-primary);
  border-color: var(--primary-blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.search-result-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-right: 16px;
  flex-shrink: 0;
}

.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: 16px;
  line-height: 1.3;
}

.search-result-section {
  font-size: 12px;
  color: var(--accent-teal);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-result-preview {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-arrow {
  color: var(--text-muted);
  margin-left: 12px;
  opacity: 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.search-result-item:hover .search-result-arrow,
.search-result-item.selected .search-result-arrow {
  opacity: 1;
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .search-modal-content {
    width: 95%;
    margin: 40px auto 0;
    max-height: calc(100vh - 80px);
  }
  
  .search-modal-header {
    padding: 16px 16px 0 16px;
  }
  
  .search-modal-input-container {
    padding: 10px 12px;
  }
  
  .search-modal-input-container input {
    font-size: 16px;
  }
  
  .search-results {
    padding: 16px;
  }
  
  .search-result-item {
    padding: 12px;
  }
  
  .search-result-icon {
    width: 36px;
    height: 36px;
    margin-right: 12px;
  }
  
  .search-tips {
    gap: 12px;
  }
  
  .search-tip {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .search-modal-content {
    width: 98%;
    margin: 20px auto 0;
    border-radius: var(--radius-md);
  }
  
  .search-tips {
    flex-direction: column;
    gap: 8px;
  }
}

[data-theme="dark"] .search-modal-overlay {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .search-result-item {
  background: var(--bg-primary);
}

[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] .search-result-item.selected {
  background: var(--bg-tertiary);
}

.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.placeholder {
  position: relative;
}

.placeholder:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  position: absolute;
  opacity: 0.6;
  font-style: italic;
  cursor: text;
}

.placeholder:focus::before {
  opacity: 0.4;
}

.placeholder:not(:empty)::before {
  display: none;
}

.placeholder[contenteditable="true"] {
  min-height: 1.2em;
  outline: none;
}

.placeholder[contenteditable="true"]:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  border-radius: 4px;
}
