/* Kuramoto Model – Synchronization in Complex Systems. Max width 800px. */

.kuramoto-tabs {
    margin-bottom: 0;
}

.kuramoto-tab-headers {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}

.kuramoto-tab-btn {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    padding: 10px 20px;
    background: #1a1a1a;
    color: #888;
    border: 1px solid #333;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    margin-right: 2px;
}

.kuramoto-tab-btn:hover {
    color: #e0e0e0;
    background: #252525;
}

.kuramoto-tab-btn.active {
    background: #121212;
    color: #00ffcc;
    border-color: #333;
    margin-bottom: -1px;
    padding-bottom: 11px;
}

.kuramoto-tab-panel {
    display: none;
    padding: 0;
}

.kuramoto-tab-panel.active {
    display: block;
}

.kuramoto-placeholder {
    padding: 24px;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-family: 'Courier New', Courier, monospace;
}

#kuramoto-app {
    max-width: 800px;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
    background: #121212;
    color: #e0e0e0;
    overflow: hidden;
}

.kuramoto-dashboard {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 400px;
}

.kuramoto-top-row {
    display: flex;
    flex: 0 0 auto;
    min-height: 0;
}

.kuramoto-controls {
    flex: 0 0 200px;
    padding: 16px;
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0d0d0d;
}

.kuramoto-top-row .kuramoto-main {
    border-bottom: 1px solid #333;
}

.kuramoto-controls h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #00ffcc;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kuramoto-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.kuramoto-control-row label {
    font-size: 12px;
    color: #aaa;
    flex: 0 0 58px;
    min-width: 0;
}

.kuramoto-control-row input[type="range"] {
    flex: 1;
    min-width: 0;
    max-width: 58px;
    margin-left: 40px;
    accent-color: #00ffcc;
}

.kuramoto-control-row .kuramoto-val {
    font-size: 12px;
    color: #00ffcc;
    flex: 0 0 28px;
    min-width: 0;
}

.kuramoto-select {
    flex: 1;
    min-width: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    padding: 4px 6px;
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    accent-color: #00ffcc;
}

.kuramoto-controls button {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid #444;
}

.kuramoto-btn-primary {
    background: #00ffcc;
    color: #121212;
    border-color: #00ffcc;
    font-weight: bold;
}

.kuramoto-btn-primary:hover {
    background: #00ddb3;
}

.kuramoto-btn-secondary {
    background: transparent;
    color: #e0e0e0;
}

.kuramoto-btn-secondary:hover {
    background: #333;
}

.kuramoto-main {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
}

.kuramoto-main canvas {
    display: block;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
}

.kuramoto-label-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 11px;
    color: #00ffcc;
}

.kuramoto-phase-circle-wrap {
    margin-top: 8px;
}

.kuramoto-time-phase-panel {
    width: 100%;
    padding: 12px 16px;
    background: #0d0d0d;
    border-bottom: 1px solid #333;
    box-sizing: border-box;
}

.kuramoto-time-phase-panel h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #e0e0e0;
    text-align: center;
}

.kuramoto-time-phase-panel canvas {
    display: block;
    width: 100%;
    max-width: 760px;
    height: 120px;
    margin: 0 auto;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
}

.kuramoto-bottom-row {
    display: flex;
    flex: 0 0 auto;
    gap: 0;
    min-height: 0;
}

.kuramoto-bottom-row .kuramoto-chart-box {
    flex: 1;
    min-width: 0;
    border: 1px solid #333;
    border-left: none;
    border-radius: 0;
}

.kuramoto-bottom-row .kuramoto-chart-box:first-child {
    border-left: 1px solid #333;
}

.kuramoto-chart-box {
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px;
}

.kuramoto-chart-subtitle {
    font-size: 0.8em;
    color: #888;
    margin: 0 0 4px 0;
}

.kuramoto-chart-box h4 {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: #888;
}

.kuramoto-chart-box canvas {
    display: block;
    width: 100%;
    background: #000;
}

.kuramoto-sync-label {
    font-size: 12px;
    color: #00ffcc;
    margin-bottom: 4px;
}

.kuramoto-status {
    font-size: 11px;
    color: #ff3366;
    margin-top: 4px;
}

.kuramoto-powergrid-wrap {
    font-family: 'Courier New', Courier, monospace;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    background: #000;
    color: #fff;
}

.kuramoto-powergrid-wrap button {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid #444;
    -webkit-appearance: none;
    appearance: none;
}

