:root {
  --bg: #302e2b;
  --bg-side: #262421;
  --bg-card: #262421;
  --bg-hover: #3c3a37;
  --text: #ffffff;
  --text-dim: #c3c2c1;
  --green: #81b64c;
  --green-dark: #45753c;
  --green-hover: #a3d160;
  --gray-btn: #3c3a37;
  --gray-btn-shadow: #1f1e1c;
  --sq-light: #ebecd0;
  --sq-dark: #739552;
  --sq-sel: rgba(255, 255, 51, .5);
  --sq-last: rgba(255, 255, 51, .35);
  --sq-check: #e46a5a;
  --radius: 8px;
  --side-w: 180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 600;
}

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

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--green); padding: 8px 12px; z-index: 100;
}
.skip:focus { left: 8px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--side-w);
  background: var(--bg-side);
  display: flex; flex-direction: column;
  padding: 12px 0;
  z-index: 20;
  transition: transform .2s;
}

.logo {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 16px 16px;
  font-size: 1.35rem; font-weight: 900; letter-spacing: -.5px;
}
.logo b { color: var(--green); font-weight: 900; }
.logo-mark { font-size: 1.8rem; color: var(--green); line-height: 1; }

.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  font-weight: 800; font-size: 1.02rem;
}
.nav a:hover { background: var(--bg-hover); }
.ico { width: 26px; text-align: center; font-size: 1.15rem; }

.sidebar-bottom {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 10px;
}
.search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 6px; color: var(--text-dim);
}
.search input {
  background: none; border: 0; color: var(--text);
  font: inherit; width: 100%; outline: none;
}
.side-link {
  color: var(--text-dim); font-size: .9rem; padding: 6px;
}
.side-link:hover { color: var(--text); }

.menu-toggle {
  display: none;
  position: fixed; top: 10px; left: 10px; z-index: 30;
  background: var(--bg-side); color: var(--text);
  border: 0; border-radius: var(--radius);
  font-size: 1.4rem; width: 42px; height: 42px; cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius);
  font: inherit; font-weight: 800; cursor: pointer;
  padding: 10px 18px;
  transition: filter .1s, transform .05s;
}
.btn:active { transform: translateY(2px); }
.btn-block { width: 100%; }
.btn-green {
  background: var(--green); color: #fff;
  box-shadow: 0 4px 0 var(--green-dark);
}
.btn-green:hover { background: var(--green-hover); }
.btn-dark, .btn-gray {
  background: var(--gray-btn); color: var(--text-dim);
  box-shadow: 0 4px 0 var(--gray-btn-shadow);
}
.btn-dark:hover, .btn-gray:hover { color: #fff; filter: brightness(1.15); }
.btn-small { padding: 6px 12px; font-size: .85rem; }
.btn-cta {
  font-size: 1.6rem; padding: 18px 0; width: 100%; max-width: 420px;
  box-shadow: 0 6px 0 var(--green-dark);
}

/* ---------- Main ---------- */
main { margin-left: var(--side-w); }

.banner {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  background: #dcdcdc; color: #312e2b;
  padding: 12px 48px; position: relative; font-size: .95rem;
}
.banner-close {
  position: absolute; right: 16px;
  background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: #666;
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 640px) 1fr;
  gap: 48px; align-items: center;
  max-width: 1300px; margin: 0 auto;
  padding: 24px 48px 48px;
}

.hero > *, .feature > *, .app-promo > *, .news-grid > * { min-width: 0; }
body { overflow-x: hidden; }

.hero-copy { text-align: center; display: flex; flex-direction: column; align-items: center; }
.hero-copy h1 {
  font-size: clamp(2rem, 3.8vw, 3.4rem);
  font-weight: 900; line-height: 1.1; margin: 0 0 20px;
}
.hero-copy p {
  font-size: 1.3rem; color: var(--text-dim); max-width: 380px; margin: 0 0 40px;
}

