@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,500&display=swap");

:root {
  --ink: #191814;
  --ink-soft: #49443a;
  --parchment: #f1e8d1;
  --parchment-deep: #d9c8a3;
  --ivory: #faf5e8;
  --wine: #722b2a;
  --wine-dark: #421c1e;
  --gold: #b89554;
  --forest: #1f3029;
  --line: rgba(68, 52, 31, 0.26);
  --display: "Cinzel", Georgia, serif;
  --body: "EB Garamond", Georgia, serif;
}

.square.analysis-highlight {
  box-shadow: inset 0 0 0 999px rgba(224, 168, 41, 0.44);
}

.challenge {
  padding: 105px clamp(22px, 5vw, 80px) 115px;
  color: var(--ivory);
  background:
    radial-gradient(circle at 50% 20%, rgba(114, 43, 42, 0.22), transparent 38%),
    var(--wine-dark);
  border-top: 1px solid var(--gold);
}

.arena-tip {
  margin: 22px 0 0;
  padding: 13px 0;
  color: rgba(250, 245, 232, 0.5);
  border-top: 1px solid rgba(184, 149, 84, 0.2);
  border-bottom: 1px solid rgba(184, 149, 84, 0.2);
  font-size: 12px;
  line-height: 1.4;
}

.arena-tip strong {
  color: var(--gold);
}

.challenge-heading {
  max-width: 850px;
  margin: 0 auto 48px;
  text-align: center;
}

.challenge-heading .eyebrow {
  color: var(--gold);
}

.challenge-heading h2 {
  margin-bottom: 15px;
  font-family: var(--display);
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 500;
}

.challenge-heading > p:last-child {
  color: rgba(250, 245, 232, 0.66);
}

