@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

:root {
    /* Primary colors */
    --primary-blue: #3498db;
    --primary-blue-dark: #2980b9;
    --primary-dark: #2c3e50;
    --primary-gray: #333;
    
    /* Background colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #f2f2f2;
    --bg-tertiary: #f0f0f0;
    --bg-white: white;
    --bg-light: #f5f7fa;
    --bg-gradient-start: #f5f7fa;
    --bg-gradient-end: #c3cfe2;
    --bg-quote: #f9f9f9;
    --bg-highlight: #ebf5fb;
    --bg-error: #ffebee;
    
    /* Text colors */
    --text-primary: #333;
    --text-secondary: #7f8c8d;
    --text-subtitle: #3f5c5d;
    --text-caption: #555;
    --text-error: #f44336;
    
    /* Border colors */
    --border-color: #ddd;
    --border-light: #bdc3c7;
    --border-primary: #3498db;
    
    /* Accent colors */
    --accent-color: #3498db;
    --hover-bg: var(--bg-light);
    
    /* Shadow colors */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --progress-bg: rgba(0, 0, 0, 0.1);
    --slide-number-bg: rgba(255, 255, 255, 0.7);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Comic Neue', cursive;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.slides-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.6s ease-in-out;
}

.slide {
    width: 100vw;
    height: 100vh;
    background: var(--bg-white);
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    display: none;
}

.slide.active {
    display: block;
}

.slide-header {
    width: 100%;
    background-color: transparent;
    color: var(--primary-blue);
    padding: 2rem 3rem;
    box-sizing: border-box;
}

.slide-content {
    width: 100%;
    max-width: 100%;
    height: calc(100% - 60px);
    padding: 0 3rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    touch-action: pan-y;
}

.slide-content p,
.slide-content ul,
.slide-content ol {
    margin-bottom: 1.5rem;
}