/* ---------- Board ---------- */
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  aspect-ratio: 1;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  user-select: none;
  container-type: inline-size;
}
.board.theme-azul { --sq-light: #dfe7ec; --sq-dark: #7f9fb8; }
.board.theme-madeira { --sq-light: #f0d9b5; --sq-dark: #b58863; }
.sq {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
  font-size: 9.5cqw;
  line-height: 1;
}
.board.static .sq { cursor: default; }
.board.static .coord { display: none; }
.sq.hint { box-shadow: inset 0 0 0 4px #f5c242; }
.sq .star {
  position: absolute; z-index: 2; font-size: 6cqw; color: #f5c242;
  text-shadow: 0 1px 2px rgba(0,0,0,.5); pointer-events: none;
}
.board .arrows {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 3;
}
.sq .badge {
  position: absolute; top: 2%; right: 2%; z-index: 4;
  min-width: 3.4cqw; height: 3.4cqw; padding: 0 0.5cqw; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1cqw; font-weight: 900; color: #fff; background: #777;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); pointer-events: none;
}
.sq .badge.b-melhor, .sq .badge.b-excelente { background: #81b64c; }
.sq .badge.b-bom { background: #95b776; }
.sq .badge.b-ok { background: #8b8987; }
.sq .badge.b-imprecisao { background: #f7c045; }
.sq .badge.b-erro { background: #ffa459; }
.sq .badge.b-grave { background: #fa412d; }
.promo {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 2cqw;
  background: rgba(0,0,0,.55);
}
.promo button {
  width: 18cqw; height: 18cqw; padding: 0;
  border: 0; border-radius: 12px; background-color: #f0f0f0; cursor: pointer;
  background-size: 85%;
}
.promo button:hover, .promo button:focus-visible { background: #fff; outline: 3px solid var(--green); }
.sq.light { background: var(--sq-light); }
.sq.dark  { background: var(--sq-dark); }
.sq.last::before, .sq.sel::before {
  content: ""; position: absolute; inset: 0; background: var(--sq-last);
}
.sq.sel::before { background: var(--sq-sel); }
.sq.check { background: var(--sq-check) !important; }

.sq .coord {
  position: absolute; font-size: max(9px, 1.7cqw); font-weight: 800; pointer-events: none;
}
.sq .coord.rank { top: 3px; left: 4px; }
.sq .coord.file { bottom: 2px; right: 4px; }
.sq.light .coord { color: var(--sq-dark); }
.sq.dark .coord  { color: var(--sq-light); }

/* Peças: imagens SVG (pecas.css define o background de cada .p-wK, .p-bQ…) */
.piece {
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.sq .piece {
  position: relative; z-index: 1; pointer-events: none;
  width: 100%; height: 100%;
  filter: drop-shadow(0 0.25cqw 0.2cqw rgba(0, 0, 0, .28));
}
.sq .piece.drag-origin { opacity: .3; }
.piece.icon { display: inline-block; width: 1.4em; height: 1.4em; vertical-align: middle; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .35));
  will-change: transform;
}
.board:not(.static) { touch-action: none; }
.board:not(.static) .sq { cursor: grab; }
.sq.drag-over { box-shadow: inset 0 0 0 0.6cqw rgba(255, 255, 255, .75); }

.sq.target::after {
  content: ""; position: absolute; z-index: 2;
  width: 32%; height: 32%; border-radius: 50%;
  background: rgba(0,0,0,.14);
}
.sq.target.capture::after {
  width: 92%; height: 92%;
  background: none; border: 0.8cqw solid rgba(0,0,0,.14);
}

.board-status {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 12px; color: var(--text-dim); font-size: .95rem;
}

/* ---------- Features ---------- */
.features {
  max-width: 1100px; margin: 0 auto; padding: 24px 48px;
  display: flex; flex-direction: column; gap: 32px;
}
.feature {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
  background: var(--bg-card); border-radius: 12px; padding: 40px;
}
.feature.reverse .feature-art { order: 2; }
.feature h2 { font-size: 2rem; font-weight: 900; margin: 0 0 12px; }
.feature p { color: var(--text-dim); font-size: 1.1rem; margin: 0 0 24px; }
.feature-art {
  aspect-ratio: 4/3; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 6rem;
}
.art-bot    { background: linear-gradient(135deg, #4a6fa5, #2b3d5a); }
.art-lesson { background: linear-gradient(135deg, #81b64c, #45753c); }
.art-puzzle { background: linear-gradient(135deg, #e6912c, #a8541b); }
.art-watch  { background: linear-gradient(135deg, #8c5fbf, #4b2f73); }

/* ---------- News ---------- */
.news { max-width: 1100px; margin: 0 auto; padding: 32px 48px; }
.news > h2 { text-align: center; font-size: 2rem; font-weight: 900; }
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.news-card {
  background: var(--bg-card); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; padding-bottom: 16px;
}
.news-card:hover { background: var(--bg-hover); }
.news-card h3 { font-size: 1.05rem; margin: 14px 16px 8px; }
.news-card span { color: var(--text-dim); font-size: .85rem; margin: 0 16px; }
.news-thumb {
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  font-size: 4rem; color: rgba(255,255,255,.85);
}
.t1 { background: #5d4a8a; } .t2 { background: #3d6b8f; } .t3 { background: #7a5a2e; }

/* ---------- App promo ---------- */
.app-promo {
  max-width: 1100px; margin: 24px auto; padding: 40px 48px;
  display: grid; grid-template-columns: 240px 1fr; gap: 48px; align-items: center;
}
.app-promo h2 { font-size: 2.2rem; font-weight: 900; margin: 0 0 8px; }
.app-promo p { color: var(--text-dim); }
.phone {
  width: 200px; aspect-ratio: 9/18; margin: 0 auto;
  background: #111; border-radius: 28px; padding: 14px; border: 3px solid #444;
  display: flex; align-items: center;
}
.phone-board {
  width: 100%; aspect-ratio: 1; border-radius: 4px;
  background: conic-gradient(var(--sq-dark) 0 25%, var(--sq-light) 0 50%, var(--sq-dark) 0 75%, var(--sq-light) 0) 0 0 / 25% 25%;
}
.store-row { display: flex; gap: 12px; flex-wrap: wrap; }
.store {
  background: #000; border: 1px solid #555; border-radius: 10px;
  padding: 8px 16px; display: flex; flex-direction: column; font-weight: 800;
}
.store small { font-weight: 600; font-size: .7rem; color: var(--text-dim); }

/* ---------- Footer ---------- */
.footer {
  text-align: center; padding: 32px 24px 48px;
  color: var(--text-dim); font-size: .85rem; line-height: 2;
}
.footer a:hover { color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 24px; }
  .board-wrap { max-width: 560px; width: 100%; margin: 0 auto; }
  .hero-copy { order: -1; }
  .feature, .app-promo { grid-template-columns: 1fr; gap: 24px; }
  .feature.reverse .feature-art { order: 0; }
  .news-grid { grid-template-columns: 1fr; }
  .features, .news, .app-promo { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: block; }
  main { margin-left: 0; }
  .banner { padding: 12px 48px 12px 60px; font-size: .85rem; }
  .hero, .features, .news, .app-promo { padding-left: 16px; padding-right: 16px; }
  .feature { padding: 20px; }
  .hero { padding-top: 64px; }
  .feature h2, .news > h2, .app-promo h2 { font-size: 1.6rem; }
  .btn-cta { font-size: 1.3rem; padding: 14px 0; }
}
