/* chessmigo.com. The app's look on the web: white, grey and black, yellow details, flat shapes with a "lip" for volume,
   Nunito at heavy weights, and the app's characters. Board, piece and character styles are appended at build time from app/styles.css. */
:root {
  --ink: #16181C; --ink-2: #5C636E; --ink-3: #9AA1AB; --line: #E6E8EC; --surf: #F5F6F8; --surf-2: #ECEEF1; --lip: #D7DBE1;
  --yellow: #FFC42E; --yellow-lip: #E3A600; --yellow-soft: #FFF6DB; --yellow-2: #FFE07A;
  --good: #34B955; --good-lip: #27933F; --good-bg: #EAF8ED; --bad: #FF4B4B; --bad-lip: #D63535; --bad-bg: #FFEDED;
  --sq-light: #FBFBFC; --sq-dark: #E6E9ED; --bg: #fff; --night: #16181C; --night-2: #23262C;
  --radius: 22px; --maxw: 1120px; --prose: 720px;
  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 17.5px; font-weight: 500; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-weight: 900; letter-spacing: -.02em; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 10px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.muted { color: var(--ink-2); }
[hidden] { display: none !important; }
.lang-bar { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 10px; background: var(--night); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.4; padding: 9px 48px; text-align: center; }
.lang-bar a { color: var(--yellow); font-weight: 900; text-decoration: none; white-space: nowrap; }
.lang-bar a:hover { text-decoration: underline; }
.lang-bar button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: #fff; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.lang-bar button:hover { background: var(--night-2); }
.draft-banner { background: var(--yellow-soft); border-bottom: 2px solid var(--yellow); color: var(--ink); font-weight: 800; font-size: 14px; padding: 8px 20px; text-align: center; }

/* ---------- header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 2px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-size: 22px; letter-spacing: -.4px; }
.logo img { border-radius: 10px; box-shadow: 0 3px 0 var(--lip); }
.logo i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); margin-left: 1px; align-self: center; }
.nav { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 15px; color: var(--ink-2); }
.nav > a:not(.btn) { text-decoration: none; padding: 8px 10px; border-radius: 12px; }
.nav > a:not(.btn):hover { color: var(--ink); background: var(--surf); }
.nav > a[aria-current] { color: var(--ink); }
.nav .lang { border: 2px solid var(--line); border-radius: 999px; padding: 3px 11px !important; font-size: 13px; margin: 0 6px; }
@media (max-width: 900px) { .hide-m { display: none; } }
@media (max-width: 600px) { .hide-s { display: none !important; } .nav { gap: 0; font-size: 14px; } .nav > a:not(.btn) { padding: 8px 7px; } .logo { font-size: 20px; } }

/* ---------- buttons: the app's chunky buttons, pressed down on tap */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 24px; border-radius: 16px; border: 0; font: inherit; font-weight: 900; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; background: #202328; color: #fff; box-shadow: 0 5px 0 #000; cursor: pointer; transition: transform .08s, box-shadow .08s; white-space: nowrap; }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 #000; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 13px; border-radius: 12px; box-shadow: 0 4px 0 #000; }
.btn.small:active { transform: translateY(4px); }
.btn.yellow { background: var(--yellow); color: var(--ink); box-shadow: 0 5px 0 var(--yellow-lip); }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 5px 0 var(--line); }
.btn.light { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #8f949c; }
.btn.store { text-transform: none; letter-spacing: 0; justify-content: flex-start; gap: 10px; min-height: 52px; padding: 0 18px 0 14px; border-radius: 14px; }
.btn.store svg { flex: none; display: block; }
.store-label { display: flex; flex-direction: column; align-items: flex-start; font-size: 18px; font-weight: 800; line-height: 1.05; letter-spacing: -.01em; }
.store-label small { font-size: 11px; font-weight: 700; letter-spacing: .01em; opacity: .85; margin-bottom: 1px; }
/* Both badges the same width, side by side; stacked only when there is no room. */
.stores { display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; vertical-align: middle; }
@media (max-width: 420px) { .btn.store { padding: 0 10px; gap: 8px; } .store-label { font-size: 17px; } }
@media (max-width: 339px) { .stores { grid-template-columns: 1fr; } }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px 12px; align-items: center; }
.note { font-size: 14px; font-weight: 800; color: var(--ink-2); }

