:root {
  --ink: #18342e;
  --ink-soft: #577068;
  --cream: #f7f2e8;
  --paper: #fffdf8;
  --line: #dcd7ca;
  --grid: #e8e2d7;
  --sine: #ee6b4d;
  --sine-soft: #fff0eb;
  --cosine: #277a70;
  --cosine-soft: #e7f4f1;
  --tangent: #8b65a6;
  --tangent-soft: #f1eaf6;
  --cotangent: #b8672a;
  --cotangent-soft: #fff0df;
  --gold: #e3ad3e;
  --period: #2f6fed;
  --cta-blue: #1555d8;
  --cta-line: #bfd1ef;
  --shadow: 0 20px 60px rgba(48, 59, 49, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(238, 107, 77, 0.08), transparent 24rem),
    radial-gradient(circle at 95% 32%, rgba(39, 122, 112, 0.07), transparent 27rem),
    var(--cream);
  font-family: "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 0 42px;
}

.site-header {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(24, 52, 46, 0.14);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  background: var(--ink);
}

.brand-mark::before {
  width: 42px;
  height: 1.5px;
}

.brand-mark::after {
  width: 1.5px;
  height: 42px;
}

.brand-mark span {
  z-index: 1;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sine);
  transform: translate(8px, -8px);
}

.mode-switch,
.segmented-control {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.68);
}

.mode-button,
.segmented-control button {
  padding: 9px 17px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-button.active,
.segmented-control button.active {
  color: var(--paper);
  background: var(--ink);
}

.mode-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.site-cta {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 2px solid var(--cta-line);
  border-radius: 999px;
  color: var(--cta-blue);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: 0 8px 22px rgba(21, 85, 216, 0.06);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.site-cta span {
  font-size: 1.18em;
  line-height: 0.8;
}

.site-cta:hover,
.site-cta:focus-visible {
  border-color: rgba(21, 85, 216, 0.45);
  box-shadow: 0 12px 28px rgba(21, 85, 216, 0.13);
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

main {
  padding: 56px 0 32px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(460px, 1.2fr) minmax(300px, 0.8fr);
  gap: 60px;
  align-items: end;
  margin-bottom: 44px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--sine);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(3rem, 6vw, 6.35rem);
  line-height: 0.94;
  letter-spacing: -0.075em;
}

.intro {
  max-width: 580px;
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 1.5vw, 1.32rem);
  line-height: 1.65;
}

.explorer-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(530px, 1.45fr);
  gap: 18px;
}

.panel,
.readout-panel,
.control-panel {
  border: 1px solid rgba(24, 52, 46, 0.14);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.panel {
  overflow: hidden;
}

.panel-heading {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 14px;
}

.panel-kicker {
  margin-bottom: 4px;
  color: var(--ink-soft);
}

h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.quadrant-badge {
  padding: 8px 12px;
  border-radius: 999px;
  color: #7d5720;
  background: #fff2cb;
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
}

.canvas-wrap {
  position: relative;
}

.circle-math-label,
.circle-coordinate,
.graph-math-label {
  position: absolute;
  z-index: 2;
  color: var(--ink-soft);
  font-size: 0.68rem;
  pointer-events: none;
}

.circle-math-label .katex,
.graph-math-label .katex {
  font-size: 1em;
}

.circle-label-positive-x {
  left: 81%;
  top: 50%;
  transform: translate(-50%, 12px);
}

.circle-label-negative-x {
  left: 19%;
  top: 50%;
  transform: translate(-50%, 12px);
}

.circle-label-positive-y {
  left: 50%;
  top: 16%;
  transform: translate(9px, -50%);
}

.circle-label-negative-y {
  left: 50%;
  top: 84%;
  transform: translate(9px, -50%);
}

.circle-coordinate {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.circle-coordinate .katex {
  font-size: 1em;
}

.graph-math-label {
  font-size: 0.61rem;
}

.graph-y-positive {
  left: 27px;
  top: 28%;
}

.graph-y-negative {
  left: 23px;
  top: 72%;
}

.graph-x-zero,
.graph-x-half-pi,
.graph-x-pi,
.graph-x-three-half-pi,
.graph-x-two-pi {
  bottom: 9px;
  transform: translateX(-50%);
}

.graph-x-zero {
  left: 6.6%;
}

.graph-x-half-pi {
  left: 29.8%;
}

.graph-x-pi {
  left: 53.2%;
}

.graph-x-three-half-pi {
  left: 76.6%;
}

.graph-x-two-pi {
  left: 98.5%;
  transform: translateX(-100%);
}

.circle-wrap {
  height: 460px;
}

.graph-wrap {
  height: 414px;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#circleCanvas {
  cursor: grab;
  touch-action: none;
}

#circleCanvas:active {
  cursor: grabbing;
}

#circleCanvas:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -5px;
}