.kuramoto-powergrid-header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.kuramoto-powergrid-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px 24px;
    margin-bottom: 12px;
    padding: 12px;
    background: #0d0d0d;
    border-radius: 4px;
}

.kuramoto-powergrid-controls .kuramoto-control-row {
    flex: 0 0 auto;
}

.kuramoto-powergrid-controls .kuramoto-control-row input[type="range"] {
    width: 90px;
    min-width: 90px;
    max-width: none;
}

.kuramoto-powergrid-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.kuramoto-powergrid-hint {
    font-size: 12px;
    color: #fff;
}

.kuramoto-powergrid-hint-below {
    font-size: 12px;
    color: #fff;
    text-align: center;
    margin: 8px auto 0;
}

.kuramoto-grid-alert {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 16px;
    text-align: center;
    padding: 8px 12px;
    margin: 0 auto 8px;
    border-radius: 4px;
    max-width: 90%;
}
.kuramoto-grid-alert-warning {
    background: rgba(255, 180, 0, 0.25);
    color: #fff;
    border: 1px solid rgba(255, 180, 0, 0.6);
}
.kuramoto-grid-alert-collapse {
    background: rgba(255, 51, 102, 0.3);
    color: #fff;
    border: 1px solid rgba(255, 51, 102, 0.7);
}

.kuramoto-pg-autotune-status {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    padding: 8px 12px;
    margin: 0 auto 8px;
    border-radius: 4px;
}
.kuramoto-pg-autotune-calibrating {
    background: rgba(0, 180, 255, 0.2);
    color: #0cf;
    border: 1px solid rgba(0, 180, 255, 0.6);
}
.kuramoto-pg-autotune-found {
    background: rgba(0, 255, 136, 0.2);
    color: #0f8;
    border: 1px solid rgba(0, 255, 136, 0.6);
}
.kuramoto-pg-autotune-failed {
    background: rgba(255, 100, 0, 0.25);
    color: #fa0;
    border: 1px solid rgba(255, 100, 0, 0.6);
}

#kuramoto-powergrid-canvas {
    display: block;
    margin-left: auto;
    margin-right: auto;
    background: #000;
    cursor: pointer;
    border: none;
}

.kuramoto-powergrid-legend {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 14px;
    margin-top: 10px;
    padding: 6px 0;
}
.kuramoto-legend-row {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 14px;
    margin-top: 4px;
}
.kuramoto-legend-title {
    color: #fff;
    font-weight: bold;
    margin-right: 4px;
}
.kuramoto-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.kuramoto-legend-line {
    display: inline-block;
    width: 18px;
    height: 3px;
    border-radius: 1px;
    vertical-align: middle;
}
.kuramoto-legend-line-dashed {
    background: transparent !important;
    border: none;
    border-top: 2px dashed;
    height: 0;
}
.kuramoto-legend-sq {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 1px;
    vertical-align: middle;
}

.kuramoto-powergrid-insights {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #333;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
}
.kuramoto-powergrid-metrics {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 24px;
    margin-bottom: 10px;
}
.kuramoto-powergrid-metrics strong {
    color: #00ffcc;
}
.kuramoto-powergrid-plots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 24px;
    align-items: flex-end;
}
.kuramoto-powergrid-plot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.kuramoto-powergrid-plot label {
    font-size: 11px;
    color: #aaa;
}
.kuramoto-powergrid-plot canvas {
    display: block;
    background: #000;
    border: 1px solid #333;
    border-radius: 2px;
    max-width: 100%;
}
.kuramoto-powergrid-plot-wide {
    flex-basis: 100%;
    max-width: 100%;
}
.kuramoto-powergrid-plot-wide canvas {
    width: 100%;
    max-width: 420px;
}

@keyframes kuramoto-vibrate {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.kuramoto-bottom-row.kuramoto-vibrate {
    animation: kuramoto-vibrate 0.15s ease-in-out infinite;
}

@media (max-width: 700px) {
    .kuramoto-top-row {
        flex-direction: column;
    }
    .kuramoto-controls {
        border-right: none;
        border-bottom: 1px solid #333;
    }
    .kuramoto-top-row .kuramoto-main {
        border-bottom: 1px solid #333;
    }
    .kuramoto-bottom-row {
        flex-direction: column;
    }
    .kuramoto-bottom-row .kuramoto-chart-box {
        border-left: 1px solid #333;
        border-top: none;
        border-radius: 0;
    }
    .kuramoto-bottom-row .kuramoto-chart-box:first-child {
        border-bottom: 1px solid #333;
    }
}