/* ---------- home: hero */
.hero { background: linear-gradient(180deg, #FFE9A3 0%, var(--yellow) 100%); position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: start; padding-top: 56px; padding-bottom: 64px; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(44px, 7.4vw, 84px); line-height: .98; letter-spacing: -.04em; margin: 0 0 18px; }
.hero .lead { font-size: clamp(18px, 2vw, 21px); font-weight: 700; color: #3a3220; max-width: 34em; margin: 0 0 28px; }
.hero .note { color: #6b5512; display: block; margin-top: 14px; }
.hero-test { margin: 22px 0 0; font-weight: 800; color: #3a3220; }
.hero-test a { white-space: nowrap; color: var(--ink); text-decoration: underline; text-decoration-color: rgba(0,0,0,.35); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.hero-test a:hover { text-decoration-color: var(--ink); }
/* Desktop: the text column sits lower so it lines up with the board, without depending on the puzzle card's height. */
@media (min-width: 861px) { .hero-grid > :first-child { padding-top: 96px; } }
.hero-play { position: relative; }
.hero-play .puzzles { background: #fff; border: 0; box-shadow: 0 8px 0 var(--yellow-lip), 0 30px 60px -30px rgba(80, 60, 0, .45); margin: 0; }
.hero-play .speech { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 12px 4px; }
.hero-play .speech .av { width: 76px; height: 76px; flex: none; }
.bubble { position: relative; background: #fff; border-radius: 18px; padding: 10px 16px; font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 var(--yellow-lip); margin-bottom: 18px; }
.bubble::before { content: ""; position: absolute; left: -7px; bottom: 12px; width: 16px; height: 16px; background: #fff; transform: rotate(45deg); border-radius: 3px; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; padding-top: 36px; padding-bottom: 44px; gap: 28px; } }

/* ---------- home: sections */
.band { padding: 76px 0; }
.band.tint { background: var(--surf); }
.band.night { background: var(--night); color: #fff; }
.band-head { max-width: 680px; margin: 0 0 36px; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow-lip); margin-bottom: 10px; }
.band h2 { font-size: clamp(32px, 4.6vw, 52px); line-height: 1.03; letter-spacing: -.035em; margin: 0 0 14px; }
.band .sub { font-size: 19px; color: var(--ink-2); margin: 0; }
.band.night .sub { color: #B9BEC6; }
@media (max-width: 600px) { .band { padding: 56px 0; } }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: step; }
.step { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 22px 20px 24px; box-shadow: 0 5px 0 var(--line); }
.step .av { width: 72px; height: 72px; margin: -4px 0 10px -4px; }
.step h3 { font-size: 21px; margin: 0 0 6px; }
.step h3::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--yellow); font-size: 15px; margin-right: 10px; vertical-align: 3px; }
.step p { margin: 0; color: var(--ink-2); font-size: 16px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat { border-radius: var(--radius); background: var(--night-2); padding: 22px; }
.stat b { display: block; font-size: clamp(36px, 4.6vw, 54px); line-height: 1; font-weight: 900; color: var(--yellow); letter-spacing: -.03em; }
.stat span { display: block; margin-top: 8px; color: #C9CDD3; font-weight: 700; font-size: 16px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }

.chars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.char { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 5px 0 var(--line); display: grid; grid-template-columns: 64px 1fr; gap: 4px 14px; align-items: center; }
.char .av { width: 64px; height: 64px; grid-row: span 2; }
.char h3 { margin: 0; font-size: 19px; line-height: 1.2; }
.char h3 small { font-size: 14px; font-weight: 800; color: var(--ink-3); margin-left: 6px; }
.char p { margin: 0; font-size: 15px; color: var(--ink-2); line-height: 1.4; }
.char.boss { background: var(--ink); border-color: var(--ink); box-shadow: 0 5px 0 #000; color: #fff; }
.char.boss p { color: #B9BEC6; }
.league { margin-top: 22px; color: var(--ink-2); font-weight: 700; }
@media (max-width: 960px) { .chars { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .chars { grid-template-columns: 1fr; } }

.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.shots img { width: 100%; height: auto; aspect-ratio: 506 / 1100; border-radius: 28px; box-shadow: 0 6px 0 var(--lip); display: block; }
@media (max-width: 760px) { .shots { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 72%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; } .shots img { scroll-snap-align: center; } }

.final { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; background: var(--yellow); border-radius: 32px; padding: 34px 36px; box-shadow: 0 8px 0 var(--yellow-lip); }
.final .av { width: 120px; height: 120px; }
.final h2 { font-size: clamp(30px, 4vw, 44px); margin: 0 0 6px; color: var(--ink); }
.final p { margin: 0; font-weight: 700; color: #3a3220; }
@media (max-width: 760px) { .final { grid-template-columns: 1fr; padding: 28px 24px; } .final .av { width: 90px; height: 90px; } }

/* ---------- cards and grids (hubs, home) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; text-decoration: none; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 5px 0 var(--line); transition: transform .12s, box-shadow .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--lip); border-color: var(--lip); }
.card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--lip); }
.card h3 { margin: 0 0 6px; font-size: 19px; line-height: 1.28; }
.card p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.card .kicker { font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow-lip); margin-bottom: 6px; }
.card .more { margin-top: auto; padding-top: 14px; font-weight: 900; font-size: 14px; color: var(--ink); }
.card .thumb { margin: -6px -6px 14px; background: var(--surf); border-radius: 16px; padding: 10px; display: grid; place-items: center; }
.card .thumb svg.diagram { width: 100%; max-width: 220px; display: block; border-radius: 10px; }
.see-all { margin-top: 22px; font-weight: 900; }
.see-all a { text-decoration: none; border-bottom: 3px solid var(--yellow); }

/* hub pages */
.hub-head { background: var(--yellow-soft); border-bottom: 2px solid #F6E3A6; }
.hub-head .wrap { padding-top: 48px; padding-bottom: 40px; }
.hub-head h1 { font-size: clamp(36px, 5.5vw, 60px); line-height: 1.02; letter-spacing: -.035em; margin: 0 0 12px; max-width: 16em; }
.hub-head p { font-size: 19px; color: #5a4a1a; margin: 0; max-width: 40em; font-weight: 700; }
.hub-body { padding-top: 40px; padding-bottom: 40px; }
.hub-body h2 { font-size: 28px; margin: 38px 0 16px; letter-spacing: -.02em; }
.hub-body h2:first-child { margin-top: 0; }
.section { padding-top: 28px; padding-bottom: 28px; }

/* ---------- articles (guides, patterns, about, tools) */
.article { max-width: calc(var(--prose) + 40px); margin: 0 auto; padding: 32px 20px 48px; }
.crumbs { font-size: 14px; font-weight: 800; color: var(--ink-3); margin-bottom: 14px; }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); }
.article h1 { font-size: clamp(34px, 5.4vw, 52px); line-height: 1.05; letter-spacing: -.035em; margin: 0 0 14px; }
.article .byline { font-size: 14px; font-weight: 800; color: var(--ink-3); margin-bottom: 24px; }
.article .answer { font-size: 19px; font-weight: 700; color: #33290c; background: var(--yellow-soft); border: 2px solid #F6E3A6; border-radius: 18px; padding: 16px 20px; margin: 0 0 26px; }
.article h2 { font-size: clamp(25px, 3vw, 31px); letter-spacing: -.025em; margin: 44px 0 12px; line-height: 1.15; }
.article h3 { font-size: 21px; margin: 28px 0 8px; }
.article p, .article li { color: #2a2d33; }
.article a:not(.btn):not(.card) { text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 3px; font-weight: 700; }
.article a:not(.btn):not(.card):hover { background: var(--yellow-soft); }
.article ul, .article ol { padding-left: 24px; }
.article li { margin: 8px 0; }
.article li::marker { color: var(--ink-3); font-weight: 900; }
.article strong { font-weight: 900; }
.article table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; margin: 18px 0; border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
@media (max-width: 640px) { .article table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 14px; } .article th, .article td { min-width: 96px; } }
.article th, .article td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.article tr:last-child td { border-bottom: 0; }
.article th { background: var(--surf); font-weight: 900; }
.article blockquote { margin: 18px 0; padding: 12px 18px; border-left: 5px solid var(--yellow); background: var(--surf); border-radius: 0 14px 14px 0; }
.article .disclosure { font-size: 15px; color: var(--ink-2); background: var(--surf); border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; margin: 0 0 20px; }
.sources { font-size: 14px; color: var(--ink-2); border-top: 2px solid var(--line); margin-top: 40px; padding-top: 14px; }
.sources h2 { font-size: 16px !important; margin: 0 0 6px !important; letter-spacing: 0 !important; }
.related { margin-top: 36px; }
.related .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* diagrams */
figure.board-fig { margin: 22px 0; }
figure.board-fig svg.diagram { display: block; width: 100%; max-width: 380px; border-radius: 16px; box-shadow: 0 6px 0 var(--lip); }
figure.board-fig figcaption { font-size: 15.5px; color: var(--ink-2); margin-top: 14px; max-width: 520px; }
svg.diagram .coord { font-size: 28px; font-weight: 900; fill: #3F454E; font-family: var(--font); } /* in board units (800 wide): about 12px on a phone-width board */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

/* ---------- playable puzzles */
.puzzles { background: var(--surf); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 22px 0; box-shadow: 0 5px 0 var(--line); }
.pz-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 900; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; flex-wrap: wrap; }
.pz-board .board-wrap { max-width: 460px; margin: 0; }
.pz-status { min-height: 26px; font-weight: 900; color: var(--ink-2); margin: 16px 0 10px; }
.pz-status.good { color: var(--good-lip); } .pz-status.bad { color: var(--bad-lip); }
.pz-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.pz-actions [hidden] { display: none; }
.btn .ico { width: 18px; height: 18px; flex: none; }
.pz-actions .btn.small { gap: 7px; padding: 0 14px; }
@media (max-width: 420px) { [data-tool="mates"] .pz-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; } [data-tool="mates"] .pz-actions .btn.small { padding: 0 8px; gap: 6px; font-size: 12px; letter-spacing: .03em; } }

/* call to action at the end of a page */
.cta { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: var(--yellow-soft); border: 2px solid var(--yellow); border-radius: var(--radius); padding: 20px 22px; margin: 44px 0 8px; box-shadow: 0 5px 0 var(--yellow-lip); }
.cta-av .av { width: 64px; height: 64px; }
.cta-text { flex: 1 1 260px; color: #3a3220; }
.cta-text strong { color: var(--ink); }

/* daily */
.share-line { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff; border: 2px dashed var(--lip); border-radius: 14px; padding: 12px 14px; font-size: 15px; white-space: pre-wrap; }

/* FAQ */
.faq details { border: 2px solid var(--line); border-radius: 18px; margin: 12px 0; background: #fff; box-shadow: 0 4px 0 var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 52px 16px 20px; font-weight: 900; font-size: 18px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--surf); display: grid; place-items: center; font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "–"; background: var(--yellow); }
.faq .a { padding: 0 20px 16px; }
.faq .a p { margin: 0 0 10px; }
.contact { background: var(--surf); border-radius: var(--radius); padding: 22px; margin-top: 30px; }
.contact h2 { margin: 0 0 6px !important; font-size: 22px !important; }

/* ---------- footer */
.foot { background: var(--night); color: #C9CDD3; margin-top: 64px; padding: 56px 0 28px; font-size: 15px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.foot .logo { color: #fff; margin-bottom: 12px; }
.foot .logo img { box-shadow: none; }
.foot-brand p { margin: 0 0 18px; max-width: 28em; }
.foot nav { display: flex; flex-direction: column; gap: 8px; }
.foot nav h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #fff; margin: 4px 0 8px; }
.foot nav a { color: #C9CDD3; text-decoration: none; font-weight: 700; }
.foot nav a:hover { color: var(--yellow); }
.foot-fine { border-top: 1px solid #2c3036; margin-top: 40px; padding-top: 18px; }
.foot-fine p { margin: 0; font-size: 13px; color: #8E949C; }
.foot-fine a { color: #C9CDD3; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }
.home .foot { margin-top: 0; }

/* ---------- level test */
.level-test { margin: 22px 0 30px; scroll-margin-top: 84px; }
.lt-card { background: var(--surf); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 5px 0 var(--line); }
.lt-card p:first-child { margin-top: 0; }
.lt-progress { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.lt-bar { flex: 1; height: 12px; border-radius: 6px; background: var(--surf-2); overflow: hidden; }
.lt-bar i { display: block; height: 100%; background: var(--yellow); border-radius: 6px; transition: width .3s; }
.lt-next-row { min-height: 60px; margin-top: 8px; }
.lt-result { background: #fff; }
.lt-level { font-size: 22px; font-weight: 800; margin-top: 0; }
.lt-level strong { font-size: 56px; font-weight: 900; letter-spacing: -.03em; display: block; line-height: 1; margin: 6px 0; }
.lt-log { padding-left: 1.6em; }
.lt-log li.no { opacity: .8; }

/* ---------- local review page */
.review .rv-table { overflow-x: auto; }
.review table { width: 100%; border-collapse: collapse; font-size: 15px; }
.review th, .review td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); min-width: 220px; }
.review code { font-size: 12px; }
.review .rv-note { background: #fff7cc; color: #3d3400; border-radius: 8px; padding: 8px 10px; font-size: 14px; margin: 8px 0 0; }
.review .st-draft { color: #b26b00; font-weight: 800; }
.review .st-reviewed { color: #2e7d32; font-weight: 800; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.hero-play .pz-board .board-wrap { max-width: 420px; }
.shots { max-width: 920px; margin: 0 auto; }

/* ---------- the piece legend (one per page, under the first board) */
.legend { max-width: 460px; margin: 14px 0 22px; padding: 10px 12px 12px; border-radius: 16px; background: var(--bg); border: 2px solid var(--line); }
.legend-t { margin: 0 0 6px; font-size: 13px; font-weight: 900; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.legend li { display: flex; flex-direction: column; align-items: center; margin: 0; font-size: 13.5px; font-weight: 800; line-height: 1.3; }
.legend-pc { display: flex; }
.legend-pc svg.pc { width: 36px; height: 36px; }
.hero-play .legend { max-width: 420px; }
@media (max-width: 420px) { .legend ul { grid-template-columns: repeat(3, 1fr); row-gap: 8px; } }
.review .rv-boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin: 10px 0 28px; }
.review .rv-board { font-size: 14px; }
.review .rv-board figure.board-fig { margin: 8px 0 0; }
.review .rv-board figure.board-fig figcaption { font-size: 14px; margin-top: 10px; }

/* The puzzle card hugs its board (460px board + padding + border), and what sits above and below lines up with it. */
.puzzles, .lt-progress, .legend { max-width: 500px; }
.hero-play .puzzles, .hero-play .legend { max-width: 460px; }
.level-test .puzzles { margin-bottom: 0; }
.level-test .lt-next-row { min-height: 52px; margin-top: 14px; }
.level-test:has(+ .legend) { margin-bottom: 0; }
.level-test + .legend { margin-top: 4px; }

/* The instruction sits above the board, so it's clear before the first tap that the board is playable. */
/* One fixed height whatever the line says (the yellow prompt or a short result), so the board under it never moves. */
.pz-status { margin: 0 0 12px; min-height: 40px; display: flex; align-items: center; }
.pz-status.prompt { width: fit-content; min-height: 40px; padding: 6px 14px; border-radius: 999px; background: var(--yellow-soft); border: 2px solid var(--yellow); color: var(--ink); font-size: 15px; }
.pz-actions:not(:empty) { margin-top: 14px; }

/* Several diagrams side by side (e.g. the three tactics in the beginner plan); one column on phones. */
.fig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin: 22px 0; max-width: 760px; }
.fig-row:has(> figure:nth-child(2):last-child) { max-width: 560px; }
.fig-row figure.board-fig { margin: 0; }
.fig-row figure.board-fig figcaption { font-size: 14.5px; margin-top: 10px; }
@media (max-width: 640px) { .fig-row { grid-template-columns: 1fr; } .fig-row figure.board-fig svg.diagram, .fig-row figure.board-fig .bd { max-width: 340px; } }

/* Which side plays from where: a label above and below each board ("Black" on top, "White (you)" below), so beginners
   can tell which way the pawns go (tools/ui.js for playable boards, lib/board-svg.mjs for diagrams). */
figure.board-fig .bd { max-width: 380px; }
.bd-side { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 900; color: var(--ink-2); line-height: 1.2; }
.bd-side svg.pc { width: 22px; height: 22px; flex: none; }
.bd-side.bd-top { margin-bottom: 6px; }
.bd-side.bd-bottom { margin-top: 12px; } /* below the board's 6px lip */
.bd-you { color: var(--ink); }
.pz-board .bd-side.bd-bottom:has(.bd-you) { color: var(--ink); }

/* {{values}}: the pieces with their points */
figure.values { margin: 22px 0; max-width: 520px; padding: 14px 10px; border-radius: 18px; background: var(--bg); border: 2px solid var(--line); box-shadow: 0 5px 0 var(--line); }
figure.values ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
figure.values li { display: flex; flex-direction: column; align-items: center; margin: 0; line-height: 1.2; }
figure.values svg.pc { width: 48px; height: 48px; }
figure.values strong { font-size: 26px; font-weight: 900; margin-top: 4px; }
figure.values span { font-size: 13.5px; font-weight: 800; color: var(--ink-2); }
@media (max-width: 420px) { figure.values svg.pc { width: 36px; height: 36px; } figure.values strong { font-size: 21px; } figure.values span { font-size: 12px; } }

/* Coordinates on playable boards: the app's 9px is too small on a phone. */
.pz-board .sq .coord { font-size: 12px; font-weight: 900; color: #3F454E; opacity: 1; }
.pz-board .sq .coord.f { right: 4px; bottom: 2px; }
.pz-board .sq .coord.r { left: 4px; top: 2px; }
@media (max-width: 420px) { .pz-board .sq .coord { font-size: 11px; } }
@media (min-width: 641px) { .fig-row svg.diagram .coord { font-size: 38px; } } /* small side-by-side diagrams: keep the labels about 10px */

/* ---------- interactive tools in guides (assets/tools/): mate trainer, stalemate quiz, piece explorer.
   They share the puzzle card's look, so a guide reads as one page, not a dashboard. */
.tool { max-width: 500px; margin: 22px 0; }
.tool > .board-fig { margin: 0; } /* the static diagram shown until the explorer loads */
.tool-card { position: relative; background: var(--surf); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 5px 0 var(--line); overflow: hidden; }
.tool .pz-status { display: block; }
.tool .pz-status.prompt { display: inline-block; }
.tool .pz-status.wait { color: var(--ink-3); }
.tool-stats { margin: 12px 0 0; font-weight: 800; font-size: 15px; color: var(--ink); }
.tool-stats b { font-weight: 900; }
.linkish { background: none; border: 0; padding: 0 4px; font: inherit; font-weight: 800; font-size: 14px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; align-self: center; }
.mark.box { background: rgba(61, 139, 255, .13); } /* the black king's box in the mate trainer */
/* stalemate quiz answers */
.quiz-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.quiz-opts[hidden] { display: none; }
.opt { min-height: 46px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 900; font-size: 15px; box-shadow: 0 4px 0 var(--line); cursor: pointer; }
.opt:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.opt:disabled { cursor: default; opacity: .55; }
.opt.right { opacity: 1; background: var(--good-bg); border-color: var(--good); box-shadow: 0 4px 0 var(--good-lip); }
.opt.wrong { opacity: 1; background: var(--bad-bg); border-color: var(--bad); box-shadow: 0 4px 0 var(--bad-lip); }
.quiz-msg { margin: 12px 0 0; font-size: 15.5px; }
.quiz-msg:empty { display: none; }
.quiz-msg.good b { color: var(--good-lip); } .quiz-msg.bad b { color: var(--bad-lip); }
/* promotion choice inside the explorer's status line */
.promo { display: inline-flex; gap: 6px; vertical-align: middle; margin-left: 6px; }
.promo .opt { width: 44px; min-height: 44px; padding: 4px; }
.promo .opt svg { width: 100%; height: auto; display: block; }
/* puzzle extras: the solution in notation */
.pz-sol { margin: 10px 0 0; font-size: 15px; font-weight: 700; }
.pz-sol[hidden] { display: none; }
/* the one-time app invitation after a solved puzzle or tool */
.nudge { max-width: 500px; margin: -6px 0 22px; padding: 14px 16px; border-radius: 18px; background: var(--yellow-soft); border: 2px solid var(--yellow); animation: nudge-in .35s ease-out; }
.nudge p { margin: 0 0 10px; font-size: 15.5px; }
.nudge .stores { gap: 8px; }
.nudge .btn.store { min-height: 46px; padding: 0 14px 0 12px; box-shadow: 0 4px 0 #000; }
.nudge .store-label { font-size: 16px; }
@keyframes nudge-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* confetti on a perfect result */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: confetti 1.5s ease-in forwards; }
@keyframes confetti { to { transform: translate(var(--dx), 560px) rotate(var(--rot)); opacity: 0; } }
/* "Embed this on your site": one quiet line under the tool until opened */
.embed-code { max-width: 500px; margin: -8px 0 22px; font-size: 14px; }
.embed-code summary { cursor: pointer; color: var(--ink-2); font-weight: 800; width: fit-content; }
.embed-code textarea { width: 100%; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; border: 2px solid var(--line); border-radius: 12px; padding: 10px; resize: vertical; color: var(--ink-2); margin-bottom: 8px; }
/* level test result: range, chart */
.lt-chart { margin: 14px 0 6px; }
.lt-chart svg { width: 100%; max-width: 420px; height: auto; display: block; }
.lt-chart .band { fill: var(--yellow-soft); }
.lt-chart .mean { stroke: var(--yellow-lip); stroke-width: 2; stroke-dasharray: 6 5; }
.lt-chart .path { fill: none; stroke: var(--lip); stroke-width: 2; }
.lt-chart circle.ok { fill: var(--good); } .lt-chart circle.no { fill: var(--bad); }
.lt-chart figcaption { font-size: 13px; margin-top: 4px; }
.lt-chart .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 1px; }
.lt-chart .dot.ok { background: var(--good); } .lt-chart .dot.no { background: var(--bad); }
.lt-chart .dash { display: inline-block; width: 16px; border-top: 2px dashed var(--yellow-lip); vertical-align: 3px; }
.small { font-size: 14px; }
/* embed pages (/embed/...): just the tool */
html.embed body { background: #fff; }
.embed-main { padding: 12px; max-width: 540px; }
.embed-title { font-size: 18px; margin: 0 0 10px; }
.embed-main .tool { margin: 0; }
.embed-credit { margin: 10px 0 0; font-size: 14px; font-weight: 800; }
.embed-credit a { color: var(--ink-2); }

/* from app/styles.css */
/* ---------- Peças ---------- */
.pc .lip { fill: var(--pc-lip); }
.pc .face { fill: var(--pc-face); }
.pc .shade { fill: var(--pc-shade); }
.pc .edge { fill: none; stroke: var(--pc-edge); stroke-width: 2.4; stroke-linejoin: round; }
.pc .det { fill: var(--pc-det); stroke: var(--pc-det); }
.pc.w { --pc-face: #FFFFFF; --pc-shade: #E7EAEF; --pc-lip: #B7BEC8; --pc-edge: #A4ACB7; --pc-det: #A4ACB7; }
.pc.b { --pc-face: #41454C; --pc-shade: #2F3237; --pc-lip: #141518; --pc-edge: #1C1E22; --pc-det: #8C939D; }
.starpc .face { fill: var(--yellow); }
.starpc .lip { fill: var(--yellow-lip); }

/* ---------- Tabuleiro ---------- */
.board-wrap { position: relative; width: 100%; max-width: 440px; margin: 0 auto; border-radius: 16px; background: var(--sq-dark); box-shadow: 0 8px 0 var(--lip); }
.board { position: relative; width: 100%; aspect-ratio: 1; border-radius: 16px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { position: relative; background: var(--sq-light); }
.sq.dk { background: var(--sq-dark); }
.sq .coord { position: absolute; font-size: 9px; font-weight: 800; color: var(--ink-3); opacity: .8; pointer-events: none; }
.sq .coord.f { right: 3px; bottom: 1px; }
.sq .coord.r { left: 3px; top: 1px; }
.marks, .pieces, .arrows { position: absolute; inset: 0; pointer-events: none; }
.mark { position: absolute; width: 12.5%; height: 12.5%; }
.mark.last { background: rgba(255, 196, 46, .30); }
.mark.sel { background: rgba(255, 196, 46, .55); }
.mark.good { background: rgba(52, 185, 85, .30); }
.mark.bad { background: rgba(255, 75, 75, .26); }
.mark.check { background: radial-gradient(circle, rgba(255, 75, 75, .55) 0, rgba(255, 75, 75, .25) 45%, transparent 70%); }
.mark.threat { box-shadow: inset 0 0 0 4px rgba(255, 75, 75, .75); border-radius: 10px; animation: pulse 1.2s ease-in-out infinite; }
.mark.hint { box-shadow: inset 0 0 0 4px rgba(255, 196, 46, .95); border-radius: 10px; animation: pulse 1s ease-in-out infinite; }
.mark.dot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(22, 24, 28, .16); }
.mark.ring::after { content: ''; position: absolute; inset: 6%; border-radius: 50%; box-shadow: inset 0 0 0 5px rgba(22, 24, 28, .16); }
@keyframes pulse { 50% { opacity: .45; } }
.piece { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; transition: transform .22s cubic-bezier(.3, .7, .3, 1), opacity .2s; will-change: transform; }
.piece svg { width: 92%; height: 92%; margin: 2% 4% 6%; display: block; overflow: visible; }
.piece.star svg { width: 64%; height: 64%; margin: 18%; }
.piece.dragging { transition: none; z-index: 5; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .18)); }
.piece.dragging svg { transform: scale(1.18) translateY(-12%); }
.piece.gone { opacity: 0; transform-origin: center; }
.piece.new { animation: popIn .3s ease; }
.piece.star svg { animation: bob 2.2s ease-in-out infinite; }
.piece.enemy svg { opacity: .95; }
@keyframes popIn { from { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-6%); } }
.piece.shake svg { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-10%); } 75% { transform: translateX(10%); } }
.arrows svg { width: 100%; height: 100%; }
.arrow { fill: none; stroke-width: 15; stroke-linecap: round; opacity: .85; }
.arrow.good { stroke: var(--good); } .arrowhead.good { fill: var(--good); }
.arrow.bad { stroke: var(--bad); } .arrowhead.bad { fill: var(--bad); }
.arrow.hint { stroke: var(--yellow); } .arrowhead.hint { fill: var(--yellow); }
.arrow.info { stroke: #7E8691; } .arrowhead.info { fill: #7E8691; }
.arrowhead { opacity: .85; }

/* ---------- Personagens ---------- */
.av { display: block; overflow: visible; }
.av .eyes { animation: blink 4.6s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.av-wrap { position: relative; display: grid; place-items: center; }
.bounce { animation: hop .6s ease; }
@keyframes hop { 30% { transform: translateY(-14%) rotate(-3deg); } 60% { transform: translateY(0) rotate(2deg); } }
.idle-sway { animation: sway 3.2s ease-in-out infinite; transform-origin: bottom center; }
@keyframes sway { 50% { transform: rotate(-2.5deg); } }