.drag-hint {
  position: absolute;
  right: 18px;
  bottom: 15px;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.9);
  font-size: 0.68rem;
  font-weight: 700;
  pointer-events: none;
}

.graph-heading {
  gap: 20px;
}

.function-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.function-toggle {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--paper);
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
  cursor: pointer;
  user-select: none;
}

.function-toggle:has(input:checked) {
  color: var(--ink);
  border-color: currentColor;
}

.function-toggle input {
  position: absolute;
  opacity: 0;
}

.swatch {
  display: block;
  width: 15px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}

.function-toggle.sine {
  color: var(--sine);
}

.function-toggle.cosine {
  color: var(--cosine);
}

.function-toggle.tangent {
  color: var(--tangent);
}

.function-toggle:not(:has(input:checked)) {
  color: #9da49e;
}

.graph-legend {
  display: flex;
  height: 46px;
  gap: 24px;
  align-items: center;
  padding: 0 24px;
  border-top: 1px solid var(--grid);
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.graph-legend span {
  display: flex;
  gap: 7px;
  align-items: center;
}

.legend-line {
  width: 16px;
  border-top: 1px dashed var(--ink-soft);
}

.legend-dot {
  width: 7px;
  height: 7px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--sine);
  box-shadow: 0 0 0 1px var(--sine);
}

.readout-panel {
  display: grid;
  grid-template-columns: 1.1fr repeat(3, 1fr);
  margin-top: 18px;
  overflow: hidden;
}

.angle-readout,
.value-readout {
  min-height: 118px;
  padding: 22px 26px;
}

.angle-readout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--paper);
  background: var(--ink);
}

.angle-readout .readout-label {
  color: rgba(255, 255, 255, 0.65);
}

.angle-readout strong {
  font-size: 2rem;
}

.angle-readout .katex {
  color: inherit;
  font-size: 1em;
}

.angle-readout > span:last-child {
  color: rgba(255, 255, 255, 0.68);
}

.value-readout {
  display: flex;
  gap: 16px;
  align-items: center;
  border-left: 1px solid var(--grid);
}

.readout-symbol {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  font-family: "DM Mono", monospace;
  font-size: 0.7rem;
  font-weight: 500;
}

.sine-value .readout-symbol {
  color: var(--sine);
  background: var(--sine-soft);
}

.cosine-value .readout-symbol {
  color: var(--cosine);
  background: var(--cosine-soft);
}

.tangent-value .readout-symbol {
  color: var(--tangent);
  background: var(--tangent-soft);
}

.value-readout div,
.value-readout strong,
.value-readout span {
  display: block;
}

.readout-label {
  margin-bottom: 3px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.value-readout strong {
  font-size: 1.17rem;
}

.value-readout .katex {
  font-size: 1em;
}

.value-readout div > span:last-child {
  margin-top: 2px;
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
}

.control-panel {
  display: grid;
  grid-template-columns: auto minmax(300px, 1fr) auto;
  gap: 28px;
  align-items: center;
  margin-top: 18px;
  padding: 22px 24px;
}

.play-button {
  display: flex;
  width: 94px;
  height: 50px;
  gap: 9px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 13px;
  color: var(--paper);
  background: var(--sine);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(238, 107, 77, 0.22);
}

.angle-control {
  min-width: 0;
}

.control-labels,
.range-labels {
  display: flex;
  justify-content: space-between;
}

.control-labels {
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.74rem;
  font-weight: 700;
}

#sliderValue {
  color: var(--sine);
}

#sliderValue .katex {
  font-size: 1em;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 5px 0;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(to right, var(--sine) 0 12.5%, var(--grid) 12.5% 100%);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 19px;
  height: 19px;
  border: 4px solid var(--paper);
  border-radius: 50%;
  appearance: none;
  background: var(--sine);
  box-shadow: 0 0 0 1px var(--sine), 0 3px 8px rgba(24, 52, 46, 0.16);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 4px solid var(--paper);
  border-radius: 50%;
  background: var(--sine);
  box-shadow: 0 0 0 1px var(--sine);
}

