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

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

#loadingOverlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-container {
    text-align: center;
    color: #fff;
    font-family: monospace;
}

.loading-text {
    font-size: 18px;
    margin-bottom: 20px;
    color: #aaa;
}

.progress-bar {
    width: 300px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff6600, #ff3300);
    transition: width 0.1s ease-out;
}

.progress-percent {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

body {
    min-height: 100vh;
    overflow: hidden;
    background: #000;
}

#backgroundCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

#glCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#controls {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-family: monospace;
    font-size: 14px;
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
}

#controls label {
    display: block;
    margin-bottom: 8px;
}

#controls input[type="range"] {
    width: 200px;
    cursor: pointer;
}

#controls select {
    width: 200px;
    padding: 4px;
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
}

#controls select:hover {
    border-color: #777;
}

.control-group {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-group-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #aaa;
}

/* Collapsible groups */
.control-group.collapsible .control-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
}

.control-group.collapsible .control-group-header:hover {
    color: #fff;
}

.control-group.collapsible .control-group-header .control-group-title {
    margin-bottom: 0;
}

.collapse-icon {
    font-size: 10px;
    transition: transform 0.2s;
    color: #888;
}

.control-group.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.control-group.collapsed .control-group-content {
    display: none;
}

#proceduralControls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
}

#volumetricControls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
}

.color-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.color-row label {
    flex: 1;
    margin-bottom: 0 !important;
}

.color-row input[type="color"] {
    width: 50px;
    height: 28px;
    padding: 0;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.color-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

#diskOpacityControls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.disk-opacity-row {
    margin-bottom: 6px;
}

.disk-opacity-row label {
    width: 70px;
    color: #aaa;
    margin-bottom: 0;
}

.disk-opacity-row input[type="range"] {
    flex: 1;
}

.disk-opacity-row span {
    width: 40px;
    text-align: right;
    color: #fff;
}

/* Settings button */
.settings-btn {
    width: 100%;
    padding: 8px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 0;
}

.settings-btn:hover {
    background: #444;
    border-color: #777;
}

/* Modal window */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    border-radius: 12px;
    width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
}

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-family: monospace;
    font-size: 14px;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-controls {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    align-items: center;
    flex-wrap: wrap;
}

.sync-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #ccc;
    font-family: monospace;
    font-size: 12px;
}

.sync-toggle input[type="checkbox"] {
    cursor: pointer;
}

.modal-controls select {
    padding: 4px 8px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.modal-controls select:disabled {
    opacity: 0.5;
}

#resetOpacitiesBtn {
    margin-left: auto;
    padding: 5px 10px;
    background: #444;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    font-size: 12px;
}

#resetOpacitiesBtn:hover {
    background: #555;
}

.modal-body {
    padding: 15px 20px;
    overflow-y: auto;
    max-height: 50vh;
}

.modal-body .disk-opacity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

/* Info Panel - Right Top Corner */
#infoPanel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 15px;
    border-radius: 8px;
    color: white;
    font-family: monospace;
    font-size: 12px;
    z-index: 100;
    min-width: 160px;
}

.info-section {
    color: #888;
    font-size: 11px;
    margin-top: 8px;
    margin-bottom: 4px;
    padding-top: 6px;
    border-top: 1px solid #333;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.info-label {
    color: #aaa;
}

.info-row span:last-child {
    color: #fff;
    font-weight: bold;
}

/* Thought Banner (Top of Screen) */
.thought-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: transparent;
    z-index: 500;
    pointer-events: none;
    padding: 15px 20px;
    display: flex;
    justify-content: center;
}

.thought-container {
    max-width: 800px;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 15px 25px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
}

.thought-number {
    font-family: 'Georgia', serif;
    font-size: 14px;
    color: #888;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.thought-title {
    font-family: 'Georgia', serif;
    font-size: 24px;
    font-weight: normal;
    color: #ff6600;
    margin-bottom: 10px;
    line-height: 1.3;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.thought-text {
    font-family: 'Georgia', serif;
    font-size: 18px;
    line-height: 1.6;
    color: #ddd;
    text-align: center;
    margin: 0;
    opacity: 1;
    transition: opacity 0.5s ease-out, font-size 0.3s ease-out;
}

/* Adaptive font sizes based on text length */
.thought-text.text-short {
    font-size: 20px;
    line-height: 1.6;
}

.thought-text.text-medium {
    font-size: 18px;
    line-height: 1.55;
}

.thought-text.text-long {
    font-size: 16px;
    line-height: 1.5;
}

.thought-text.text-very-long {
    font-size: 14px;
    line-height: 1.45;
}

.thought-overlay.fading .thought-number,
.thought-overlay.fading .thought-title,
.thought-overlay.fading .thought-text {
    opacity: 0;
}

/* Performance Panel */
.perf-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-family: monospace;
    font-size: 11px;
    z-index: 600;
    min-width: 220px;
    border: 1px solid #333;
    display: none;
    backdrop-filter: blur(4px);
}

.perf-panel.active {
    display: block;
}

.perf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #444;
}

.perf-title {
    font-weight: bold;
    color: #ff6600;
    font-size: 11px;
    letter-spacing: 1px;
}

.perf-hint {
    font-size: 9px;
    color: #666;
}

.perf-section {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.perf-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.perf-section-title {
    color: #888;
    font-size: 10px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.perf-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    color: #aaa;
}

.perf-value {
    color: #fff;
    font-weight: bold;
}

.perf-value.warn {
    color: #ffaa00;
}

.perf-value.critical {
    color: #ff4444;
}

.perf-load {
    margin-top: 5px;
}

.perf-bar-container {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    gap: 8px;
}

.perf-bar-label {
    width: 30px;
    color: #aaa;
}

.perf-bar {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
}

.perf-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00cc00, #ffcc00, #ff4444);
    background-size: 300% 100%;
    border-radius: 3px;
    transition: width 0.2s ease-out;
}

.perf-bar-fill.low {
    background: #00cc00;
}

.perf-bar-fill.medium {
    background: #ffcc00;
}

.perf-bar-fill.high {
    background: #ff6600;
}

.perf-bar-fill.critical {
    background: #ff4444;
}

.perf-info-row {
    margin-top: 4px;
}

.perf-info {
    font-size: 9px;
    color: #666;
    font-style: italic;
    line-height: 1.3;
}

/* Scientific highlight section */
.perf-highlight {
    background: rgba(255, 102, 0, 0.1);
    margin: -12px -16px 10px -16px;
    padding: 12px 16px;
    border-bottom: 1px solid #ff6600;
}

.perf-big {
    font-size: 12px;
    margin-bottom: 5px;
}

.perf-glow {
    color: #ff6600;
    text-shadow: 0 0 8px rgba(255, 102, 0, 0.6);
}

.perf-value.active {
    color: #00ff88;
}

.perf-value.inactive {
    color: #666;
}
