.puzzle-case {
  max-width: 67rem;
  margin: 0 auto;
  color: var(--ink);
}

.puzzle-heading {
  padding: clamp(1.75rem, 4vw, 3rem) 0 clamp(1.5rem, 3vw, 2.5rem);
  border-block: 1px solid #142a2540;
}

.puzzle-kicker,
.puzzle-meta,
.puzzle-index,
:is(.puzzle-hint, .grid-clues) > summary,
.puzzle-action,
.puzzle-word-list,
.puzzle-word-grid button,
.puzzle-matrix caption,
.puzzle-matrix th {
  font-family: var(--mono);
}

.puzzle-kicker {
  margin: 0 0 .7rem;
  color: var(--burgundy);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.puzzle-kicker span {
  margin-inline: .25em;
  color: #645849;
}

.puzzle-heading h1 {
  max-width: 19ch;
  margin: 0;
  color: var(--green);
  font-family: var(--display);
  font-size: clamp(2.65rem, 6.6vw, 5.5rem);
  font-weight: 600;
  line-height: .95;
}

.puzzle-standfirst {
  max-width: 39rem;
  margin: 1.1rem 0 1.25rem;
  color: #413a31;
  font-size: clamp(1.06rem, 2.2vw, 1.35rem);
  line-height: 1.45;
}

.puzzle-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.puzzle-meta li {
  padding: .3rem .65rem;
  border: 1px solid #142a2540;
  color: var(--green);
  font-size: .74rem;
}

.puzzle-brief {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(12rem, 1fr);
  align-items: start;
  gap: clamp(1.25rem, 4vw, 3rem);
  padding-block: clamp(1.5rem, 4vw, 2.5rem);
}

.puzzle-case h2,
.puzzle-workbench legend {
  margin: 0 0 .75rem;
  color: var(--green);
  font-family: var(--display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 650;
  line-height: 1.03;
}

.puzzle-story p,
.puzzle-evidence p,
.puzzle-workbench > p {
  max-width: 65ch;
  margin: .6rem 0 0;
  line-height: 1.55;
}

.puzzle-hint {
  border: 1px solid #8a7047;
  background: #c7ac7926;
}

:is(.puzzle-hint, .grid-clues) > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .7rem .9rem;
  color: var(--green);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  list-style: none;
}

:is(.puzzle-hint, .grid-clues) > summary::-webkit-details-marker {
  display: none;
}

:is(.puzzle-hint, .grid-clues) > summary::after {
  width: .42rem;
  height: .42rem;
  margin: 0 .15rem .18rem 0;
  transform: rotate(45deg);
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  content: "";
}

:is(.puzzle-hint, .grid-clues)[open] > summary::after {
  margin-block: .16rem 0;
  transform: rotate(225deg);
}

.puzzle-hint p {
  padding: 0 .9rem .9rem;
  margin: 0;
  font-size: .9rem;
  line-height: 1.45;
}

.puzzle-file {
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.puzzle-evidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.puzzle-evidence li {
  padding: clamp(.85rem, 2.5vw, 1.35rem);
  border: 1px solid #142a2540;
  border-top-color: #a08758;
  background: #faf5e785;
}

.puzzle-index {
  float: right;
  margin: .2rem 0 .1rem .5rem;
  color: var(--burgundy);
  font-size: .75rem;
}

.puzzle-evidence h3 {
  margin: 0;
  color: var(--green);
  font-family: var(--display);
  font-size: clamp(1.45rem, 3vw, 1.8rem);
  font-weight: 700;
  line-height: 1.1;
}

.puzzle-workbench {
  padding: clamp(1rem, 3.5vw, 2.25rem);
  border: 1px solid #8a7047;
  background: #f7efdf;
}

.puzzle-workbench fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0;
}

.puzzle-workbench legend {
  padding: 0;
}

.puzzle-suspects {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
  margin: 0 0 1rem;
}

.puzzle-suspect {
  display: flex;
  min-height: 55px;
  align-items: center;
  gap: .65rem;
  padding: .65rem .7rem;
  border: 1px solid #142a2550;
  background: var(--paper);
  color: var(--green);
  cursor: pointer;
  line-height: 1.25;
}

.puzzle-suspect:has(:checked) {
  border-color: var(--green);
  background: #dfe3d1;
  box-shadow: inset 0 0 0 1px var(--green);
}

.puzzle-suspect small {
  display: block;
  margin-top: .14rem;
  color: #51483c;
  font-size: .76rem;
}

.puzzle-profile {
  display: grid;
  gap: .1rem;
  margin-top: .45rem;
  font: 400 .75rem/1.45 var(--mono);
  color: #51483c;
}

.puzzle-profile > span::first-letter {
  text-transform: uppercase;
}

.puzzle-suspect input {
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--green);
}

.puzzle-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: .55rem .95rem;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff6e2;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  text-align: center;
}

.puzzle-action:hover {
  background: #244238;
}

.puzzle-action--secondary {
  background: transparent;
  color: var(--green);
}

.puzzle-action--secondary:hover {
  background: #e7deca;
}

.puzzle-case :where(summary, button, input):focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 3px;
}

.puzzle-workbench .puzzle-feedback:empty {
  margin: 0;
}

.puzzle-workbench .puzzle-feedback:not(:empty) {
  padding: .65rem .8rem;
  border-left: 3px solid #8a7047;
  margin: .9rem 0 0;
  background: #eee5d3;
}