.range-labels {
  color: #8c9a94;
  font-family: "DM Mono", monospace;
  font-size: 0.6rem;
}

.control-options {
  display: flex;
  gap: 15px;
  align-items: center;
}

.segmented-control {
  flex: 0 0 auto;
}

.segmented-control button {
  padding: 7px 11px;
  font-size: 0.68rem;
}

.snap-toggle {
  display: flex;
  min-width: 154px;
  gap: 8px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.snap-toggle input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  display: flex;
  width: 34px;
  height: 19px;
  flex: 0 0 auto;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: #b5bdb9;
  transition: background 160ms ease;
}

.toggle-track span {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

.snap-toggle input:checked + .toggle-track {
  background: var(--cosine);
}

.snap-toggle input:checked + .toggle-track span {
  transform: translateX(15px);
}

.reset-button {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 9px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.insight-card {
  display: flex;
  max-width: 760px;
  gap: 16px;
  align-items: flex-start;
  margin: 28px auto 0;
  padding: 20px 24px;
  border-left: 3px solid var(--gold);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 253, 248, 0.62);
}

.insight-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #875f13;
  background: #ffe8a9;
}

.insight-card p {
  margin: 0;
}

#insightText {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.6;
}

#insightText strong {
  color: var(--ink);
}

.transform-hero {
  margin-bottom: 28px;
}

.transform-hero .intro .katex {
  font-size: 1em;
}

.lab-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin: 34px 0 14px;
}

.lab-heading h2 {
  margin: 0;
  font-size: clamp(1.55rem, 2.8vw, 2.45rem);
  letter-spacing: -0.05em;
}

.lab-heading .eyebrow {
  margin: 0 0 6px;
}

.transform-lab {
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(620px, 1.55fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
}

.tan-cot-lab {
  margin-bottom: 34px;
}

.stacked-heading {
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
}

.analysis-panel,
.tangent-panel {
  overflow: hidden;
}

.family-toggle {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(247, 242, 232, 0.68);
}

.family-toggle button {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  padding: 9px 12px;
}

.family-toggle button.active {
  color: var(--paper);
}

.family-toggle .sine-tab.active {
  background: var(--sine);
}

.family-toggle .cosine-tab.active {
  background: var(--cosine);
}

.family-toggle .tangent-tab.active {
  background: var(--tangent);
}

.family-toggle .cotangent-tab.active {
  background: var(--cotangent);
}

.analysis-list {
  display: grid;
  border-top: 1px solid var(--grid);
}

.analysis-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, auto);
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--grid);
}

.analysis-row > span {
  color: var(--ink-soft);
  font-size: 0.858rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.analysis-row strong {
  min-height: 1.35em;
  color: var(--ink);
  font-size: clamp(1.8rem, 2.56vw, 2.2rem);
  font-weight: 900;
  line-height: 1.04;
  text-align: right;
  justify-self: end;
  letter-spacing: -0.04em;
  font-variant-numeric: lining-nums tabular-nums;
}

.analysis-row .katex {
  font-size: 1.16em;
  font-weight: 800;
}

.analysis-row .katex-html {
  font-size: inherit;
  font-weight: 800;
}

.metric-note {
  padding: 8px 11px;
  border-radius: 999px;
  color: #7d5720;
  background: #fff2cb;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  font-weight: 500;
}

.transform-wrap {
  height: 420px;
  border-top: 1px solid var(--grid);
  border-bottom: 1px solid var(--grid);
}

#transformCanvas {
  cursor: grab;
  touch-action: none;
}

#transformCanvas:active {
  cursor: grabbing;
}

.transform-y-top,
.transform-y-mid,
.transform-y-bottom {
  left: 17px;
  transform: translateY(-50%);
}

.transform-y-top {
  top: 20%;
}

.transform-y-mid {
  top: 50%;
}

.transform-y-bottom {
  top: 80%;
}

.transform-x-left,
.transform-x-center,
.transform-x-right {
  bottom: 10px;
}

.transform-x-left {
  left: 55px;
}

.transform-x-center {
  left: 50%;
  transform: translateX(-50%);
}

.transform-x-right {
  right: 20px;
}

.axis-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.axis-increment-label {
  position: absolute;
  z-index: 3;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--period);
  background: rgba(255, 253, 248, 0.78);
  font-size: 0.66rem;
  font-weight: 800;
  transform: translate(-50%, 0);
  white-space: nowrap;
}

