:root {
  color-scheme: light;
  --ink: #17231c;
  --muted: #5f6d64;
  --paper: #fbfaf5;
  --paper-2: #f2efe5;
  --surface: #ffffff;
  --surface-soft: #f7f5ed;
  --line: #d9ddd4;
  --brand: #184b35;
  --brand-strong: #103c2a;
  --brand-soft: #dfece4;
  --accent: #d4a82f;
  --accent-soft: #f8edc8;
  --danger: #a83a32;
  --board-frame: #254336;
  --board-frame-dark: #162a22;
  --board-light: #f1ddbb;
  --board-dark: #6f8971;
  --board-light-hover: #f7e9cf;
  --board-dark-hover: #7d987e;
  --board-selected: 243, 198, 76;
  --board-last: 233, 184, 76;
  --board-hint: 61, 126, 197;
  --board-legal: 36, 66, 52;
  --board-capture: 167, 70, 56;
  --shadow-sm: 0 4px 16px rgba(31, 48, 38, 0.08);
  --shadow-md: 0 18px 48px rgba(31, 48, 38, 0.13);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --container: 1180px;
}

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

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% 2%, rgba(212, 168, 47, 0.11), transparent 28rem),
    radial-gradient(circle at 100% 18%, rgba(24, 75, 53, 0.09), transparent 32rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

body[data-menu-open="true"] {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: var(--brand);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--brand-strong);
}

p,
ul,
ol {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.55em;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", "Noto Serif KR", serif;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2.35rem, 7vw, 5.15rem);
}

h2 {
  font-size: clamp(1.75rem, 4vw, 3.15rem);
}

h3 {
  font-size: clamp(1.25rem, 2.2vw, 1.72rem);
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  background: transparent !important;
}

.skip-link {
  position: fixed;
  z-index: 9999;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-180%);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1rem;
}

.skip-link:focus {
  transform: translateY(0);
}

.container {
  width: min(calc(100% - 2rem), var(--container));
  margin-inline: auto;
}

