* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Computer Modern', 'Latin Modern Roman', Georgia, 'Times New Roman', serif;
    background: #fafafa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #2e2e2e;
    line-height: 1.5;
}

header {
    background: white;
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

header h1 {
    font-size: 1.75rem;
    color: #2e2e2e;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.subtitle {
    color: #666;
    font-size: 0.95rem;
    font-style: italic;
}

.container {
    flex: 1;
    display: flex;
    padding: 2rem;
    gap: 1.5rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.panel {
    flex: 1;
    background: white;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.1rem;
    color: #2e2e2e;
    font-weight: 400;
    font-style: italic;
}

.controls {
    display: flex;
    gap: 0.5rem;
}

.editor-container {
    flex: 1;
    position: relative;
    min-height: 400px;
}

.divider {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid #2e2e2e;
    background: white;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:hover {
    background: #2e2e2e;
    color: white;
}

.btn:active {
    background: #1a1a1a;
}

.btn-primary {
    padding: 1.25rem 2rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #2e2e2e;
    color: white;
    border: 1px solid #2e2e2e;
}

.btn-primary:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

.btn-secondary {
    background: white;
    color: #2e2e2e;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #2e2e2e;
}

.btn-icon {
    font-size: 1.25rem;
    line-height: 1;
}

select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

select:hover {
    border-color: #2e2e2e;
}

select:focus {
    outline: none;
    border-color: #2e2e2e;
}

footer {
    background: white;
    padding: 1rem;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    border-top: 1px solid #ddd;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }

    .divider {
        padding: 1rem 0;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .btn-icon {
        transform: rotate(90deg);
    }
    
    .tabs {
        padding: 0 1rem;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .tab-content {
        padding: 1.5rem 1rem;
    }
    
    .demo-section {
        padding: 1.5rem 1rem;
    }
    
    .gif-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .use-case {
        margin: 1rem 0;
        padding: 0.75rem 0;
    }
    
    .figures-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1rem 0;
        padding: 0;
    }
    
    .figure-item {
        padding: 1rem;
    }
}

/* Ace Editor Theme Override */
.ace_editor {
    font-size: 13px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace !important;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid #2e2e2e;
    width: 80%;
    max-width: 600px;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 400;
}

.modal-content pre {
    background: #f5f5f5;
    padding: 1rem;
    border: 1px solid #ddd;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
}

.close {
    color: #666;
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #2e2e2e;
}

/* Tab Navigation */
.tabs {
    display: flex;
    justify-content: center;
    background: white;
    padding: 0 2rem;
    gap: 0.25rem;
    position: relative;
}

.tabs::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(1200px, 90%);
    height: 2px;
    background: #696969;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-family: inherit;
    font-size: 0.95rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: #2e2e2e;
}

.tab-btn.active {
    color: #2e2e2e;
    border-bottom-color: #2e2e2e;
    font-weight: 500;
}

/* Tab Content */
.tab-content-container {
    background: white;
    position: relative;
}

.tab-content-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(1200px, 90%);
    height: 1px;
    background: #ddd;
}

.tab-content {
    display: none;
    padding: 1.5rem 2rem;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.info-content {
    max-width: 1200px;
    margin: 0 auto;
}

.info-content h2 {
    font-size: 1.5rem;
    color: #2e2e2e;
    margin-bottom: 0.4rem;
    font-weight: 400;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

.info-content h3 {
    font-size: 1.15rem;
    color: #2e2e2e;
    /* margin-top: 1.5rem; */
    /* margin-bottom: 0.75rem; */
    font-weight: 400;
    font-style: italic;
}

.info-content p {
    /* margin-bottom: 1rem; */
    color: #444;
    text-align: justify;
}

.info-content .abstract {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.info-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.info-content li {
    margin-bottom: 0.5rem;
    color: #444;
}

/* Playground Tab Content */
.playground-content {
    padding: 0;
}

.playground-content .demo-header {
    max-width: 1200px;
    margin: 0 auto 2rem auto;
    padding: 0 2rem;
}

.playground-content .demo-header h2 {
    font-size: 1.5rem;
    color: #2e2e2e;
    margin-bottom: 0.75rem;
    font-weight: 400;
}

.playground-content .demo-header p {
    color: #666;
    font-size: 0.95rem;
}

.playground-content .container {
    margin-top: 0;
    padding-top: 0;
}

/* Media Content */
.media-container {
    margin: 1.5rem 0;
    text-align: center;
}

.demo-gif {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Figures Container */
.figures-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0 1rem 0;
    padding: 0;
}

.figure-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 1.25rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 450px;
    margin: 0 auto;
}

/* .figure-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
} */

.figure-img {
    width: 100%;
    height: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 1rem;
    background: white;
}

.figure-caption {
    font-size: 0.9rem;
    color: #555;
    text-align: center;
    margin: 0;
    font-style: italic;
    font-weight: 500;
    line-height: 1.4;
}

/* Use Case and Gallery Styles */
.use-case {
    margin: 0.5rem 0 1rem 0;
    padding: 1rem 0 0.5rem 0;
    border-top: 1px solid #eee;
}

.use-case:first-of-type {
    border-top: none;
    padding-top: 0.5rem;
}

.use-case h3 {
    font-size: 1.25rem;
    color: #2e2e2e;
    margin-bottom: 0.5rem;
    font-weight: 750;
    font-style: normal;
}

.use-case > p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    font-style: normal;
}

.gif-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 0.5rem 0 0 0;
}

.gif-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fafafa;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 450px;
    justify-self: start;
}

.gif-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gif-item img {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.gif-caption {
    font-size: 0.9rem;
    color: #555;
    text-align: center;
    margin: 0;
    font-style: normal;
}

/* Tree Visualization Styles */
.tree-subsection {
    border-top: 1px solid #ddd;
    padding: 1rem 1.5rem;
    background: #f9f9f9;
}

.tree-subsection h3 {
    font-size: 1rem;
    color: #2e2e2e;
    margin-bottom: 0.75rem;
    font-weight: 400;
    font-style: italic;
}

.tree-svg-container {
    width: 100%;
    height: 300px;
    overflow: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.tree-svg-container svg {
    width: 100%;
    height: 100%;
}

/* D3 Tree Node Styles */
.tree-node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.tree-node circle {
    stroke-width: 2px;
    transition: all 0.2s ease;
}

.tree-node text {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 12px;
    fill: #2e2e2e;
    text-anchor: middle;
    dominant-baseline: middle;
}

.tree-link {
    stroke: #999;
    stroke-width: 2px;
    transition: all 0.2s ease;
}

.tree-node:hover circle {
    stroke-width: 3px;
    stroke: #2e2e2e;
}

.tree-node:hover text {
    font-weight: bold;
}

/* Node type specific colors */
.node-sequence circle {
    fill: #e3f2fd;
    stroke: #1976d2;
}

.node-selector circle {
    fill: #f3e5f5;
    stroke: #7b1fa2;
}

.node-action circle {
    fill: #e8f5e8;
    stroke: #388e3c;
}

.node-conditional circle {
    fill: #fff9c4;
    stroke: #f9a825;
}

.node-uniform circle {
    fill: #fff3e0;
    stroke: #f57c00;
}

.node-normal circle {
    fill: #fce4ec;
    stroke: #c2185b;
}

.node-bias circle {
    fill: #e0f2f1;
    stroke: #00695c;
}

.node-range circle {
    fill: #f1f8e9;
    stroke: #689f38;
}

/* Responsive adjustments for tree */
@media (max-width: 1024px) {
    .tree-subsection {
        padding: 0.75rem 1rem;
    }
    
    .tree-svg-container {
        height: 250px;
    }
    
    .tree-node text {
        font-size: 10px;
    }
}

/* Print-friendly styles */
@media print {
    .tab-content {
        display: block !important;
        page-break-inside: avoid;
    }
    .tabs {
        display: none;
    }
    .tree-subsection {
        page-break-inside: avoid;
    }
}