.axis-increment-label .katex {
  font-size: 1em;
}

.pan-hint {
  position: absolute;
  right: 16px;
  top: 14px;
  z-index: 3;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.88);
  font-size: 0.64rem;
  font-weight: 800;
  pointer-events: none;
}

.parameter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  padding: 22px 24px 24px;
}

.parameter-control {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 10px 14px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.parameter-control > span {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--ink);
}

.parameter-control i {
  display: inline-grid;
  min-width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 7px;
  color: var(--paper);
  background: var(--ink);
  font-style: normal;
}

.parameter-control i .katex {
  color: inherit;
  font-size: 0.95em;
}

.parameter-control input[type="number"] {
  width: 86px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Mono", monospace;
  font-size: 0.78rem;
  padding: 8px 9px;
}

.pi-stepper {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 7px;
  align-items: center;
  margin-top: -1px;
}

.pi-stepper > span {
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pi-stepper button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.82);
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.pi-stepper button:hover,
.pi-stepper button:focus-visible {
  border-color: var(--period);
  color: var(--period);
  outline: none;
}

.pi-stepper .katex {
  font-size: 1em;
}

.tangent-panel {
  grid-column: 1 / -1;
  padding-bottom: 20px;
}

.tangent-panel p {
  margin: 0;
  padding: 0 20px 16px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.6;
}

.tangent-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  padding: 0 20px;
}

.tangent-metrics > span {
  display: block;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--tangent);
  background: var(--tangent-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.tangent-metrics .katex {
  font-size: 1em;
}

.tan-cot-note {
  margin: 0;
  padding: 18px 24px 22px;
  border-top: 1px solid var(--grid);
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.65;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 0 36px;
  border-top: 1px solid rgba(24, 52, 46, 0.12);
  color: var(--ink-soft);
  font-size: 0.72rem;
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper);
  font-family: "DM Mono", monospace;
}

@media (max-width: 1100px) {
  .app-shell {
    padding: 0 24px;
  }

  .explorer-grid {
    grid-template-columns: 1fr;
  }

  .transform-lab {
    grid-template-columns: 1fr;
  }

  .tangent-panel {
    grid-column: auto;
  }

  .tangent-metrics {
    grid-template-columns: 1fr;
  }

  .circle-wrap {
    height: 420px;
  }

  .readout-panel {
    grid-template-columns: repeat(3, 1fr);
  }

  .angle-readout {
    grid-column: 1 / -1;
    min-height: 90px;
    flex-direction: row;
    gap: 18px;
    align-items: baseline;
  }

  .control-panel {
    grid-template-columns: auto 1fr;
  }

  .control-options {
    grid-column: 1 / -1;
    justify-content: center;
  }

}

@media (max-width: 700px) {
  .app-shell {
    padding: 0 14px;
  }

  .site-header {
    height: auto;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 0;
  }

  .brand {
    font-size: 0.86rem;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-mark::before {
    width: 34px;
  }

  .brand-mark::after {
    height: 34px;
  }

  .mode-switch {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
  }

  .site-cta {
    width: auto;
    max-width: 100%;
    min-height: 46px;
    padding: 0 20px;
    font-size: 0.95rem;
    text-align: center;
  }

  main {
    padding-top: 38px;
  }

  .hero {
    display: block;
    margin-bottom: 28px;
  }

  h1 {
    font-size: clamp(3.2rem, 16vw, 5rem);
  }

  .intro {
    margin-top: 24px;
  }

  .circle-wrap {
    height: 370px;
  }

  .graph-wrap {
    height: 340px;
  }

  .panel-heading {
    padding: 17px 16px 12px;
  }

  .graph-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .function-toggles {
    justify-content: flex-start;
  }

  .readout-panel {
    grid-template-columns: 1fr;
  }

  .angle-readout {
    grid-column: auto;
    min-height: 88px;
  }

  .value-readout {
    min-height: 86px;
    padding: 14px 20px;
    border-top: 1px solid var(--grid);
    border-left: 0;
  }

  .control-panel {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .play-button {
    width: 100%;
  }

  .control-options {
    grid-column: auto;
    flex-wrap: wrap;
  }

  .transform-wrap {
    height: 340px;
  }

  .parameter-grid,
  .analysis-list {
    grid-template-columns: 1fr;
  }

  footer {
    gap: 10px;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