.narrow {
  width: min(calc(100% - 2rem), 820px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid rgba(217, 221, 212, 0.86);
  background: rgba(251, 250, 245, 0.9);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.brand-word {
  display: grid;
  line-height: 1.05;
}

.brand-word small {
  margin-top: 0.23rem;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}

.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
  content: "";
}

.nav-toggle span {
  margin-block: 4px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 700;
  padding: 0.58rem 0.75rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.site-nav .nav-play {
  margin-left: 0.35rem;
  background: var(--brand);
  color: #fff;
  padding-inline: 1rem;
}

.site-nav .nav-play:hover,
.site-nav .nav-play[aria-current="page"] {
  background: var(--brand-strong);
  color: #fff;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.45rem;
  border-left: 1px solid var(--line);
  padding-left: 0.75rem;
}

.lang-switch a {
  padding-inline: 0.55rem;
}

main {
  min-height: 62vh;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(4.2rem, 10vw, 8rem) 0 clamp(4.4rem, 9vw, 7rem);
}

.hero::after {
  position: absolute;
  z-index: -1;
  right: -8rem;
  bottom: -12rem;
  width: 34rem;
  height: 34rem;
  border: 1px solid rgba(24, 75, 53, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 4rem rgba(24, 75, 53, 0.035),
    0 0 0 8rem rgba(24, 75, 53, 0.02);
  content: "";
}

.hero-grid {
  display: grid;
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(24, 75, 53, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.38rem 0.72rem;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.hero h1 em {
  color: var(--brand);
  font-style: normal;
}

.hero-lead {
  max-width: 680px;
  margin-bottom: 1.6rem;
  color: var(--muted);
  font-size: clamp(1.04rem, 2vw, 1.24rem);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  padding: 0.68rem 1.15rem;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: var(--brand-strong);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button-secondary:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
}

.button-small {
  min-height: 40px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
}

.hero-board-card {
  position: relative;
  max-width: 510px;
  margin-inline: auto;
  border: 1px solid rgba(217, 221, 212, 0.82);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-md);
  padding: clamp(0.9rem, 2vw, 1.25rem);
  backdrop-filter: blur(12px);
}

.hero-board-card::before {
  position: absolute;
  z-index: -1;
  inset: 12% -6% -7% 14%;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  content: "";
  transform: rotate(3deg);
}

.mini-board,
.diagram-board {
  display: grid;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
  border: clamp(5px, 1.2vw, 8px) solid var(--board-frame);
  border-radius: 14px;
  background: var(--board-frame-dark);
  container-type: inline-size;
  grid-auto-rows: 1fr;
  grid-template-columns: repeat(8, 1fr);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 12px 24px rgba(31, 48, 38, 0.1);
}

.mini-board-square,
.diagram-square {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  font-family: "Arial Unicode MS", "Noto Sans Symbols 2", serif;
  line-height: 1;
}

.mini-board-square {
  font-size: clamp(1.2rem, 4.8vw, 2.85rem);
}

.diagram-square {
  font-size: clamp(1.05rem, 4.4vw, 2.18rem);
}

@supports (font-size: 1cqi) {
  .mini-board-square {
    font-size: min(9.2cqi, 2.85rem);
  }

  .diagram-square {
    font-size: min(9.1cqi, 2.18rem);
  }
}

.mini-board-square.light,
.diagram-square.light {
  background: var(--board-light);
}

.mini-board-square.dark,
.diagram-square.dark {
  background: var(--board-dark);
}

.mini-board-square .white-piece,
.mini-board-square .black-piece,
.diagram-square .white-piece,
.diagram-square .black-piece {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  line-height: 0.86;
}

.mini-board-square .white-piece,
.diagram-square .white-piece {
  color: #fffaf0;
  filter:
    drop-shadow(0 1px 1px rgba(25, 25, 18, 0.58))
    drop-shadow(0 3px 3px rgba(25, 25, 18, 0.16));
}

.mini-board-square .black-piece,
.diagram-square .black-piece {
  color: #1b211b;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.28))
    drop-shadow(0 3px 3px rgba(0, 0, 0, 0.14));
}

.hero-proof {
  display: grid;
  margin-top: 1.1rem;
  gap: 0.65rem;
  grid-template-columns: repeat(3, 1fr);
}

.hero-proof div {
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 0.7rem;
  text-align: center;
}

.hero-proof strong {
  display: block;
  color: var(--brand);
  font-family: Georgia, serif;
  font-size: 1.2rem;
}

.hero-proof span {
  color: var(--muted);
  font-size: 0.72rem;
}

.section {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.section-soft {
  border-block: 1px solid var(--line);
  background: rgba(242, 239, 229, 0.7);
}

.section-dark {
  background: var(--ink);
  color: #eaf0eb;
}

.section-dark h2,
.section-dark h3,
.section-dark a {
  color: #fff;
}

.section-dark p {
  color: #c7d0ca;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.section-heading > div {
  max-width: 760px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.25rem, 3vw, 1.8rem);
}

.card p:last-child {
  margin-bottom: 0;
}

.card-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.45rem;
  font-weight: 900;
}

.course-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.course-card::after {
  position: absolute;
  top: -3rem;
  right: -3rem;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  background: var(--brand-soft);
  content: "";
  opacity: 0.65;
}

.course-card[data-level="intermediate"]::after {
  background: var(--accent-soft);
}

.course-card[data-level="advanced"]::after {
  background: #e6e2f3;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.32rem 0.6rem;
}

.course-card .button {
  align-self: flex-start;
  margin-top: auto;
}

.check-list,
.arrow-list {
  display: grid;
  margin: 0 0 1.4rem;
  gap: 0.58rem;
  list-style: none;
  padding: 0;
}

.check-list li,
.arrow-list li {
  position: relative;
  padding-left: 1.65rem;
}

.check-list li::before {
  position: absolute;
  top: 0.14rem;
  left: 0;
  display: grid;
  width: 1.15rem;
  height: 1.15rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  content: "✓";
  font-size: 0.72rem;
  font-weight: 900;
}

.arrow-list li::before {
  position: absolute;
  left: 0.2rem;
  color: var(--accent);
  content: "→";
  font-weight: 900;
}

.stat-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}

.stat strong {
  display: block;
  color: inherit;
  font-family: Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.stat span {
  color: var(--muted);
  font-size: 0.92rem;
}

.section-dark .stat span {
  color: #b9c4bd;
}

.page-hero {
  padding: clamp(3rem, 7vw, 5.5rem) 0 2.8rem;
}

.page-hero .narrow,
.page-hero .container {
  position: relative;
}

.page-hero h1 {
  max-width: 920px;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
}

.page-intro {
  max-width: 790px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.22rem);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.breadcrumbs .separator {
  color: #a8b0aa;
}

.article-layout {
  display: grid;
  align-items: start;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr) 285px;
}

.article-body {
  min-width: 0;
}

.article-body > section {
  scroll-margin-top: 96px;
}

.article-body p,
.article-body li {
  color: #34453a;
}

.article-body h2 {
  margin-top: 2.4rem;
}

.article-body h3 {
  margin-top: 1.8rem;
}

.article-body blockquote {
  margin: 1.5rem 0;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  padding: 1rem 1.2rem;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.toc {
  position: sticky;
  top: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.8);
  padding: 1.15rem;
  backdrop-filter: blur(10px);
}

.toc strong {
  display: block;
  margin-bottom: 0.55rem;
}

.toc ol {
  display: grid;
  margin: 0;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
}

.toc a {
  display: block;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.35rem 0.45rem;
  text-decoration: none;
}

.toc a:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.lesson-list {
  display: grid;
  gap: 1.1rem;
}

.lesson-card {
  display: grid;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.15rem, 3vw, 1.65rem);
}

.lesson-card > p,
.lesson-card .arrow-list,
.lesson-card .check-list {
  margin-bottom: 0;
}

.lesson-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.lesson-number {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--brand);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.lesson-head h3 {
  margin-bottom: 0.2rem;
}

.lesson-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.lesson-check {
  display: inline-flex;
  align-items: center;
  justify-self: flex-start;
  gap: 0.55rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
}

.lesson-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--brand);
}

