/* /css/XYChainLesson.css
// ==========================================================
// Sudoku Paradise — XY-Chain Interactive Lesson
// ========================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #243b3e;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lesson-page-header {
  display: flex;
  justify-content: center;
  padding: 1.1rem 5rem 0.4rem;
}

.lesson-brand {
  color: #0b6870;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.lesson-page-main {
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.7rem 0 2.5rem;
}

.lesson-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 920px;
  margin: 0 auto 1rem;
  color: #547074;
  font-size: 0.84rem;
}

.lesson-breadcrumbs a,
.lesson-page-footer a,
.lesson-card a {
  color: #0b6870;
  font-weight: 700;
}

.lesson-hero {
  max-width: 920px;
  margin: 0 auto 1.4rem;
  text-align: center;
}

.lesson-eyebrow,
.section-kicker {
  margin: 0 0 0.4rem;
  color: #0b6870;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.lesson-hero h1 {
  margin: 0;
  color: #174f55;
  font-size: clamp(2rem, 6vw, 3.35rem);
  line-height: 1.08;
}

.lesson-lead {
  max-width: 820px;
  margin: 1rem auto 0;
  font-size: clamp(1.03rem, 2.4vw, 1.18rem);
  line-height: 1.68;
}

.lesson-card {
  max-width: 920px;
  margin: 1.3rem auto;
  padding: clamp(1.15rem, 4vw, 1.8rem);
  border: 1px solid rgba(11, 104, 112, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(20, 55, 60, 0.1);
}

.lesson-card h2 {
  margin: 0 0 0.85rem;
  color: #0b6870;
  font-size: clamp(1.35rem, 3.5vw, 1.8rem);
  line-height: 1.25;
}

.lesson-card p,
.lesson-card li {
  line-height: 1.65;
}

.name-card,
.proof-workbench,
.lesson-cta {
  background: linear-gradient(145deg, #eef9f8, #ffffff);
}

.memory-rule,
.internal-link-note {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid #d39a1f;
  background: rgba(255, 246, 216, 0.82);
  color: #174f55;
}

code {
  color: #075f68;
  font-weight: 800;
}

.difference-grid,
.link-language-grid,
.proof-road-grid,
.spotting-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.difference-grid,
.link-language-grid,
.proof-road-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.spotting-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.difference-grid article,
.link-language-grid article,
.proof-road-grid article,
.spotting-grid article {
  padding: 1rem;
  border: 1px solid rgba(11, 104, 112, 0.22);
  border-radius: 11px;
  background: #f7fbfb;
}

.difference-grid h3,
.link-language-grid h3,
.proof-road-grid h3,
.spotting-grid h3 {
  margin: 0 0 0.45rem;
  color: #174f55;
}

.difference-grid p,
.link-language-grid p,
.proof-road-grid p,
.spotting-grid p {
  margin-bottom: 0;
}

.featured-difference,
.strong-card {
  border-color: rgba(211, 154, 31, 0.68) !important;
  background: #fffaf0 !important;
}

.weak-card {
  border-color: rgba(37, 136, 163, 0.55) !important;
  background: #eef8fa !important;
}

.term-abbreviation {
  margin: 0 0 0.25rem !important;
  color: #0b6870;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.chain-role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.chain-role-grid article {
  min-width: 0;
  padding: 0.85rem 0.5rem;
  border: 2px solid transparent;
  border-radius: 11px;
  text-align: center;
}

.chain-role-grid h3 {
  margin: 0.2rem 0 0.65rem;
  font-size: 1rem;
}

.role-name {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.role-pair {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin: 0;
}

.role-pair span,
.bvc-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  height: 1.85rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 900;
}

.endpoint-a-role,
.endpoint-b-role {
  border-color: #2588a3 !important;
  background: linear-gradient(135deg, #d9f0f6 0 50%, #ddf2e2 50%);
}

.relay-role.relay-one,
.relay-role.relay-three {
  border-color: #d39a1f !important;
  background: #fff3bd;
}

.relay-role.relay-two {
  border-color: #42975c !important;
  background: #ddf2e2;
}

.handoff-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1rem;
}

.handoff-list span {
  padding: 0.55rem 0.72rem;
  border: 1px solid rgba(11, 104, 112, 0.3);
  border-radius: 999px;
  background: #ffffff;
  color: #174f55;
  font-size: 0.9rem;
}

.case-study {
  background: linear-gradient(145deg, #f8fcfb, #ffffff);
}

.case-figure-single {
  margin: 1.2rem 0 0;
  text-align: center;
}

.case-figure-single img {
  display: block;
  width: min(100%, 620px);
  height: auto;
  margin: 0 auto;
  border: 3px solid #566164;
  background: #ffffff;
}

.case-figure-single figcaption {
  max-width: 720px;
  margin: 0.7rem auto 0;
  color: #547074;
  font-size: 0.94rem;
  line-height: 1.55;
}

.natural-case-figure img {
  width: min(100%, 330px);
}

.natural-chain-notation {
  margin-top: 1.2rem;
}

.proof-summary {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-left: 4px solid #b94742;
  background: #fdebea;
  color: #762824;
  font-weight: 750;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(280px, 480px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  margin-top: 1.1rem;
}

.xy-chain-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid #43585b;
  background: #ffffff;
}

.xy-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-right: 1px solid #b5c1c3;
  border-bottom: 1px solid #b5c1c3;
  font-size: clamp(0.66rem, 2vw, 0.95rem);
  transition: box-shadow 160ms ease, filter 160ms ease;
}

.xy-cell:nth-child(9n + 3),
.xy-cell:nth-child(9n + 6) {
  border-right: 3px solid #43585b;
}

.xy-cell:nth-child(n + 19):nth-child(-n + 27),
.xy-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 3px solid #43585b;
}

.xy-cell:nth-child(9n) {
  border-right: 0;
}

.xy-cell:nth-child(n + 73) {
  border-bottom: 0;
}

.xy-cell .coordinate {
  position: absolute;
  top: 2px;
  left: 3px;
  color: #5c7377;
  font-size: clamp(0.42rem, 1.2vw, 0.62rem);
  font-weight: 750;
}

.xy-cell .cell-candidates {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.18rem;
  padding: 0.55rem 0.1rem 0.1rem;
}

.xy-cell .digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15em;
  color: #1a6269;
  font-weight: 900;
  transition: transform 160ms ease, color 160ms ease, opacity 160ms ease;
}

.xy-cell.endpoint-a,
.xy-cell.endpoint-b {
  background: linear-gradient(135deg, #d9f0f6 0 50%, #ddf2e2 50%);
  box-shadow: inset 0 0 0 3px #2588a3;
}

.xy-cell.relay-b,
.xy-cell.relay-d {
  background: #fff3bd;
  box-shadow: inset 0 0 0 3px #d39a1f;
}

.xy-cell.relay-c {
  background: #ddf2e2;
  box-shadow: inset 0 0 0 3px #42975c;
}

.xy-cell.victim {
  background: #f9dedd;
  box-shadow: inset 0 0 0 3px #b94742;
}

.xy-cell.is-reached {
  filter: saturate(1.2);
}

.xy-cell.is-active {
  box-shadow: inset 0 0 0 4px #0b6870, 0 0 0 3px rgba(11, 104, 112, 0.28);
  z-index: 1;
}

.xy-cell .digit.is-chosen,
.xy-cell .digit.is-forced {
  color: #8b5200;
  font-size: 1.22em;
  transform: scale(1.18);
}

.xy-cell .digit.is-eliminated {
  color: #a12824;
  opacity: 0.72;
  text-decoration: line-through 3px;
  transform: scale(0.9);
}

.board-key p {
  margin: 0 0 0.75rem;
}

.key-swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.4rem;
  border: 2px solid;
  vertical-align: -0.12rem;
}

.key-swatch.endpoint {
  border-color: #2588a3;
  background: linear-gradient(135deg, #d9f0f6 0 50%, #ddf2e2 50%);
}

.key-swatch.relay {
  border-color: #d39a1f;
  background: #fff3bd;
}

.key-swatch.victim {
  border-color: #b94742;
  background: #f9dedd;
}

.board-observation {
  padding: 0.8rem;
  border-radius: 9px;
  background: #eef5f5;
}

.trace-controls,
.proof-buttons,
.victim-choices,
.structure-actions,
.cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.trace-controls {
  margin-top: 1rem;
}

.trace-controls button,
.proof-buttons button,
.victim-choices button,
.structure-actions button,
.cta-links a {
  padding: 0.68rem 0.9rem;
  border: 1px solid #0b6870;
  border-radius: 7px;
  background: #ffffff;
  color: #075f68;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.trace-controls button:hover,
.trace-controls button:focus-visible,
.proof-buttons button:hover,
.proof-buttons button:focus-visible,
.victim-choices button:hover,
.victim-choices button:focus-visible,
.structure-actions button:hover,
.structure-actions button:focus-visible,
.cta-links a:hover,
.cta-links a:focus-visible {
  background: #e7f5f4;
}

.trace-controls button:disabled {
  border-color: #9aabad;
  background: #e8eeee;
  color: #6a7c7f;
  cursor: default;
}

.trace-controls .secondary {
  border-color: #76898c;
  color: #4a6063;
}

.trace-status {
  min-height: 4.8rem;
  margin: 0.8rem 0 0;
  padding: 0.9rem 1rem;
  border-radius: 9px;
  background: #eef5f5;
  font-weight: 700;
}

.trace-list {
  margin-bottom: 0;
  padding-left: 1.5rem;
}

.trace-list li {
  padding: 0.25rem 0.4rem;
  color: #607477;
  transition: background 160ms ease, color 160ms ease;
}

.trace-list li.is-complete {
  color: #185f38;
}

.trace-list li.is-current {
  border-radius: 6px;
  background: #dff4e5;
  font-weight: 800;
}

.proof-buttons button.is-tested,
.victim-choices button.is-correct,
.structure-actions button.is-correct {
  border-color: #23864c;
  background: #dff4e5;
  color: #185f38;
}

.victim-choices button.is-wrong,
.structure-actions button.is-wrong {
  border-color: #b94742;
  background: #fbe0df;
  color: #932e29;
}

.proof-result {
  min-height: 5.4rem;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 9px;
  background: #eef5f5;
  line-height: 1.6;
}

.proof-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.proof-progress span {
  padding: 0.38rem 0.65rem;
  border-radius: 999px;
  background: #e8eeee;
  color: #547074;
  font-size: 0.86rem;
  font-weight: 750;
}

.proof-progress span.is-complete {
  background: #dff4e5;
  color: #185f38;
}

.proof-conclusion {
  padding: 0.85rem 1rem;
  border-left: 4px solid #b94742;
  background: #fdebea;
  color: #762824;
}

.chain-notation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(11, 104, 112, 0.24);
  border-radius: 10px;
  background: #eef5f5;
}

.chain-notation span {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: #ffffff;
  color: #174f55;
  font-weight: 900;
}

.chain-notation b {
  color: #1976a3;
  font-size: 1.3rem;
}

.notation-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 0.7rem;
  border: 1px solid #bfd0d2;
  text-align: left;
}

thead th {
  background: #e8f3f3;
  color: #174f55;
}

.victim-feedback {
  min-height: 3.2rem;
  margin-bottom: 0;
  padding: 0.8rem 0;
  font-weight: 750;
}

.victim-feedback.success,
.structure-feedback.success {
  color: #185f38;
}

.victim-feedback.error,
.structure-feedback.error {
  color: #932e29;
}

.structure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.structure-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(11, 104, 112, 0.22);
  border-radius: 11px;
  background: #f7fbfb;
}

.structure-card h3 {
  margin: 0 0 0.4rem;
  color: #174f55;
}

.endpoint-label {
  margin: 0 0 0.75rem;
  color: #547074;
  font-size: 0.86rem;
  font-weight: 800;
}

.sequence-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.32rem;
  margin-bottom: 0.85rem;
}

.bvc-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.32rem 0.42rem;
  border: 2px solid #64a2a8;
  border-radius: 8px;
  background: #ffffff;
  color: #174f55;
  font-size: 0.86rem;
  font-weight: 800;
}

.bvc-chip span {
  min-width: 1.5rem;
  height: 1.5rem;
}

.bvc-chip.is-not-bvc {
  border-color: #b94742;
  background: #fdebea;
}

.sequence-link {
  color: #547074;
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.structure-feedback {
  min-height: 3.2rem;
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.structure-score {
  margin-bottom: 0;
  color: #0b6870;
  font-weight: 850;
  text-align: right;
}

.near-misses ul {
  padding-left: 1.25rem;
}

.lesson-faq details {
  padding: 0.85rem 0;
  border-top: 1px solid rgba(11, 104, 112, 0.2);
}

.lesson-faq summary {
  color: #174f55;
  font-weight: 800;
  cursor: pointer;
}

.lesson-faq details p {
  margin-bottom: 0;
}

.cta-links .primary {
  background: #0b6870;
  color: #ffffff;
}

.lesson-page-footer {
  padding: 1rem;
  color: #547074;
  text-align: center;
}

@media (max-width: 820px) {
  .chain-role-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .difference-grid,
  .link-language-grid,
  .proof-road-grid,
  .spotting-grid,
  .board-layout,
  .structure-grid {
    grid-template-columns: 1fr;
  }

  .xy-chain-board {
    width: min(100%, 480px);
    margin: 0 auto;
  }

  .lesson-page-header {
    padding-left: 6rem;
  }
}

@media (max-width: 520px) {
  .chain-role-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .lesson-page-main {
    width: min(100% - 1rem, 1040px);
  }

  .lesson-card {
    padding: 1rem;
  }

  .trace-controls button,
  .proof-buttons button,
  .victim-choices button,
  .structure-actions button,
  .cta-links a {
    width: 100%;
    text-align: center;
  }

  .xy-cell .coordinate {
    display: none;
  }
}