.puzzle-workbench .puzzle-feedback[data-kind="retry"] {
  border-color: var(--burgundy);
  background: #f1ded8;
  color: #52242b;
}

.puzzle-workbench .puzzle-feedback[data-kind="success"] {
  border-color: var(--green);
  background: #dfe3d1;
  color: var(--green);
}

.grid-clues {
  position: sticky;
  z-index: 1;
  top: max(.5rem, env(safe-area-inset-top));
  margin-block: 1rem .6rem;
  border: 1px solid #8a7047;
  background: #eee1c8;
  box-shadow: 0 2px 6px #191c1e19;
}


.grid-clue-panel {
  position: absolute;
  inset: 100% -1px auto;
  box-sizing: border-box;
  max-height: min(26rem, 50dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(.8rem, 2vw, 1.35rem);
  border: 1px solid #8a7047;
  background: #f7efdf;
  box-shadow: 0 10px 24px #191c1e29;
}

.grid-clue-panel:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: -3px;
}

.grid-clue-panel h3 {
  margin: 0 0 .65rem;
  color: var(--green);
}

.grid-clue-panel .puzzle-statements {
  max-width: none;
}

.grid-clue-panel .puzzle-hint {
  margin-top: .75rem;
}

.puzzle-statements {
  max-width: 50rem;
  padding: .55rem 1rem .55rem 2.2rem;
  border-left: 1px solid #8a7047;
  margin: 0;
  background: #faf5e785;
  line-height: 1.55;
}

.puzzle-statements li {
  padding: .32rem 0 .32rem .12rem;
}

.puzzle-statements li::marker {
  color: var(--burgundy);
  font-family: var(--mono);
  font-size: .82em;
}

.puzzle-workbench kbd {
  padding: 0 .18em;
  border: 1px solid #142a2540;
  background: #eee5d3;
  font-family: var(--mono);
  font-size: .82em;
}

.puzzle-matrices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.25rem), 1fr));
  gap: 1rem;
  margin-block: 1.1rem;
}

.puzzle-matrix {
  width: 100%;
  border-spacing: 2px;
  table-layout: fixed;
}

.puzzle-matrix caption {
  padding: .34rem;
  background: var(--green);
  color: #fff6e2;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-align: center;
  text-transform: uppercase;
}

.puzzle-matrix th {
  padding: .15rem .1rem;
  color: var(--green);
  font-size: clamp(.6rem, 1.15vw, .72rem);
  font-weight: 600;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.puzzle-matrix tbody th {
  text-align: left;
}

.puzzle-matrix td {
  padding: 0;
}

.puzzle-matrix button,
.puzzle-word-grid button {
  display: grid;
  width: 100%;
  place-items: center;
  padding: 0;
  border: 1px solid #142a2550;
  background: var(--paper);
  color: var(--green);
  cursor: pointer;
  line-height: 1;
}

.puzzle-matrix button {
  min-height: 42px;
  font-size: 1.18rem;
  font-weight: 700;
}

.puzzle-matrix button:hover,
.puzzle-word-grid button:hover {
  border-color: var(--green);
  filter: brightness(.95);
}

.puzzle-matrix button[data-mark="no"] {
  background: #f1ded8;
  color: var(--burgundy);
}

.puzzle-matrix button[data-mark="yes"],
.puzzle-word-grid button[data-found="true"] {
  background: var(--green);
  color: #fff6e2;
}

.puzzle-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.puzzle-word-layout {
  display: grid;
  grid-template-columns: minmax(0, 29rem) minmax(10rem, 1fr);
  align-items: start;
  gap: 1.2rem;
  margin-block: 1.15rem;
}

.puzzle-word-grid {
  width: 100%;
  max-width: calc(3rem * var(--word-columns));
  border-spacing: 2px;
  table-layout: fixed;
}

.puzzle-word-grid td {
  padding: 0;
}

.puzzle-word-grid button {
  aspect-ratio: 1;
  font-size: clamp(.8rem, 2.7vw, 1rem);
  font-weight: 600;
}

.puzzle-word-grid button[aria-pressed="true"] {
  border-color: var(--burgundy);
  background: var(--burgundy);
  color: #fff6e2;
}

.puzzle-word-list {
  padding: .75rem .9rem;
  border: 1px solid #142a2550;
  background: var(--paper);
  font-size: .8rem;
}

.puzzle-word-count {
  padding-bottom: .55rem;
  border-bottom: 1px solid #142a2540;
  margin: 0 0 .4rem;
  color: var(--burgundy);
  font-weight: 600;
}

.puzzle-word-list ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.puzzle-word-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  padding: .18em 0;
}

.puzzle-word-list li[data-found="true"] > span:first-child {
  text-decoration: line-through;
}

.puzzle-word-list [data-found-label] {
  color: #465143;
  font-size: .67rem;
}

@media (max-width: 49rem) {
  .puzzle-suspects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 35rem) {
  .puzzle-brief,
  .puzzle-word-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: .8rem;
  }

  .puzzle-word-list ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: .9rem;
  }
}

@media (max-width: 29rem) {
  .puzzle-evidence {
    grid-template-columns: minmax(0, 1fr);
  }

  .puzzle-suspect {
    gap: .4rem;
    padding-inline: .45rem;
  }
}
