:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #131922;
  --card: #161d28;
  --card-2: #1b2330;
  --line: #2a3442;
  --muted: #8e9bab;
  --text: #f5f7fa;
  --cyan: #20d9ee;
  --pink: #ff3b83;
  --green: #35e78a;
  --orange: #ff9f43;
}

.site-footer { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 0 0 28px; text-align: center; color: var(--muted); font-size: 12px; }
.site-footer p { margin: 0 0 8px; }
.site-footer a { color: var(--cyan); font-weight: 600; text-decoration: underline; text-decoration-color: #20d9ee88; text-underline-offset: 3px; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--cyan); }

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 70% 0%, #121b27 0, var(--bg) 42%); color: var(--text); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }

.controls { position: fixed; inset: 0 auto 0 0; width: 350px; background: rgba(20, 26, 35, .96); border-right: 1px solid var(--line); overflow-y: auto; backdrop-filter: blur(16px); }
.controls__inner { padding: 44px 34px 30px; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.side-header h2 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.side-header > p:last-child { max-width: 250px; margin: 8px 0 32px; color: var(--muted); font-size: 13px; }

fieldset { padding: 0; border: 0; margin: 0 0 34px; }
legend, .slider-heading label { color: #dfe5eb; font-size: 13px; font-weight: 750; }
.glider-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.glider-picker legend { grid-column: 1 / -1; margin-bottom: 10px; }
.glider-picker label { position: relative; cursor: pointer; }
.glider-picker input { position: absolute; opacity: 0; }
.glider-picker span { display: grid; min-height: 50px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #111720; color: var(--muted); font-size: 13px; font-weight: 700; transition: .18s ease; }
.glider-picker input:checked + span { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 13%, #111720); color: #fff; box-shadow: inset 0 0 0 1px var(--pink); }
.glider-picker input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }

.slider-group { margin: 0 0 30px; }
.slider-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.slider-heading label small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.slider-heading output { color: var(--pink); font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
input[type="range"] { width: 100%; height: 4px; margin: 20px 0 4px; appearance: none; border-radius: 4px; background: linear-gradient(to right, var(--pink) 0 var(--fill, 50%), #384251 var(--fill, 50%) 100%); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; appearance: none; border: 3px solid #fff; border-radius: 50%; background: var(--pink); box-shadow: 0 2px 10px #0008; }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; background: var(--pink); box-shadow: 0 2px 10px #0008; }
input[type="range"]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 6px; }
.range-labels { display: flex; justify-content: space-between; color: #657284; font-size: 10px; }
.angle-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.angle-shortcuts button { min-height: 34px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #111720; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; line-height: 1.2; }
.angle-shortcuts button[data-angle="90"] { grid-column: 1 / -1; }
.angle-shortcuts button:hover { border-color: #566477; color: #fff; }
.angle-shortcuts button[aria-pressed="true"] { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 13%, #111720); color: #fff; }
.angle-shortcuts button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
#resetButton { width: 100%; padding: 11px; border: 1px solid #3a4656; border-radius: 9px; background: transparent; color: #dce3ea; cursor: pointer; font-weight: 700; }
#resetButton:hover { border-color: var(--cyan); color: #fff; }

main { min-height: 100vh; margin-left: 350px; padding: 44px clamp(28px, 4vw, 72px) 52px; }
.main-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.main-header h1 { margin: 0; font-size: clamp(34px, 4.2vw, 64px); line-height: 1; letter-spacing: -.055em; }
.main-header h1 span { color: #778597; font-weight: 400; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.metrics article { position: relative; overflow: hidden; min-width: 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, var(--card-2), var(--card)); }
.metrics article::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--cyan); }
.metrics article:nth-child(2)::before { background: var(--pink); }
.metrics article:nth-child(3)::before { background: var(--green); }
.metrics article > span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.metrics strong { display: block; margin: 5px 0 1px; font-size: clamp(27px, 3vw, 44px); line-height: 1.15; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metrics strong small { color: #a7b2bf; font-size: .38em; font-weight: 650; letter-spacing: 0; }
.metrics p { margin: 0; color: #657284; font-size: 11px; }

.chart-card { padding: 24px 26px 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(20, 27, 37, .92); box-shadow: 0 22px 60px #0003; }
.chart-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
.chart-heading h2 { margin: 0; font-size: 18px; }
.chart-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px 16px; max-width: 460px; color: #a3afbd; font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { display: inline-block; flex: 0 0 auto; }
.legend .line { width: 19px; height: 2px; }
.legend .polar { background: var(--cyan); }
.legend .tangent { border-top: 2px dashed var(--pink); }
.legend .cross { color: #788598; font-size: 17px; font-style: normal; line-height: 8px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; }
.legend .origin { background: var(--green); }
.legend .optimum { background: var(--pink); }
.canvas-wrap { position: relative; height: min(52vh, 560px); min-height: 360px; }
canvas { display: block; width: 100%; height: 100%; }
.chart-note { display: flex; justify-content: space-between; gap: 16px; padding-top: 13px; border-top: 1px solid var(--line); color: #748193; font-size: 10px; }

@media (max-width: 980px) {
  .controls { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .controls__inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 26px; }
  .side-header { grid-column: 1 / -1; }
  .side-header > p:last-child { margin-bottom: 0; max-width: none; }
  .glider-picker { grid-column: 1 / -1; margin-bottom: 0; }
  .slider-group { margin: 0; }
  #resetButton { grid-column: 1 / -1; }
  main { margin-left: 0; padding: 32px 26px 42px; }
}

@media (max-width: 680px) {
  .controls__inner { grid-template-columns: 1fr; }
  .side-header, .glider-picker, #resetButton { grid-column: auto; }
  .main-header { align-items: start; }
  .status { margin-top: 9px; }
  .main-header h1 span { display: block; }
  .metrics { grid-template-columns: 1fr; }
  .chart-card { padding: 18px 14px 14px; }
  .chart-heading { display: block; }
  .legend { justify-content: start; margin-top: 14px; }
  .canvas-wrap { min-height: 330px; }
  .chart-note { display: block; }
  .chart-note span { display: block; }
}
