:root {
  --bg: #f2eee6;
  --bg-strong: #e7decd;
  --surface: rgba(255, 250, 241, 0.72);
  --surface-strong: rgba(255, 248, 235, 0.9);
  --border: rgba(89, 58, 30, 0.14);
  --text: #201610;
  --muted: #67584d;
  --accent: #b25c2f;
  --accent-deep: #7c3416;
  --success: #3d7a57;
  --danger: #9e3b2f;
  --light-square: #f6ebdb;
  --dark-square: #b7794d;
  --select: rgba(43, 95, 176, 0.82);
  --hint: rgba(36, 125, 93, 0.88);
  --glass-shadow: 0 28px 70px rgba(52, 31, 16, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 24%),
    linear-gradient(135deg, #efe4d2 0%, #f8f2ea 45%, #e8dbc8 100%);
}

button {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 32px;
  overflow: hidden;
}

.ambient {
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.5;
  pointer-events: none;
}

.ambient-left {
  top: -80px;
  left: -120px;
  background: radial-gradient(circle, rgba(231, 129, 56, 0.32), transparent 68%);
}

.ambient-right {
  right: -120px;
  bottom: -100px;
  background: radial-gradient(circle, rgba(73, 114, 155, 0.28), transparent 68%);
}

.app-card {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--glass-shadow);
}

.mascot {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.mascot-bubble {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid rgba(89, 58, 30, 0.12);
  color: var(--muted);
  font-size: 0.84rem;
  box-shadow: 0 12px 26px rgba(52, 31, 16, 0.08);
}

.mascot-face {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 28px 28px 30px 30px;
  background: linear-gradient(180deg, #fff5de, #f3c784);
  border: 1px solid rgba(89, 58, 30, 0.12);
  box-shadow: 0 18px 32px rgba(52, 31, 16, 0.12);
}

.ear {
  position: absolute;
  top: -10px;
  width: 22px;
  height: 22px;
  border-radius: 8px 8px 2px 2px;
  background: #f0b35d;
  border: 1px solid rgba(89, 58, 30, 0.12);
}

.ear-left {
  left: 14px;
  transform: rotate(-18deg);
}

.ear-right {
  right: 14px;
  transform: rotate(18deg);
}

.eye,
.blush,
.mouth {
  position: absolute;
}

.eye {
  top: 32px;
  width: 8px;
  height: 12px;
  border-radius: 999px;
  background: #3f2d22;
}

.eye-left {
  left: 24px;
}

.eye-right {
  right: 24px;
}

.blush {
  top: 46px;
  width: 14px;
  height: 8px;
  border-radius: 999px;
  background: rgba(224, 127, 105, 0.34);
}

.blush-left {
  left: 16px;
}

.blush-right {
  right: 16px;
}

.mouth {
  left: 50%;
  bottom: 18px;
  width: 22px;
  height: 11px;
  border-bottom: 3px solid #5a3725;
  border-radius: 0 0 18px 18px;
  transform: translateX(-50%);
}

.hero-copy {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}

.eyebrow,
.board-kicker,
.sidebar-label,
.stat-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Inter", "Avenir Next", "Segoe UI", sans-serif;
  font-weight: 700;
}

h1 {
  max-width: 760px;
  font-family: "Inter", "Avenir Next", "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero-title {
  font-family: "Inter", "Avenir Next", "Segoe UI", sans-serif !important;
  font-style: normal;
  font-weight: 800;
}

.intro {
  max-width: 760px;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 760px;
}

.stats-row > div,
.sidebar-card,
.board-panel {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  border-radius: 24px;
}

.stats-row > div {
  padding: 16px 18px;
}

.stats-row strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.play-surface {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.board-panel {
  padding: 20px;
}

.board-header,
.sidebar-headline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.board-wrap {
  margin-top: 18px;
}

.board-body {
  display: grid;
  grid-template-columns: 18px minmax(280px, 1fr) 18px;
  gap: 12px;
  align-items: stretch;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1;
  width: min(100%, 760px);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(52, 31, 16, 0.08);
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 4vw, 3.3rem);
  user-select: none;
  transition: transform 140ms ease, filter 140ms ease;
}

.square:hover {
  filter: brightness(1.04);
}

.piece-image {
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

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

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

.square.selected::after,
.square.hint::after,
.square.last-move::before,
.square.in-check::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 18px;
}

.square.selected::after {
  border: 3px solid var(--select);
}

.square.hint::after {
  inset: auto;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: var(--hint);
}

.square.last-move::before {
  background: rgba(255, 255, 255, 0.18);
}

.square.in-check::before {
  background: rgba(176, 54, 37, 0.28);
}

.coords {
  display: grid;
  color: var(--muted);
  font-size: 0.82rem;
}

.coords-top,
.coords-bottom {
  grid-template-columns: repeat(8, 1fr);
  padding: 0 30px;
  margin: 8px 0;
}

.coords-left,
.coords-right {
  grid-template-rows: repeat(8, 1fr);
}

.coords span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar {
  display: grid;
  gap: 16px;
}

.sidebar-card {
  padding: 18px;
}

.support-text,
.feedback-text {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.tries-text {
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.solution-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(89, 58, 30, 0.18);
}

.solution-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  color: var(--muted);
}

.solution-text {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.45;
}

.progress-track {
  margin-top: 16px;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(32, 22, 16, 0.08);
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #df9c5e);
  transition: width 220ms ease;
}

.move-list {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.move-list li.completed {
  color: var(--text);
}

.puzzle-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.puzzle-nav button {
  width: 100%;
}

.primary-button,
.ghost-button {
  padding: 11px 16px;
  border-radius: 999px;
  transition: transform 140ms ease, background 140ms ease;
}

.primary-button {
  color: #fff9f2;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.ghost-button {
  background: rgba(32, 22, 16, 0.06);
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 1040px) {
  .play-surface {
    grid-template-columns: 1fr;
  }

  .board {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 18px;
  }

  .app-card {
    padding: 96px 20px 20px;
    border-radius: 26px;
  }

  .mascot {
    top: 16px;
    right: 16px;
  }

  .mascot-bubble {
    font-size: 0.76rem;
    padding: 8px 12px;
  }

  .mascot-face {
    width: 72px;
    height: 72px;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .board-body {
    gap: 8px;
    grid-template-columns: 14px minmax(0, 1fr) 14px;
  }

  .coords-top,
  .coords-bottom {
    padding: 0 18px;
  }

  .sidebar-headline,
  .board-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .puzzle-nav {
    grid-template-columns: 1fr;
  }
}
