/*
 * Styles for the Cryptic Crossword app. Colors are defined once as custom properties and switched automatically by prefers-color-scheme; there is no theme control.
 */

:root {
  color-scheme: light dark;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eeebe3;
  --text: #1c1d21;
  --muted: #5d6068;
  --border: #d9d4c8;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --accent-soft: #e2e9fb;
  --grid-line: #1c1d21;
  --block: #1c1d21;
  --cell: #ffffff;
  --cell-text: #15161a;
  --word: #cddcff;
  --cursor: #ffd84d;
  --correct: #1b63c9;
  --incorrect: #cf3222;
  --revealed: #e06b00;
  --bar: #1c1d21;
  --success: #17703f;
  --success-soft: #dcf2e4;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgb(0 0 0 / 8%), 0 6px 20px rgb(0 0 0 / 10%);
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --type-substitution: #2f5bd3;
  --type-anagram: #8a3fd1;
  --type-container: #0e8a7e;
  --type-hidden: #2e8b3a;
  --type-reversal: #d26a00;
  --type-deletion: #b33a5e;
  --type-selection: #7a6a00;
  --type-homophone: #c2410c;
  --type-charade: #4b5563;
  --type-other: #6b4fa3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --surface: #1e2126;
    --surface-2: #272b32;
    --text: #e9e7e3;
    --muted: #a4a8b0;
    --border: #363b44;
    --accent: #86a8ff;
    --accent-text: #0e1320;
    --accent-soft: #24304d;
    --grid-line: #08090b;
    --block: #08090b;
    --cell: #2b2f37;
    --cell-text: #f2f0eb;
    --word: #2c4373;
    --cursor: #8a6c10;
    --correct: #86b1ff;
    --incorrect: #ff8172;
    --revealed: #ffa75c;
    --bar: #d6d3cc;
    --success: #7fd9a2;
    --success-soft: #183626;
    --danger: #ff8a80;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 28px rgb(0 0 0 / 45%);
    --type-substitution: #86a8ff;
    --type-anagram: #c79bff;
    --type-container: #4fd1c1;
    --type-hidden: #7ad687;
    --type-reversal: #ffad5c;
    --type-deletion: #ff8fb1;
    --type-selection: #e1cf5a;
    --type-homophone: #ff9a6b;
    --type-charade: #b4bcc8;
    --type-other: #b9a2ee;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--sans);
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
}

code {
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1.3em;
  height: 1.3em;
  fill: currentColor;
  flex: none;
}

.noscript {
  padding: 1rem;
}

/* Buttons */

.primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  cursor: pointer;
}

