:root {
  --bg: #faf7f0;
  --card: #fff;
  --navy: #14213d;
  --green: #2d6a4f;
  --gold: #e0a82e;
  --text: #25304a;
  --muted: #5d6881;
  --border: #e6dfcf;
  --alt: #fff;
  --btn: #14213d;
  --btntext: #fff;
  --sl: #f0d9b5;
  --sd: #b58863;
  --soft: #f6e7bf;
  --softtext: #7a5600;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1626;
    --card: #18233b;
    --navy: #e8ecf5;
    --green: #6fcf9c;
    --gold: #e0a82e;
    --text: #d5dbea;
    --muted: #9aa6c0;
    --border: #2a3957;
    --alt: #131d33;
    --btn: #e0a82e;
    --btntext: #14213d;
    --soft: #3a3016;
    --softtext: #f0cd78;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1626;
  --card: #18233b;
  --navy: #e8ecf5;
  --green: #6fcf9c;
  --gold: #e0a82e;
  --text: #d5dbea;
  --muted: #9aa6c0;
  --border: #2a3957;
  --alt: #131d33;
  --btn: #e0a82e;
  --btntext: #14213d;
  --soft: #3a3016;
  --softtext: #f0cd78;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

h1, h2, h3 {
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 .6rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1rem;
}

.wrap {
  width: min(1100px, 100% - 2rem);
  margin-inline: auto;
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #14213d;
  color: #fff;
}

.hin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  position: relative;
}

.logo {
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
  text-decoration: none;
}

.logo b {
  color: var(--gold);
  font-size: 1.6rem;
  margin-right: .4rem;
}

#tg {
  background: none;
  border: 2px solid rgba(255, 255, 255, .4);
  color: #fff;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  cursor: pointer;
}

nav {
  display: none;
  position: absolute;
  top: 100%;
  left: -1rem;
  right: -1rem;
  background: #14213d;
  padding: .5rem 1rem 1rem;
}

nav.open {
  display: block;
}

nav a {
  display: block;
  color: #dfe5f2;
  text-decoration: none;
  padding: .65rem .25rem;
  font-weight: 500;
}

nav a.on {
  color: var(--gold);
}

@media (min-width: 1000px) {
  #tg {
    display: none;
  }

  nav {
    display: block;
    position: static;
    padding: 0;
    background: none;
  }

  nav a {
    display: inline-block;
    margin-left: 1rem;
    padding: .3rem 0;
    font-size: .92rem;
  }
}

/* Buttons & Helpers */
.btn {
  display: inline-block;
  border: 2px solid var(--btn);
  border-radius: 999px;
  padding: .65rem 1.3rem;
  font: 600 1rem inherit;
  cursor: pointer;
  text-decoration: none;
  background: var(--btn);
  color: var(--btntext);
}

.btn.o {
  background: none;
  color: var(--navy);
  border-color: var(--navy);
}

.btn.s {
  padding: .45rem 1rem;
  background: var(--card);
  color: var(--navy);
  border-color: var(--border);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.1rem;
}

.eye {
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
  margin-bottom: .4rem;
}

.lead {
  font-size: 1.08rem;
  color: var(--muted);
}

/* Sections, Hero & Grids */
.hero {
  padding: 2.2rem 0 3rem;
  display: grid;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.1fr 1fr;
    gap: 3rem;
    padding: 3.5rem 0;
  }

  .g3 {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .g2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

.sec {
  padding: 2.6rem 0;
}

.alt {
  background: var(--alt);
  border-block: 1px solid var(--border);
}

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

@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(20, 33, 61, .08);
  padding: 1.3rem;
  color: inherit;
  text-decoration: none;
  display: block;
}

a.card:hover {
  transform: translateY(-3px);
}

.card p {
  color: var(--muted);
  margin: 0 0 .6rem;
}

.sym {
  font-size: 2.3rem;
  color: var(--navy);
  line-height: 1;
}

.badge {
  display: inline-block;
  background: var(--soft);
  color: var(--softtext);
  border-radius: 999px;
  padding: .2rem .75rem;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: .6rem;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  margin: .4rem 0;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--green);
}

.small {
  font-size: .82rem;
  color: var(--muted);
}

.ctr {
  text-align: center;
}

.mw {
  max-width: 680px;
  margin-inline: auto;
}

ul.tick {
  list-style: none;
  padding: 0;
}

ul.tick li {
  padding-left: 1.5rem;
  position: relative;
  margin-bottom: .4rem;
}

ul.tick li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* Chessboard */
.bw {
  width: 100%;
  max-width: 470px;
  margin-inline: auto;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  border: 4px solid #14213d;
  border-radius: 8px;
  overflow: hidden;
}

.sq {
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

.sq.l {
  background: var(--sl);
}

.sq.d {
  background: var(--sd);
}

.sq.sel {
  background: #f7ec74;
}

.sq.chk {
  background: #e57373;
}

.sq.t:after {
  content: "";
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(45, 106, 79, .6);
}

.sq.cap {
  box-shadow: inset 0 0 0 4px rgba(45, 106, 79, .75);
}

.pc {
  font-size: clamp(1.6rem, 8vw, 2.9rem);
  line-height: 1;
  pointer-events: none;
}

.pc.w {
  color: #fff;
  text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 3px #000;
}

.pc.b {
  color: #111;
}

.co {
  position: absolute;
  font-size: .58rem;
  font-weight: 700;
  opacity: .75;
  pointer-events: none;
}

.co.r {
  top: 2px;
  left: 3px;
}

.co.f {
  bottom: 1px;
  right: 3px;
}

.sq.l .co {
  color: var(--sd);
}

.sq.d .co {
  color: var(--sl);
}

.st {
  text-align: center;
  font-weight: 700;
  color: var(--navy);
  margin: .8rem 0 0;
}

.bc {
  display: flex;
  gap: .6rem;
  justify-content: center;
  margin-top: .6rem;
}

/* Tables & Roadmap/Rule Steps */
table {
  width: 100%;
  border-collapse: collapse;
}

td, th {
  text-align: left;
  padding: .6rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--navy);
}

.step {
  border-left: 4px solid var(--gold);
  padding-left: 1rem;
  margin-bottom: 1.2rem;
}

/* Learn Page Sticky Demo Container */
.demo-wrap {
  position: sticky;
  top: 76px;
}

/* Footer & Focus */
.skip-link {
  display: block;
  background: #0d1629;
  color: #faf7f0;
  border-bottom: 1px solid rgba(224, 168, 46, .35);
  padding: .4rem max(1rem, calc((100% - 1100px) / 2));
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.skip-link:hover,
.skip-link:focus,
.skip-link:focus-visible {
  color: var(--gold);
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}

footer {
  background: #14213d;
  color: #cfd6e6;
  margin-top: 2rem;
  padding: 2rem 0 1.2rem;
  font-size: .92rem;
}

footer a {
  display: inline-block;
  color: #cfd6e6;
  margin-right: 1rem;
  padding: .35rem 0;
}

@media (max-width: 600px) {
  footer a {
    padding: .6rem .35rem .6rem 0;
    margin-right: .85rem;
  }
}

footer a:hover {
  color: var(--gold);
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
