/* Crossword fields, clue cards and direction controls share the book palette. */
.solve-surface[data-kind="crossword"][data-grid-style="open"] {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
#reader .crossword {
  grid-template-rows: repeat(var(--n), minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
}
#reader .isolated-puzzle .open-crossword {
  background: transparent;
}
#reader .crossword .input-cell {
  aspect-ratio: auto;
  border-style: solid;
  border-width: 1.2px;
  border-color: color-mix(in srgb, var(--game-accent) 55%, #aebbae);
  border-radius: 4px;
  background: var(--game-panel);
  box-shadow:
    inset 0 1px 0 #ffffffc0,
    0 2px 0 #173b2b18;
}
#reader .crossword .input-cell small {
  left: 2px;
  top: 2px;
  min-width: 10px;
  padding: 1px 2px;
  font-family: "Noto Sans", sans-serif;
  font-size: clamp(7px, calc(var(--live-cell-font) * 0.4), 12px);
  font-weight: 750;
  line-height: 1;
  color: var(--game-accent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--game-accent) 9%, white);
}
#reader .crossword .input-cell input {
  padding: calc(var(--live-cell-font) * 0.6) 1px 0;
  line-height: 1;
  caret-color: var(--game-accent);
  font-weight: 650;
}
#reader .crossword .input-cell[data-crossword-word="true"] {
  background: color-mix(in srgb, var(--game-accent) 12%, var(--game-panel));
  border-color: var(--game-accent);
}
#reader .crossword .input-cell.active {
  background: #ffedb9;
  border-color: #bf8d35;
  box-shadow:
    inset 0 0 0 1.5px #cf9c42,
    0 2px 0 #9b732940;
}
#reader .crossword .input-cell.active small {
  background: #fff7df;
  color: #79511c;
}
.crossword .blocked {
  border-radius: 3px;
}
.crossword-active-clue {
  display: grid;
  gap: 8px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--ui-line);
  border-left: 4px solid var(--game-accent);
  border-radius: 11px;
  background: linear-gradient(
    130deg,
    white,
    color-mix(in srgb, var(--game-accent) 5%, var(--book-paper))
  );
  box-shadow: 0 3px 0 #173b2b0c;
}
.crossword-clue-heading,
.crossword-clue-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.crossword-clue-heading > strong {
  font-size: 11px;
  color: var(--game-accent);
  white-space: nowrap;
}
.crossword-direction-switch {
  display: flex;
  gap: 5px;
}
#reader .crossword-direction-switch button {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 11px;
  gap: 4px;
}
.crossword-direction-switch .reader-icon {
  width: 15px;
  height: 15px;
}
.crossword-active-clue p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--game-ink);
}
[data-crossword-pattern] {
  min-width: 0;
  font:
    650 16px/1.3 "Noto Sans",
    sans-serif;
  color: var(--game-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#reader .crossword-clue-footer button {
  flex-shrink: 0;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 11px;
}
.crossword-clue-footer .reader-icon {
  width: 16px;
  height: 16px;
}
.crossword-clue-list > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  color: var(--game-ink);
  list-style: none;
}
.crossword-clue-list > summary::-webkit-details-marker {
  display: none;
}
.crossword-clue-list > summary::after {
  content: "+";
  margin-left: auto;
  font-size: 18px;
}
.crossword-clue-list[open] > summary::after {
  content: "−";
}
.crossword-clue-list > summary > span {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--reader-soft);
  font-size: 10px;
  color: var(--game-accent);
}
.crossword-clue-groups {
  display: grid;
  gap: 16px;
  padding: 7px 0;
}
.crossword-clue-group h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--game-accent);
}
.crossword-clue-group h3 .reader-icon {
  width: 14px;
  height: 14px;
}
.crossword-clue-list .clues {
  display: grid;
  columns: auto;
  gap: 7px;
  padding: 0;
  margin: 0;
}
.crossword-clue-list .clues li {
  padding: 0;
}
#reader .crossword-clue-list [data-action="crosswordClue"] {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--ui-line);
  border-radius: 9px;
  background: #fffef9;
  text-align: left;
}
#reader .crossword-clue-list [aria-current="true"] {
  border-color: var(--game-accent);
  background: color-mix(in srgb, var(--game-accent) 8%, white);
  box-shadow: inset 3px 0 0 var(--game-accent);
}
.crossword-clue-list .clue-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: var(--reader-soft);
  color: var(--game-accent);
  font-size: 12px;
  font-weight: 700;
}
.clue-copy {
  min-width: 0;
}
.clue-copy strong {
  display: block;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
}
.clue-copy small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--ui-muted);
}
@media (max-width: 900px) {
  .crossword-clue-groups {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .crossword-active-clue {
    padding: 8px;
    gap: 6px;
  }
  .crossword-active-clue p {
    font-size: 13px;
  }
  .crossword-clue-groups {
    grid-template-columns: 1fr;
  }
  #reader .crossword-direction-switch button,
  #reader .crossword-clue-footer button {
    width: 40px;
    min-height: 40px;
    padding: 6px;
  }
  .crossword-direction-switch .button-label,
  .crossword-clue-footer .button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}
