:root {
      /* Spacing */
      --space-1: 0.25rem;
      --space-2: 0.5rem;
      --space-3: 0.75rem;
      --space-4: 1rem;
      --space-5: 1.25rem;
      --space-6: 1.5rem;
      --space-8: 2rem;
      --space-12: 3rem;
      --space-16: 4rem;
      /* Border Radius */
      --radius-md: 10px;
      --radius-lg: 14px;
      /* Transitions */
      --transition-fast: 0.3s ease;
      --transition-smooth: 0.4s ease;
      /* Python Blue Colors (no lime green) */
      --color-primary: #306998;          /* Python blue */
      --color-primary-dark: #264969;
      --color-accent: #3776ab;           /* Slightly lighter blue for accent */
      --color-accent-dark: #264769;      /* Dark blue for accent hover */
      /* Backgrounds and neutrals */
      --color-bg-main: #fdfdfd;          /* Page background */
      --color-bg-light: #f3f6fb;         /* Section backgrounds */
      --color-bg-dark: #232833;          /* Dark-based (e.g., code blocks) */
      /* Grayscale */
      --color-gray-200: #e5e7eb;
      --color-gray-300: #d1d5db;
      --color-gray-600: #566677;
      --color-gray-700: #33465a;
      --color-gray-800: #2a2a2a;
      --color-gray-900: #1e1e1e;
      /* Status Colors */
      --color-success: #22c55e;
      --color-error: #ef4444;
      /* Shadows */
      --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
      --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.10);
      /* Typography */
      --font-family: 'Poppins', Arial, sans-serif;
    }
    /* Prevent overflow on x-axis everywhere */
    html, body {
      width: 100vw;
      max-width: 100vw;
      overflow-x: hidden;
      box-sizing: border-box;
    }
    /* Always apply border-box */
    *, *::before, *::after {
      box-sizing: inherit;
    }
    /* =====
       SUBTOPIC PAGE STYLES
    ===== */
    .subtopic-container {
      max-width: 1200px;
      width: 100%;
      margin: 0 auto;
      padding: var(--space-12) var(--space-4);
      background-color: var(--color-bg-main);
      color: var(--color-gray-900);
      font-family: var(--font-family);
      box-sizing: border-box;
    }
    .subtopic-header {
      margin-bottom: var(--space-8);
    }
    .breadcrumbs {
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-2);
      margin-bottom: var(--space-4);
      font-size: 0.9rem;
      color: var(--color-gray-600);
    }
    .breadcrumbs a {
      color: inherit;
      transition: color var(--transition-fast);
      padding: var(--space-1);
      min-height: 44px;
      display: flex;
      align-items: center;
    }
    .breadcrumbs a:hover {
      color: var(--color-primary);
    }
    .breadcrumbs .separator {
      color: var(--color-gray-600);
    }
    .subtopic-title {
      font-size: 2.8rem;
      color: var(--color-primary);
      font-weight: 700;
      margin-bottom: var(--space-2);
      letter-spacing: 0.8px;
      text-shadow: 0 1px 3px rgba(48, 105, 152, 0.2);
      line-height: 1.2;
    }
    .subtopic-meta {
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-4);
      font-size: 0.9rem;
      color: var(--color-gray-700);
      margin-bottom: var(--space-6);
    }
    .subtopic-meta span {
      display: flex;
      align-items: center;
    }
    .subtopic-meta svg {
      margin-right: var(--space-1);
      stroke: var(--color-primary);
      fill: none;
    }
    /* =====
       TABLE OF CONTENTS
    ===== */
    .table-of-contents {
      background-color: var(--color-bg-light);
      border-radius: var(--radius-lg);
      padding: var(--space-5);
      margin-bottom: var(--space-8);
      box-shadow: var(--shadow-md);
      border: 2px solid var(--color-primary);
      max-width: 100%;
      overflow-x: auto;
      word-break: break-word;
    }
    .table-of-contents h3 {
      font-size: 1.3rem;
      margin-bottom: var(--space-3);
      color: var(--color-primary-dark);
      font-weight: 600;
      letter-spacing: 0.5px;
      line-height: 1.3;
    }
    .toc-list {
      list-style: none;
      padding: 0;
      margin: 0;
    }
    .toc-list li {
      margin-bottom: var(--space-2);
    }
    .toc-list a {
      color: var(--color-gray-700);
      display: inline-block;
      transition: color var(--transition-fast), transform var(--transition-fast);
      font-weight: 500;
      padding: var(--space-1) 0;
      min-height: 44px;
      display: flex;
      align-items: center;
    }
    .toc-list a:hover {
      color: var(--color-accent);
      transform: translateX(6px);
    }
    /* =====
       CONTENT SECTIONS
    ===== */
    .subtopic-content {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-8);
    }
    .content-section {
      background-color: #fff;
      border-radius: var(--radius-lg);
      padding: var(--space-6);
      border-top: 6px solid var(--color-primary);
      box-shadow: var(--shadow-md);
      transition: box-shadow var(--transition-smooth);
      width: 100%;
      max-width: 100vw;
      overflow-x: auto;
    }
    .content-section:hover {
      box-shadow: var(--shadow-lg);
    }
    .content-section h2 {
      color: var(--color-primary);
      font-size: 1.7rem;
      margin-bottom: var(--space-4);
      padding-bottom: var(--space-2);
      border-bottom: 2px solid var(--color-gray-200);
      letter-spacing: 0.5px;
      font-weight: 700;
      line-height: 1.3;
    }
    .section-description {
      margin-bottom: var(--space-4);
      color: var(--color-gray-700);
      line-height: 1.6;
    }
    .prerequisites-list,
    .examples-list {
      list-style: disc;
      margin-left: var(--space-5);
      color: var(--color-gray-800);
      line-height: 1.5;
    }
    .prerequisites-list li,
    .examples-list li {
      margin-bottom: var(--space-2);
    }
    /* =====
       CODE EXAMPLE
    ===== */
    .code-example {
      background-color: var(--color-bg-dark);
      color: var(--color-accent);
      padding: var(--space-5);
      border-radius: var(--radius-lg);
      font-family: 'Fira Code', monospace;
      font-size: 0.95rem;
      overflow-x: auto;
      line-height: 1.6;
      box-shadow: var(--shadow-md);
      border-left: 8px solid var(--color-primary);
    }
    /* =====
       RESOURCES
    ===== */
    .resource-item {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--space-3);
      background-color: var(--color-bg-light);
      padding: var(--space-4);
      border-radius: var(--radius-lg);
      margin-bottom: var(--space-4);
      transition: background-color var(--transition-fast), transform var(--transition-fast);
      box-shadow: var(--shadow-md);
    }
    .resource-item:hover {
      background-color: #e6f0ff;  /* soft light blue hover */
      transform: translateY(-3px);
      box-shadow: var(--shadow-lg);
    }
    .resource-icon {
      font-size: 1.6rem;
      color: var(--color-primary);
      display: flex;
      align-items: center;
    }
    .resource-details {
      flex: 1;
      min-width: 200px;
      color: var(--color-gray-900);
    }
    .resource-details h4 {
      margin-bottom: var(--space-1);
      font-weight: 700;
      color: var(--color-primary-dark);
      line-height: 1.3;
    }
    .resource-details p {
      font-size: 0.9rem;
      color: var(--color-gray-700);
      line-height: 1.5;
    }
    .resource-link {
      margin-left: auto;
      background: var(--color-accent);
      color: #fff;
      font-size: 0.9rem;
      padding: var(--space-2) var(--space-3);
      border-radius: var(--radius-md);
      text-decoration: none;
      transition: background var(--transition-fast);
      white-space: nowrap;
      box-shadow: 0 3px 12px rgba(38, 70, 105, 0.3);
      min-height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .resource-link:hover {
      background: var(--color-accent-dark);
    }
    /* =====
       HAMBURGER MENU STYLES
    ===== */
    .mobile-menu-btn {
      display: none;
      flex-direction: column;
      gap: 6px;
      background: none;
      border: none;
      cursor: pointer;
      z-index: 101;
      padding: var(--space-2);
    }
    .mobile-menu-btn span {
      width: 28px;
      height: 4px;
      background: #fff;
      border-radius: 2px;
      transition: all var(--transition-fast);
    }
    .mobile-menu-btn.active span:nth-child(1) { 
      transform: rotate(45deg) translate(7px, 7px);
    }
    .mobile-menu-btn.active span:nth-child(2) { 
      opacity: 0;
    }
    .mobile-menu-btn.active span:nth-child(3) { 
      transform: rotate(-45deg) translate(7px, -7px);
    }
    /* Footer and Header Styles (for consistency) */
    .header {
      background: linear-gradient(90deg, var(--color-primary) 70%, var(--color-primary-dark) 100%);
      color: #fff;
      padding: var(--space-4) var(--space-6);
      box-shadow: var(--shadow-md);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      position: relative;
    }
    .logo h1 {
      font-size: 2rem;
      font-weight: 700;
      color: #fff;
      text-shadow: 0 2px 8px rgba(38,105,152,0.12);
      letter-spacing: 1.5px;
      margin: 0;
    }
    .nav ul {
      list-style: none;
      display: flex;
      gap: var(--space-6);
      margin: 0;
      padding: 0;
    }
    .nav a {
      font-weight: 600;
      color: #fff;
      border-bottom: 2px solid transparent;
      transition: color 0.2s, border-bottom 0.2s;
      padding: var(--space-2) 0;
    }
    .nav a.active,
    .nav a:hover {
      border-color: #fff;
      color: #fff;
    }
    .footer {
      background: var(--color-primary-dark);
      color: #dde6f3;
      padding: 3rem 2rem;
      font-size: 0.96rem;
    }
    .footer-content {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      gap: var(--space-6);
    }
    .footer-logo h2 {
      color: #fff;
      font-weight: 700;
      margin-bottom: 0.5rem;
    }
    .footer-logo p {
      color: #b7c4d3;
      font-style: italic;
      line-height: 1.5;
    }
    .footer-links h3,
    .footer-social h3 {
      color: #fff;
      margin-bottom: var(--space-3);
      font-weight: 600;
    }
    .footer-links ul {
      list-style: none;
      margin: 0; 
      padding: 0;
    }
    .footer-links li { 
      margin: 0.3rem 0; 
    }
    .footer-links a {
      color: #dde6f3;
      transition: color 0.18s;
      padding: var(--space-1) 0;
      display: inline-block;
    }
    .footer-links a:hover {
      color: #fff;
    }
    .social-icons {
      display: flex;
      gap: var(--space-4);
      margin-top: 0.5rem;
    }
    .social-icon {
      min-height: 44px;
      min-width: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .social-icon svg {
      stroke: #dde6f3;
      transition: stroke 0.21s;
      width: 24px; 
      height: 24px;
    }
    .social-icon:hover svg {
      stroke: #fff;
    }
    .footer-bottom {
      text-align: center;
      margin-top: var(--space-6);
      border-top: 1px solid #1a283c;
      padding-top: var(--space-3);
      color: #b7c4d3;
      line-height: 1.5;
    }
    /* =====
       RESPONSIVE STYLES
    ===== */
    @media (min-width: 1024px) {
      .subtopic-content {
        grid-template-columns: repeat(2, 1fr);
      }
      .section-description,
      .section-examples,
      .section-real-world,
      .section-applications,
      .section-resources {
        grid-column: span 2;
      }
    }
    @media (max-width: 1023px) {
      .subtopic-container {
        padding: var(--space-8) var(--space-3);
        width: 100%;
        max-width: 100vw;
      }
      .subtopic-content {
        gap: var(--space-6);
      }
      .content-section {
        padding: var(--space-5);
        width: 100%;
        max-width: 100vw;
        overflow-x: auto;
      }
    }
    @media (max-width: 768px) {
      .mobile-menu-btn { 
        display: flex; 
      }
      .header {
        padding: var(--space-3) var(--space-4);
      }
      .logo h1 {
        font-size: 1.6rem;
        letter-spacing: 1px;
      }
      .nav { 
        position: fixed;
        top: 0; 
        right: 0;
        background: var(--color-primary);
        height: 100vh;
        width: 85vw;
        max-width: 300px;
        flex-direction: column;
        padding: 5rem 1rem 1rem;
        transform: translateX(100%);
        transition: transform var(--transition-smooth);
        opacity: 0; 
        visibility: hidden; 
        z-index: 100;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
      }
      .nav.nav-open {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
      }
      .nav ul { 
        flex-direction: column; 
        gap: var(--space-4);
        width: 100%;
      }
      .nav a { 
        font-size: 1.2rem; 
        color: #fff;
        padding: var(--space-3) var(--space-4);
        border-radius: var(--radius-md);
        width: 100%;
        text-align: left;
        min-height: 44px;
        display: flex;
        align-items: center;
      }
      .nav a:hover {
        background: rgba(255,255,255,0.1);
      }
      .subtopic-container {
        padding: var(--space-6) var(--space-3);
        width: 100%;
        max-width: 100vw;
      }
      .subtopic-title {
        font-size: 2.2rem;
      }
      .subtopic-meta {
        gap: var(--space-3);
        font-size: 0.85rem;
      }
      .table-of-contents {
        padding: var(--space-4);
        max-width: 100%;
        overflow-x: auto;
      }
      .table-of-contents h3 {
        font-size: 1.2rem;
      }
      .content-section {
        padding: var(--space-4);
        width: 100%;
        max-width: 100vw;
        overflow-x: auto;
      }
      .code-example {
        padding: var(--space-4);
        font-size: 0.9rem;
      }
      .resource-item {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-3);
      }
      .resource-link {
        margin-top: var(--space-2);
        margin-left: 0;
        width: 100%;
        text-align: center;
      }
      /* Disable hover effects on touch devices */
      .content-section:hover,
      .resource-item:hover {
        transform: none;
        box-shadow: var(--shadow-md);
      }
      /* Add active states for better touch feedback */
      .content-section:active,
      .resource-item:active {
        transform: scale(0.98);
        transition: transform 0.1s;
      }
    }
    @media (max-width: 480px) {
      .subtopic-container {
        padding: var(--space-4) var(--space-2);
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: auto;
      }
      .subtopic-title {
        font-size: 1.8rem;
        line-height: 1.2;
        word-break: break-word;
      }
      .breadcrumbs {
        font-size: 0.8rem;
        gap: var(--space-1);
      }
      .subtopic-meta {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
      }
      .table-of-contents {
        padding: var(--space-3);
        max-width: 100%;
        overflow-x: auto;
      }
      .table-of-contents h3 {
        font-size: 1.1rem;
        word-break: break-word;
      }
      .toc-list a {
        font-size: 0.9rem;
        padding: var(--space-2) 0;
      }
      .subtopic-content {
        gap: var(--space-4);
      }
      .content-section {
        padding: var(--space-3);
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: auto;
      }
      .content-section h2 {
        font-size: 1.3rem;
        margin-bottom: var(--space-3);
      }
      .section-description {
        font-size: 0.95rem;
      }
      .code-example {
        padding: var(--space-3);
        font-size: 0.85rem;
      }
      .resource-item {
        padding: var(--space-2);
      }
      .resource-details h4 {
        font-size: 1rem;
      }
      .resource-details p {
        font-size: 0.85rem;
      }
      .resource-link {
        font-size: 0.85rem;
        padding: var(--space-2);
      }
      .prerequisites-list,
      .examples-list {
        margin-left: var(--space-4);
      }
      .prerequisites-list li,
      .examples-list li {
        margin-bottom: var(--space-1);
        line-height: 1.5;
      }
      /* Better text contrast and spacing */
      .section-description,
      .resource-details p {
        line-height: 1.6;
      }
      .subtopic-title,
      .content-section h2,
      .table-of-contents h3 {
        line-height: 1.3;
      }
      .nav {
        width: 90vw;
        padding: 4rem 0.5rem 1rem;
      }
      .nav a {
        font-size: 1.1rem;
        padding: var(--space-2) var(--space-3);
      }
      .header {
        padding: var(--space-2) var(--space-3);
      }
      .logo h1 {
        font-size: 1.4rem;
      }
    }
    /* Touch-friendly improvements for mobile */
    @media (max-width: 768px) {
      .toc-list a,
      .breadcrumbs a,
      .resource-link {
        min-height: 44px; /* Minimum touch target size */
      }
    }
    /* Responsive header/nav fix */
    header,
    .navbar {
      width: 100%;
      max-width: 100vw;
      min-width: 0;
      box-sizing: border-box;
      overflow-x: auto;
    }
    /* Optionally, fix for nav/icon menu */
    .menu-icon,
    .hamburger-menu {
      min-width: 44px;
      min-height: 44px;
      box-sizing: border-box;
      max-width: 100vw;
    }
