@import 'buttons.css';

/* ========== Z-INDEX SCALE ========== */
:root {
  --z-content:        1;
  --z-sidebar:       10;
  --z-side-buttons:  30;
  --z-sticky:       100;
  --z-taskbar:     1000;
  --z-hamburger:   1002;
  --z-mobile-sidebar: 1040;
  --z-mobile-overlay: 1045;
  --z-mobile-sidebar-open: 1050;
  --z-drawer-overlay: 1100;
  --z-drawer:      1101;
  --z-dropdown:   10000;
  --z-settings:   10005;
  --z-more-panel: 10006;
  --z-search:     99999;

  /* ========== THEME COLOR PALETTE ========== */
  --color-bg:          #ffffff;
  --color-surface:     #f8fafc;
  --color-surface-alt: #f1f5f9;
  --color-text:        #0f172a;
  --color-text-secondary: #64748b;
  --color-text-muted:  #94a3b8;
  --color-border:      #e2e8f0;
  --color-border-light: rgba(226, 232, 240, 0.7);
  --color-accent-blue: #3b82f6;
  --color-accent-green: #059669;
  --color-accent-purple: #8b5cf6;
  --color-shadow:      rgba(15, 23, 42, 0.12);
}

body.dark-mode {
  --color-bg:          #1e293b;
  --color-surface:     #0f172a;
  --color-surface-alt: #111827;
  --color-text:        #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-text-muted:  #64748b;
  --color-border:      #334155;
  --color-border-light: rgba(51, 65, 85, 0.5);
  --color-accent-blue: #60a5fa;
  --color-accent-green: #34d399;
  --color-accent-purple: #a78bfa;
  --color-shadow:      rgba(0, 0, 0, 0.3);
}