.progress-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.2rem 0 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.15rem;
}

.progress-track {
  position: relative;
  overflow: hidden;
  width: min(420px, 55vw);
  height: 11px;
  border-radius: 999px;
  background: var(--paper-2);
}

.progress-track::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #3b7758);
  content: "";
  transition: width 240ms ease;
}

.progress-label {
  min-width: 6rem;
  color: var(--brand);
  font-weight: 800;
  text-align: right;
}

.diagram-wrap {
  display: grid;
  align-items: center;
  gap: clamp(1rem, 2.3vw, 1.45rem);
  margin: 0.2rem 0;
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr);
}

.diagram-board {
  max-width: 330px;
}

.diagram-caption {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.callout {
  border: 1px solid rgba(24, 75, 53, 0.2);
  border-radius: 14px;
  background: var(--brand-soft);
  padding: 1rem 1.1rem;
}

.callout-warning {
  border-color: rgba(212, 168, 47, 0.35);
  background: var(--accent-soft);
}

.callout strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--brand-strong);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.lesson-support {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

.faq-list {
  display: grid;
  gap: 0.8rem;
}

.faq-list details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.15rem;
}

.faq-list summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.faq-list details p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.cta-panel {
  display: grid;
  align-items: center;
  gap: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--brand);
  color: #fff;
  padding: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: 1fr auto;
  box-shadow: var(--shadow-md);
}

.cta-panel h2,
.cta-panel h3 {
  color: #fff;
}

.cta-panel p {
  margin-bottom: 0;
  color: #d8e5dc;
}

.cta-panel .button {
  background: #fff;
  color: var(--brand);
}

.cta-panel .button:hover {
  background: var(--accent-soft);
  color: var(--brand-strong);
}

.play-monetized-shell {
  width: min(calc(100% - 2rem), 1360px);
  margin-inline: auto;
}

.play-monetized-grid {
  display: block;
}

.play-primary {
  min-width: 0;
}

.play-inner {
  width: min(100%, var(--container));
  margin-inline: auto;
}

.adfit-inline-host,
.adfit-rail-host {
  min-width: 0;
}

.adfit-rail-host {
  display: none;
}

.adfit-inline-host:not(:empty) {
  display: flex;
  justify-content: center;
  margin: 0 0 20px;
}

