:root {
  color-scheme: light;
  --paper: #f7f7ef;
  --white: #fffffa;
  --ink: #202e27;
  --muted: #526058;
  --pine: #244b38;
  --line: #dce2d7;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.65 var(--sans); }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button[hidden] { display: none; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid #ad6030;
  outline-offset: 4px;
}
[id] { scroll-margin-top: 1.5rem; }
.shell { width: min(72rem, calc(100% - 4rem)); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.skip-link:focus {
  position: absolute;
  z-index: 3;
  inset: .75rem auto auto .75rem;
  background: var(--white);
  padding: .75rem 1rem;
}

.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.header-inner { min-height: 4.75rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 800; letter-spacing: .1em; }
.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-content: center;
  border-radius: .65rem;
  background: var(--pine);
  color: #f4edcf;
  font: 1.6rem/1 "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", sans-serif;
}
nav { display: flex; gap: clamp(.9rem, 3vw, 2.25rem); align-items: center; }
nav a, .footer-inner a { color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 650; white-space: nowrap; }
nav a:hover, .footer-inner a:hover { color: var(--pine); text-decoration: underline; text-underline-offset: .25em; }

.hero { display: grid; grid-template-columns: 1fr minmax(22rem, .91fr); align-items: center; gap: clamp(2.25rem, 7vw, 7rem); padding-block: clamp(2.5rem, 6.2vw, 5.9rem); }
.hero-copy { padding-block: .5rem; }
.kicker { display: flex; align-items: center; gap: .7rem; margin: 0 0 1.1rem; color: var(--pine); font-size: .92rem; font-weight: 750; letter-spacing: .18em; }
.kicker::before { width: 1.75rem; height: 2px; background: #a6714d; content: ""; }
h1, h2 { font-family: var(--serif); }
.hero h1 {
  margin: 0;
  font-size: clamp(3.1rem, 7.1vw, 6.6rem);
  line-height: 1.07;
  font-weight: 800;
  letter-spacing: -.045em;
  color: #23392e;
}
.hero-description { margin: 1.75rem 0 1.85rem; max-width: 24rem; font-size: clamp(1.04rem, 1.7vw, 1.2rem); line-height: 1.9; color: var(--muted); }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .9rem 1.2rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: .64rem 1.16rem;
  border: 1px solid #bac9ba;
  border-radius: .52rem;
  background: var(--white);
  color: var(--pine);
  font-size: .93rem;
  font-weight: 750;
  text-decoration: none;
}
.button:hover { background: #eaf0e6; }
.button.primary { color: #fffdf4; background: var(--pine); border-color: var(--pine); }
.button.primary:hover { background: #386049; }
.button.small { min-height: 2.5rem; padding: .35rem .66rem; font-size: .88rem; }
.button:disabled { opacity: .55; cursor: default; }
.text-link, .course-link { color: var(--pine); font-weight: 750; text-underline-offset: .28em; }
.text-link:hover, .course-link:hover { text-decoration-thickness: 2px; }
.hero-progress { display: flex; align-items: center; gap: .65rem; margin-top: 2.15rem; color: var(--muted); font-size: .9rem; }
.progress-icon { display: flex; gap: .24rem; }
.progress-icon span { width: .42rem; height: .42rem; border-radius: 50%; background: #c6d0c1; }
.progress-icon .is-filled { background: #397552; }

.practice {
  min-width: 0;
  padding: clamp(.85rem, 2vw, 1.35rem);
  border: 1px solid #d9e3d6;
  border-radius: 1.15rem;
  background: var(--white);
  box-shadow: 0 1.3rem 3rem #263d2620;
}
.practice-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.practice h2 { margin: 0; font-size: clamp(1.25rem, 2.6vw, 1.7rem); line-height: 1.3; }
.turn-label { display: inline-flex; align-items: center; gap: .38rem; padding: .24rem .55rem; border-radius: .4rem; background: #eaf0e8; color: #274434; font-size: .88rem; font-weight: 720; white-space: nowrap; }
.turn-label span { width: .64rem; height: .64rem; border: 1px solid #7b9080; border-radius: 50%; background: var(--white); }
.turn-label.is-done span { background: #397552; }
.practice-prompt { margin: .6rem 0 .9rem; color: var(--muted); }
.board-frame { padding: .38rem; border-radius: .52rem; background: #324b3d; }
.board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; overflow: hidden; border-radius: .2rem; background: #e7e7cf; touch-action: manipulation; }
.square {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #e7e7cf;
  color: #263c31;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
}
.square.dark { background: #5d7765; color: #fffff1; }
.square:hover::after, .square:focus-visible::after, .square.is-selected::after, .square.is-hint::after, .square.is-played::after {
  position: absolute;
  inset: 0;
  border: .2rem solid #f5d775;
  z-index: 2;
  pointer-events: none;
  content: "";
}
.square:hover::after { border-color: #ffffff75; }
.square:focus-visible { outline: none; z-index: 3; }
.square:focus-visible::after { border-color: #b35d32; }
.square.is-hint::after { border-style: dashed; border-color: #9d4627; }
.square.is-played::after { border-color: #faf0a3; }
.square.is-legal::before { position: absolute; width: 24%; aspect-ratio: 1; border-radius: 50%; background: #28433360; content: ""; }
.square.has-piece.is-legal::before { width: 85%; background: none; border: .16rem solid #244b38a0; }
.piece { font: 1.8rem/1 "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", sans-serif; font-size: 78cqi; transform: translateY(-2%); user-select: none; }
.piece.black { color: #1d2b24; text-shadow: 0 1px 0 #f4f2d957; }
.piece.white { color: #fffbea; text-shadow: 0 1px 0 #2a3a2f, 1px 0 0 #2a3a2f, -1px 0 0 #2a3a2f, 0 -1px 0 #2a3a2f, 0 2px 2px #16251c6e; }
.coordinate { position: absolute; font-size: .75rem; line-height: 1.1; font-weight: 800; user-select: none; }
.coordinate.rank { left: .2rem; top: .06rem; }
.coordinate.file { right: .22rem; bottom: .02rem; }
.practice-bottom { display: flex; align-items: start; justify-content: space-between; gap: .55rem; min-height: 3.2rem; margin-top: .8rem; }
.practice-actions { display: flex; gap: .35rem; align-items: start; flex-wrap: wrap; flex: 0 0 auto; }
.feedback { margin: .28rem 0 0; color: var(--muted); font-size: .9rem; }
.feedback[data-tone="success"] { color: #225b36; font-weight: 700; }
.feedback[data-tone="retry"] { color: #853d22; }

.course-section { padding-block: 3.75rem 4.3rem; border-block: 1px solid #dce4d9; background: #e9eee4; }
.section-heading { margin-bottom: 1.7rem; }
.section-heading h2 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.23; }
.section-heading p { margin: .65rem 0 0; color: var(--muted); }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.15rem; }
.course { display: flex; flex-direction: column; padding: 1.4rem; border: 1px solid #d4e0d0; border-radius: .9rem; background: var(--white); }
.course-icon { display: grid; place-content: center; width: 2.65rem; height: 2.65rem; margin-bottom: .9rem; border-radius: .55rem; background: #e1ebe0; color: var(--pine); font: 1.65rem/1 "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", sans-serif; }
.course:nth-child(2) .course-icon { background: #f1e6d3; color: #8a4e29; }
.course:nth-child(3) .course-icon { background: #e4e9ee; color: #3c5769; }
.course h3 { margin: 0; font-size: 1.23rem; }
.course p { flex: 1; margin: .6rem 0 1.05rem; color: var(--muted); }
.course-link { align-self: start; }

.faq-section { display: grid; grid-template-columns: .52fr 1fr; gap: 2rem; padding-block: 4rem; }
.faq-list { border-top: 1px solid #ccd5c8; }
.faq-list details { border-bottom: 1px solid #ccd5c8; padding: .95rem 0; }
.faq-list summary { cursor: pointer; font-weight: 750; padding-inline: .25rem; }
.faq-list p { margin: .72rem 0 .25rem; color: var(--muted); padding-inline: .25rem; }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { min-height: 4.4rem; font-size: .9rem; color: var(--muted); }

@media (max-width: 53rem) {
  .shell { width: min(72rem, calc(100% - 2.5rem)); }
  .hero { gap: 2rem; grid-template-columns: .85fr minmax(19rem, 1fr); }
  .course { padding: 1.1rem; }
}
@media (max-width: 40rem) {
  .header-inner { min-height: 3.9rem; }
  .nav-faq { display: none; }
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 2.45rem; }
  .hero h1 { font-size: clamp(2.8rem, 10vw, 4rem); }
  .hero-description { margin: 1rem 0 1.25rem; }
  .hero-progress { margin-top: 1.25rem; }
  .practice { width: min(100%, 30rem); justify-self: center; }
  .course-section, .faq-section { padding-block: 2.6rem; }
  .course-grid, .faq-section { grid-template-columns: 1fr; gap: .95rem; }
  .faq-section .section-heading { margin-bottom: .35rem; }
}
@media (max-width: 23rem) {
  .shell { width: calc(100% - 1.5rem); }
  nav { gap: .65rem; }
  .nav-lessons { display: none; }
  .practice-bottom { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
