.sgd-clouds { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; max-width: 850px; margin: 1.6rem auto; }
.sgd-clouds img { width: 100%; min-width: 0; }
.sgd-figure { max-width: 720px; margin: 2rem auto 2.5rem; border: 0; padding: 0; }
.sgd-controls { display: flex; align-items: end; gap: 1.4rem; justify-content: space-between; margin: 0 1rem .6rem; }
.sgd-controls label { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; width: min(320px, 100%); font-size: .95rem; }
.sgd-optimizer-controls { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, .8fr) auto; }
.sgd-optimizer-controls label { width: 100%; min-width: 0; }
.sgd-controls output { font-variant-numeric: tabular-nums; color: #287f71; }
.sgd-controls input { grid-column: 1 / -1; width: 100%; accent-color: #44aa99; min-height: 28px; cursor: pointer; }
.sgd-controls button { background: white; color: #333; border: 1px solid #d8dedc; border-radius: 6px; padding: .4rem .8rem; font: inherit; white-space: nowrap; }
.sgd-controls button:hover { background: #f3f8f6; }
.sgd-controls :focus-visible { outline: 3px solid #44aa99; outline-offset: 3px; }
.sgd-key { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1.5rem; font-size: .85rem; margin: .7rem 0 0; }
.sgd-key span { display: inline-flex; align-items: center; gap: .45rem; }
.sgd-key i { display: inline-block; width: 22px; border-top: 3px solid #44aa99; }
.sgd-key .sgd-reference { border-color: #332288; border-top-style: dashed; }
.sgd-key .sgd-diamond { width: 8px; height: 8px; background: #333; border: 0; transform: rotate(45deg); }
.sgd-plot, .sgd-fallback { display: block; width: 100%; height: auto; }
.sgd-figure [hidden] { display: none !important; }
@media (max-width: 600px) {
 .sgd-clouds { grid-template-columns: 1fr; max-width: 480px; gap: .7rem; }
 .sgd-controls { margin-inline: 0; gap: .8rem; }
 .sgd-optimizer-controls { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
 .sgd-optimizer-controls button { justify-self: end; }
 .sgd-plot { font-size: 19px !important; }
 .sgd-key { font-size: .8rem; gap: .4rem 1rem; }
}
@media (prefers-reduced-motion: reduce) { .sgd-figure * { scroll-behavior: auto; } }
.sgd-controls input[type="range"] { appearance: none; background: transparent; }
.sgd-controls input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: #dce6e2; }
.sgd-controls input[type="range"]::-moz-range-track { height: 4px; border-radius: 3px; background: #dce6e2; }
.sgd-controls input[type="range"]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #44aa99; border: 2px solid white; box-shadow: 0 0 0 1px #44aa99; }
.sgd-controls input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #44aa99; border: 2px solid white; box-shadow: 0 0 0 1px #44aa99; }

.sgd-key .sgd-arrow { position: relative; border-top-width: 2px; }
.sgd-key .sgd-arrow::after { content: ""; position: absolute; right: 0; top: -5px; width: 7px; height: 7px; border-top: 2px solid #44aa99; border-right: 2px solid #44aa99; transform: rotate(45deg); }
.sgd-key .sgd-example, .sgd-key .sgd-example::after { border-color: #a9b4af; }
.sgd-key .sgd-full, .sgd-key .sgd-full::after { border-color: #332288; }
.sgd-key .sgd-full { border-top-style: dashed; }

.sgd-fallback img { width: 100%; height: auto; }
.sgd-methods { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.4rem; margin: 0 1rem 1.2rem; font-size: .9rem; }
.sgd-methods label, .sgd-methods span { display: inline-flex; align-items: center; gap: .4rem; }
.sgd-methods label { cursor: pointer; }
.sgd-methods input { width: 16px; height: 16px; margin: 0; accent-color: var(--method-color); cursor: pointer; }
.sgd-methods label:has(input:not(:checked)) { opacity: .5; }
.sgd-methods i { display: inline-block; width: 22px; border-top: 3px solid; }
.sgd-methods .sgd-gd { border-color: #332288; border-top-style: dashed; }
.sgd-methods .sgd-momentum { border-color: #44AA99; }
.sgd-methods .sgd-adaptivity { border-color: #DDCC77; border-top-style: dotted; }
.sgd-methods .sgd-adam { border: 0; height: 3px; background: linear-gradient(to right,#CC6677 0 11px,transparent 11px 14px,#CC6677 14px 17px,transparent 17px 20px,#CC6677 20px); }
.sgd-methods input:focus-visible { outline: 3px solid #44AA99; outline-offset: 3px; }
.sgd-controls button:disabled { opacity: .4; cursor: default; }
@media (max-width: 600px) {
 .sgd-methods { display: grid; grid-template-columns: auto auto; gap: .65rem 1.6rem; margin-inline: 0; justify-content: center; }
}
