:root {
  color-scheme: light;
  --ink: #17221f;
  --muted: #63706b;
  --paper: #f8f5ed;
  --paper-deep: #eee8da;
  --canvas: #e7e3d8;
  --green: #173f3a;
  --green-light: #2f5f57;
  --line: rgba(23, 34, 31, 0.13);
  --wood-light: #d9b47f;
  --wood-mid: #b77a42;
  --wood-dark: #754623;
  --open-month: #fff7d7;
  --open-day: #f7d777;
  --shadow: 0 24px 60px rgba(39, 41, 35, 0.12);
  --radius: 24px;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 63, 58, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 63, 58, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 44px 44px;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  border: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid #d79b37;
  outline-offset: 3px;
}

a {
  color: inherit;
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.page-glow-one {
  top: -19rem;
  left: -10rem;
  background: rgba(242, 195, 111, 0.22);
}

.page-glow-two {
  right: -18rem;
  bottom: -20rem;
  background: rgba(67, 123, 113, 0.16);
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 2px solid var(--green);
  border-radius: 12px;
  color: var(--paper);
  background: var(--green);
  box-shadow: 3px 3px 0 #c78a41;
}

.brand-mark span {
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
}

.brand-mark span + span {
  color: var(--green);
  background: #f1cf7e;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.eyebrow,
.step-label {
  margin: 0;
  color: var(--green-light);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
  font-weight: 700;
}

.header-note {
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  font-style: italic;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(270px, 0.7fr);
  gap: 60px;
  align-items: end;
  padding: 70px 0 50px;
}

.hero h1 {
  max-width: 760px;
  margin: 12px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.25rem, 7vw, 6.5rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.hero h1 em {
  color: var(--green);
  font-weight: 400;
}

.hero-copy {
  max-width: 440px;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.solver-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.workspace,
.guide-column {
  display: grid;
  gap: 20px;
}

.date-card,
.board-card,
.guide-card {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: rgba(248, 245, 237, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.date-card {
  padding: 26px;
}

.date-heading,
.board-heading,
.key-heading,
.hint-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

h2 {
  margin: 6px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.quick-actions {
  display: flex;
  gap: 6px;
}

.text-button {
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--green);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 750;
}

.text-button:hover {
  background: rgba(23, 63, 58, 0.08);
}

.date-fields {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(100px, 0.55fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 23px;
}

.date-fields label {
  display: grid;
  gap: 7px;
}

.date-fields label > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select {
  width: 100%;
  height: 52px;
  padding: 0 44px 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background:
    linear-gradient(45deg, transparent 50%, var(--green) 50%) calc(100% - 19px)
      22px / 6px 6px no-repeat,
    linear-gradient(135deg, var(--green) 50%, transparent 50%) calc(100% - 13px)
      22px / 6px 6px no-repeat,
    #fffdf8;
  appearance: none;
  font-weight: 700;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 46px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 800;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.primary-button {
  padding: 0 20px;
  color: #fffdf8;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(23, 63, 58, 0.18);
}

.date-fields .primary-button {
  height: 52px;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #23534d;
  box-shadow: 0 14px 28px rgba(23, 63, 58, 0.22);
}

.primary-button svg,
.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.secondary-button,
.icon-button {
  border: 1px solid var(--line);
  color: var(--green);
  background: #fffdf8;
}

.secondary-button {
  padding: 0 16px;
}

.secondary-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #f2efe6;
}

.icon-button {
  width: 46px;
  padding: 0;
}

.quiet-button {
  color: var(--muted);
}

.board-card {
  padding: 26px;
}

.date-badge {
  display: grid;
  grid-template-columns: auto auto;
  overflow: hidden;
  border: 1px solid rgba(23, 63, 58, 0.16);
  border-radius: 10px;
  color: var(--paper);
  background: var(--green);
}

.date-badge span,
.date-badge strong {
  display: grid;
  min-width: 48px;
  min-height: 42px;
  place-items: center;
  padding: 0 10px;
}

.date-badge span {
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.date-badge strong {
  color: var(--green);
  background: var(--open-day);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  margin: 19px 0 13px;
}

#status {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.solution-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
}

.solution-count strong {
  margin-left: 5px;
  color: var(--ink);
}

.tray {
  width: min(100%, 640px);
  margin-inline: auto;
  padding: clamp(14px, 3vw, 24px);
  border: 2px solid #9b622f;
  border-radius: 22px;
  background:
    repeating-linear-gradient(
      102deg,
      transparent 0,
      transparent 17px,
      rgba(91, 48, 20, 0.06) 18px,
      transparent 20px
    ),
    linear-gradient(145deg, var(--wood-light), var(--wood-mid));
  box-shadow:
    inset 0 0 0 7px rgba(255, 235, 193, 0.18),
    inset 0 -13px 25px rgba(89, 48, 20, 0.15),
    0 18px 35px rgba(76, 51, 27, 0.14);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: clamp(3px, 0.7vw, 5px);
  aspect-ratio: 1;
  padding: clamp(7px, 1.4vw, 11px);
  border: 1px solid rgba(82, 49, 23, 0.32);
  border-radius: 13px;
  background: rgba(91, 50, 19, 0.24);
  box-shadow:
    inset 0 8px 18px rgba(63, 34, 12, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.42);
}

.board-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(75, 54, 34, 0.14);
  border-radius: clamp(5px, 1vw, 9px);
  color: #5a4937;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.45), transparent 65%),
    #eee2c9;
  box-shadow:
    inset 0 -3px 6px rgba(99, 67, 34, 0.1),
    0 1px 2px rgba(77, 46, 20, 0.18);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.66rem, 1.8vw, 1.05rem);
  font-weight: 700;
  transition:
    background-color 180ms ease,
    transform 180ms ease,
    opacity 180ms ease;
}

.board-cell.void {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.board-cell.piece {
  border-color: color-mix(in srgb, var(--piece-color), #000 18%);
  color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 55%),
    var(--piece-color);
  box-shadow:
    inset 0 -5px 10px rgba(0, 0, 0, 0.13),
    inset 0 1px rgba(255, 255, 255, 0.28),
    0 2px 4px rgba(56, 38, 22, 0.24);
  animation: piece-in 220ms ease both;
}

@keyframes piece-in {
  from {
    opacity: 0.65;
    transform: scale(0.94);
  }
}

.cell-label {
  position: absolute;
  top: 8%;
  left: 10%;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: clamp(0.42rem, 1.05vw, 0.65rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  opacity: 0.48;
}

.piece-stamp {
  display: grid;
  width: clamp(19px, 3.7vw, 28px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.12);
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: clamp(0.46rem, 1.15vw, 0.68rem);
  font-weight: 900;
}

.board-cell.open {
  z-index: 1;
  border: 2px solid var(--green);
  color: var(--green);
  background: var(--open-month);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.6),
    0 3px 8px rgba(49, 43, 28, 0.2);
}

.board-cell.open-day {
  background: var(--open-day);
}

.open-tag {
  position: absolute;
  right: 5px;
  bottom: 4px;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: clamp(0.32rem, 0.7vw, 0.48rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-actions,
.layout-navigation,
.hint-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.board-actions {
  justify-content: space-between;
  margin-top: 18px;
}

.guide-card {
  padding: 23px;
}

.hint-card {
  color: #f8f5ed;
  border-color: rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 100% 0, rgba(88, 143, 132, 0.26), transparent 38%),
    var(--green);
}

.hint-card .step-label,
.hint-note {
  color: rgba(248, 245, 237, 0.65);
}

.hint-heading {
  margin-top: 5px;
}

.hint-heading h2 {
  margin-top: 0;
}

.hint-heading strong {
  color: #f1cf7e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 25px 0 9px;
  border-radius: 100px;
  accent-color: #efc86e;
  background: rgba(255, 255, 255, 0.22);
}

.hint-scale {
  display: flex;
  justify-content: space-between;
  color: rgba(248, 245, 237, 0.52);
  font-size: 0.65rem;
  font-weight: 700;
}

.hint-actions {
  margin-top: 22px;
}

.hint-card .secondary-button {
  flex: 1;
  border-color: rgba(255, 255, 255, 0.17);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.hint-card .secondary-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.compact-button {
  flex: 1.2;
  color: var(--green);
  background: #efc86e;
  box-shadow: none;
}

.compact-button:hover:not(:disabled) {
  background: #f7d98f;
  box-shadow: none;
}

.hint-note {
  margin: 18px 0 0;
  font-size: 0.72rem;
  line-height: 1.55;
}

.cell-total {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.piece-key {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 9px;
  margin-top: 22px;
}

.piece-key-item {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-width: 0;
}

.mini-shape {
  display: grid;
  width: 44px;
  height: 44px;
  place-content: center;
  gap: 1px;
}

.mini-cell {
  width: var(--mini-size);
  height: var(--mini-size);
  border-radius: 2px;
  background: transparent;
}

.mini-cell.filled {
  background: var(--piece-color);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.25);
}

.piece-key-item strong {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.piece-key-item span {
  color: var(--muted);
  font-size: 0.58rem;
}

.rules-card {
  padding: 0;
}

.rules-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 21px 23px;
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 700;
  list-style: none;
}

.rules-card summary::-webkit-details-marker {
  display: none;
}

.rules-card summary > span:first-child {
  display: grid;
  gap: 5px;
}

.summary-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: rgba(23, 63, 58, 0.08);
  font-family: Inter, ui-sans-serif, sans-serif;
  transition: transform 180ms ease;
}

.rules-card[open] .summary-icon {
  transform: rotate(45deg);
}

.rules-copy {
  padding: 0 23px 22px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.rules-copy p {
  margin: 0;
}

.rules-copy p + p {
  margin-top: 10px;
}

footer {
  padding: 36px 0 45px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
  text-align: center;
}

footer p {
  margin: 0;
}

footer a {
  color: var(--green);
  font-weight: 750;
}

noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  padding: 14px;
  border-radius: 10px;
  color: #fff;
  background: #8d342c;
  text-align: center;
}

@media (max-width: 940px) {
  .solver-shell {
    grid-template-columns: 1fr;
  }

  .guide-column {
    grid-template-columns: 1fr 1fr;
  }

  .rules-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    min-height: 78px;
  }

  .header-note {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 48px 4px 34px;
  }

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

  .hero-copy {
    max-width: 520px;
  }

  .date-fields {
    grid-template-columns: 1fr 0.7fr;
  }

  .date-fields .primary-button {
    grid-column: 1 / -1;
  }

  .guide-column {
    grid-template-columns: 1fr;
  }

  .rules-card {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .brand-copy .eyebrow {
    display: none;
  }

  .brand-name {
    font-size: 1.08rem;
  }

  .date-card,
  .board-card,
  .guide-card {
    border-radius: 18px;
  }

  .date-card,
  .board-card {
    padding: 19px;
  }

  .date-heading {
    align-items: flex-start;
  }

  .date-heading h2 {
    font-size: 1.3rem;
  }

  .quick-actions {
    display: grid;
  }

  .date-fields {
    grid-template-columns: 1fr 0.62fr;
  }

  .tray {
    padding: 11px;
    border-radius: 16px;
  }

  .board-grid {
    padding: 6px;
  }

  .cell-label {
    top: 5%;
    left: 7%;
  }

  .board-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .layout-navigation {
    display: grid;
    grid-template-columns: 46px 1fr;
  }

  .quiet-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
