:root {
  color-scheme: light;
  --paper: #f5f0e5;
  --white: #fffcf5;
  --ink: #22263d;
  --muted: #625e68;
  --line: #d7cebe;
  --brick: #a63d2b;
  --brick-dark: #843020;
  --yellow: #edbe55;
  --cream: #f6e8bd;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid var(--brick); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }

.page { width: min(100% - 6rem, 73rem); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font: bold 1.32rem/1 var(--serif);
  letter-spacing: -.025em;
  text-decoration: none;
}
.wordmark-period { color: var(--brick); margin-left: -.55rem; }
.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 1.55rem;
  height: 1.55rem;
  padding: .18rem;
  gap: .12rem;
  border-radius: .18rem;
  background: var(--ink);
}
.brand-mark i:not(:nth-child(2)) { background: var(--paper); border-radius: .04rem; }
.brand-mark i:nth-child(3) { background: var(--yellow); }
.nav-link {
  color: var(--ink);
  font-size: .9rem;
  font-weight: 650;
  text-underline-offset: .28em;
}
.nav-link { text-decoration: none; }
.nav-link:hover { color: var(--brick); text-decoration: underline; }
.site-nav { display: flex; align-items: baseline; gap: clamp(.55rem, 3vw, 1.65rem); }
.site-nav .nav-link { white-space: nowrap; }

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: 32rem;
  padding-block: 4rem 4.2rem;
}
.hero-copy { position: relative; z-index: 1; }
.hero h1 {
  font: bold clamp(4rem, 7vw, 7.15rem)/.87 var(--serif);
  letter-spacing: -.077em;
}
.hero h1 em { color: var(--brick); font-weight: normal; }
.hero-copy p { margin-top: 1.7rem; color: var(--muted); line-height: 1.5; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.85rem;
  padding: .65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: .35rem;
  font-size: .95rem;
  font-weight: 680;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--brick); color: var(--white); }
.button-primary:hover { background: var(--brick-dark); }
.button-outline { border-color: var(--line); background: var(--white); }
.button-outline:hover { border-color: var(--brick); color: var(--brick-dark); }
.hero-links { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.35rem; }