.primary:hover {
  filter: brightness(1.08);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover {
  background: var(--surface-2);
}

/* App bar */

.app-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: max(0.4rem, env(safe-area-inset-top)) max(0.6rem, env(safe-area-inset-right)) 0.4rem
    max(0.6rem, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-bar .title {
  flex: 1;
  min-width: 0;
  padding-left: 0.2rem;
}

.app-bar h1 {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.byline {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.byline:empty {
  display: none;
}

.tools {
  display: flex;
  gap: 0.3rem;
}

@media (max-width: 480px) {
  .app-bar h1 {
    font-size: 0.95rem;
  }

  .app-bar .title {
    min-width: 4.5rem;
  }

  .byline {
    display: none;
  }

  .tools {
    gap: 0.2rem;
  }

  .menu-button {
    padding: 0.3rem 0.1rem 0.3rem 0.55rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 400px) {
  .app-bar .icon-button {
    width: 2.2rem;
  }

  .menu-button {
    padding: 0.3rem 0.5rem;
  }

  .menu-button .icon {
    display: none;
  }
}

/* Menus */

.menu {
  position: relative;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 0.3rem 0.3rem 0.3rem 0.7rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.menu-button .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.menu-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 20;
  display: grid;
  min-width: 8.5rem;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.menu-list button {
  border: none;
  background: none;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.menu-list button:hover,
.menu-list button:focus-visible {
  background: var(--accent-soft);
}

/* Puzzle layout. The solving screen always fits the part of the screen that is visible, above an on-screen keyboard too. On phones the grid, the clue bar and the clue lists are stacked; on wide or short screens the clue lists sit beside the grid. The grid takes as much of its space as it can. */

.puzzle-view {
  container: puzzle / size;
  position: fixed;
  inset: 0 0 auto;
  display: flex;
  flex-direction: column;
  height: var(--viewport-height, 100dvh);
  transform: translateY(var(--viewport-top, 0px));
}

.puzzle-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.board {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem max(0.75rem, env(safe-area-inset-right)) 0.5rem
    max(0.75rem, env(safe-area-inset-left));
}

.grid-wrap {
  container-type: size;
  flex: 0 1 auto;
  width: 100%;
  max-width: 44rem;
  min-height: 5rem;
  aspect-ratio: var(--grid-width) / var(--grid-height);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.grid-frame {
  position: relative;
  width: min(100cqw, 100cqh * var(--grid-width) / var(--grid-height));
  aspect-ratio: var(--grid-width) / var(--grid-height);
  margin: 0 auto;
}

svg.grid {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* The hidden field that receives typing sits over the selected cell, so that browsers keep that cell in view. Its font size must be at least 16px, or Safari on iOS zooms in when it gains focus. */
.grid-input {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  opacity: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  pointer-events: none;
}

.clue-bar {
  order: 2;
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  width: 100%;
  max-width: 44rem;
  min-height: 3.4rem;
  padding: 0.2rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.clue-bar-text {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  text-align: left;
  padding: 0.3rem 0.4rem;
  font: 1.02rem/1.35 var(--serif);
  cursor: pointer;
}

.clue-bar-label {
  margin-right: 0.45rem;
  font: 700 0.85rem var(--sans);
  color: var(--accent);
}

.solved-banner {
  order: 3;
  flex: none;
  width: 100%;
  max-width: 44rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  background: var(--success-soft);
  color: var(--success);
}

.clue-panel {
  container: clues / inline-size;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.clue-lists {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 max(0.75rem, env(safe-area-inset-right)) 1rem max(0.75rem, env(safe-area-inset-left));
}

.clue-list h2 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0.75rem 0 0.25rem;
  padding: 0.3rem 0;
  background: var(--bg);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.clue-list-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.clue-item {
  display: flex;
  align-items: flex-start;
  border-left: 4px solid transparent;
  border-radius: 8px;
}

.clue-item.current {
  background: var(--word);
}

.clue-item.crossing {
  border-left-color: var(--word);
}

.clue {
  flex: 1;
  display: flex;
  gap: 0.55rem;
  border: none;
  background: none;
  text-align: left;
  padding: 0.45rem 0.4rem;
  font: 1rem/1.4 var(--serif);
  cursor: pointer;
}

.clue-number {
  min-width: 1.7rem;
  text-align: right;
  font: 700 0.88rem/1.6 var(--sans);
}

.clue-body {
  flex: 1;
  min-width: 0;
}

.clue-item.filled .clue-text {
  color: var(--muted);
}

.enumeration {
  white-space: nowrap;
  font: 0.85em var(--sans);
  color: var(--muted);
}

.explore-button {
  color: var(--accent);
}

.puzzle-notes {
  margin: 1rem 0;
  color: var(--muted);
}

.puzzle-notes summary {
  cursor: pointer;
}

.credits {
  font-size: 0.85rem;
}

/* Across and Down side by side, each scrolling on its own, when there is room */

@container clues (min-width: 34rem) {
  .clue-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0 1.5rem;
    overflow: hidden;
    padding-top: 0.25rem;
    padding-bottom: 0;
  }

  .clue-list {
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 1rem;
  }

  .puzzle-notes {
    grid-column: 1 / -1;
    margin: 0.5rem 0 1rem;
  }
}

/* Clue lists beside the grid on wide screens and on short ones such as phones on their side */

@container puzzle (min-width: 860px) or ((min-width: 560px) and (max-height: 560px)) {
  .puzzle-main {
    flex-direction: row;
  }

  .board {
    flex: none;
    width: min(58cqw, 100cqh - 6rem);
    padding: 1rem 1.25rem;
  }

  .grid-wrap {
    flex: 1 1 0;
    max-width: none;
    aspect-ratio: auto;
  }

  .clue-bar,
  .solved-banner {
    order: 0;
  }
}

/* On short screens the grid takes the full height, with the clue bar above the clue lists */

@container puzzle (min-width: 560px) and (max-height: 560px) {
  .puzzle-main {
    display: grid;
    grid-template-columns: min(55cqw, 100cqh - 3rem) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .board {
    display: contents;
  }

  .grid-wrap {
    grid-column: 1;
    grid-row: 1 / -1;
    width: auto;
    max-width: none;
    min-height: 0;
    aspect-ratio: auto;
    margin: 0.4rem 0.6rem 0.4rem max(0.6rem, env(safe-area-inset-left));
  }

  .clue-bar,
  .solved-banner {
    grid-column: 2;
    width: auto;
    max-width: none;
    margin: 0.4rem max(0.75rem, env(safe-area-inset-right)) 0 0;
  }

  .clue-bar {
    grid-row: 1;
    min-height: 2.6rem;
  }

  .solved-banner {
    grid-row: 2;
  }

  .clue-panel {
    grid-column: 2;
    grid-row: 3;
  }
}

@container puzzle (max-height: 640px) {
  .clue-bar-text {
    font-size: 0.95rem;
  }
}

/* With an on-screen keyboard open on a phone held upright, the grid needs every row of pixels: the app bar comes back when the keyboard goes away. */

@media (hover: none) and (pointer: coarse) {
  @container puzzle (max-width: 559px) and (min-aspect-ratio: 4 / 5) {
    .app-bar {
      display: none;
    }

    .clue-bar {
      min-height: 3rem;
    }
  }

  .toast {
    top: calc(env(safe-area-inset-top) + 4rem);
    bottom: auto;
  }
}

/* Grid drawing */

svg.grid .cell {
  cursor: pointer;
}

svg.grid .cell-bg {
  fill: var(--cell-color, var(--cell));
  stroke: var(--grid-line);
  stroke-width: 1;
}

svg.grid .block {
  fill: var(--block);
  stroke: var(--grid-line);
  stroke-width: 1;
}

svg.grid .highlighted .cell-bg {
  fill: color-mix(in srgb, var(--cell) 65%, var(--cursor));
}

svg.grid .in-word .cell-bg {
  fill: var(--word);
}

svg.grid .selected .cell-bg {
  fill: var(--cursor);
}

svg.grid .number {
  font: 600 12px var(--sans);
  fill: var(--cell-text);
  pointer-events: none;
}

svg.grid .entry {
  font: 600 23px var(--sans);
  fill: var(--cell-text);
  text-anchor: middle;
  pointer-events: none;
}

svg.grid .entry.rebus {
  font-size: 11px;
}

svg.grid .circle {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  pointer-events: none;
}

svg.grid .reveal-mark,
svg.grid .wrong-mark {
  display: none;
  pointer-events: none;
}

svg.grid .revealed .reveal-mark {
  display: inline;
  fill: var(--revealed);
}

svg.grid .incorrect .wrong-mark {
  display: inline;
  stroke: var(--incorrect);
  stroke-width: 2;
}

svg.grid .incorrect .entry {
  fill: var(--incorrect);
}

svg.grid .correct .entry {
  fill: var(--correct);
}

svg.grid .bar {
  stroke: var(--bar);
  stroke-width: 4;
  stroke-linecap: square;
}

svg.grid .word-break {
  stroke: var(--grid-line);
  stroke-width: 3.5;
}

svg.grid .hyphen {
  stroke: var(--grid-line);
  stroke-width: 3;
}

/* Clue explorer */

dialog.explorer {
  width: min(40rem, calc(100vw - 2rem));
  height: min(40rem, calc(100dvh - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgb(0 0 0 / 32%);
}

dialog.explorer[open] {
  display: flex;
  flex-direction: column;
}

dialog.explorer::backdrop {
  background: rgb(0 0 0 / 45%);
}

@media (max-width: 600px) {
  dialog.explorer {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
}

.explorer-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.explorer-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: max(0.6rem, env(safe-area-inset-top)) 0.6rem 0.2rem 1.25rem;
}

.explorer-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.length-badge {
  flex: 1;
  font-weight: 600;
  color: var(--muted);
}

.explorer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 0.9rem;
  padding: 0.4rem 1.25rem 1.25rem;
}

/* The working clue, with the tools that change it */

.work {
  border-radius: var(--radius);
  background: var(--surface-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.25rem;
  padding: 0.9rem 0.8rem 0.5rem;
  font: 1.3rem/1.3 var(--serif);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.chip-wrap {
  display: inline-flex;
  align-items: baseline;
}

.chip {
  --type-color: var(--accent);
  border: 2px solid transparent;
  border-radius: 8px;
  background: none;
  padding: 0.12rem 0.35rem;
  font: inherit;
  cursor: pointer;
  text-underline-offset: 6px;
}

.chip:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.chip.transformed {
  border-color: var(--type-color);
  background: var(--surface);
  font: 700 1.05rem/1.55 var(--sans);
  letter-spacing: 0.06em;
}

.chip.selected,
.chip.transformed.selected {
  background: var(--accent);
  color: var(--accent-text);
}

.chip.definition {
  text-decoration: underline 3px var(--accent);
}

.chip.correct {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.chip.incorrect {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent);
}

.chip.hinted {
  outline: 3px dashed var(--revealed);
  outline-offset: 2px;
}

.work-tools {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 0 0.4rem 0.4rem;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.3rem 0.7rem;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.tool .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.tool:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.tool:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.type-substitution {
  --type-color: var(--type-substitution);
}

.type-anagram {
  --type-color: var(--type-anagram);
}

.type-container {
  --type-color: var(--type-container);
}

.type-hidden {
  --type-color: var(--type-hidden);
}

.type-reversal,
.type-cycle {
  --type-color: var(--type-reversal);
}

.type-deletion {
  --type-color: var(--type-deletion);
}

.type-selection {
  --type-color: var(--type-selection);
}

.type-homophone,
.type-spoonerism {
  --type-color: var(--type-homophone);
}

.type-charade {
  --type-color: var(--type-charade);
}

.type-definition,
.type-cryptic-definition,
.type-translation,
.type-special {
  --type-color: var(--type-other);
}

.explorer-message {
  min-height: 1.45em;
  margin: 0;
  font-size: 0.95rem;
}

/* What the selection could become: letter tiles, grouped and colored by kind of wordplay */

.options {
  display: grid;
  gap: 0.8rem;
}

.options-placeholder {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.option-group h3 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.option-group h3::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  background: var(--type-color, var(--accent));
}

.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option {
  --type-color: var(--accent);
  min-width: 3rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.8rem;
  border: 2px solid var(--type-color);
  border-radius: 6px;
  background: color-mix(in srgb, var(--type-color) 10%, var(--surface));
  box-shadow: 0 2px 0 color-mix(in srgb, var(--type-color) 45%, transparent);
  color: var(--text);
  font:
    700 1.05rem ui-monospace,
    "SF Mono",
    Menlo,
    Consolas,
    monospace;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.option:hover {
  background: color-mix(in srgb, var(--type-color) 22%, var(--surface));
}

.option:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Help for the solver, in a bar of its own */

.explorer-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.25rem;
  padding: 0.3rem max(0.5rem, env(safe-area-inset-right)) max(0.3rem, env(safe-area-inset-bottom))
    max(0.5rem, env(safe-area-inset-left));
  border-top: 1px solid var(--border);
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3.4rem;
  padding: 0.35rem 0.25rem;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.action .icon {
  width: 1.45rem;
  height: 1.45rem;
}

.action:hover:not(:disabled) {
  background: var(--accent-soft);
}

.action:disabled {
  color: var(--muted);
  opacity: 0.45;
  cursor: not-allowed;
}

.solved {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.solved h3 {
  margin: 0;
  color: var(--success);
}

.solved p {
  margin: 0;
}

.breakdown {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding-left: 1.3rem;
}

.step-input {
  font-family: var(--serif);
}

.step-type,
.step-note,
.hint-count,
.in-grid {
  color: var(--muted);
}

.glossary {
  margin: 0;
}

.glossary dt {
  font-weight: 700;
}

.glossary dd {
  margin: 0 0 0.3rem;
}

.solved .primary {
  justify-self: start;
}

/* Library */

.library-view {
  min-height: 100vh;
  min-height: 100dvh;
}

.library {
  display: grid;
  gap: 1.75rem;
  width: min(44rem, 100%);
  margin: 0 auto;
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
}

.library h2 {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.intro {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
}

.intro p {
  margin: 0;
}

.error {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.empty,
.muted {
  color: var(--muted);
}

.empty {
  margin: 0;
}

.muted {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
}

.puzzle-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.puzzle-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.4rem 0.6rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.puzzle-list li.solved {
  border-left: 4px solid var(--success);
}

.puzzle-summary {
  display: grid;
  flex: 1;
  min-width: 0;
}

.puzzle-summary a {
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}

.puzzle-summary a:hover {
  text-decoration: underline;
}

.puzzle-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.samples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.6rem;
}

.sample {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.sample:hover {
  border-color: var(--accent);
}

.sample-title {
  font-weight: 700;
}

.sample-description {
  font-size: 0.85rem;
  color: var(--muted);
}

.about p {
  margin: 0;
  color: var(--muted);
}

/* Notifications */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.toast button {
  margin-left: 0.5rem;
  padding: 0.2rem 0.75rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  cursor: pointer;
}