.arena {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(430px, 1fr) 220px;
  border: 1px solid rgba(184, 149, 84, 0.52);
  background: rgba(19, 12, 12, 0.42);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.arena-controls,
.move-scroll {
  padding: 30px 26px;
}

.arena-controls {
  border-right: 1px solid rgba(184, 149, 84, 0.3);
}

.move-scroll {
  border-left: 1px solid rgba(184, 149, 84, 0.3);
}

.side-picker {
  margin: 12px 0 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.side-picker button {
  padding: 11px 6px;
  color: rgba(250, 245, 232, 0.65);
  border: 1px solid rgba(184, 149, 84, 0.4);
  background: transparent;
  cursor: pointer;
  font-family: var(--display);
  font-size: 10px;
}

.side-picker button + button {
  border-left: 0;
}

.side-picker button.active {
  color: var(--ink);
  background: var(--gold);
}

.control-label {
  margin: 22px 0 8px;
  display: block;
  color: var(--gold);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.arena select {
  width: 100%;
  padding: 11px 10px;
  color: var(--ivory);
  border: 1px solid rgba(184, 149, 84, 0.42);
  border-radius: 0;
  background: #2d1a1b;
  font-family: var(--body);
  font-size: 15px;
}

.bot-profile {
  min-height: 115px;
  margin: 18px 0;
  padding: 15px;
  border-left: 2px solid var(--gold);
  background: rgba(255, 255, 255, 0.04);
}

.bot-profile strong,
.bot-profile span {
  display: block;
}

.bot-profile strong {
  font-family: var(--display);
  font-size: 16px;
}

.bot-profile span {
  margin: 4px 0 9px;
  color: var(--gold);
  font-size: 12px;
}

.bot-profile p {
  margin: 0;
  color: rgba(250, 245, 232, 0.58);
  font-size: 14px;
  line-height: 1.35;
}

.arena-new-game {
  width: 100%;
  margin-top: 26px;
  justify-content: center;
  border: 0;
  cursor: pointer;
}

.apprentice-panel {
  margin-top: 32px;
  padding-top: 27px;
  border-top: 1px solid rgba(184, 149, 84, 0.32);
}

.apprentice-panel > p:not(.sidebar-label) {
  margin-bottom: 18px;
  color: rgba(250, 245, 232, 0.55);
  font-size: 13px;
  line-height: 1.4;
}

.apprentice-button {
  width: 100%;
  margin-top: 22px;
  padding-inline: 11px;
  justify-content: center;
  color: var(--gold);
  border: 1px solid var(--gold);
  background: transparent;
  cursor: pointer;
  box-shadow: none;
}

.apprentice-button:hover {
  color: var(--wine-dark);
  background: var(--gold);
}

.arena-board-column {
  padding: 25px clamp(22px, 3vw, 40px) 30px;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.025);
}

.turn-banner {
  width: min(100%, 530px);
  margin-bottom: 19px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.turn-light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.turn-light.thinking {
  animation: pulse 750ms ease-in-out infinite alternate;
}

@keyframes pulse {
  to {
    opacity: 0.25;
  }
}

.arena-board-frame {
  width: min(100%, 530px);
}

.captured-tray {
  width: min(100%, 530px);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 2px;
  color: rgba(250, 245, 232, 0.5);
}

.captured-top {
  margin-bottom: 8px;
}

.captured-bottom {
  margin-top: 8px;
}

.captured-tray::before {
  content: attr(data-label);
  min-width: 76px;
  margin-right: 5px;
  color: rgba(250, 245, 232, 0.42);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.captured-piece {
  font-family: "Times New Roman", serif;
  font-size: 25px;
  line-height: 1;
}

.captured-piece.white {
  color: #fffdf4;
  -webkit-text-stroke: 1px #0d0d0c;
}

.captured-piece.black {
  color: #11110f;
  -webkit-text-stroke: 1px #c3a66c;
}

.promotion-dialog {
  padding: 18px;
  position: absolute;
  z-index: 8;
  inset: 50% auto auto 50%;
  color: var(--ivory);
  border: 1px solid var(--gold);
  background: rgba(31, 20, 20, 0.97);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
  text-align: center;
}

.promotion-dialog[hidden] {
  display: none;
}

.promotion-dialog strong {
  display: block;
  margin-bottom: 12px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.promotion-options {
  display: flex;
  gap: 7px;
}

.promotion-options button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #fffdf4;
  border: 1px solid rgba(184, 149, 84, 0.55);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-family: "Times New Roman", serif;
  font-size: 38px;
  -webkit-text-stroke: 1px #0d0d0c;
}

.promotion-options button:hover {
  color: var(--wine-dark);
  background: var(--gold);
}

.move-list {
  max-height: 470px;
  overflow-y: auto;
  scrollbar-color: var(--gold) transparent;
}

.empty-history {
  color: rgba(250, 245, 232, 0.4);
  font-size: 14px;
  font-style: italic;
  line-height: 1.4;
}

.move-row {
  padding: 9px 0;
  display: grid;
  grid-template-columns: 25px 1fr 1fr;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 14px;
}

.move-row span:first-child {
  color: var(--gold);
  font-family: var(--display);
  font-size: 9px;
}

.bot-roster {
  max-width: 1240px;
  margin: 34px auto 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: rgba(184, 149, 84, 0.32);
  border: 1px solid rgba(184, 149, 84, 0.32);
}

.roster-card {
  min-height: 105px;
  padding: 18px;
  background: rgba(30, 19, 20, 0.92);
}

.roster-card strong,
.roster-card span,
.roster-card small {
  display: block;
}

.roster-card strong {
  font-family: var(--display);
  font-size: 13px;
}

.roster-card span {
  margin: 5px 0;
  color: var(--gold);
  font-family: var(--display);
  font-size: 10px;
}

.roster-card small {
  color: rgba(250, 245, 232, 0.48);
  font-style: italic;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--parchment);
  font-family: var(--body);
  font-size: 18px;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.6), transparent 35%),
    linear-gradient(110deg, transparent 48%, rgba(88, 58, 29, 0.04) 49%, transparent 50%),
    var(--parchment);
}

.page-texture {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.3;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

.site-header {
  height: 90px;
  padding: 0 clamp(24px, 6vw, 100px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(241, 232, 209, 0.87);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 43px;
  height: 49px;
  display: grid;
  place-items: center;
  color: var(--parchment);
  background: var(--wine);
  font-size: 19px;
  letter-spacing: -6px;
  padding-right: 5px;
  clip-path: polygon(50% 0, 92% 14%, 86% 78%, 50% 100%, 14% 78%, 8% 14%);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.07em;
}

.brand small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: italic;
  letter-spacing: 0.06em;
}

nav {
  display: flex;
  gap: clamp(22px, 3vw, 45px);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

nav a {
  position: relative;
}

nav a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 1px;
  left: 50%;
  bottom: -7px;
  background: var(--wine);
  transition: 180ms ease;
}

nav a:hover::after {
  width: 100%;
  left: 0;
}

.header-cta {
  border: 1px solid var(--wine);
  padding: 11px 16px;
  color: var(--wine);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-cta span {
  margin-left: 8px;
}

.hero {
  min-height: 680px;
  padding: 80px clamp(28px, 9vw, 150px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  align-items: center;
  gap: 60px;
  position: relative;
  overflow: hidden;
}

.board-stack {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
}

.board-stack .chessboard {
  height: 100%;
  position: absolute;
  inset: 0;
}

.arrow-layer {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: visible;
  pointer-events: none;
}

.analysis-arrows line {
  stroke: rgba(222, 140, 35, 0.82);
  stroke-width: 10;
  stroke-linecap: round;
  marker-end: url("#analysis-arrowhead");
}

.arrow-layer marker path {
  fill: rgba(222, 140, 35, 0.88);
}

.hero::before,
.hero::after {
  content: "❦";
  position: absolute;
  color: rgba(114, 43, 42, 0.08);
  font-size: 280px;
  line-height: 1;
}

.hero::before {
  top: -105px;
  left: -70px;
  transform: rotate(120deg);
}

.hero::after {
  right: -70px;
  bottom: -140px;
  transform: rotate(-55deg);
}

.hero-copy {
  z-index: 1;
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--wine);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow span {
  padding: 0 8px;
  color: var(--gold);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 28px;
  font-family: var(--display);
  font-size: clamp(50px, 5.5vw, 84px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

h1 em {
  color: var(--wine);
  font-family: var(--body);
  font-weight: 500;
}

.hero-intro {
  max-width: 610px;
  color: var(--ink-soft);
  font-size: 21px;
  line-height: 1.55;
}

.hero-actions {
  margin-top: 35px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: transform 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--ivory);
  background: var(--wine);
  box-shadow: 4px 4px 0 var(--gold);
}

.text-link {
  padding-bottom: 3px;
  border-bottom: 1px solid var(--ink);
  font-style: italic;
}

.hero-stats {
  margin: 55px 0 0;
  display: flex;
  gap: 0;
}

.hero-stats div {
  min-width: 135px;
  padding: 0 26px;
  border-right: 1px solid var(--line);
}

.hero-stats div:first-child {
  padding-left: 0;
}

.hero-stats div:last-child {
  border: 0;
}

.hero-stats dt {
  color: var(--wine);
  font-family: var(--display);
  font-size: 25px;
}

.hero-stats dd {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-style: italic;
}

.hero-emblem {
  min-height: 470px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}

.emblem-ring {
  width: min(31vw, 430px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid var(--gold);
  border-radius: 50%;
  box-shadow:
    0 0 0 12px var(--parchment),
    0 0 0 13px rgba(114, 43, 42, 0.25),
    inset 0 0 0 8px var(--parchment),
    inset 0 0 0 9px rgba(114, 43, 42, 0.25);
}

.emblem-ring::before,
.emblem-ring::after {
  content: "✦";
  position: absolute;
  top: 50%;
  color: var(--wine);
  font-size: 13px;
}

.emblem-ring::before {
  left: -7px;
}

.emblem-ring::after {
  right: -7px;
}

.ring-text {
  position: absolute;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.ring-text-top {
  top: 33px;
}

.ring-text-bottom {
  bottom: 33px;
}

.emblem-shield {
  width: 210px;
  height: 255px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--parchment);
  background: var(--wine);
  clip-path: polygon(50% 0, 92% 12%, 88% 72%, 50% 100%, 12% 72%, 8% 12%);
}

.crown {
  margin-top: 25px;
  color: var(--gold);
  font-size: 32px;
}

.shield-piece {
  margin-top: -3px;
  font-size: 91px;
  line-height: 1;
}

.shield-divider {
  width: 65px;
  height: 1px;
  margin: 8px 0 11px;
  background: var(--gold);
}

.emblem-shield small {
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.25em;
}

.laurel {
  position: absolute;
  bottom: 3px;
  color: var(--forest);
  font-size: 120px;
}

.laurel-left {
  left: 5%;
  transform: rotate(42deg);
}

.laurel-right {
  right: 5%;
  transform: scaleX(-1) rotate(42deg);
}

.featured {
  padding: 100px clamp(28px, 7vw, 115px) 115px;
  border-top: 1px solid var(--line);
  background: rgba(250, 245, 232, 0.58);
}

.section-heading {
  max-width: 1280px;
  margin: 0 auto 45px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 80px;
}

.section-heading h2,
.academy-heading h2,
.codex-story h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(32px, 4vw, 50px);
  font-weight: 500;
}

.section-heading > p {
  max-width: 430px;
  margin: 0 0 6px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.opening-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.opening-card {
  min-height: 420px;
  padding: 28px 30px 25px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.opening-card:hover,
.opening-card.active {
  transform: translateY(-6px);
  box-shadow: 7px 9px 0 rgba(73, 54, 30, 0.12);
}

.opening-card.active::after {
  content: "Selected";
  padding: 5px 9px;
  position: absolute;
  top: -12px;
  right: 18px;
  color: var(--ivory);
  background: var(--gold);
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.opening-card-light {
  background: #e4d4b2;
}

.opening-card-red {
  color: var(--ivory);
  background: var(--wine);
}

.opening-card-dark {
  color: var(--ivory);
  background: var(--forest);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  font-family: var(--display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.difficulty {
  opacity: 0.65;
}

.card-icon {
  height: 125px;
  display: grid;
  place-items: center;
}

.card-icon span {
  font-size: 85px;
  line-height: 1;
  text-shadow: 3px 3px 0 rgba(184, 149, 84, 0.65);
}

.opening-card-red .card-icon span,
.opening-card-dark .card-icon span {
  color: var(--parchment);
}

.move-sequence {
  margin-bottom: 10px;
  opacity: 0.68;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.opening-card h3 {
  margin-bottom: 12px;
  font-family: var(--display);
  font-size: 27px;
  font-weight: 500;
}

.opening-card > p:not(.move-sequence) {
  opacity: 0.83;
  line-height: 1.45;
}

.card-link {
  width: 100%;
  margin-top: auto;
  padding: 14px 0 0;
  display: flex;
  justify-content: space-between;
  border: 0;
  border-top: 1px solid currentColor;
  background: transparent;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.variation-library {
  max-width: 1280px;
  margin: 65px auto 0;
  padding-top: 42px;
  border-top: 1px solid var(--line);
}

.variation-heading {
  margin-bottom: 28px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
}

.variation-heading h3 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 500;
}

.variation-heading > p {
  max-width: 410px;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.variation-grid {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  counter-reset: variations;
  list-style: none;
}

.variation-grid li {
  min-height: 105px;
  padding: 19px 18px 16px 52px;
  background: rgba(250, 245, 232, 0.72);
  position: relative;
  counter-increment: variations;
}

.variation-button {
  width: 100%;
  min-height: 70px;
  padding: 0;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.variation-grid li:hover,
.variation-grid li.selected {
  z-index: 1;
  background: #eadab7;
  box-shadow: inset 0 0 0 2px var(--wine);
}

.variation-grid li:focus-within {
  outline: 2px solid var(--wine);
  outline-offset: -3px;
}

.variation-grid li::before {
  content: counter(variations, decimal-leading-zero);
  position: absolute;
  top: 20px;
  left: 16px;
  color: var(--wine);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
}

.variation-grid strong,
.variation-grid span {
  display: block;
}

.variation-grid strong {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.variation-grid span {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  font-style: italic;
  line-height: 1.25;
}

.optional-lines {
  margin-top: 22px;
  border: 1px solid var(--line);
}

.optional-lines summary {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  color: var(--wine);
  background: rgba(228, 212, 178, 0.52);
  cursor: pointer;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  list-style: none;
  text-transform: uppercase;
}

.optional-lines summary::-webkit-details-marker {
  display: none;
}

.optional-lines summary::before {
  content: "＋";
  margin-right: 12px;
}

.optional-lines[open] summary::before {
  content: "−";
}

.optional-lines summary span {
  margin-left: auto;
  opacity: 0.58;
  font-family: var(--body);
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
}

.optional-grid {
  border: 0;
  border-top: 1px solid var(--line);
}

.variation-study-panel {
  margin-top: 28px;
  padding: clamp(25px, 4vw, 48px);
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: clamp(30px, 5vw, 75px);
  color: var(--ivory);
  background: var(--forest);
  border: 1px solid var(--gold);
  box-shadow: 8px 10px 0 rgba(73, 54, 30, 0.13);
}

.variation-study-panel[hidden] {
  display: none;
}

.variation-study-copy h3 {
  margin-bottom: 10px;
  font-family: var(--display);
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 500;
}

.variation-study-sequence {
  color: var(--gold);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.variation-study-copy > p:not(.eyebrow, .variation-study-sequence) {
  color: rgba(250, 245, 232, 0.7);
  line-height: 1.5;
}

.variation-study-copy ul {
  margin: 22px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.variation-study-copy li::before {
  content: "✦";
  margin-right: 9px;
  color: var(--gold);
}

.variation-study-action {
  padding-left: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid rgba(184, 149, 84, 0.38);
}

.study-seal {
  color: var(--gold);
  font-size: 55px;
}

.variation-study-action p {
  color: rgba(250, 245, 232, 0.62);
  font-size: 15px;
  line-height: 1.45;
}

.variation-study-action .button {
  justify-content: center;
  border: 0;
  cursor: pointer;
}

.academy {
  padding: 105px clamp(22px, 5vw, 80px) 120px;
  color: var(--ivory);
  background:
    linear-gradient(rgba(23, 26, 22, 0.96), rgba(23, 26, 22, 0.96)),
    repeating-linear-gradient(45deg, transparent 0 20px, rgba(255,255,255,.04) 20px 21px);
  position: relative;
}

.academy::before {
  content: "♞";
  position: absolute;
  top: 2px;
  right: 5vw;
  color: rgba(255, 255, 255, 0.025);
  font-size: 360px;
  line-height: 1;
}

.academy-heading {
  margin: 0 auto 50px;
  max-width: 1200px;
  text-align: center;
}

.academy-heading .eyebrow {
  color: var(--gold);
}

.academy-heading > p:last-child {
  margin-top: 15px;
  color: rgba(250, 245, 232, 0.62);
}

.lesson-shell {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 245px minmax(400px, 1fr) 275px;
  border: 1px solid rgba(184, 149, 84, 0.42);
  background: rgba(10, 12, 10, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.lesson-shell > * {
  min-width: 0;
}

.lesson-sidebar {
  padding: 33px 28px;
  border-right: 1px solid rgba(184, 149, 84, 0.3);
}

.sidebar-label,
.note-count {
  margin-bottom: 8px;
  color: var(--gold);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lesson-sidebar h3 {
  margin-bottom: 5px;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 500;
}

.lesson-sidebar > p:not(.sidebar-label) {
  color: rgba(250, 245, 232, 0.52);
  font-style: italic;
}

.study-side-label {
  margin-top: 25px;
}

.study-side-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.study-side-picker button {
  padding: 9px 4px;
  color: rgba(250, 245, 232, 0.6);
  border: 1px solid rgba(184, 149, 84, 0.38);
  background: transparent;
  cursor: pointer;
  font-family: var(--display);
  font-size: 9px;
}

.study-side-picker button + button {
  border-left: 0;
}

.study-side-picker button.active {
  color: var(--ink);
  background: var(--gold);
}

.lesson-progress {
  height: 2px;
  margin: 27px 0 22px;
  background: rgba(255, 255, 255, 0.12);
}

.lesson-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 220ms ease;
}

#lesson-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

#lesson-steps li {
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(250, 245, 232, 0.42);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  font-size: 15px;
}

#lesson-steps li span {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
}

#lesson-steps li.active {
  color: var(--ivory);
}

#lesson-steps li.active span {
  color: var(--ink);
  border-color: var(--gold);
  background: var(--gold);
}

.reset-button {
  margin-top: 28px;
  padding: 0;
  color: rgba(250, 245, 232, 0.55);
  border: 0;
  background: transparent;
  font-size: 13px;
  font-style: italic;
  cursor: pointer;
}

.reset-button:hover {
  color: var(--gold);
}

.reset-button.completion-restart {
  padding: 11px 16px;
  color: var(--ink);
  border: 1px solid var(--gold);
  background: var(--gold);
  font-style: normal;
  font-weight: 700;
  box-shadow: 3px 4px 0 rgba(20, 18, 13, 0.32);
}

.reset-button.completion-restart:hover {
  color: var(--ivory);
  background: var(--wine);
}

.board-panel {
  padding: clamp(20px, 3vw, 42px);
  display: flex;
  flex-direction: column;
  place-items: center;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.025);
}

.board-frame {
  width: min(100%, 530px);
  min-width: 0;
  padding: 14px 17px 12px;
  border: 1px solid #9e7f48;
  background: #3b3021;
  box-shadow:
    0 0 0 4px #171813,
    0 0 0 5px rgba(184, 149, 84, 0.5),
    0 12px 30px rgba(0, 0, 0, 0.36);
}

.coordinate {
  width: calc(100% - 2px);
  height: 28px;
  margin-inline: 1px;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: center;
  color: #f0d593;
  font-family: var(--display);
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 700;
  overflow: hidden;
}

.coordinate span {
  display: block;
  text-align: center;
}

.chessboard {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  border: 1px solid #1d1811;
  overflow: hidden;
}

.square {
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  font-family: "Times New Roman", serif;
  font-size: clamp(24px, 5vw, 58px);
  line-height: 1;
  user-select: none;
}

.board-coordinate {
  position: absolute;
  z-index: 3;
  color: rgba(35, 27, 19, 0.75);
  font-family: var(--display);
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.square.dark .board-coordinate {
  color: rgba(247, 236, 207, 0.8);
}

.file-label {
  right: 4px;
  bottom: 3px;
}

.rank-label {
  top: 4px;
  left: 4px;
}

.square.drop-target {
  box-shadow: inset 0 0 0 4px rgba(239, 205, 111, 0.95);
}

.square.selected {
  box-shadow: inset 0 0 0 4px rgba(239, 205, 111, 0.95);
}

.square.legal-target::before {
  content: "";
  width: 24%;
  aspect-ratio: 1;
  position: absolute;
  z-index: 2;
  border-radius: 50%;
  background: rgba(38, 50, 39, 0.48);
  pointer-events: none;
}

.square.legal-target:has(.piece)::before {
  width: 82%;
  background: transparent;
  border: 4px solid rgba(114, 43, 42, 0.62);
}

.square.light {
  background: #d9c89f;
}

.square.dark {
  background: #6d4535;
}

.square.last-move::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 2px solid rgba(225, 188, 90, 0.9);
  pointer-events: none;
}

.piece {
  width: 100%;
  height: 100%;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: 0.88em;
  line-height: 1;
  filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.28));
  cursor: grab;
  touch-action: none;
}

.piece-k,
.piece-b {
  font-size: 0.8em;
}

.piece:active {
  cursor: grabbing;
}

.piece.dragging {
  opacity: 0.45;
}

.chessboard.lesson-complete {
  box-shadow: 0 0 0 3px var(--gold), 0 0 28px rgba(184, 149, 84, 0.28);
}

.chessboard.lesson-complete .piece {
  cursor: default;
}

.piece.white {
  color: #fffdf4;
  -webkit-text-stroke: 1.35px #0d0d0c;
  paint-order: stroke fill;
}

.piece.black {
  color: #171713;
  -webkit-text-stroke: 1px #c3a66c;
}

.board-help {
  margin: 22px 0 0;
  color: rgba(250, 245, 232, 0.52);
  font-size: 13px;
  font-style: italic;
  text-align: center;
}

.lesson-note {
  padding: 38px 30px 30px;
  border-left: 1px solid rgba(184, 149, 84, 0.3);
  position: relative;
}

.note-ornament {
  width: 55px;
  height: 55px;
  margin-bottom: 25px;
  display: grid;
  place-items: center;
  color: var(--gold);
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.note-ornament::first-letter {
  transform: rotate(-45deg);
}

.note-count {
  margin-top: 15px;
}

.lesson-note h3 {
  margin-bottom: 15px;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 500;
}

#note-copy {
  min-height: 113px;
  color: rgba(250, 245, 232, 0.67);
  font-size: 16px;
  line-height: 1.55;
}

.principle {
  padding: 15px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgba(184, 149, 84, 0.28);
  border-bottom: 1px solid rgba(184, 149, 84, 0.28);
}

.principle > span {
  color: var(--gold);
}

.principle small,
.principle strong {
  display: block;
}

.principle small {
  color: rgba(250, 245, 232, 0.42);
  font-size: 11px;
  font-style: italic;
}

.principle strong {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
}

.lesson-controls {
  margin-top: 27px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lesson-controls button {
  width: 38px;
  height: 38px;
  color: var(--gold);
  border: 1px solid rgba(184, 149, 84, 0.48);
  background: transparent;
  cursor: pointer;
}

.lesson-controls button:hover:not(:disabled) {
  color: var(--ink);
  background: var(--gold);
}

.lesson-controls button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

#move-indicator {
  color: rgba(250, 245, 232, 0.5);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.arena-takeback {
  width: 100%;
  margin-top: 10px;
  color: var(--gold);
  border-color: rgba(184, 149, 84, 0.65);
  background: transparent;
}

.arena-takeback:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.roster-card.conquered {
  border-color: var(--gold);
  box-shadow: inset 0 3px 0 var(--gold);
}

.roster-card.conquered strong {
  color: var(--gold);
}

.records-section,
.sandbox-section {
  padding: 95px clamp(28px, 7vw, 115px);
  border-bottom: 1px solid var(--line);
}

.records-section {
  background: rgba(250, 245, 232, 0.56);
}

.records-layout {
  margin-top: 45px;
  display: grid;
  grid-template-columns: minmax(230px, 0.32fr) minmax(0, 1fr);
  gap: 28px;
}

.player-card,
.game-records,
.sandbox-copy {
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--parchment);
  box-shadow: 5px 7px 0 rgba(73, 54, 30, 0.1);
}

.player-card input {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid #9e7f48;
  background: #fffaf0;
  font: inherit;
}

.record-stats {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.record-stats div {
  padding: 14px 8px;
  display: grid;
  text-align: center;
  border: 1px solid var(--line);
}

.record-stats strong {
  color: var(--wine);
  font-family: var(--display);
  font-size: 25px;
}

.record-stats span,
.record-legend,
.record-meta {
  color: var(--ink-soft);
  font-size: 12px;
}

.record-legend {
  margin: 20px 0 0;
}

.game-records {
  max-height: 520px;
  overflow: auto;
}

.empty-records {
  color: var(--ink-soft);
  font-style: italic;
}

.game-record {
  border-bottom: 1px solid var(--line);
}

.game-record summary {
  padding: 16px 4px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.game-record summary small {
  color: var(--ink-soft);
}

.record-result {
  min-width: 52px;
  padding: 4px 8px;
  color: var(--ivory);
  background: var(--forest);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}

.record-result-loss {
  background: var(--wine);
}

.record-result-draw {
  color: var(--ink);
  background: var(--gold);
}

.record-meta {
  padding: 0 4px 10px;
}

.game-record pre {
  margin: 0 0 18px;
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ivory);
  background: var(--forest);
  font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.sandbox-section {
  background: #d8c8a5;
}

.sandbox-shell {
  margin-top: 45px;
  display: grid;
  grid-template-columns: minmax(320px, 560px) minmax(260px, 1fr);
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 6vw, 90px);
}

.sandbox-board-frame {
  width: 100%;
}

.sandbox-copy {
  background: rgba(250, 245, 232, 0.74);
}

.sandbox-copy h3 {
  margin: 20px 0 12px;
  font-family: var(--display);
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 500;
}

.sandbox-copy p {
  margin-bottom: 26px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.codex-story {
  padding: 65px clamp(28px, 10vw, 160px);
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  align-items: center;
  gap: 45px;
  border-bottom: 1px solid var(--line);
}

.variation-grid {
  grid-template-columns: repeat(3, 1fr);
}

.variation-study-panel {
  grid-template-columns: 1fr;
}

.variation-study-action {
  padding: 28px 0 0;
  border-top: 1px solid rgba(184, 149, 84, 0.38);
  border-left: 0;
}

.arena {
  grid-template-columns: 230px minmax(400px, 1fr);
}

.move-scroll {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(184, 149, 84, 0.3);
  border-left: 0;
}

.move-list {
  max-height: 180px;
}

.bot-roster {
  grid-template-columns: repeat(2, 1fr);
}

.story-mark {
  color: var(--wine);
  font-size: 75px;
}

.codex-story > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 19px;
  line-height: 1.55;
}

footer {
  padding: 35px clamp(28px, 7vw, 115px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #d8c8a5;
  font-size: 14px;
  font-style: italic;
}

.footer-brand .brand-mark {
  width: 35px;
  height: 40px;
  font-size: 20px;
}

footer > p {
  margin: 0;
  color: var(--ink-soft);
}

footer > a:last-child {
  border-bottom: 1px solid var(--ink);
}

@media (max-width: 1050px) {
  .header-cta {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr 0.8fr;
    padding-inline: 6vw;
  }

  .emblem-shield {
    width: 160px;
    height: 205px;
  }

  .shield-piece {
    font-size: 67px;
  }

  .lesson-shell {
    grid-template-columns: 210px minmax(380px, 1fr);
  }

  .lesson-note {
    grid-column: 1 / -1;
    border-top: 1px solid rgba(184, 149, 84, 0.3);
    border-left: 0;
  }

  #note-copy {
    min-height: auto;
  }

  .codex-story {
    grid-template-columns: auto 1fr;
  }

  .codex-story > p {
    grid-column: 2;
  }
}

@media (max-width: 780px) {
  .site-header {
    height: 76px;
    padding-inline: 20px;
  }

  .site-header nav {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 65px 24px 80px;
    grid-template-columns: 1fr;
  }

  .hero-emblem {
    display: none;
  }

  h1 {
    font-size: clamp(45px, 13vw, 68px);
  }

  .hero-stats div {
    min-width: 0;
    padding-inline: 14px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 15px;
  }

  .opening-grid {
    grid-template-columns: 1fr;
  }

  .variation-heading {
    align-items: start;
    flex-direction: column;
  }

  .variation-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .opening-card {
    min-height: 390px;
  }

  .lesson-shell {
    grid-template-columns: 1fr;
  }

  .arena {
    grid-template-columns: 1fr;
  }

  .arena-controls {
    border-right: 0;
    border-bottom: 1px solid rgba(184, 149, 84, 0.3);
  }

  .move-scroll {
    grid-column: auto;
  }

  .bot-roster {
    grid-template-columns: 1fr;
  }

  .lesson-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(184, 149, 84, 0.3);
  }

  #lesson-steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 20px;
  }

  .board-panel {
    padding: 26px 18px;
  }

  .coordinate {
    font-size: 13px;
  }

  .square {
    font-size: clamp(25px, 8vw, 40px);
  }

  .records-layout,
  .sandbox-shell {
    grid-template-columns: 1fr;
  }

  .game-record summary {
    grid-template-columns: auto 1fr;
  }

  .game-record summary small {
    grid-column: 2;
  }

  .codex-story {
    padding-block: 55px;
    grid-template-columns: 1fr;
    gap: 20px;
    text-align: center;
  }

  .codex-story > p {
    grid-column: auto;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 22px;
  }
}

@media (max-width: 460px) {
  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-stats {
    justify-content: space-between;
  }

  .hero-stats div {
    padding-inline: 10px;
  }

  .hero-stats dd {
    max-width: 80px;
  }

  #lesson-steps {
    grid-template-columns: 1fr;
  }

  .variation-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