.adfit-slot {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.adfit-slot--rail {
  width: 160px;
}

.adfit-slot--inline {
  width: 100%;
}

.adfit-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.adfit-frame {
  display: grid;
  width: var(--adfit-width);
  min-height: var(--adfit-height);
  max-width: 100%;
  place-items: center;
  overflow: hidden;
}

.adfit-frame .kakao_ad_area {
  max-width: 100%;
}

/* Chess application */
.chess-app-shell {
  padding: 2rem 0 clamp(4rem, 8vw, 7rem);
}

.chess-app {
  display: grid;
  align-items: start;
  gap: 1.35rem;
  grid-template-columns: minmax(300px, 660px) minmax(280px, 1fr);
}

.board-panel {
  min-width: 0;
  border: 1px solid rgba(37, 67, 54, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(242, 239, 229, 0.96)),
    var(--surface);
  box-shadow:
    0 22px 55px rgba(31, 48, 38, 0.14),
    0 7px 18px rgba(31, 48, 38, 0.08);
  padding: clamp(0.62rem, 1.8vw, 1.1rem);
}

.chess-board {
  display: grid;
  overflow: hidden;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1;
  border: clamp(8px, 1.15vw, 12px) solid var(--board-frame);
  border-radius: 14px;
  background: var(--board-frame-dark);
  container-type: inline-size;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 0 18px rgba(0, 0, 0, 0.18);
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  touch-action: none;
  user-select: none;
}

.chess-square {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  place-items: center;
  border: 0;
  border-radius: 0;
  appearance: none;
  contain: layout paint;
  overflow: hidden;
  padding: 0;
  -webkit-appearance: none;
  color: var(--ink);
  outline-offset: -4px;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.chess-square.is-draggable {
  cursor: grab;
}

.chess-square:disabled {
  opacity: 1;
}

.chess-board.is-dragging,
.chess-board.is-dragging .chess-square {
  cursor: grabbing;
}

.chess-square.is-light {
  background: var(--board-light);
}

.chess-square.is-dark {
  background: var(--board-dark);
}

.chess-square:hover:not(:disabled)::after,
.chess-square:focus-visible::after {
  position: absolute;
  z-index: 4;
  inset: 7%;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 7px;
  content: "";
  pointer-events: none;
}

.chess-square.is-light:hover:not(:disabled) {
  background: var(--board-light-hover);
}

.chess-square.is-dark:hover:not(:disabled) {
  background: var(--board-dark-hover);
}

.chess-square.is-selected {
  box-shadow:
    inset 0 0 0 clamp(3px, 0.52vw, 5px) rgba(67, 54, 19, 0.22),
    inset 0 0 0 clamp(7px, 1vw, 10px) rgba(var(--board-selected), 0.86);
}

.chess-square.is-last {
  background-image: linear-gradient(rgba(var(--board-last), 0.28), rgba(var(--board-last), 0.28));
}

.chess-square.is-hint {
  box-shadow: inset 0 0 0 clamp(4px, 0.7vw, 6px) rgba(var(--board-hint), 0.72);
}

.chess-square.is-drop-target {
  box-shadow: inset 0 0 0 clamp(4px, 0.7vw, 6px) rgba(var(--board-hint), 0.78);
}

.chess-square.is-check {
  background-image: radial-gradient(circle, rgba(var(--board-capture), 0.9), rgba(var(--board-capture), 0.28) 58%, transparent 62%);
}

.chess-square.is-legal::before {
  position: absolute;
  z-index: 2;
  inset: 18%;
  border: 2px solid rgba(var(--board-legal), 0.36);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 999px rgba(var(--board-legal), 0.08);
  content: "";
  pointer-events: none;
}

.chess-square.is-capture::before {
  position: absolute;
  z-index: 2;
  inset: 9%;
  border: clamp(3px, .58vw, 5px) solid rgba(var(--board-capture), 0.72);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.22),
    0 0 0 1px rgba(67, 24, 18, 0.1);
  content: "";
  pointer-events: none;
}

.piece {
  position: relative;
  z-index: 3;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: visible;
  transform: none;
  font-family: "Arial Unicode MS", "Noto Sans Symbols 2", "Segoe UI Symbol", serif;
  font-size: clamp(1.65rem, 6vw, 4.1rem);
  line-height: 0.86;
  pointer-events: none;
}

@supports (font-size: 1cqi) {
  .chess-square .piece {
    font-size: min(8.8cqi, 4.1rem);
  }
}

.chess-square.is-drag-origin .piece {
  opacity: 0;
}

.drag-piece {
  position: fixed;
  z-index: 2000;
  display: grid;
  place-items: center;
  line-height: 0.86;
  transform: translate(-50%, -50%) scale(1.02);
  will-change: left, top;
}

.piece-w {
  color: #fffaf0;
  filter:
    drop-shadow(0 2px 1px rgba(25, 25, 18, 0.68))
    drop-shadow(0 5px 5px rgba(25, 25, 18, 0.2));
}

.piece-b {
  color: #1b211b;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.3))
    drop-shadow(0 4px 4px rgba(0, 0, 0, 0.18));
}

.coord {
  position: absolute;
  z-index: 5;
  color: rgba(36, 66, 52, 0.72);
  font-size: clamp(0.52rem, 1.4vw, 0.76rem);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.is-dark .coord {
  color: rgba(255, 255, 255, 0.74);
}

.coord-rank {
  top: 4px;
  left: 4px;
}

.game-sidebar {
  display: grid;
  min-width: 0;
  gap: 1rem;
}

.game-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem;
}

.game-status {
  border-color: rgba(24,75,53,.2);
  background: linear-gradient(135deg, var(--brand-soft), #f4f8f5);
}

.game-status strong {
  display: block;
  color: var(--brand-strong);
  font-size: 1.03rem;
}

.game-status small {
  color: var(--muted);
}

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

.field {
  display: grid;
  gap: 0.28rem;
}

.field label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.field select {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.7rem;
}

.game-actions {
  display: grid;
  margin-top: 0.85rem;
  gap: 0.55rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.game-actions .button {
  width: 100%;
  border-radius: 11px;
  padding-inline: 0.55rem;
  font-size: 0.86rem;
}

.captured-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}

.captured-grid small {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.captured-pieces {
  min-height: 1.6rem;
  font-family: "Arial Unicode MS", "Noto Sans Symbols 2", serif;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}

.move-log {
  max-height: 245px;
  overflow: auto;
}

.move-log h2,
.game-card h2 {
  margin-bottom: 0.7rem;
  font-family: inherit;
  font-size: 0.92rem;
  letter-spacing: 0;
}

.move-list-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.move-pairs {
  display: grid;
  margin: 0;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
}

.move-pairs li {
  display: grid;
  gap: 0.45rem;
  align-items: start;
  border-radius: 8px;
  grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr);
  padding: 0.25rem 0.35rem;
  font-size: 0.84rem;
  line-height: 1.45;
}

.move-pairs li:nth-child(odd) {
  background: var(--surface-soft);
}

.move-pairs li span:not(.move-number) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.move-number {
  color: var(--muted);
  font-size: 0.8rem;
}

.promotion-dialog {
  width: min(calc(100% - 2rem), 420px);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.4rem;
}

.promotion-dialog::backdrop {
  background: rgba(14, 24, 18, .66);
  backdrop-filter: blur(3px);
}

.promotion-options {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(4, 1fr);
}

.promotion-options button {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  font-family: "Arial Unicode MS", "Noto Sans Symbols 2", serif;
  font-size: 2.2rem;
}

.toast {
  position: fixed;
  z-index: 1000;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  max-width: min(420px, calc(100% - 2rem));
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-md);
  padding: 0.8rem 1rem;
  font-weight: 700;
}

.play-guide {
  margin-top: 3rem;
}

.play-guide-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: #f0ede3;
  padding: 3.2rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1.2fr repeat(3, minmax(130px, .6fr));
}