.hero-art {
  position: relative;
  width: min(100%, 33.5rem);
  aspect-ratio: 1.24;
  justify-self: center;
  user-select: none;
}
.hero-sun {
  position: absolute;
  width: 64%;
  aspect-ratio: 1;
  background: var(--yellow);
  border-radius: 50%;
  right: 12%;
  top: 5%;
}
.hero-paper {
  position: absolute;
  top: 12%;
  left: 13%;
  width: 65%;
  aspect-ratio: 1;
  padding: 3.2%;
  border: 1px solid var(--ink);
  border-radius: .28rem;
  background: var(--white);
  box-shadow: .48rem .6rem 0 var(--ink);
  transform: rotate(-10deg);
}
.hero-board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 1px;
  padding: 1px;
  background: var(--ink);
}
.hero-board span {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--white);
  font: bold clamp(.6rem, 2.6vw, 1.9rem)/1 var(--serif);
}
.hero-board .hero-def {
  padding: .18em;
  background: #e2e4e6;
  font: 680 clamp(.44rem, 1.15vw, .75rem)/1 var(--sans);
  text-align: center;
}
.hero-def-sketch i { width: 52%; height: 1px; background: #727887; box-shadow: 0 3px #727887; }
.hero-board .hero-crossing { background: var(--cream); }
.hero-board .hero-highlight { background: #eab49c; }
.hero-pencil {
  position: absolute;
  width: 40%;
  height: 5%;
  bottom: 17%;
  right: 1.5%;
  transform: rotate(-33deg);
  border: 1px solid var(--ink);
  border-right-width: .27rem;
  border-radius: 0 .36rem .36rem 0;
  background: linear-gradient(90deg, var(--brick) 0 81%, #dcccaa 81% 88%, #cd7056 88%);
  box-shadow: inset 0 -.19rem #722a22;
}
.hero-pencil::before {
  content: '';
  position: absolute;
  width: 12%;
  height: calc(100% + 2px);
  right: 100%;
  top: -1px;
  background: linear-gradient(90deg, var(--ink) 0 27%, #cdad79 27%);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.hero-sparkle {
  position: absolute;
  width: 11%;
  aspect-ratio: 1;
  top: 1%;
  right: 3%;
  background: var(--brick);
  clip-path: polygon(50% 0, 59% 38%, 100% 50%, 59% 60%, 50% 100%, 40% 60%, 0 50%, 40% 39%);
}

.catalogue { border-top: 1px solid var(--line); padding-block: 1.7rem 4.5rem; scroll-margin-top: 1.2rem; }
.section-header {
  margin-bottom: 1.3rem;
}
.section-header h2 { font: bold clamp(2.15rem, 4vw, 3.2rem)/1 var(--serif); letter-spacing: -.06em; }
.catalogue-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.catalogue-list li { display: flex; }
.puzzle-card {
  display: grid;
  grid-template-columns: 4.9rem 1fr .45rem;
  align-items: center;
  gap: .85rem;
  width: 100%;
  min-height: 7.05rem;
  padding: .85rem .95rem .85rem .85rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: .38rem;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.puzzle-card:hover { border-color: #b7a593; box-shadow: 0 .18rem .3rem #22263d12; background: #fffdf9; }
.puzzle-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: .25rem;
  background: #f5d6a1;
}
[data-tone="1"] .puzzle-preview { background: #c9dde3; }
[data-tone="2"] .puzzle-preview { background: #d4dfcb; }
[data-tone="3"] .puzzle-preview { background: #edccbf; }
[data-tone="4"] .puzzle-preview { background: #dfd6ea; }
.mini-grid {
  display: grid;
  width: 53%;
  aspect-ratio: var(--columns) / var(--rows);
  grid-template-columns: repeat(var(--columns), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  gap: .42px;
  padding: .65px;
  background: var(--ink);
}
.mini-letter { background: #fffaf0; }
.mini-clue { background: #bdc3ca; }
.puzzle-copy { display: grid; min-width: 0; gap: .15rem; }
.puzzle-copy strong {
  font: bold clamp(1.05rem, 2vw, 1.34rem)/1.08 var(--serif);
  letter-spacing: -.032em;
}
.puzzle-theme { color: var(--muted); font-size: .875rem; line-height: 1.3; }
.puzzle-status { color: var(--muted); font-size: .79rem; margin-top: .22rem; }
.has-progress { color: var(--brick-dark); font-weight: 680; }
.chevron {
  display: block;
  width: .43rem;
  height: .43rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
}

.game-page { max-width: 65rem; padding-block: 1.6rem 3.2rem; }
.game-header { margin-bottom: 1.4rem; }
.game-header h1 {
  font: bold clamp(2.65rem, 5.6vw, 4.25rem)/.98 var(--serif);
  letter-spacing: -.063em;
}
.game-header p { color: var(--muted); margin-top: .55rem; }
.game-share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  margin-top: .75rem;
}
.game-share input {
  width: min(100%, 22rem);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: .25rem;
  padding: .6rem;
  color: var(--ink);
  background: var(--white);
}
.game-share span { color: var(--muted); font-size: .85rem; }
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 35rem) minmax(15rem, 1fr);
  gap: clamp(1.3rem, 3.9vw, 3rem);
  align-items: start;
}
.game-sidebar {
  position: sticky;
  top: 1.2rem;
  display: grid;
  gap: 1rem;
}
.active-clue {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
  align-items: stretch;
  min-height: 4.4rem;
  border: 1px solid #d6bd82;
  border-radius: .35rem;
  background: var(--cream);
}
.clue-step {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: .27rem;
  background: transparent;
  cursor: pointer;
}
.clue-step:hover { background: #e4c988; }
.clue-step:focus-visible { outline-offset: -3px; }
.previous .chevron { transform: rotate(135deg); }
.active-clue-copy { display: grid; gap: .1rem; align-content: center; padding-block: .48rem; }
.active-clue-copy strong { font-size: .8rem; color: var(--brick-dark); }
.active-clue-copy span { font-size: 1rem; line-height: 1.35; font-weight: 580; }
.board {
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 1px;
  aspect-ratio: var(--columns) / var(--rows);
  position: relative;
  padding: 1px;
  border-radius: .2rem;
  background: var(--ink);
  user-select: none;
  touch-action: manipulation;
  container-type: inline-size;
}
.cell {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--white);
  cursor: text;
  -webkit-tap-highlight-color: transparent;
}
.cell.bar-right::after, .cell.bar-below::before {
  content: '';
  position: absolute;
  z-index: 1;
  pointer-events: none;
}
.cell.bar-right::after { inset: 0 -1px 0 auto; width: 2px; background: var(--ink); }
.cell.bar-below::before { inset: auto 0 -1px; height: 2px; background: var(--ink); }
.cell b {
  font-size: clamp(.85rem, 5cqi, 1.62rem);
  line-height: 1;
  font-weight: 680;
}
.cell.in-word { background: #f7e8ba; }
.cell.selected { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--ink); }
.cell.wrong b { color: #962819; }
.cell.wrong { background: #f3c4b8; }
.cell.wrong.selected { box-shadow: inset 0 0 0 2px #962819; }
.clue-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #e2e4e6;
}
.clue-button {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding: 1px 2px;
  border: 0;
  background: transparent;
  font-size: clamp(.39rem, 1.69cqi, .63rem);
  font-weight: 650;
  line-height: 1.06;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.clue-button:hover { background: #ced3d7; }
.clue-button[aria-current="true"] { background: var(--yellow); }
.clue-button:focus-visible { outline-offset: -2px; }
.clue-button + .clue-button { border-top: 1px solid #22263d77; }
.clue-caption {
  display: -webkit-box;
  overflow: hidden;
  hyphens: auto;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.clue-arrow {
  flex-shrink: 0;
  font-size: clamp(.49rem, 2.3cqi, .86rem);
  font-weight: 850;
  line-height: .9;
}
.clue-button[data-arrow="across"] .clue-arrow,
.clue-button[data-arrow="right-down"] .clue-arrow { align-self: end; }
.clue-button[data-arrow="left-down"] .clue-arrow { align-self: start; }
.clue-cell:has(.clue-button + .clue-button) .clue-button { flex-direction: row; gap: 1px; }
.clue-cell:has(.clue-button + .clue-button) .clue-caption { -webkit-line-clamp: 2; line-clamp: 2; }
.clue-cell:has(.clue-button + .clue-button) .clue-arrow { align-self: center; }
.letter-input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  font-size: 1rem;
  opacity: 0;
  pointer-events: none;
}
.board:has(.letter-input:focus-visible) .cell.selected { outline: 2px solid var(--brick-dark); outline-offset: -3px; }

.play-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .45rem .8rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--white);
}
.progress-group { flex: 1; max-width: 15rem; min-width: 7rem; padding-top: .1rem; }
.progress-group label { display: flex; flex-wrap: wrap; column-gap: .27rem; align-items: baseline; }
.progress-group strong { font: bold 1.25rem/1.15 var(--serif); }
.progress-group label span { font-size: .84rem; color: var(--muted); }
progress {
  display: block;
  width: 100%;
  height: .45rem;
  margin-top: .44rem;
  overflow: hidden;
  border: 0;
  border-radius: 2rem;
  background: #ded5c7;
  color: var(--brick);
  accent-color: var(--brick);
}
progress::-webkit-progress-bar { background: #ded5c7; }
progress::-webkit-progress-value { background: var(--brick); }
progress::-moz-progress-bar { background: var(--brick); }
.check-group { text-align: center; }
.check-button { width: 100%; background: var(--ink); color: var(--white); }
.check-button:hover:not([aria-disabled="true"]) { background: #393e58; }
.check-button[aria-disabled="true"] { border-color: var(--line); background: transparent; color: var(--muted); cursor: default; }
.check-group p { font-size: .79rem; color: var(--muted); margin-top: .28rem; }
.game-feedback {
  grid-column: 1 / -1;
  font-size: .9rem;
  color: var(--brick-dark);
  font-weight: 640;
}
.play-tip { color: var(--muted); font-size: .92rem; line-height: 1.45; }

.factory-page { max-width: 65rem; padding-block: 3.2rem 4rem; }
.factory-header { margin-bottom: 1.65rem; }
.factory-header h1 {
  font: bold clamp(2.7rem, 6vw, 5rem)/.97 var(--serif);
  letter-spacing: -.06em;
}
.factory-header p { margin-top: .65rem; line-height: 1.5; color: var(--muted); }
.factory-layout {
  display: grid;
  grid-template-columns: minmax(0, 29rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 5vw, 4rem);
  align-items: start;
}
.factory-form, .install-panel, .factory-loading {
  padding: clamp(1rem, 4vw, 1.65rem);
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--white);
}
.factory-form fieldset { display: grid; gap: .55rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.factory-form legend, .factory-history h2, .install-instructions h2 {
  padding: 0;
  font: bold 1.6rem/1.1 var(--serif);
  letter-spacing: -.025em;
}
.factory-form legend { margin-bottom: .85rem; }
.factory-level {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .72rem;
  border: 1px solid var(--line);
  border-radius: .3rem;
  cursor: pointer;
}
.factory-level:has(input:checked) { border-color: #b48b39; background: var(--cream); }
.factory-level input { margin-top: .25rem; accent-color: var(--brick); }
.factory-level small { display: block; margin-top: .15rem; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.factory-form > .button { margin-top: 1rem; }
.factory-history h2 { margin-bottom: .65rem; }
.factory-history p, .install-panel p { color: var(--muted); line-height: 1.55; }
.factory-history ul { margin: 0; padding: 0; list-style: none; }
.factory-history li { border-top: 1px solid var(--line); }
.factory-history li:last-child { border-bottom: 1px solid var(--line); }
.factory-history a {
  display: flex;
  justify-content: space-between;
  gap: .65rem;
  align-items: center;
  min-height: 2.85rem;
  padding: .45rem .1rem;
  font-weight: 650;
  text-decoration: none;
}
.factory-history a span + span { color: var(--brick-dark); font-size: .85rem; }
.factory-history a:hover { color: var(--brick); }
.factory-credits { margin-top: 1.65rem; font-size: .88rem; color: var(--muted); }
.factory-credits summary { width: fit-content; cursor: pointer; }
.factory-credits p { max-width: 38rem; margin-top: .55rem; line-height: 1.5; }
.install-link { display: inline-block; margin-top: 1.45rem; color: var(--brick-dark); text-underline-offset: .2em; }
.factory-loading, .install-panel { display: grid; gap: .9rem; max-width: 42rem; }
.factory-loading .button, .install-panel .button { justify-self: start; }
.factory-loading a { width: fit-content; color: var(--brick-dark); }
.factory-error { margin: 0 0 1rem; color: var(--brick-dark); font-weight: 650; }
.install-panel #offline-status { color: var(--ink); font-weight: 700; }
.install-instructions { display: grid; gap: .5rem; border-top: 1px solid var(--line); padding-top: .95rem; }
.install-instructions p + h2 { margin-top: .35rem; }
#share-link[hidden], #install-app[hidden] { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 66rem) {
  .page { width: min(100% - 3.5rem, 73rem); }
  .catalogue-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { min-height: 28rem; }
}

@media (max-width: 47rem) {
  .page { width: calc(100% - 2rem); }
  .masthead-inner { min-height: 3.55rem; }
  .hero { grid-template-columns: 1.1fr .9fr; min-height: 0; padding-block: 2.75rem 2.4rem; }
  .hero h1 { font-size: clamp(2.75rem, 9.2vw, 4.55rem); }
  .hero-copy p { font-size: .94rem; margin-top: 1.2rem; }
  .hero-links { margin-top: 1.05rem; }
  .factory-page { padding-block: 2rem 2.75rem; }
  .factory-layout { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .puzzle-card { grid-template-columns: 3.75rem 1fr .4rem; gap: .62rem; padding: .65rem; }
  .game-page { max-width: 30rem; padding-top: .85rem; }
  .game-header { margin-bottom: .95rem; }
  .game-header p { margin-top: .35rem; font-size: .91rem; }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: .55rem; }
  .game-sidebar { display: contents; }
  .active-clue { grid-row: 1; position: sticky; top: .35rem; z-index: 3; min-height: 3.8rem; }
  .board { grid-row: 2; }
  .play-tools { grid-row: 3; padding: .68rem; }
  .play-tip { grid-row: 4; }
}

@media (max-width: 34rem) {
  .masthead-inner { gap: .5rem; }
  .site-nav .nav-link { font-size: .83rem; }
  .hero {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.6rem;
    padding-block: 2.05rem 1.85rem;
  }
  .hero h1 { font-size: clamp(2.85rem, 11.6vw, 4rem); }
  .hero-art { width: min(77%, 18rem); }
  .hero-board span { font-size: clamp(.62rem, 3.8vw, 1.05rem); }
  .catalogue { padding-block: 1.35rem 2.4rem; }
  .section-header { margin-bottom: .95rem; }
  .catalogue-list { grid-template-columns: minmax(0, 1fr); gap: .58rem; }
  .puzzle-card { grid-template-columns: 4rem 1fr .4rem; min-height: 5.4rem; padding-inline: .62rem .85rem; gap: .75rem; }
  .puzzle-copy strong { font-size: 1.22rem; }
}

@media (max-width: 23rem) {
  .wordmark { gap: .38rem; font-size: 1.05rem; }
  .wordmark-period { margin-left: -.38rem; }
  .brand-mark { width: 1.25rem; height: 1.25rem; }
  .site-nav .nav-link { font-size: .79rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
