/* 1-Variable Gradient Descent II – Canvas-based visualization */
.gd2-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    gap: 16px;
    max-width: 1100px;
    min-height: 540px;
    height: 800px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #1a1b26;
    color: #c0caf5;
    border-radius: 10px;
    padding: 16px;
    box-sizing: border-box;
}

.gd2-container * {
    box-sizing: border-box;
}

.gd2-sidebar {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #16161e;
    border-radius: 8px;
    padding: 14px;
    border: 1px solid #2d2d3a;
    height: 100%;
}

.gd2-sidebar h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #7aa2f7;
    border-bottom: 1px solid #2d2d3a;
    padding-bottom: 6px;
}

.gd2-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gd2-control-row label {
    min-width: 68px;
    font-size: 12px;
    color: #a9b1d6;
}

.gd2-sidebar select {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 12px;
    background: #24283b;
    color: #c0caf5;
    border: 1px solid #3b4261;
    border-radius: 6px;
    cursor: pointer;
}

.gd2-sidebar select:hover,
.gd2-sidebar select:focus {
    border-color: #7aa2f7;
    outline: none;
}

.gd2-sidebar input[type="range"] {
    flex: 1;
    min-width: 80px;
    height: 6px;
    background: #24283b;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
}

.gd2-sidebar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #7aa2f7;
    border-radius: 50%;
    cursor: pointer;
}

.gd2-sidebar input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #7aa2f7;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.gd2-value {
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #9ece6a;
    min-width: 52px;
    text-align: right;
}

.gd2-trajectory-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.gd2-trajectory-opts .gd2-check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #a9b1d6;
    cursor: pointer;
    min-width: 0;
}

.gd2-trajectory-opts .gd2-check-label input {
    cursor: pointer;
    accent-color: #7aa2f7;
}

#gd2MomentumMuRow.disabled {
    opacity: 0.5;
    pointer-events: none;
}

#gd2AutoRLParams {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gd2-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gd2-buttons button {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    background: #24283b;
    color: #c0caf5;
    border: 1px solid #3b4261;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.gd2-buttons button:hover {
    background: #2d2d3a;
    border-color: #7aa2f7;
}

.gd2-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gd2-buttons button:disabled:hover {
    background: #24283b;
    border-color: #3b4261;
}

.gd2-buttons button.active {
    background: #7aa2f7;
    color: #1a1b26;
    border-color: #7aa2f7;
}

.gd2-metrics {
    font-size: 11px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: #24283b;
    border-radius: 6px;
    padding: 10px;
    border: 1px solid #2d2d3a;
    color: #a9b1d6;
    line-height: 1.6;
}

.gd2-metrics span {
    color: #9ece6a;
}

.gd2-desc {
    font-size: 11px;
    color: #787c99;
    line-height: 1.4;
    padding: 8px 0;
    border-top: 1px solid #2d2d3a;
    margin-top: 4px;
}

.gd2-insight {
    font-size: 11px;
    background: #1f2335;
    border-radius: 6px;
    padding: 10px;
    border-left: 3px solid #7aa2f7;
    color: #a9b1d6;
    line-height: 1.5;
}

.gd2-insight.overshot {
    border-left-color: #f7768e;
    background: rgba(247, 118, 142, 0.08);
}

.gd2-visuals {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.gd2-main-canvas-wrap {
    width: 100%;
    max-width: 560px;
    height: 480px;
    min-height: 420px;
    margin-left: auto;
    margin-right: auto;
    background: #16161e;
    border-radius: 8px;
    border: 1px solid #2d2d3a;
    overflow: hidden;
    position: relative;
}

.gd2-main-canvas-wrap canvas {
    display: block;
    margin-left: -15;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.gd2-loss-wrap {
    width: 100%;
    max-width: 560px;
    height: 272px;
    min-height: 170px;
    margin-left: auto;
    margin-right: auto;
    background: #16161e;
    border-radius: 8px;
    border: 1px solid #2d2d3a;
    overflow: hidden;
}

.gd2-loss-wrap canvas {
    display: block;
    margin-left: -15;
    height: 238px;
    width: 100%;
}

@media (max-width: 700px) {
    .gd2-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }
    .gd2-sidebar {
        grid-column: 1;
        grid-row: 1;
    }
    .gd2-visuals {
        grid-column: 1;
        grid-row: 2 / -1;
    }
}
