:root {
  --paper: #f2ecdc;
  --ink: #191916;
  --muted: #6a685f;
  --line: #c8bfaa;
  --smith: #c3412f;
  --smith-soft: #f2c1b4;
  --defender: #24645c;
  --defender-soft: #b9d8d0;
  --yellow: #e5b742;
  --panel: #fffaf0;
  --anatomy: #8c887c;
  --reach: #4d83ad;
  --grip: #c3412f;
  --pressure: #7d3f8c;
  --counter: #16806d;
  --threat: #c4801c;
  --shadow: 0 18px 50px rgba(38, 32, 20, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(35, 33, 27, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 33, 27, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
a {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--ink);
  font-family: "Trebuchet MS", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.site-header p {
  margin: 0;
  color: var(--muted);
}

.brand {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

main {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(360px, 1.15fr);
  gap: 40px 8vw;
  padding: clamp(54px, 8vw, 110px) clamp(8px, 2vw, 24px) 52px;
  align-items: end;
}

.intro h1 {
  margin: 8px 0 0;
  max-width: 760px;
  font-size: clamp(58px, 8.6vw, 142px);
  line-height: 0.82;
  letter-spacing: -0.065em;
  font-weight: 500;
}

.intro h1 span {
  color: var(--smith);
}

.eyebrow {
  margin: 0;
  font: 800 11px/1.2 "Trebuchet MS", sans-serif;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  max-width: 680px;
  margin: 0 0 28px;
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.38;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font: 700 11px/1.2 "Trebuchet MS", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-line {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--edge-color);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(320px, 0.65fr);
  min-height: 780px;
  border: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.graph-panel {
  position: relative;
  min-width: 0;
  padding: 24px;
  border-right: 1px solid var(--ink);
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 48%, rgba(195, 65, 47, 0.1), transparent 24%),
    radial-gradient(circle at 75% 48%, rgba(36, 100, 92, 0.1), transparent 24%),
    #f8f2e4;
}

.graph-heading {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.graph-heading h2 {
  margin: 5px 0 0;
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.state-index {
  color: var(--muted);
  font: 700 12px/1.2 "Trebuchet MS", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
}

#graph {
  display: block;
  width: 100%;
  height: auto;
  margin-top: -20px;
  overflow: visible;
}

.anatomical-edge {
  stroke: var(--anatomy);
  stroke-width: 3;
  opacity: 0.54;
}

.interaction-edge {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0;
  animation: edge-in 460ms ease forwards;
}

.interaction-edge.reach {
  stroke: var(--reach);
  stroke-dasharray: 12 9;
  marker-end: url(#arrow-reach);
}

.interaction-edge.grip {
  stroke: var(--grip);
  marker-end: url(#arrow-grip);
}

.interaction-edge.pressure {
  stroke: var(--pressure);
  stroke-dasharray: 5 7;
  marker-end: url(#arrow-pressure);
}

.interaction-edge.counter {
  stroke: var(--counter);
  stroke-dasharray: 16 6 3 6;
  marker-end: url(#arrow-counter);
}

.interaction-edge.threat {
  stroke: var(--threat);
  stroke-width: 9;
  opacity: 0.3;
  marker-end: url(#arrow-threat);
}

.interaction-edge.partial,
.interaction-edge.migrating,
.interaction-edge.weakening,
.interaction-edge.weak {
  opacity: 0.56;
  stroke-width: 4;
}

.interaction-edge.secured {
  stroke-width: 9;
}

.node {
  cursor: default;
}

.node circle {
  stroke: var(--ink);
  stroke-width: 2.5;
  transition: transform 180ms ease, filter 180ms ease;
}

.node:hover circle {
  filter: brightness(1.08);
  transform: scale(1.08);
  transform-box: fill-box;
  transform-origin: center;
}

.node.smith circle {
  fill: var(--smith-soft);
}

.node.defender circle {
  fill: var(--defender-soft);
}

.node text {
  fill: var(--ink);
  text-anchor: middle;
  pointer-events: none;
}

.node .node-label {
  font: 700 12px/1 "Trebuchet MS", sans-serif;
}

.node .piece-label {
  fill: var(--muted);
  font: 700 9px/1 "Trebuchet MS", sans-serif;
  text-transform: uppercase;
}

.node.active circle {
  fill: var(--yellow);
  filter: drop-shadow(0 4px 8px rgba(80, 54, 7, 0.28));
}

.wrestler-labels {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 18px;
  display: flex;
  justify-content: space-around;
  font: 800 11px/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.wrestler-labels span:first-child {
  color: var(--smith);
}

.wrestler-labels span:last-child {
  color: var(--defender);
}

.state-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 3vw, 42px);
  background: #1d1c18;
  color: #f7f0df;
}

.state-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.state-meta span {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  font: 800 10px/1 "Trebuchet MS", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.state-summary {
  margin: 26px 0 38px;
  font-size: clamp(19px, 1.7vw, 25px);
  line-height: 1.45;
}

.state-panel section + section {
  margin-top: 28px;
}

.state-panel h3 {
  margin: 0 0 12px;
  color: #d2c8b2;
  font: 800 11px/1.2 "Trebuchet MS", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.state-panel ul {
  margin: 0;
  padding-left: 20px;
  color: #f1c577;
  line-height: 1.5;
}

.transition-list {
  display: grid;
  gap: 10px;
}

.transition-button {
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: transparent;
  color: #fff8e9;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.transition-button:hover,
.transition-button:focus-visible {
  border-color: var(--yellow);
  background: rgba(229, 183, 66, 0.11);
  transform: translateX(4px);
  outline: none;
}

.transition-button strong {
  display: block;
  margin-bottom: 5px;
  font: 800 13px/1.3 "Trebuchet MS", sans-serif;
}

.transition-button span {
  color: #bdb5a3;
  font-size: 13px;
  line-height: 1.35;
}

.terminal-message {
  padding: 16px;
  border-left: 3px solid var(--yellow);
  color: #e8d8b8;
}

.history-block {
  margin-top: auto;
  padding-top: 36px;
}

#history {
  max-height: 180px;
  margin: 0;
  padding-left: 22px;
  overflow-y: auto;
  color: #aaa391;
  font: 12px/1.6 "Trebuchet MS", sans-serif;
}

#history li:last-child {
  color: #fff;
}

.utility-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
}

.utility-controls button {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.utility-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.notation {
  display: grid;
  grid-template-columns: 0.8fr 1.1fr 1fr;
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(64px, 9vw, 120px) clamp(8px, 2vw, 24px);
  align-items: start;
}

.notation h2 {
  margin: 9px 0 0;
  font-size: clamp(35px, 4.5vw, 68px);
  line-height: 0.98;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.notation pre {
  margin: 0;
  padding: 22px;
  overflow-x: auto;
  border: 1px solid var(--ink);
  background: #e3dbc7;
  font: 13px/1.55 "Courier New", monospace;
}

.notation > p {
  margin: 0;
  font-size: 19px;
  line-height: 1.55;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(20px, 5vw, 72px);
  border-top: 1px solid var(--ink);
  font: 12px/1.4 "Trebuchet MS", sans-serif;
}

footer p {
  margin: 0;
}

footer a {
  color: var(--smith);
  font-weight: 800;
}

@keyframes edge-in {
  from {
    opacity: 0;
    stroke-dashoffset: 30;
  }
  to {
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .graph-panel {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .state-panel {
    min-height: 540px;
  }

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

  .notation > p {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    gap: 12px;
  }

  .site-header p {
    max-width: 140px;
    text-align: right;
  }

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

  .intro h1 {
    font-size: clamp(55px, 18vw, 92px);
  }

  .workspace {
    border-left: 0;
    border-right: 0;
  }

  main {
    width: 100%;
  }

  .graph-panel {
    padding: 18px 8px 28px;
    overflow-x: auto;
  }

  .graph-heading {
    padding: 0 10px;
  }

  #graph {
    width: 900px;
    max-width: none;
  }

  .wrestler-labels {
    display: none;
  }

  .notation {
    grid-template-columns: 1fr;
    padding-left: 20px;
    padding-right: 20px;
  }

  .notation > p {
    grid-column: auto;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
