:root {
  color-scheme: light;
  font-family:
    ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #172033;
  --muted: #64748b;
  --blue: #2563eb;
  --copy: #d9566d;
  --copy-dark: #a6384d;
  --line: #cbd5e1;
  --green: #087154;
  --highlight: #e3a321;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 5%, rgb(37 99 235 / 7%), transparent 28rem),
    #f6f7fb;
  overscroll-behavior: none;
}

button,
svg {
  -webkit-tap-highlight-color: transparent;
}

.area-shell {
  width: min(100%, 1380px);
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.area-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: clamp(0.82rem, 1.5vw, 1rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 1100px;
  margin: 0;
  font-size: clamp(1.65rem, 3.8vw, 3.25rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 650;
}

.local-note {
  flex: 0 0 auto;
  margin: 4px 0 0;
  padding: 9px 14px;
  border: 1px solid #b9e5d5;
  border-radius: 999px;
  color: var(--green);
  background: #ecfdf5;
  font-size: clamp(0.74rem, 1.2vw, 0.9rem);
  font-weight: 750;
  white-space: nowrap;
}

.local-note span {
  margin-right: 5px;
  font-size: 0.7em;
}

.area-visualizer,
.area-insight {
  border: 1px solid rgb(203 213 225 / 82%);
  border-radius: 26px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 20px 60px rgb(30 41 59 / 9%);
}

.area-visualizer {
  min-width: 0;
  padding: clamp(8px, 1.4vw, 16px);
}

.area-board {
  display: block;
  width: 100%;
  max-height: min(61dvh, 700px);
  border-radius: 20px;
  touch-action: none;
}

.board-background {
  fill: #f8fafc;
  stroke: #dbe4ef;
  stroke-width: 4;
}

.original-triangle,
.copy-triangle,
.animated-copy {
  stroke-linejoin: round;
  stroke-width: 9;
}

.original-triangle {
  fill: rgb(37 99 235 / 18%);
  stroke: var(--blue);
}

.copy-triangle,
.animated-copy {
  fill: rgb(217 86 109 / 19%);
  stroke: var(--copy);
}

.animated-copy {
  opacity: 0.42;
  pointer-events: none;
}

.parallelogram-outline {
  fill: none;
  stroke: #334155;
  stroke-linejoin: round;
  stroke-width: 7;
  pointer-events: none;
}

.parallelogram-highlight {
  fill: rgb(227 163 33 / 0%);
  stroke: rgb(227 163 33 / 0%);
  stroke-linejoin: round;
  stroke-width: 19;
  pointer-events: none;
}

.parallelogram-highlight.is-emphasized {
  animation: emphasize-parallelogram 650ms ease-out both;
}

.height-line {
  stroke: #52657e;
  stroke-dasharray: 14 12;
  stroke-width: 6;
}

.height-foot {
  fill: #52657e;
}

.right-angle {
  fill: none;
  stroke: #52657e;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}

.geometry-label {
  fill: var(--ink);
  paint-order: stroke;
  stroke: #f8fafc;
  stroke-linejoin: round;
  stroke-width: 12px;
  font-size: 40px;
  font-style: italic;
  font-weight: 850;
  text-anchor: middle;
}

.height-label {
  fill: #52657e;
}

.apex-hit {
  fill: transparent;
  pointer-events: all;
  cursor: grab;
}

.apex-hit:active {
  cursor: grabbing;
}

.apex-hit:focus-visible {
  fill: rgb(37 99 235 / 13%);
  outline: none;
}

.apex-dot {
  fill: var(--blue);
  stroke: white;
  stroke-width: 7;
  pointer-events: none;
}

.area-board[data-state="animating"] .apex-hit {
  cursor: wait;
  pointer-events: none;
}

.area-insight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 24px;
  margin-top: 14px;
  padding: clamp(16px, 2vw, 24px);
  align-items: center;
}

.area-prompt {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  font-weight: 750;
  line-height: 1.35;
}

.area-formulas {
  display: flex;
  grid-column: 1 / -1;
  gap: clamp(18px, 4vw, 58px);
  padding-top: 4px;
  flex-wrap: wrap;
}

.area-formulas[hidden] {
  display: none;
}

.area-formulas p {
  margin: 0;
  color: #182b48;
  font-size: clamp(1.35rem, 3.2vw, 2.35rem);
  font-weight: 850;
  letter-spacing: -0.025em;
}

.area-formulas sub {
  font-size: 0.55em;
}

.area-controls {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.primary-button,
.reset-button {
  min-height: 56px;
  padding: 0 20px;
  border-radius: 16px;
  font: inherit;
  font-size: clamp(0.95rem, 1.5vw, 1.08rem);
  font-weight: 850;
  touch-action: manipulation;
}

.primary-button {
  border: 2px solid var(--blue);
  color: white;
  background: var(--blue);
}

.reset-button {
  border: 2px solid var(--line);
  color: var(--ink);
  background: #f8fafc;
}

button:focus-visible {
  outline: 5px solid rgb(37 99 235 / 28%);
  outline-offset: 3px;
}

button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

noscript {
  display: block;
  margin-top: 12px;
  color: var(--copy-dark);
  font-weight: 700;
}

@keyframes emphasize-parallelogram {
  0% {
    fill: rgb(227 163 33 / 16%);
    stroke: rgb(227 163 33 / 74%);
  }
  100% {
    fill: rgb(227 163 33 / 0%);
    stroke: rgb(227 163 33 / 0%);
  }
}

@media (max-width: 760px) {
  .area-shell {
    padding-inline: 10px;
  }

  .area-header {
    display: block;
  }

  .local-note {
    display: inline-block;
    margin-top: 10px;
  }

  .area-insight {
    grid-template-columns: 1fr;
  }

  .area-controls {
    justify-content: stretch;
  }

  .primary-button,
  .reset-button {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .area-controls,
  .area-formulas {
    flex-direction: column;
  }

  .area-board {
    min-height: 330px;
  }
}

@media (orientation: landscape) and (max-height: 820px) {
  .area-shell {
    padding-block: 10px;
  }

  .module-navigation {
    margin-bottom: 6px;
  }

  .area-header {
    margin-bottom: 9px;
  }

  .subtitle {
    margin-top: 3px;
  }

  .area-board {
    max-height: 54dvh;
  }

  .area-insight {
    padding-block: 12px;
  }
}

@media (min-width: 1500px) {
  .area-board {
    max-height: 720px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .parallelogram-highlight.is-emphasized {
    animation: none;
    fill: rgb(227 163 33 / 8%);
    stroke: rgb(227 163 33 / 42%);
  }
}
