@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,700;9..144,850&family=Manrope:wght@400;600;700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #241f1a;
  --muted: #6c6158;
  --line: #e1d3c4;
  --paper: #fbf7ef;
  --panel: #fffdf8;
  --wood: #b66c3b;
  --wood-dark: #70401f;
  --teal: #247b78;
  --teal-dark: #155653;
  --gold: #d99a2b;
  --rose: #aa4f47;
  --sky: #81b8c4;
  --sage: #c8cf75;
  --violet: #9b83c9;
  --shadow: 0 22px 60px rgba(64, 39, 20, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(112, 64, 31, 0.05) 1px, transparent 1px) 0 0 / 42px 42px,
    var(--paper);
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

.site-header,
.site-footer {
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--teal-dark);
  color: #fffdf8;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

nav a {
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.hero {
  max-width: 1220px;
  min-height: 250px;
  margin: 0 auto;
  padding: 22px 24px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 34px;
  align-items: center;
}

.hero > *,
.game-shell > *,
.solver-band > *,
.guide-grid > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin: 0 0 18px;
  font-size: clamp(2.45rem, 5vw, 3.85rem);
  line-height: 0.96;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 3.5vw, 2.6rem);
  line-height: 1.05;
}

.hero-copy > p:not(.eyebrow),
.solver-band > div > p {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.button-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  background: var(--teal-dark);
  color: #fffdf8;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.button-link {
  padding: 0 20px;
}

.text-link {
  color: var(--teal-dark);
  font-weight: 850;
}

.hero-panel {
  display: grid;
  gap: 12px;
}

.hero-panel div,
.control-panel,
.board-card,
.steps-card,
.guide-grid article,
.faq-band details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hero-panel div {
  padding: 14px 18px;
}

.hero-panel strong,
.hero-panel span {
  display: block;
}

.hero-panel span {
  color: var(--muted);
}

.game-band {
  padding: 24px 24px 48px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.25), rgba(255, 253, 248, 0)),
    #eadcc8;
}

.game-shell {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.control-panel {
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-heading {
  margin-bottom: 16px;
}

.field,
.speed-field {
  display: grid;
  gap: 8px;
}

.field span,
.speed-field span {
  font-weight: 850;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(36, 123, 120, 0.24);
  outline-offset: 2px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stat-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbf4e8;
}

.stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stat-grid strong {
  display: block;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.button-grid button:nth-child(4) {
  background: var(--wood-dark);
}

.speed-field {
  margin-top: 18px;
}

.message,
.copy-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--teal-dark);
  font-weight: 800;
}

.board-card {
  padding: 24px;
  overflow: hidden;
}

.board-topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.selected-label {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
  white-space: nowrap;
}

.board {
  position: relative;
  min-height: clamp(240px, 28vw, 300px);
  margin-top: 18px;
  padding: 24px 18px 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.6), rgba(255, 253, 248, 0.1)),
    linear-gradient(90deg, rgba(112, 64, 31, 0.13) 1px, transparent 1px) 0 0 / 36px 36px,
    #deb887;
  box-shadow: inset 0 -12px 0 rgba(112, 64, 31, 0.13);
}

.peg {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  min-height: 100%;
  padding: 0 8px 30px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.peg::before {
  content: "";
  position: absolute;
  bottom: 42px;
  width: 18px;
  height: 68%;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(90deg, #8d4f2a, #c27a45 45%, #7a3f20);
  box-shadow: 0 10px 14px rgba(64, 39, 20, 0.18);
}

.peg::after {
  content: "";
  position: absolute;
  bottom: 24px;
  width: 86%;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #c0793f, #875027);
  box-shadow: 0 8px 18px rgba(64, 39, 20, 0.18);
}

.peg.active::before {
  box-shadow: 0 0 0 5px rgba(36, 123, 120, 0.2), 0 10px 14px rgba(64, 39, 20, 0.18);
}

.stack {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.disk {
  height: clamp(24px, 4.4vw, 38px);
  border: 1px solid rgba(64, 39, 20, 0.12);
  border-radius: 999px;
  color: rgba(36, 31, 26, 0.68);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: inset 0 -7px 0 rgba(64, 39, 20, 0.14), 0 8px 12px rgba(64, 39, 20, 0.12);
  transform: translateY(0);
  transition: transform 170ms ease, filter 170ms ease;
}

.disk.selected {
  transform: translateY(-18px);
  filter: saturate(1.14) brightness(1.06);
}

.disk[data-size="1"] { background: #9b83c9; }
.disk[data-size="2"] { background: #81b8c4; }
.disk[data-size="3"] { background: #c8cf75; }
.disk[data-size="4"] { background: #f0be57; }
.disk[data-size="5"] { background: #e78b55; }
.disk[data-size="6"] { background: #c9695f; }
.disk[data-size="7"] { background: #7fb084; }
.disk[data-size="8"] { background: #7b9ab8; }
.disk[data-size="9"] { background: #b08a63; }

.peg-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

.solver-band,
.guide-grid,
.faq-band {
  max-width: 1220px;
  margin: 0 auto;
  padding: 54px 24px;
}

.solver-band {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(360px, 1.2fr);
  gap: 28px;
  align-items: start;
}

.steps-card {
  padding: 22px;
}

.steps-toolbar {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
}

.steps-toolbar button {
  width: auto;
  min-height: 40px;
  padding: 0 14px;
}

.solution-steps {
  max-height: 360px;
  overflow: auto;
  margin: 18px 0 0;
  padding-left: 24px;
}

.solution-steps li {
  margin: 6px 0;
  color: var(--muted);
}

.solution-steps li.current {
  color: var(--ink);
  font-weight: 900;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding-top: 18px;
}

.guide-grid article {
  padding: 25px;
}

.guide-grid li {
  margin: 7px 0;
}

.faq-band {
  max-width: 920px;
  padding-top: 12px;
}

.faq-band details {
  margin-top: 12px;
  padding: 18px 20px;
}

summary {
  cursor: pointer;
  font-weight: 850;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 76px;
}

.page h1 {
  font-size: clamp(2.35rem, 6vw, 4rem);
}

@media (max-width: 1040px) {
  .hero,
  .game-shell,
  .solver-band,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    order: 2;
  }
}

@media (max-width: 680px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header nav,
  .site-footer nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, max-content));
    gap: 10px 18px;
  }

  .hero {
    min-height: auto;
    padding-top: 32px;
  }

  h1 {
    font-size: clamp(2.2rem, 10vw, 2.9rem);
  }

  h2 {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .hero-copy,
  .hero-copy > p:not(.eyebrow) {
    max-width: min(100%, 346px);
  }

  .game-band,
  .solver-band,
  .guide-grid,
  .faq-band {
    padding-inline: 14px;
  }

  .board-card,
  .control-panel {
    padding: 16px;
  }

  .board-topline,
  .steps-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .board {
    min-height: 430px;
    gap: 8px;
    padding-inline: 4px;
  }

  .peg {
    padding-inline: 2px;
  }

  .peg-labels {
    gap: 8px;
  }
}