.footer-brand p {
  max-width: 410px;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links strong {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.85rem;
}

.footer-links a {
  display: block;
  margin: 0.3rem 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  padding-top: 1.2rem;
}

.not-found {
  display: grid;
  min-height: 64vh;
  place-items: center;
  text-align: center;
  padding: 4rem 1rem;
}

.not-found-mark {
  margin-bottom: 0.4rem;
  color: var(--brand);
  font-family: Georgia, serif;
  font-size: clamp(5rem, 18vw, 10rem);
  font-weight: 800;
  line-height: .9;
}

@media (min-width: 1240px) {
  .play-monetized-shell[data-adfit-has-rail="true"] .play-monetized-grid {
    display: grid;
    align-items: start;
    gap: 32px;
    grid-template-columns: minmax(0, 1fr) 160px;
  }

  .play-monetized-shell[data-adfit-has-rail="true"] .play-inner {
    width: 100%;
  }

  .play-monetized-shell[data-adfit-has-rail="true"] .adfit-rail-host {
    display: block;
    align-self: stretch;
  }

  .play-monetized-shell[data-adfit-has-rail="true"] .adfit-rail-host .adfit-slot.is-sticky {
    position: sticky;
    top: 92px;
  }
}

@media (max-width: 980px) {
  .hero-grid,
  .chess-app,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .hero-board-card {
    width: min(100%, 560px);
  }

  .toc {
    position: static;
    order: -1;
  }

  .toc ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chess-app {
    max-width: 760px;
    margin-inline: auto;
  }

  .game-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-status,
  .game-sidebar > .game-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .nav-toggle {
    display: grid;
  }

  .site-nav {
    position: fixed;
    top: 72px;
    right: 0;
    left: 0;
    display: none;
    max-height: calc(100vh - 72px);
    max-height: calc(100dvh - 72px);
    overflow: auto;
    align-items: stretch;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow-md);
    padding: 0.8rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
  }

  .site-nav[data-open] {
    display: grid;
  }

  .site-nav a {
    border-radius: 10px;
    padding: 0.72rem 0.8rem;
  }

  .site-nav .nav-play {
    margin: 0.4rem 0 0;
    text-align: center;
  }

  .lang-switch {
    margin: 0.35rem 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 0.65rem 0 0;
  }

  .card-grid,
  .play-guide-grid {
    grid-template-columns: 1fr;
  }

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

  .section-heading,
  .cta-panel {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: block;
  }

  .section-heading .button {
    margin-top: 1rem;
  }

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

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 759px) {
  .adfit-inline-host:not(:empty) {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
  }

  .page-hero--play {
    padding-top: 2rem;
    padding-bottom: 1.4rem;
  }
}