body {
      box-sizing: border-box;
      background-color: var(--color-bg);
      color: var(--color-text);
      transition: background-color 0.3s ease, color 0.3s ease;
    }

    /* ========== SKIP-TO-CONTENT ========== */
    .skip-to-content {
      position: absolute;
      left: -9999px;
      top: 0;
      z-index: calc(var(--z-search) + 1);
      background: #2563eb;
      color: white;
      padding: 0.75rem 1.5rem;
      font-weight: 700;
      font-size: 0.95rem;
      border-radius: 0 0 0.5rem 0;
      text-decoration: none;
      transition: left 0.15s;
    }
    .skip-to-content:focus {
      left: 0;
    }

    /* ========== FOCUS-VISIBLE RING ========== */
    :focus-visible {
      outline: 2px solid #3b82f6;
      outline-offset: 2px;
    }
    .taskbar :focus-visible {
      outline-color: rgba(255, 255, 255, 0.9);
    }
    
    .logo-font {
      font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }
    
    .main-container {
      height: 100%;
      width: 100%;
      padding: 5.5rem 2rem 2rem 2rem;
      overflow: auto;
    }
    
    .taskbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      z-index: var(--z-taskbar);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    
    .taskbar-container {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: var(--taskbar-gap, 0.5rem);
      padding: 0.5rem 1rem;
      max-width: 100%; 
      width: 100%;
      flex-wrap: nowrap;
    }

    /* === CONSOLIDATED TASKBAR LAYOUT === */
    .taskbar-left {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      flex-shrink: 0;
    }

    .taskbar-right {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      flex-shrink: 0;
    }

    /* Lesson navigation center section — taskbar stepper */
    .taskbar-center {
      display: flex;
      align-items: center;
      margin: 0 auto;
      opacity: 0.95;
    }

    .tb-progress-bar {
      display: flex;
      align-items: center;
      gap: 0;
    }

    .tb-lp-step {
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      flex: 1;
      min-width: 5.5rem;
    }

    .tb-lp-connector {
      position: absolute;
      top: 1.1rem;
      right: 50%;
      width: 100%;
      height: 3px;
      border-radius: 2px;
      z-index: 0;
    }

    .tb-lp-connector-done {
      background: linear-gradient(90deg, #10b981, #3b82f6);
    }

    .tb-lp-connector-pending {
      background: rgba(255, 255, 255, 0.2);
    }

    .tb-lp-dot-link {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-decoration: none;
      color: inherit;
    }

    .tb-lp-dot-link:hover .tb-lp-dot {
      transform: scale(1.15);
    }

    .tb-lp-dot {
      width: 2.2rem;
      height: 2.2rem;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
      font-weight: 700;
      position: relative;
      z-index: 1;
      transition: transform 0.2s ease, box-shadow 0.2s;
    }

    .tb-lp-label {
      margin-top: 0.2rem;
      font-size: 0.7rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      transition: color 0.2s;
    }

    /* Step states */
    .tb-lp-completed .tb-lp-dot {
      background: linear-gradient(135deg, #10b981, #059669);
      color: white;
      box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
    }
    .tb-lp-completed .tb-lp-label {
      color: #34d399;
    }

    .tb-lp-current .tb-lp-dot {
      background: linear-gradient(135deg, #3b82f6, #8b5cf6);
      color: white;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 4px 12px rgba(59, 130, 246, 0.35);
      animation: tb-lp-pulse 2.5s ease-in-out infinite;
    }
    .tb-lp-current .tb-lp-label {
      color: #93c5fd;
      font-weight: 700;
    }

    .tb-lp-upcoming .tb-lp-dot {
      background: rgba(255, 255, 255, 0.12);
      color: rgba(255, 255, 255, 0.5);
      border: 2px solid rgba(255, 255, 255, 0.25);
    }
    .tb-lp-upcoming .tb-lp-label {
      color: rgba(255, 255, 255, 0.45);
    }

    @keyframes tb-lp-pulse {
      0%, 100% { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 4px 12px rgba(59, 130, 246, 0.35); }
      50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.1), 0 4px 16px rgba(59, 130, 246, 0.45); }
    }

    /* Overflow "More" menu for secondary items */
    .taskbar-more-wrap {
      position: relative;
    }

    .taskbar-more-btn {
      padding: 0.5rem 0.75rem;
      border-radius: 0.5rem;
      font-weight: 600;
      color: white;
      background: rgba(255, 255, 255, 0.1);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.875rem;
      white-space: nowrap;
      transition: background 0.2s;
    }

    .taskbar-more-btn:hover {
      background: rgba(255, 255, 255, 0.2);
    }

    .taskbar-more-panel {
      position: fixed;
      z-index: var(--z-more-panel);
      min-width: 180px;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      border-radius: 0.75rem;
      box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15);
      padding: 0.4rem;
      display: none;
    }

    .taskbar-more-panel.is-open {
      display: block;
    }

    .taskbar-more-panel .more-item {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      padding: 0.6rem 0.8rem;
      border-radius: 0.5rem;
      min-height: 44px;
      color: #0f172a;
      text-decoration: none;
      font-weight: 500;
      font-size: 0.9rem;
      cursor: pointer;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
    }

    .taskbar-more-panel .more-item:hover {
      background: #f1f5f9;
      color: #3b82f6;
    }

    body.dark-mode .taskbar-more-panel {
      background: #1e293b;
      border-color: #334155;
    }

    body.dark-mode .taskbar-more-panel .more-item {
      color: #e2e8f0;
    }

    body.dark-mode .taskbar-more-panel .more-item:hover {
      background: rgba(255,255,255,0.08);
      color: #3b82f6;
    }

    /* === BREADCRUMBS === */
    .breadcrumb-bar {
      width: 100%;
      background: rgba(255, 255, 255, 0.08);
      border-top: 1px solid rgba(255, 255, 255, 0.12);
      padding: 0.3rem 1.5rem;
      display: flex;
      align-items: center;
      overflow-x: auto;
      -ms-overflow-style: none;
      scrollbar-width: none;
    }

    .breadcrumb-bar::-webkit-scrollbar {
      display: none;
    }

    .breadcrumb-bar a,
    .breadcrumb-bar span {
      white-space: nowrap;
      font-size: 0.8rem;
      font-weight: 500;
      color: rgba(255, 255, 255, 0.7);
      text-decoration: none;
      transition: color 0.2s;
    }

    .breadcrumb-bar a:hover {
      color: #ffffff;
    }

    .breadcrumb-bar .bc-current {
      color: #ffffff;
      font-weight: 600;
    }

    .breadcrumb-sep {
      margin: 0 0.4rem;
      color: rgba(255, 255, 255, 0.4);
      font-size: 0.75rem;
    }

    /* === HAMBURGER MENU (MOBILE) === */
    .hamburger-btn {
      display: none;
      background: none;
      border: none;
      color: white;
      cursor: pointer;
      padding: 0.5rem;
      font-size: 1.5rem;
      line-height: 1;
      z-index: var(--z-hamburger);
      min-width: 44px;
      min-height: 44px;
      align-items: center;
      justify-content: center;
    }

    .mobile-drawer-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(4px);
      z-index: var(--z-drawer-overlay);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .mobile-drawer-overlay.is-open {
      display: block;
      opacity: 1;
    }

    .mobile-drawer {
      position: fixed;
      top: 0;
      right: -300px;
      width: 280px;
      max-width: 85vw;
      height: 100%;
      background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
      z-index: var(--z-drawer);
      transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      overflow-y: auto;
      padding: 1rem 0;
      box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .mobile-drawer.is-open {
      right: 0;
    }

    .mobile-drawer-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.5rem 1.25rem 1rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      margin-bottom: 0.5rem;
    }

    .mobile-drawer-header .drawer-title {
      font-size: 1.1rem;
      font-weight: 700;
      color: #f8fafc;
    }

    .mobile-drawer-close {
      background: none;
      border: none;
      color: #94a3b8;
      cursor: pointer;
      font-size: 1.5rem;
      padding: 0.25rem;
      line-height: 1;
    }

    .mobile-drawer-close:hover {
      color: #f8fafc;
    }

    .mobile-drawer-section {
      padding: 0.5rem 1rem;
    }

    .mobile-drawer-section-title {
      font-size: 0.7rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #64748b;
      padding: 0.25rem 0.5rem;
      margin-bottom: 0.25rem;
    }

    .mobile-drawer .drawer-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.7rem 0.75rem;
      border-radius: 0.5rem;
      min-height: 44px;
      color: #e2e8f0;
      text-decoration: none;
      font-weight: 500;
      font-size: 0.95rem;
      cursor: pointer;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
      transition: background 0.15s;
    }

    .mobile-drawer .drawer-item:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #3b82f6;
    }

    .mobile-drawer .drawer-divider {
      height: 1px;
      background: rgba(255, 255, 255, 0.08);
      margin: 0.5rem 1rem;
    }

    @media (max-width: 768px) {
      .hamburger-btn {
        display: flex;
        align-items: center;
      }

      .taskbar-right {
        display: none;
      }

      .taskbar-center {
        display: none;
      }

      .taskbar-more-wrap {
        display: none;
      }

      .taskbar-category {
        display: none !important;
      }

      .taskbar-left .taskbar-button:not(#back-button) {
        display: none;
      }

      .breadcrumb-bar {
        padding: 0.25rem 1rem;
      }

      #language-toggle-button {
        display: none !important;
      }
    }

    /* ========== LESSON PROGRESSION BAR ========== */
    .lesson-progress-bar {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem 2rem;
      margin-top: 1.25rem;
      background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
      border: 1px solid rgba(226, 232, 240, 0.6);
      border-radius: 1rem;
      gap: 0;
      position: relative;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    }

    body.dark-mode .lesson-progress-bar {
      background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
      border-color: rgba(51, 65, 85, 0.5);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    .lp-step {
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      flex: 1;
      max-width: 10rem;
    }

    .lp-connector {
      position: absolute;
      top: 1.25rem;
      right: 50%;
      width: 100%;
      height: 3px;
      border-radius: 2px;
      z-index: 0;
    }

    .lp-connector-done {
      background: linear-gradient(90deg, #10b981, #3b82f6);
    }

    .lp-connector-pending {
      background: #e2e8f0;
    }

    body.dark-mode .lp-connector-pending {
      background: #334155;
    }

    .lp-dot-link {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-decoration: none;
      color: inherit;
    }

    .lp-dot-link:hover .lp-dot {
      transform: scale(1.12);
    }

    .lp-dot {
      width: 2.5rem;
      height: 2.5rem;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      font-weight: 700;
      position: relative;
      z-index: 1;
      transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s;
    }

    .lp-label {
      margin-top: 0.4rem;
      font-size: 0.72rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      transition: color 0.2s;
    }

    /* Step states */
    .lp-completed .lp-dot {
      background: linear-gradient(135deg, #10b981, #059669);
      color: white;
      box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    }
    .lp-completed .lp-label {
      color: #059669;
    }

    .lp-current .lp-dot {
      background: linear-gradient(135deg, #3b82f6, #8b5cf6);
      color: white;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18), 0 4px 12px rgba(59, 130, 246, 0.25);
      animation: lp-pulse 2.5s ease-in-out infinite;
    }
    .lp-current .lp-label {
      color: #3b82f6;
      font-weight: 700;
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    body.dark-mode .lp-current .lp-label {
      color: #93c5fd;
    }

    .lp-upcoming .lp-dot {
      background: #e2e8f0;
      color: #94a3b8;
      border: 2px solid #cbd5e1;
    }
    .lp-upcoming .lp-label {
      color: #94a3b8;
    }

    body.dark-mode .lp-upcoming .lp-dot {
      background: #1e293b;
      color: #475569;
      border-color: #334155;
    }
    body.dark-mode .lp-upcoming .lp-label {
      color: #64748b;
    }

    body.dark-mode .lp-completed .lp-dot {
      background: linear-gradient(135deg, #10b981, #059669);
    }
    body.dark-mode .lp-completed .lp-label {
      color: #34d399;
    }

    @keyframes lp-pulse {
      0%, 100% { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18), 0 4px 12px rgba(59, 130, 246, 0.25); }
      50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.08), 0 4px 16px rgba(59, 130, 246, 0.35); }
    }

    @media (max-width: 480px) {
      .lesson-progress-bar {
        padding: 0.75rem 1rem;
      }
      .lp-dot {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
      }
      .lp-label {
        font-size: 0.6rem;
      }
    }

    /* ========== COURSE SIDEBAR NAVIGATION ========== */
    .course-sidebar {
      width: 15rem;
      min-width: 15rem;
      flex-shrink: 0;
      background: var(--color-bg);
      border: 2px solid rgba(15, 23, 42, 0.15);
      border-radius: 2rem;
      margin-right: 1rem;
      padding: 0;
      position: sticky;
      top: 5.5rem;
      max-height: calc(100vh - 6.5rem);
      overflow-y: auto;
      overflow-x: hidden;
      transition: margin-left 0.25s cubic-bezier(.4,0,.2,1), margin-right 0.25s cubic-bezier(.4,0,.2,1), background-color 0.3s ease, border-color 0.3s ease;
      z-index: var(--z-sidebar);
      box-shadow: 0 1px 3px var(--color-shadow);
      /* Hidden scrollbar by default, shows on hover */
      scrollbar-width: none;
      align-self: stretch;
    }

    .course-sidebar::-webkit-scrollbar {
      width: 4px;
    }
    .course-sidebar::-webkit-scrollbar-track {
      background: transparent;
    }
    .course-sidebar::-webkit-scrollbar-thumb {
      background: transparent;
      border-radius: 4px;
    }
    .course-sidebar:hover {
      scrollbar-width: thin;
      scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
    }
    .course-sidebar:hover::-webkit-scrollbar-thumb {
      background: rgba(148, 163, 184, 0.35);
    }
    .course-sidebar:hover::-webkit-scrollbar-thumb:hover {
      background: rgba(148, 163, 184, 0.55);
    }

    body.dark-mode .course-sidebar {
      border-color: rgba(255, 255, 255, 0.08);
    }
    body.dark-mode .course-sidebar:hover {
      scrollbar-color: rgba(100, 116, 139, 0.4) transparent;
    }
    body.dark-mode .course-sidebar:hover::-webkit-scrollbar-thumb {
      background: rgba(100, 116, 139, 0.4);
    }

    .course-sidebar.is-collapsed {
      margin-left: -12.5rem;
      margin-right: 0.5rem;
      overflow: hidden;
    }

    .course-sidebar.is-collapsed .cs-unit {
      visibility: hidden;
      opacity: 0;
    }
    .course-sidebar.is-collapsed .cs-title {
      visibility: hidden;
      opacity: 0;
    }

    .cs-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.85rem 0.9rem;
      border-bottom: 1px solid rgba(226, 232, 240, 0.7);
      position: sticky;
      top: 0;
      background: inherit;
      z-index: 1;
      border-radius: 2rem 2rem 0 0;
    }

    body.dark-mode .cs-header {
      border-bottom-color: rgba(51, 65, 85, 0.5);
    }

    .cs-unit-header,
    .cs-lesson {
      min-height: 40px;
    }

    .cs-title {
      font-weight: 700;
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #94a3b8;
    }

    body.dark-mode .cs-title {
      color: #64748b;
    }

    .cs-collapse-btn {
      background: none;
      border: none;
      cursor: pointer;
      width: 1.6rem;
      height: 1.6rem;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
      color: #94a3b8;
      border-radius: 0.375rem;
      transition: background 0.15s, color 0.15s;
    }

    .cs-collapse-btn svg {
      transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    }

    .cs-collapse-btn:hover {
      background: rgba(59, 130, 246, 0.08);
      color: #3b82f6;
    }

    body.dark-mode .cs-collapse-btn:hover {
      background: rgba(96, 165, 250, 0.1);
      color: #60a5fa;
    }

    .cs-unit {
      border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    }

    .cs-unit:last-child {
      border-bottom: none;
    }

    body.dark-mode .cs-unit {
      border-bottom-color: rgba(51, 65, 85, 0.4);
    }

    .cs-unit-header {
      display: flex;
      align-items: center;
      width: 100%;
      padding: 0.7rem 0.9rem;
      background: none;
      border: none;
      cursor: pointer;
      font-size: 0.82rem;
      font-weight: 600;
      color: #334155;
      gap: 0.5rem;
      transition: background 0.15s;
    }

    body.dark-mode .cs-unit-header {
      color: #e2e8f0;
    }

    .cs-unit-header:hover {
      background: rgba(59, 130, 246, 0.04);
    }

    .cs-unit-name {
      flex: 1;
      text-align: left;
    }

    .cs-unit-progress {
      font-size: 0.65rem;
      color: #94a3b8;
      font-weight: 500;
      background: rgba(148, 163, 184, 0.1);
      padding: 0.15rem 0.45rem;
      border-radius: 1rem;
    }
    .cs-unit-progress.cs-unit-done {
      color: #059669;
      background: rgba(5, 150, 105, 0.1);
      font-weight: 600;
    }

    body.dark-mode .cs-unit-progress {
      background: rgba(100, 116, 139, 0.15);
      color: #64748b;
    }
    body.dark-mode .cs-unit-progress.cs-unit-done {
      color: #34d399;
      background: rgba(52, 211, 153, 0.12);
    }

    .cs-chevron {
      display: flex;
      align-items: center;
      transition: transform 0.25s cubic-bezier(.4,0,.2,1);
      color: #cbd5e1;
    }

    body.dark-mode .cs-chevron {
      color: #475569;
    }

    .cs-unit.is-expanded .cs-chevron {
      transform: rotate(90deg);
    }

    .cs-lessons {
      display: grid;
      grid-template-rows: 0fr;
      transition: grid-template-rows 0.25s cubic-bezier(.4,0,.2,1);
    }

    .cs-unit.is-expanded .cs-lessons {
      grid-template-rows: 1fr;
    }

    .cs-lessons-inner {
      overflow: hidden;
      min-height: 0;
    }

    .cs-lesson {
      display: flex;
      align-items: center;
      padding: 0.45rem 0.9rem 0.45rem 1.5rem;
      font-size: 0.76rem;
      color: #64748b;
      text-decoration: none;
      transition: background 0.15s, color 0.15s, padding-left 0.15s;
      gap: 0.4rem;
      border-left: 2px solid transparent;
    }

    body.dark-mode .cs-lesson {
      color: #94a3b8;
    }

    .cs-lesson:hover {
      background: rgba(59, 130, 246, 0.05);
      color: #3b82f6;
      border-left-color: rgba(59, 130, 246, 0.3);
      padding-left: 1.6rem;
    }

    body.dark-mode .cs-lesson:hover {
      background: rgba(96, 165, 250, 0.06);
      color: #60a5fa;
      border-left-color: rgba(96, 165, 250, 0.3);
    }

    .cs-lesson-status {
      font-size: 0.65rem;
      min-width: 0.9rem;
      text-align: center;
      flex-shrink: 0;
    }

    .cs-lesson-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 1.35;
    }

    .cs-completed {
      color: #059669 !important;
    }

    .cs-started {
      color: #3b82f6 !important;
    }

    body.dark-mode .cs-completed {
      color: #34d399 !important;
    }

    body.dark-mode .cs-started {
      color: #60a5fa !important;
    }

    @media (max-width: 768px) {
      .course-sidebar {
        position: fixed;
        left: 0;
        top: 3.5rem;
        bottom: 0;
        border-radius: 0;
        z-index: var(--z-mobile-sidebar-open);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(.4,0,.2,1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
        margin-right: 0;
      }

      .course-sidebar.is-mobile-open {
        transform: translateX(0);
      }

      .course-sidebar.is-collapsed {
        margin-left: 0;
      }
    }

    .cs-mobile-toggle {
      display: none;
      position: fixed;
      bottom: 1.5rem;
      left: 1.5rem;
      z-index: var(--z-mobile-sidebar);
      min-width: 44px;
      min-height: 44px;
      background: linear-gradient(135deg, #3b82f6, #6366f1);
      color: white;
      border: none;
      border-radius: 2rem;
      padding: 0.55rem 1.1rem;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
      transition: transform 0.2s, box-shadow 0.2s;
      letter-spacing: 0.02em;
    }

    .cs-mobile-toggle:hover {
      transform: scale(1.05);
      box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    }

    @media (max-width: 768px) {
      .cs-mobile-toggle {
        display: flex;
        align-items: center;
        gap: 0.35rem;
      }
    }

    .cs-mobile-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.35);
      backdrop-filter: blur(2px);
      -webkit-backdrop-filter: blur(2px);
      z-index: var(--z-mobile-overlay);
      transition: opacity 0.3s;
    }

    .cs-mobile-overlay.is-open {
      display: block;
    }

    .taskbar-button {
      padding: var(--taskbar-padding-y, 0.5rem) var(--taskbar-padding-x, 1rem);
      font-size: var(--taskbar-font-size, 0.875rem);
      border-radius: 0.5rem;
      font-weight: 600;
      color: white;
      transition: opacity 0.3s, transform 0.2s;
      background: rgba(255, 255, 255, 0.1);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      white-space: nowrap;
      text-decoration: none;
      min-height: 2.5rem;
    }
    
    .taskbar-button:hover {
      opacity: 0.9;
      scale: 1.05;
      background: rgba(255, 255, 255, 0.2);
    }

    /* Icon-only buttons with labels */
    .taskbar-icon-btn {
      flex-direction: column;
      gap: 0;
      padding: 0.3rem 0.6rem;
      min-width: 44px;
      min-height: 44px;
      justify-content: center;
    }

    .taskbar-icon-btn .tb-icon {
      font-size: 1.15rem;
      line-height: 1;
    }

    .taskbar-icon-btn .tb-label {
      font-size: 0.55rem;
      font-weight: 500;
      opacity: 0.85;
      letter-spacing: 0.02em;
      line-height: 1;
      margin-top: 1px;
    }

    .settings-menu {
      width: 13rem;
      padding: 0.5rem;
      background: #ffffff;
      border-radius: 0.5rem;
      box-shadow: 0 8px 20px rgba(2,6,23,0.12);
      color: #0f172a;
      font-size: 0.95rem;
      visibility: hidden;
      opacity: 0;
      transform: translateY(-6px);
      transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
      position: fixed;
      z-index: var(--z-dropdown);
    }

    body.dark-mode .settings-menu {
      background: #0f172a;
      color: #cbd5e1;
    }

    .page-title {
      font-size: 2.25rem;
      font-weight: 700;
      margin-bottom: 1rem;
      background: linear-gradient(135deg, #2563eb 0%, #059669 50%, #7c3aed 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
      display: inline-block;
      filter: drop-shadow(0 0 0.5px rgba(0,0,0,0.05));
    }

    body.dark-mode .page-title {
      background: linear-gradient(135deg, #60a5fa 0%, #34d399 50%, #a78bfa 100%);
      -webkit-background-clip: text;
      background-clip: text;
    }

    .courses-container {
      background: var(--color-surface);
      border-radius: 2rem;
      border: 2px solid rgba(15, 23, 42, 0.15);
      min-height: 32rem;
      padding: 2rem;
      margin-bottom: 2rem;
      position: relative;
      transition: background-color 0.3s ease, border-color 0.3s ease;
    }

    .courses-container:has(.lesson-layout) {
      display: grid;
      grid-template-columns: 1fr 1fr;
      grid-template-rows: auto auto;
      gap: 0.75rem 1rem;
    }

    .courses-container:has(.lesson-layout) .lesson-layout {
      display: contents;
    }

    .courses-container:has(.lesson-layout) .video-stack {
      grid-column: 1 / -1;
    }

    .courses-container:has(.lesson-layout) .rubric-box {
      grid-column: 1;
      justify-self: start;
      align-self: center;
    }

    .courses-container:has(.lesson-layout) .side-buttons {
      grid-column: 2;
      justify-self: end;
      align-self: center;
    }

    .courses-section {
      margin-bottom: 2rem;
    }

    .lesson-layout {
      display: flex;
      flex-wrap: wrap;
      gap: 1.5rem;
      align-items: flex-start;
      width: 100%;
    }

    /* Embedded Summary Styles */
    .lesson-notes {
      margin-top: 1.5rem;
      background: var(--color-surface);
      border: 1px solid var(--color-border);
      border-radius: 1rem;
      padding: 1.5rem 1.75rem;
      box-shadow: 0 10px 18px var(--color-shadow);
      color: var(--color-text);
      transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    }

    .lesson-notes h3 {
      font-size: 1.2rem;
      font-weight: 700;
      color: var(--color-text);
      margin-bottom: 0.5rem;
    }

    .lesson-notes p {
      margin-bottom: 1rem;
      color: var(--color-text);
    }

    .lesson-notes ul {
      margin: 0 0 1.25rem 1.25rem;
      color: var(--color-text);
      list-style: disc;
    }

    .lesson-notes li {
      margin-bottom: 0.35rem;
    }
    
    .diagram-card {
      background: rgba(255, 255, 255, 0.95);
      border-radius: 1rem;
      padding: 1.5rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      margin-top: 1.5rem;
      position: relative;
    }

    body.dark-mode .lesson-notes {
      background: #0f172a;
      border: 1px solid #1e293b;
      box-shadow: 0 10px 18px rgba(2, 6, 23, 0.35);
      color: #e2e8f0;
    }

    body.dark-mode .lesson-notes h3 {
      color: #f8fafc;
    }

    body.dark-mode .lesson-notes p,
    body.dark-mode .lesson-notes ul {
      color: #e2e8f0;
    }

    body.dark-mode .diagram-card {
      background: rgba(15, 23, 42, 0.85);
    }
    
    .summary-actions {
      margin-top: 1.5rem;
      display: flex;
      justify-content: flex-end;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    .side-buttons {
      position: relative;
      display: flex;
      flex-direction: row;
      flex: 1 1 100%;
      gap: 1rem;
      z-index: var(--z-side-buttons);
      align-items: center;
      justify-content: flex-end;
      pointer-events: auto;
    }

    /* Flashcard Styles */
    body.dark-mode .flashcard-box {
      background: #1e293b !important;
      color: #e2e8f0 !important;
      box-shadow: 0 2px 12px rgba(0,0,0,0.35) !important;
      border: 1.5px solid #334155;
    }
    body.dark-mode #prev-flashcard {
      background: #b91c1c !important;
      color: #fff !important;
    }
    body.dark-mode #next-flashcard {
      background: #059669 !important;
      color: #fff !important;
    }
    body.dark-mode .flashcard-box svg {
      filter: drop-shadow(0 0 2px #0f172a);
    }
    #shuffle-flashcard {
      background: #6366f1;
      color: #fff;
      border: none;
      border-radius: 0.5rem;
      padding: 0.75rem 1.5rem;
      cursor: pointer;
      font-weight: 600;
      margin-left: 1rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      box-shadow: 0 2px 8px rgba(0,0,0,0.12);
      transition: background 0.2s;
    }
    #shuffle-flashcard:hover {
      background: #4f46e5;
    }
    body.dark-mode #shuffle-flashcard {
      background: #3730a3;
    }
    body.dark-mode #shuffle-flashcard:hover {
      background: #312e81;
    }

    .side-button {
      padding: 1rem 1.5rem;
      border-radius: 0.75rem;
      font-weight: 600;
      color: #ffffff;
      font-size: 1rem;
      border: none;
      cursor: pointer;
      background: linear-gradient(135deg, #8b5cf6 0%, #10b981 50%, #3b82f6 100%);
      box-shadow: 0 6px 14px rgba(15, 23, 42, 0.2);
      min-width: 11rem;
      display: inline-flex;
      justify-content: center;
      align-items: center;
      text-decoration: none;
      text-align: center;
    }
    .side-button:hover {
      opacity: 0.9;
      transform: scale(1.1);
    }
    .videos-panel {
      width: 12rem;
      min-height: 6rem;
      pointer-events: auto;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      display: block;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.25rem);
      z-index: 10;
      opacity: 0;
      transform-origin: bottom right;
      transform: scale(3);
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem 0.7rem;
    }

    .videos-panel.is-open {
      opacity: 0.9;
      visibility: visible;
      pointer-events: auto;
      animation: panelFadeIn 0.25s ease-out;
    }

    .Practice-actions {
      margin-top: 1.5rem;
      display: flex;
      justify-content: flex-end;
    }

    /* Scaled Quiz Styles */
    #quiz-content-view .quiz-question p {
      font-size: 1.45rem !important; /* Scaled from 1.1rem */
    }
    #quiz-content-view label {
      font-size: 1.3rem !important; /* Scaled from base */
    }
    #quiz-content-view .side-button {
      font-size: 1.3rem !important;
    }
    #quiz-content-view input[type="radio"] {
      transform: scale(1.3);
      margin-right: 0.75rem !important;
    }
    #quiz-content-view .attempts-indicator {
      font-size: 1.25rem !important;
      color: #64748b;
      margin-bottom: 0.5rem;
      font-weight: 700;
    }

    .Practices-menu {
      position: relative;
    }

    .Practices-panel {
      width: 12rem;
      min-height: 3rem;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.25rem);
      z-index: 10;
      opacity: 0;
      transform: scale(0.95);
      transform-origin: bottom right;
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem;
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    }

    .Practices-panel.is-open {
      opacity: 0.95;
      visibility: visible;
      pointer-events: auto;
      transform: scale(1);
    }
    
    .Practices-panel a {
      display: block;
      color: #e2e8f0;
      text-decoration: none;
      padding: 0.5rem;
      border-radius: 0.25rem;
      font-size: 0.9rem;
      font-weight: 500;
    }
    
    .Practices-panel a:hover {
      background: rgba(255, 255, 255, 0.1);
      color: white;
    }

    .videos-panel-title {
      font-size: 0.65rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #cbd5f5;
      margin-bottom: 0.45rem;
    }

    .videos-panel a {
      display: block;
      font-size: 0.7rem;
      line-height: 1.2;
      color: #e2e8f0;
      text-decoration: none;
      margin-bottom: 0.35rem;
    }

    .videos-panel a:hover {
      color: #93c5fd;
    }

    .videos-panel-legend {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.2rem;
      margin-bottom: 0.35rem;
      margin-left: auto;
      width: 3.2rem;
    }

    .videos-panel-legend span {
      font-size: 0.45rem;
      font-weight: 700;
      color: #cbd5f5;
      text-align: center;
      letter-spacing: 0.04em;
    }

    .videos-panel-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .video-info-text {
      position: absolute;
      left: 0.75rem;
      top: calc(100% - 5.25rem);
      width: calc(100% - 0.75rem);
      z-index: 5;
      border: 2px solid #e2e8f0;
      border-radius: 0.9rem;
      background: #ffffff;
      color: #1e293b;
      padding: 0.8rem 1.1rem;
      text-align: center;
      opacity: 0;
      transition: opacity 0.4s ease;
      display: none;
    }

    body.dark-mode .video-info-text {
      border-color: #334155;
      background: #0f172a;
      color: #e2e8f0;
    }

    .video-info-text.is-visible {
      display: block;
      opacity: 0.95;
    }

    .video-info-text.is-fading {
      opacity: 0;
    }

    .videos-panel-item:last-child a {
      margin-bottom: 0;
    }

    .mini-rubric {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      width: 3.2rem;
      height: 0.45rem;
      border-radius: 999px;
      overflow: hidden;
      border: 1px solid rgba(148, 163, 184, 0.7);
      flex-shrink: 0;
    }

    .mini-rubric span {
      display: block;
      height: 100%;
    }

    .side-buttons.videos-open .videos-panel {
      display: block;
    }

    .rubric-box {
      position: relative;
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 1rem;
      z-index: 8;
      width: fit-content;
    }

    .rubric-hover-wrap {
      position: relative;
      z-index: 20;
    }

    .rubric-hover-dot {
      scale: 1.5;
      width: 1.4rem;
      height: 1.4rem;
      border-radius: 999px;
      border: 2px solid #cbd5e1;
      background: #ffffff;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
      cursor: pointer;
      position: relative;
      z-index: 21;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      font-weight: 700;
    }

    body.dark-mode .rubric-hover-dot {
      border-color: #1f2937;
      background: #0f172a;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
    }

    .rubric-hover-dot span {
      font-family: 'Playfair Display', 'Poppins', serif;
      background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
    }

    .rubric-hover-panel {
      position: absolute;
      bottom: calc(100% + 0.5rem);
      right: 0;
      width: 12rem;
      min-height: 3rem;
      background: #ffffff;
      border: 2px solid #e2e8f0;
      border-radius: 0.75rem;
      padding: 0.5rem;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-0.25rem);
      transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
      z-index: 30;
      pointer-events: none;
    }

    body.dark-mode .rubric-hover-panel {
      background: #0f172a;
      border-color: #334155;
    }

    .rubric-hover-panel p {
      font-size: 0.7rem;
      line-height: 1.2;
      margin: 0.25rem 0;
      color: #334155;
    }

    body.dark-mode .rubric-hover-panel p {
      color: #cbd5e1;
    }

    .rubric-hover-wrap:hover .rubric-hover-panel {
      opacity: 0.9;
      visibility: visible;
      transform: translateY(0);
    }

    .rubric-box .page-title {
      margin-bottom: 0;
    }

    .rubric-card {
      background: #f8fafc;
      border-radius: 1rem;
      border: 3px solid transparent;
      --rubric-border-gradient: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      background:
        linear-gradient(#f8fafc, #f8fafc) padding-box,
        var(--rubric-border-gradient) border-box;
      width: 20rem;
      height: auto;
      margin-top: 0;
      padding: 0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      transform: none;
      overflow: hidden;
    }
    .rubric-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0;
      height: 100%;
    }

    .rubric-item {
      padding: 0.75rem 0.5rem;
      text-align: center;
      font-size: 0.85rem;
      color: #0f172a;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      border-right: 2px solid rgba(15, 23, 42, 0.85);
      border-left: none;
      border-bottom: none;
      border-top: none;
    }

    .rubric-item:first-child {
      border-left: none;
    }

    .rubric-text {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
      transform: none;
      white-space: nowrap;
    }

    .rubric-label {
      font-weight: 600;
    }

    .rubric-rating {
      font-size: 0.7rem;
      font-weight: 600;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    .rubric-item:nth-child(1) {
      background: #90EE90;
    }

    .rubric-item:nth-child(2) {
      background: #FFD700;
    }

    .rubric-item:nth-child(3) {
      background: #7FFF00;
    }

    .rubric-item:nth-child(4) {
      background: #FFD700;
    }

    .rubric-item:last-child {
      border-right: none;
    }

    body.dark-mode .rubric-item {
      color: #0f172a;
      border-right-color: rgba(226, 232, 240, 0.85);
      border-left-color: transparent;
      border-top-color: transparent;
      border-bottom-color: transparent;
      border-top-width: 0;
      border-bottom-width: 0;
    }

    body.dark-mode .rubric-card {
      background:
        linear-gradient(#0f172a, #0f172a) padding-box,
        var(--rubric-border-gradient) border-box;
    }

    body.dark-mode .rubric-item:nth-child(1) {
      background: #90EE90;
    }

    body.dark-mode .rubric-item:nth-child(2) {
      background: #FFD700;
    }

    body.dark-mode .rubric-item:nth-child(3) {
      background: #7FFF00;
    }

    body.dark-mode .rubric-item:nth-child(4) {
      background: #FFD700;
    }

    .video-stack {
      flex: 1 1 100%;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      position: relative;
    }

    .video-embed {
      position: relative;
      transform: scale(0.85);
      transform-origin: top left;
      width: 100%;
      padding-top: 56.25%;
      margin-left: 0.75rem;
      margin-top: 0.5rem;
      border-radius: 1rem;
      overflow: hidden;
      background: rgba(255, 255, 255, 0.95);
      box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
    }

    .video-embed iframe {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border: 0;
      z-index: 1;
    }

    body.dark-mode .video-embed {
      background: rgba(15, 23, 42, 0.85);
    }

    .courses-section-title {
      font-size: 1.5rem;
      font-weight: 700;
      color: #1e293b;
      margin-bottom: 1rem;
    }

    body.dark-mode .courses-section-title {
      color: #f8fafc;
    }

    .courses-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1rem;
    }

    .course-box {
      border-radius: 1rem;
      padding: 1.25rem 0.75rem;
      text-align: center;
      transition: all 0.3s ease;
      cursor: pointer;
      color: #1e293b;
    }

    body:not(.dark-mode) .course-box {
      background: #ffffff !important;
      border: 1px solid #e2e8f0 !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    }

    body:not(.dark-mode) .course-box:hover {
      background: #ffffff !important;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    }

    .course-box:hover {
      transform: translateY(-4px);
    }

    .course-box a {
      text-decoration: none;
      color: #1e293b;
      font-size: 1.125rem;
      font-weight: 600;
      display: block;
      background: transparent !important;
      box-shadow: none !important;
    }

    .course-box a:hover {
      color: #3b82f6;
    }

    body.dark-mode .course-box {
      background: transparent !important;
      color: #cbd5e1;
      border-color: transparent !important;
      box-shadow: none !important;
    }

    body.dark-mode .course-box a {
      color: #cbd5e1;
      background: transparent !important;
    }

    body.dark-mode .course-box a:hover {
      color: #3b82f6;
    }

    body.dark-mode .courses-container {
      background: var(--color-surface-alt);
      border: 2px solid rgba(226, 232, 240, 0.22);
    }
    @keyframes panelFadeIn {
      from {
        opacity: 0;
        transform: scale(2.7);
      }
      to {
        opacity: 0.8;
        transform: scale(3);
      }
    }

    .lesson-notes {
      margin-top: 1.5rem;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 1rem;
      padding: 1.5rem 1.75rem;
      box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
      color: #0f172a;
    }

    .lesson-notes h3 {
      font-size: 1.2rem;
      font-weight: 700;
      color: #0f172a;
      margin-bottom: 0.5rem;
    }

    .lesson-notes p {
      margin-bottom: 1rem;
      color: #1e293b;
    }

    .lesson-notes ul {
      margin: 0 0 1.25rem 1.25rem;
      color: #1e293b;
      list-style: disc;
    }

    .lesson-notes li {
      margin-bottom: 0.35rem;
    }

    body.dark-mode .lesson-notes {
      background: #0f172a;
      border: 1px solid #1e293b;
      box-shadow: 0 10px 18px rgba(2, 6, 23, 0.35);
      color: #e2e8f0;
    }

    body.dark-mode .lesson-notes h3 {
      color: #f8fafc;
    }

    body.dark-mode .lesson-notes p,
    body.dark-mode .lesson-notes ul {
      color: #e2e8f0;
    }

    body.dark-mode .diagram-card {
      background: rgba(15, 23, 42, 0.85);
    }

    .diagram-placeholder {
      border: 2px dashed rgba(59, 130, 246, 0.6);
      border-radius: 0.75rem;
      padding: 2.5rem;
      text-align: center;
      color: #475569;
    }

    body.dark-mode .diagram-placeholder {
      color: #cbd5e1;
      border-color: rgba(148, 163, 184, 0.6);
    }
    
    .diagram-card {
      background: rgba(255, 255, 255, 0.95);
      border-radius: 1rem;
      padding: 1.5rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      margin-top: 1.5rem;
      position: relative;
    }
    .summary-actions {
      margin-top: 1.5rem;
      display: flex;
      justify-content: flex-end;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    /* videos-panel-overrides */
    .side-buttons {
      z-index: 30;
      pointer-events: auto;
    }

    .videos-panel {
      width: 12rem;
      min-height: 6rem;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      display: block;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.25rem);
      z-index: 10;
      opacity: 0;
      transform-origin: bottom right;
      transform: scale(3);
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem 0.7rem;
    }

    .videos-panel.is-open {
      opacity: 0.9;
      visibility: visible;
      pointer-events: auto;
      animation: panelFadeIn 0.25s ease-out;
    }

    .videos-panel-title {
      font-size: 0.65rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #cbd5f5;
      margin-bottom: 0.45rem;
    }

    .videos-panel a {
      display: block;
      font-size: 0.7rem;
      line-height: 1.2;
      color: #e2e8f0;
      text-decoration: none;
      margin-bottom: 0.35rem;
    }

    .videos-panel a:hover {
      color: #93c5fd;
    }

    .videos-panel-legend {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.2rem;
      margin-bottom: 0.35rem;
      margin-left: auto;
      width: 3.2rem;
    }

    .videos-panel-legend span {
      font-size: 0.45rem;
      font-weight: 700;
      color: #cbd5f5;
      text-align: center;
      letter-spacing: 0.04em;
    }

    .videos-panel-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .videos-panel-item:last-child a {
      margin-bottom: 0;
    }

    .mini-rubric {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      width: 3.2rem;
      height: 0.45rem;
      border-radius: 999px;
      overflow: hidden;
      border: 1px solid rgba(148, 163, 184, 0.7);
      flex-shrink: 0;
    }

    .mini-rubric span {
      display: block;
      height: 100%;
    }

    .side-buttons.videos-open .videos-panel {
      display: block;
    }

    .rubric-hover-wrap {
      position: relative;
      z-index: 20;
    }

    .rubric-hover-dot {
      scale: 1.5;
      width: 1.4rem;
      height: 1.4rem;
      border-radius: 999px;
      border: 2px solid #cbd5e1;
      background: #ffffff;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
      cursor: pointer;
      position: relative;
      z-index: 21;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      font-weight: 700;
    }

    body.dark-mode .rubric-hover-dot {
      border-color: #1f2937;
      background: #0f172a;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
    }

    .rubric-hover-dot span {
      font-family: 'Playfair Display', 'Poppins', serif;
      background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
    }

    .rubric-hover-panel {
      position: absolute;
      bottom: calc(100% + 0.5rem);
      right: 0;
      width: 12rem;
      min-height: 3rem;
      background: #ffffff;
      border: 2px solid #e2e8f0;
      border-radius: 0.75rem;
      padding: 0.5rem;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-0.25rem);
      transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
      z-index: 30;
      pointer-events: none;
    }

    body.dark-mode .rubric-hover-panel {
      background: #0f172a;
      border-color: #334155;
    }

    .rubric-hover-panel p {
      font-size: 0.7rem;
      line-height: 1.2;
      margin: 0.25rem 0;
      color: #334155;
    }

    body.dark-mode .rubric-hover-panel p {
      color: #cbd5e1;
    }

    .rubric-hover-wrap:hover .rubric-hover-panel {
      opacity: 0.9;
      visibility: visible;
      transform: translateY(0);
    }

    /* rubric-overrides */
    .rubric-box .page-title {
      margin-bottom: 0;
    }

    .rubric-card {
      background: #f8fafc;
      border-radius: 1rem;
      border: 3px solid transparent;
      --rubric-border-gradient: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      background:
        linear-gradient(#f8fafc, #f8fafc) padding-box,
        var(--rubric-border-gradient) border-box;
      width: 20rem;
      height: auto;
      margin-top: 0;
      padding: 0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      transform: none;
      overflow: hidden;
    }

    .rubric-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0;
      height: 100%;
    }

    .rubric-item {
      padding: 0.75rem 0.5rem;
      text-align: center;
      font-size: 0.85rem;
      color: #0f172a;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      border-right: 2px solid rgba(15, 23, 42, 0.85);
      border-left: none;
      border-bottom: none;
      border-top: none;
    }

    .rubric-item:first-child {
      border-left: none;
    }

    .rubric-item:last-child {
      border-right: none;
    }

    .rubric-text {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
      transform: none;
      white-space: nowrap;
    }

    .rubric-label {
      font-weight: 600;
    }

    .rubric-rating {
      font-size: 0.7rem;
      font-weight: 600;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    body.dark-mode .rubric-item {
      color: #0f172a;
      border-right-color: rgba(226, 232, 240, 0.85);
      border-left-color: transparent;
      border-top-color: transparent;
      border-bottom-color: transparent;
      border-top-width: 0;
      border-bottom-width: 0;
    }

    body.dark-mode .rubric-card {
      background:
        linear-gradient(#0f172a, #0f172a) padding-box,
        var(--rubric-border-gradient) border-box;
    }

    /* rubric-hover-interactions */
    .rubric-hover-wrap {
      pointer-events: auto;
    }

    .rubric-hover-dot {
      pointer-events: auto;
    }

    .rubric-hover-panel {
      z-index: 30;
      pointer-events: none;
    }

    .rubric-hover-wrap.is-open .rubric-hover-panel,
    .rubric-hover-wrap:focus-within .rubric-hover-panel {
      opacity: 0.9;
      visibility: visible;
      transform: translateY(0);
      pointer-events: auto;
    }

    /* Embedded Game Styles Swapped In */
    .Practices-menu {
      position: relative;
      display: inline-block;
    }
    .Practices-panel {
      position: absolute;
      bottom: 100%;
      right: 0;
      width: 12rem;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      border-radius: 0.75rem;
      box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
      padding: 0.5rem;
      margin-bottom: 0.5rem;
      opacity: 0;
      visibility: hidden;
      transform: translateY(10px);
      transition: all 0.2s ease-out;
      z-index: 50;
    }
    .Practices-panel.is-open {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }
    body.dark-mode .Practices-panel {
      background: #1e293b;
      border-color: #334155;
    }
    .Practices-panel-item a {
      display: block;
      padding: 0.75rem 1rem;
      color: #334155;
      text-decoration: none;
      border-radius: 0.5rem;
      transition: background-color 0.15s;
    }
    .Practices-panel-item a:hover {
      background-color: #f1f5f9;
      color: #0f172a;
    }
    body.dark-mode .Practices-panel-item a {
      color: #cbd5e1;
    }
    body.dark-mode .Practices-panel-item a:hover {
      background-color: #334155;
      color: #f8fafc;
    }

    /* Mix & Match Styles */
    .mix-match-board {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 1rem;
      margin-top: 1.5rem;
      width: 100%;
    }
    .mm-card {
      background: #f8fafc;
      border: 2px solid #e2e8f0;
      border-radius: 0.75rem;
      padding: 1.5rem;
      min-height: 100px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      cursor: pointer;
      font-weight: 500;
      color: #334155;
      transition: all 0.2s;
      user-select: none;
      box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    body.dark-mode .mm-card {
      background: #1e293b;
      border-color: #334155;
      color: #cbd5e1;
    }
    .mm-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
      border-color: #94a3b8;
    }
    .mm-card.selected {
      background: #eff6ff;
      border-color: #3b82f6;
      color: #1d4ed8;
      transform: scale(1.02);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    }
    body.dark-mode .mm-card.selected {
      background: #172554;
      border-color: #60a5fa;
      color: #bfdbfe;
    }
    .mm-card.matched {
      background: #f0fdf4;
      border-color: #22c55e;
      color: #15803d;
      opacity: 0.8;
      cursor: default;
    }
    body.dark-mode .mm-card.matched {
      background: #052e16;
      border-color: #22c55e;
      color: #86efac;
    }
    .mm-card.wrong {
      background: #fef2f2;
      border-color: #ef4444;
      animation: shake 0.5s;
    }
    body.dark-mode .mm-card.wrong {
      background: #450a0a;
      border-color: #ef4444;
    }
    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-5px); }
      75% { transform: translateX(5px); }
    }
    .mm-modal {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s;
    }
    .mm-modal.active {
      opacity: 1;
      visibility: visible;
    }
    .mm-modal-content {
      background: white;
      padding: 2rem;
      border-radius: 1rem;
      text-align: center;
      max-width: 90%;
      width: 400px;
      transform: scale(0.9);
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .mm-modal.active .mm-modal-content {
      transform: scale(1);
    }
    body.dark-mode .mm-modal-content {
      background: #1e293b;
      color: #ffffff;
    }

    /* Block Puzzle Styles */
    .block-puzzle-container {
      width: 100%;
      max-width: 600px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1.5rem;
    }
    .bp-grid {
      display: grid;
      grid-template-columns: repeat(8, 1fr);
      gap: 2px;
      background: #cbd5e1;
      padding: 2px;
      border-radius: 0.5rem;
      width: 100%;
      aspect-ratio: 1;
    }
    body.dark-mode .bp-grid {
      background: #475569;
    }
    .bp-cell {
      background: #f1f5f9;
      border-radius: 2px;
      position: relative;
    }
    body.dark-mode .bp-cell {
      background: #334155;
    }
    .bp-cell.filled {
      background: #3b82f6; 
      box-shadow: inset 0 0 4px rgba(0,0,0,0.2);
    }
    .bp-blocks-area {
      display: flex;
      justify-content: center;
      gap: 2rem;
      min-height: 120px;
      width: 100%;
      padding: 1rem;
      background: rgba(241, 245, 249, 0.5);
      border-radius: 1rem;
    }
    body.dark-mode .bp-blocks-area {
      background: rgba(30, 41, 59, 0.5);
    }
    .bp-block-option {
      cursor: grab;
      transition: transform 0.2s;
    }
    .bp-block-option:active {
      cursor: grabbing;
      transform: scale(1.1);
    }
    .bp-preview {
      display: grid;
      gap: 2px;
      pointer-events: none;
    }
    .bp-preview-cell {
      width: 20px;
      height: 20px;
      border-radius: 2px;
    }/* Fixed Practices Menu CSS */
    .Practices-menu {
      position: relative;
      display: inline-block;
    }
    
    .Practices-panel {
      width: 12rem;
      min-height: 3rem;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.5rem);
      z-index: 50; /* Increased z-index */
      opacity: 0;
      transform: scale(0.95);
      transform-origin: bottom right;
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem;
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
      box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }

    .Practices-panel.is-open {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transform: scale(1);
    }

    .Practices-panel-item {
      margin-bottom: 0.5rem;
    }
    
    .Practices-panel a {
      display: block;
      color: #e2e8f0;
      text-decoration: none;
      padding: 0.5rem;
      border-radius: 0.25rem;
      font-size: 0.9rem;
      font-weight: 500;
      transition: background-color 0.2s;
    }

    .Practices-panel a:hover {
      background: rgba(255, 255, 255, 0.1);
      color: white;
    }

    /* ===================== */
    /* Climb / Boost Game    */
    /* ===================== */
    @keyframes twinkle {
      0%   { opacity: 0.3; transform: scale(0.8); }
      100% { opacity: 1;   transform: scale(1.2); }
    }
    @keyframes floatPlanet {
      0%   { transform: translateY(0px);   }
      50%  { transform: translateY(-20px); }
      100% { transform: translateY(0px);   }
    }
    @keyframes slideLadder {
      from { background-position: 0 0;    }
      to   { background-position: 0 40px; }
    }
    .climb-option-btn {
      background: #f1f5f9;
      border: 2px solid #e2e8f0;
      padding: 0.75rem;
      border-radius: 0.5rem;
      cursor: pointer;
      font-size: 1rem;
      color: #334155;
      transition: all 0.2s;
      text-align: left;
    }
    .climb-option-btn:hover {
      background: #e2e8f0;
      border-color: #cbd5e1;
    }
    /* Light Mode (Day Sky) */
    body:not(.dark-mode) #climb-space-bg {
      background: radial-gradient(ellipse at bottom, #bae6fd 0%, #0369a1 100%) !important;
    }
    body:not(.dark-mode) #climb-stars div {
      opacity: 0.3 !important;
    }
    /* Dark Mode */
    body.dark-mode #climb-game-ui { background-color: #0f172a !important; }
    body.dark-mode #climb-ladder-bg { background-image: repeating-linear-gradient(180deg, #334155 0, #334155 2px, transparent 2px, transparent 40px) !important; opacity: 0.2 !important; }
    body.dark-mode #climb-header { background: rgba(15, 23, 42, 0.95) !important; box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important; }
    body.dark-mode #climb-score { color: #e2e8f0 !important; }
    body.dark-mode #climb-interaction { background: #1e293b !important; border-color: #334155 !important; }
    body.dark-mode #climb-start-screen h3, body.dark-mode #climb-game-over h3, body.dark-mode #climb-paused-screen h3 { color: #f8fafc !important; }
    body.dark-mode #climb-start-screen p, body.dark-mode #climb-game-over p, body.dark-mode #climb-question-text { color: #cbd5e1 !important; }
    body.dark-mode .climb-option-btn { background: #334155 !important; border-color: #475569 !important; color: #e2e8f0 !important; }
    body.dark-mode .climb-option-btn:hover { background: #475569 !important; border-color: #64748b !important; }
    body.dark-mode #climb-fullscreen-btn { background: rgba(30, 41, 59, 0.9) !important; }
    body.dark-mode #climb-fullscreen-btn svg { stroke: #e2e8f0 !important; }
    body.dark-mode #climb-start-screen, body.dark-mode #climb-game-over, body.dark-mode #climb-paused-screen { background: rgba(30, 41, 59, 0.95) !important; border-color: #475569 !important; }
    body.dark-mode #climb-start-screen div { color: #cbd5e1 !important; }
    body.dark-mode #climb-fuel-text { color: #e2e8f0 !important; }

/* =====================================================
   LIGHT MODE OVERRIDES — Fix hardcoded dark-only styles
   ===================================================== */

/* Videos Panel - light mode */
body:not(.dark-mode) .videos-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .videos-panel-title {
    color: #475569;
}

body:not(.dark-mode) .videos-panel a {
    color: #334155;
}

body:not(.dark-mode) .videos-panel a:hover {
    color: #3b82f6;
}

body:not(.dark-mode) .videos-panel-legend span {
    color: #475569;
}

/* Video Info Text - light mode */
body:not(.dark-mode) .video-info-text {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Rubric Hover Dot - light mode */
body:not(.dark-mode) .rubric-hover-dot {
    border-color: #cbd5e1;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

/* Rubric Hover Panel - light mode */
body:not(.dark-mode) .rubric-hover-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .rubric-hover-panel p {
    color: #334155;
}

/* Practices Panel - light mode */
body:not(.dark-mode) .Practices-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .Practices-panel a {
    color: #334155;
}

body:not(.dark-mode) .Practices-panel a:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Courses Section Title - light mode */
body:not(.dark-mode) .courses-section-title {
    color: #1e293b;
}

/* Taskbar Mobile Responsiveness - from LoginSignup.html */
@media (max-width: 640px) {
  .taskbar-container {
    padding: 0.35rem 0.5rem;
  }

  .taskbar-button {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
  
  .courses-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .logo-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  .company-title {
    font-size: 2.5rem;
    line-height: 1.2;
    text-align: center;
    word-wrap: break-word;
    margin-bottom: 1rem;
  }

  .content-wrapper {
    padding: 0 1rem;
  }
  
  /* Flashcard responsiveness */
  .flashcard-box[style*="min-width"] {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 90vw !important;
    padding: 1.5rem !important;
    min-height: 200px !important;
  }
  
  /* Flashcard game container */
  .flashcard-game {
    width: 100% !important;
    padding: 0 1rem !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  
  /* Flashcard Content Text */
  #flashcard-content {
    font-size: 1rem !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Button container below flashcard */
  .flashcard-game > div:not(.flashcard-box) {
    flex-wrap: wrap !important;
    justify-content: center !important;
    width: 100% !important;
  }
  
  /* Buttons themselves */
  .flashcard-game button {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
  }
  
  /* Ensure diagram card doesn't overflow */
  .diagram-card {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
}


/* Fix for subject pages with complex inline grid styles */
@media (max-width: 1024px) {
   div[style*="grid-template-columns: repeat(4, 1fr)"],
   div[style*="grid-template-columns:repeat(4, 1fr)"],
   div[style*="grid-template-columns: repeat(3, 1fr)"],
   div[style*="grid-template-columns:repeat(3, 1fr)"],
   div[style*="grid-template-columns: repeat(4,1fr)"],
   div[style*="grid-template-columns: repeat(3,1fr)"] {
      grid-template-columns: repeat(2, 1fr) !important;
      grid-template-rows: auto !important;
      height: auto !important;
      position: relative !important;
      inset: auto !important;
      transform: none !important;
      padding-bottom: 2rem !important;
      margin-top: 2rem !important;
   }
   
   .courses-container[style*="min-height"] {
      min-height: auto !important;
      height: auto !important;
   }
}

@media (max-width: 640px) {
   div[style*="grid-template-columns: repeat(4, 1fr)"],
   div[style*="grid-template-columns:repeat(4, 1fr)"],
   div[style*="grid-template-columns: repeat(3, 1fr)"],
   div[style*="grid-template-columns:repeat(3, 1fr)"],
   div[style*="grid-template-columns: repeat(4,1fr)"],
   div[style*="grid-template-columns: repeat(3,1fr)"] {
      grid-template-columns: 1fr !important;
   }
}

/* Mobile Optimization for Lesson Pages */
@media (max-width: 1024px) {
  /* Use grid to force centering if flex fails for some reason */
  .courses-container:has(.lesson-layout) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .lesson-layout {
    display: contents !important;
  }
  
  .video-stack {
    order: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    margin-bottom: 2rem !important;
  }
  
  /* Rubric Box - Forced Width and Margin Reset */
  .rubric-box {
    order: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
  }
  
  /* Buttons container - Forced Width and Margin Reset */
  .side-buttons {
    order: 3 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin: 1rem 0 !important;
    float: none !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
  }
  
  /* Individual Buttons */
  .side-button, .view-other-videos {
    flex: 1 1 40% !important; /* Allow buttons to sit side-by-side */
    margin-bottom: 0 !important;
    text-align: center !important;
    min-width: 140px !important;
    padding: 0.75rem 0.5rem !important; /* Slightly smaller padding */
    font-size: 0.9rem !important; /* Slightly smaller font */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: normal !important; /* Allow multiline text if needed */
  }

  /* Un-rotate rubric and make responsive */
  .rubric-card {
    grid-row: 2 !important;
    width: 100% !important;
    max-width: 100% !important; /* Let parent constrain width */
    margin: 0 !important;
    transform: none !important;
  }
  
  .rubric-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1px !important;
    background-color: rgba(15, 23, 42, 0.1) !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
  }
  
  .rubric-item {
    padding: 1rem !important;
    min-height: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background-color: white !important; /* Override specific colors if needed, but keeping original bg colors is usually better. If original colors are used, we might need transparency or just rely on Gap */
  }
  
  /* Restore original background colors via nth-child being more specific if lost, 
     but since we are only changing layout, the original background colors on .rubric-item:nth-child should still apply 
     unless overridden by !important above. Let's fix the background. */
  .rubric-item:nth-child(1) { background: #90EE90 !important; }
  .rubric-item:nth-child(2) { background: #FFD700 !important; }
  .rubric-item:nth-child(3) { background: #7FFF00 !important; }
  .rubric-item:nth-child(4) { background: #00FFFF !important; }

  .rubric-text {
    transform: none !important; /* Text explicitly not rotated */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.25rem !important;
    white-space: normal !important;
  }

  /* Rubric Header Container (New approach to align title and icon) */
  .rubric-box {
    position: relative !important;
    padding-top: 3rem !important; /* Make space for header */
  }

  .rubric-hover-dot {
    margin: 0 !important;
  }
  
  /* Target the Page Title text within rubric box */
  .rubric-box > .page-title {
    position: absolute !important;
    top: 0 !important;
    left: 50% !important; /* Start from center */
    transform: translateX(-50%) !important; /* Move back by half width (centered) */
    width: 90% !important; /* Match card width */
    max-width: 400px !important;
    text-align: left !important; /* Align text to left of this container */
    font-size: 1.5rem !important;
    margin: 0 !important;
    padding-bottom: 0.5rem !important;
  }
  
  /* Target the Info Icon Wrapper */
  .rubric-hover-wrap {
    position: absolute !important;
    top: 0.4rem !important; /* Align vertically with title text */
    left: 50% !important;
    /* 
       We need to push it right relative to the left-aligned title text.
       Container is centered 90% wide. Text starts at left edge of that container.
       "Rubric" text is roughly 4-5rem wide.
       So we transform from center - 45% (left edge) + 6rem (text width).
    */
    transform: translateX(calc(-50% - 4.5rem + 15px)) !important; /* Adjust until it sits next to Rubric */
    /* Wait, simpler calculation:
       Left edge of card is at (100% - 90%)/2 = 5%.
       Title is at 5%.
       We want icon at 5% + TitleWidth.
    */
    margin: 0 !important;
    width: auto !important;
    display: block !important;
    z-index: 10 !important;
    /* Reset previous transforms */
    right: auto !important;
  }
  
  /* Fix layout specific calculation because previous logic was messy */
  .rubric-box {
      position: relative !important;
      padding-top: 3rem !important; /* Space for title header */
      display: block !important; /* Allow absolute positioning inside to work relative to this block */
      width: 100% !important;
      max-width: 100% !important;
  }
  
  /* Re-center the card itself */
  .rubric-card {
    margin: 0 auto 2rem auto !important;
  }

  /* Since calculating strict pixel widths in CSS calc() is flaky without fixed container size,
     let's try a different approach: Flex header for title and icon.
     But HTML structure is [Icon] [Title] [Card].
     We can position Icon absolute relative to Title if Title was relative, but they are siblings.
     
     HTML:
     .rubric-hover-wrap (Icon)
     h2.page-title (Rubric)
     .rubric-card
  */
  
  /* Let's use Grid on the container to place them! */
  .rubric-box {
    display: grid !important;
    /* Rows: Header (Title+Icon), Card */
    grid-template-areas: 
      "title icon"
      "card card" !important;
    grid-template-columns: max-content max-content !important; /* Shrink to fit content */
    align-content: start !important;
    justify-content: start !important; /* Align content to the left of the box */
    align-items: center !important;
    column-gap: 0.5rem !important; /* Space between Title and Icon */
    row-gap: 0.5rem !important;
    padding-top: 0 !important;
    width: 90% !important; 
    max-width: 400px !important;
    margin: 0 auto 1.5rem auto !important;
  }
  
  /* The Title */
  .rubric-box > .page-title {
    grid-area: title !important;
    position: static !important;
    transform: none !important;
    width: auto !important;
    text-align: left !important;
    margin: 0 !important;
    display: block !important;
    padding: 0 !important;
  }

  /* The Icon Wrapper */
  .rubric-hover-wrap {
    grid-area: icon !important;
    position: relative !important; /* Relative for panel positioning */
    justify-self: start !important; 
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    z-index: 50 !important; /* Ensure on top */
  }
  
  .rubric-hover-panel {
     position: absolute !important;
     top: 100% !important;
     left: 0 !important; /* Align left edge with icon or shift slightly? */
     transform: none !important;
     margin-top: 0.5rem !important;
     width: 16rem !important;
     max-width: 60vw !important; /* Ensure it fits on screen better */
     z-index: 100 !important;
     display: none !important;
  }

  .rubric-hover-wrap:hover .rubric-hover-panel {
     display: block !important; /* ensure visibility */
  }

  /* Reset Videos Panel for Mobile */
  .videos-panel {
    width: 100% !important;
    min-height: auto !important;
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    background: transparent !important;
    border: none !important;
    padding: 1rem 0 !important;
    display: none; 
  }

  .videos-panel.is-open {
    display: block !important;
    animation: none !important;
  }
}

/* ========== SCROLL REVEAL ANIMATIONS ========== */
.aris-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s cubic-bezier(.4,0,.2,1), transform 0.5s cubic-bezier(.4,0,.2,1);
}
.aris-reveal.aris-scale {
  opacity: 0;
  transform: scale(0.95);
}
.aris-reveal.aris-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Stagger children */
.aris-reveal-stagger > .aris-reveal:nth-child(2) { transition-delay: 0.06s; }
.aris-reveal-stagger > .aris-reveal:nth-child(3) { transition-delay: 0.12s; }
.aris-reveal-stagger > .aris-reveal:nth-child(4) { transition-delay: 0.18s; }
.aris-reveal-stagger > .aris-reveal:nth-child(5) { transition-delay: 0.24s; }
.aris-reveal-stagger > .aris-reveal:nth-child(6) { transition-delay: 0.30s; }
.aris-reveal-stagger > .aris-reveal:nth-child(n+7) { transition-delay: 0.36s; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .aris-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