.title-slide .slide-content {
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

h1 {
    font-size: 4.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
}

h2 {
    font-size: 3rem;
    color: var(--primary-blue);
    margin: 0;
}

h3 {
    font-size: 2rem;
    color: var(--primary-dark);
    margin: 0;
}

/* Base list styles */
ul.itemize {
    list-style-type: none;
    margin: 1rem 0;
    padding-left: 0;
}

/* Level 0 (base level) list items */
ul.itemize li {
    font-size: 1.8rem;
    margin-bottom: 1.2rem;
    padding-left: 2.5rem;
    position: relative;
    line-height: 1.4;
}

ul.itemize li:before {
    content: "•";
    color: var(--primary-blue);
    font-weight: bold;
    font-size: 2rem;
    position: absolute;
    left: 0;
    top: 0;
    line-height: 1;
}

/* Level 1 (first nested level) - double indent */
ul.itemize ul.itemize {
    margin: 0.5rem 0 0.5rem 4rem;
    padding-left: 0;
}

ul.itemize ul.itemize li {
    font-size: 1.8rem;
    margin-bottom: 1.2rem;
    padding-left: 2.5rem;
}

ul.itemize ul.itemize li:before {
    content: "•";
    font-size: 2rem;
    color: var(--primary-blue);
    font-weight: bold;
}

/* Level 2 (second nested level) - quadruple indent */
ul.itemize ul.itemize ul.itemize {
    margin: 0.5rem 0 0.5rem 4rem;
    padding-left: 0;
}

ul.itemize ul.itemize ul.itemize li {
    font-size: 1.8rem;
    margin-bottom: 1.2rem;
    padding-left: 2.5rem;
}

ul.itemize ul.itemize ul.itemize li:before {
    content: "•";
    font-size: 2rem;
    color: var(--primary-blue);
    font-weight: bold;
}

/* Legacy ul styles for backward compatibility */
ul:not(.itemize) {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

ul:not(.itemize) li {
    font-size: 1.8rem;
    margin-bottom: 1.2rem;
    padding-left: 2rem;
    position: relative;
}

ul:not(.itemize) li:before {
    content: "•";
    color: var(--primary-blue);
    font-weight: bold;
    font-size: 2rem;
    position: absolute;
    left: 0;
    top: 0;
    line-height: 1;
}

label {
    font-size: 1.5rem;
}

.subtitle {
    font-size: 2rem;
    color: var(--text-subtitle);
}

.subsubtitle {
    font-size: 1.5rem;
    color: var(--text-subtitle);
}

p {
    font-size: 2rem;
    line-height: 1.6;
    margin: 1rem;
}

.slide-number {
    position: absolute;
    right: 10px;
    top: -36px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    background-color: var(--slide-number-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-arrow {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--primary-blue);
    transition: color 0.3s ease;
}

.nav-arrow:hover {
    color: var(--primary-blue-dark);
}

.nav-arrow.disabled {
    color: var(--border-light);
    cursor: not-allowed;
}

.nav-arrow.disabled:hover {
    color: var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 1.8rem;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-secondary);
    font-weight: bold;
}

tr:hover {
    background-color: var(--bg-light);
}

.figure {
    text-align: center;
    margin-bottom: 1rem;
}

.figure-content {
    display: inline-block;
    transform-origin: center center;
}

.figure img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.figure-caption {
    margin-top: 0.8rem;
    font-style: italic;
    color: var(--text-caption);
    font-size: 1.8rem;
    text-align: center;
    width: 100%;
}

code {
    background: var(--bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
    color: var(--accent-color);
}

pre {
    background: var(--bg-tertiary);
    padding: 1.5em;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin: 1.5em 0;
    position: relative;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.95em;
    line-height: 1.5;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Andale Mono', monospace;
}

pre code p {
    margin: 0;
    color: var(--accent-color);
}

.copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

pre:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: var(--hover-bg);
    color: var(--accent-color);
}

.copy-button.copied {
    background: var(--accent-color);
    color: var(--bg-white);
    border-color: var(--accent-color);
}

.footnote {
    font-size: 1.2rem !important;
    margin-top: 1.5rem;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 1rem 2rem 0 2rem;
}

.footnote p {
    font-size: 1.5rem !important;
    margin: 0;
    line-height: 1.4;
}

.footnote::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2rem;
    right: 2rem;
    height: 1px;
    background-color: #333;
}

.footnote a {
    color: var(--primary-blue);
    text-decoration: none;
    vertical-align: baseline;
    font-size: inherit;
}

.footnote-ref {
    font-size: 0.9em;
    text-decoration: none;
}

.footnote-cite {
    vertical-align: super;
    font-size: 1.8rem;
    color: var(--primary-blue);
    text-decoration: none;
}

.animation-container {
    width: 100%;
    height: 300px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.animated-element {
    width: 50px;
    height: 50px;
    background-color: var(--primary-blue);
    border-radius: 50%;
    position: absolute;
    top: 125px;
    left: 0;
    transition: left 0.3s ease;
}

@keyframes moveRight {
    from {
        left: 0;
    }

    to {
        left: calc(100% - 50px);
    }
}

.slider-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.slider {
    width: 80%;
}

.slider-value {
    font-size: 1.8rem;
    color: var(--text-caption);
}

/* Unified column system */
.columns {
    display: grid;
    gap: 2rem;
    width: 100%;
    padding: 0;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
}

.columns[data-cols="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.columns[data-cols="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.columns[data-cols="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Weight-based columns */
.columns[data-weights] {
    grid-template-columns: var(--col-weights);
}

.column {
    background-color: var(--bg-light);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px var(--shadow-light);
}

.column.highlight {
    background-color: var(--bg-highlight);
    border: 2px solid var(--primary-blue);
}

.column h3 {
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 2.4rem;
}

.progress-container {
    width: 100%;
    height: 6px;
    background-color: var(--progress-bg);
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-blue);
    width: 0;
    transition: width 0.3s ease;
}

.katex {
    text-align: center;
    font-size: 1.8rem;
    margin: 0;
}

.quote-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--bg-quote);
    border-left: 5px solid var(--primary-blue);
    position: relative;
}

.quote-text {
    font-size: 2rem;
    font-style: italic;
    margin-bottom: 0.8rem;
}

.quote-author {
    font-size: 1.6rem;
    text-align: right;
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.compare-table {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.compare-item {
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.compare-item h3 {
    color: var(--primary-blue);
    margin-top: 0;
    font-size: 2.4rem;
    text-align: center;
}

.compare-item.highlight {
    background-color: var(--bg-highlight);
    border: 2px solid var(--primary-blue);
}

body::before {
    content: none;
}

.figure-row {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    margin: 0 auto;
}

.figure img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 8px var(--shadow-light);
}

.figure-caption {
    margin-top: 0.8rem;
    font-style: italic;
    color: #555;
    font-size: 1.8rem;
    text-align: center;
    width: 100%;
}

.slides-container.zoomed {
    transform-origin: 0 0;
    transition: transform 0.1s ease;
}

.qr-box {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--shadow-light);
    text-align: center;
    transition: transform 0.2s;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-container {
    width: 300px;
    height: 300px;
    margin: 10px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--bg-white);
    padding: 10px;
    border-radius: 8px;
}

.qr-container img {
    max-width: 100%;
    height: auto;
    display: block;
}

.qr-caption {
    margin-top: 15px;
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-gray);
    padding: 5px;
    border-radius: 5px;
}

.qr-error {
    color: var(--text-error);
    font-size: 16px;
    padding: 10px;
    background-color: var(--bg-error);
    border-radius: 5px;
    margin: 10px 0;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.plots-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.plot {
    width: 500px;
    height: 250px;
    min-width: 500px;
    min-height: 250px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #ffffff;
}

.plot.rotation-canvas {
    height: 50vh !important;
    width: calc(50vh * 4/3) !important;
    max-width: 90vw;
    min-width: 400px;
    min-height: 300px;
}

.plot-title {
    text-align: center;
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
    font-size: 1.5em;
}

/* Controls styles */
.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    max-width: 800px;
    margin: 0 auto;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.slider-label {
    min-width: 80px;
    font-weight: 500;
    color: #495057;
}

.controls .slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    width: auto;
}

.controls .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.controls .slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.controls .slider:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

.controls .slider:disabled::-webkit-slider-thumb {
    background: #6c757d;
    cursor: not-allowed;
}

.controls .slider:disabled::-moz-range-thumb {
    background: #6c757d;
    cursor: not-allowed;
}

.controls .slider-container {
    position: relative;
    flex: 1;
    min-width: 400px;
    display: block;
}

.slider-ticks {
    position: absolute;
    top: 8px;
    left: 95px;
    right: 75px;
    height: 2px;
    pointer-events: none;
}

.tick-mark {
    position: absolute;
    width: 3px;
    height: 14px;
    background: #007bff;
    top: -6px;
    border-radius: 1px;
}

.tick-mark.start { left: 0%; }
.tick-mark.third { left: 33.33%; }
.tick-mark.two-third { left: 66.67%; }
.tick-mark.end { left: 100%; transform: translateX(-100%); }

.controls .slider-value {
    min-width: 60px;
    text-align: right;
    font-weight: 500;
    color: #495057;
    font-size: inherit;
}

.tabs-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tabs-label {
    min-width: 100px;
    font-weight: 500;
    color: #495057;
}

.tabs {
    display: flex;
    gap: 5px;
    flex: 1;
    justify-content: center;
}

.tab {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: white;
    color: #495057;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.tab:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.tab.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.panel {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fafafa;
}

.panel h2 {
    text-align: center;
    color: #495057;
    margin-bottom: 15px;
    font-weight: 400;
    font-size: 2.2em;
    line-height: 1.4;
}

.panel h2 .katex {
    font-size: 1em;
}

.axis {
    stroke: #6c757d;
    stroke-width: 1;
}

.axis text {
    fill: #6c757d;
    font-size: 12px;
}

.grid-line {
    stroke: #e9ecef;
    stroke-width: 0.5;
    stroke-dasharray: 2,2;
}

.instance-container {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 12px;
    background: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

/* Device detection for performance optimization */
.is-mobile-device .animation-container {
    /* Reduce animation complexity for mobile devices */
    will-change: auto;
}

.is-mobile-device canvas {
    /* Reduce canvas complexity on mobile to prevent lag */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.is-mobile-device .plot {
    /* Simplify plots on mobile */
    shape-rendering: optimizeSpeed;
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}