@media (max-width: 640px) {
  body {
    line-height: 1.65;
  }

  .container,
  .narrow {
    width: min(calc(100% - 1.2rem), var(--container));
  }

  .header-inner {
    min-height: 64px;
  }

  .site-nav {
    top: 64px;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
  }

  .brand-word small {
    display: none;
  }

  .hero {
    padding-top: 3.4rem;
  }

  .hero-grid {
    gap: 2.4rem;
  }

  .hero-proof {
    gap: 0.4rem;
  }

  .hero-proof div {
    padding: 0.55rem 0.25rem;
  }

  .section {
    padding-block: 3.6rem;
  }

  .game-sidebar {
    grid-template-columns: 1fr;
  }

  .game-status,
  .game-sidebar > .game-card:last-child {
    grid-column: auto;
  }

  .board-panel {
    border-radius: 15px;
    padding: 0.35rem;
  }

  .chess-board {
    border-width: 4px;
    border-radius: 10px;
  }

  .game-actions {
    grid-template-columns: 1fr 1fr;
  }

  .game-actions .button:first-child {
    grid-column: 1 / -1;
  }

  .diagram-wrap {
    grid-template-columns: 1fr;
  }

  .diagram-board {
    width: min(100%, 330px);
    margin-inline: auto;
  }

  .lesson-support {
    grid-template-columns: 1fr;
  }

  .progress-panel {
    display: grid;
  }

  .progress-track {
    width: 100%;
  }

  .progress-label {
    text-align: left;
  }

  .toc ol {
    grid-template-columns: 1fr;
  }

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

  .footer-brand {
    grid-column: auto;
  }

  .footer-bottom {
    display: grid;
  }
}

@media (max-width: 420px) {
  .control-grid,
  .captured-grid {
    grid-template-columns: 1fr;
  }

  .action-row .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .action-row,
  .toc,
  .lesson-check,
  .progress-panel,
  .toast,
  .adfit-inline-host,
  .adfit-rail-host,
  .adfit-slot {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .section,
  .page-hero {
    padding-block: 1rem;
  }

  .card,
  .lesson-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
