.word-search-main {
  width: min(1120px, calc(100% - 64px));
}

.word-search-page {
  max-width: 720px;
  margin-inline: auto;
  padding-block: 4px 38px;
}

.word-search-page .breadcrumbs ol {
  flex-wrap: nowrap;
  white-space: nowrap;
  font-size: 12px;
}

.word-search-page .breadcrumbs li + li::before {
  margin-inline: 4px;
}

.word-search-intro {
  margin-bottom: 7px;
}

.word-search-intro h1 {
  margin-bottom: 2px;
  font-size: clamp(32px, 8vw, 42px);
  letter-spacing: -2px;
  line-height: 1.1;
}

.word-search-intro p,
.word-search-how-to-play p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.word-search-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px #29234a0a;
}

.word-search-selectors {
  width: min(100%, 420px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.word-search-select {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.word-search-select span {
  flex: 0 0 auto;
}

.word-search-select select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  flex: 1;
  padding: 4px 20px 4px 6px;
  border: 1px solid #dcd9e9;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.word-search-puzzle-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.1;
}

.word-search-board {
  width: min(100%, 46svh, 420px);
  display: grid;
  grid-template-rows: repeat(9, minmax(0, 1fr));
  aspect-ratio: 1;
  border: 2px solid #776b95;
  border-radius: 4px;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.word-search-row {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.word-search-cell {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #e3dfec;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: clamp(12px, 4vw, 19px);
  font-weight: 700;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.word-search-cell.is-preview {
  background: #e9e3ff;
  color: var(--purple-dark);
}

.word-search-cell.is-valid-preview {
  background: #d7f4e3;
  color: #17653b;
}

.word-search-cell.is-found {
  background: #c9efd8;
  color: #145a35;
  font-weight: 900;
}

.word-search-cell:focus-visible,
.word-search-select select:focus-visible,
.word-search-actions button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid #a391ff;
  outline-offset: 1px;
}

.word-search-instructions {
  width: min(100%, 420px);
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.word-search-list {
  width: min(100%, 420px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.word-search-list li {
  min-width: 0;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.word-search-list li.is-found {
  background: #e3f5e9;
  color: #28643f;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.word-search-status {
  width: min(100%, 420px);
  min-height: 17px;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.word-search-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.word-search-actions button {
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.word-search-actions button[hidden] {
  display: none;
}

.word-search-how-to-play {
  margin-top: 20px;
}

.word-search-how-to-play h2 {
  margin-bottom: 6px;
  font-size: 20px;
  letter-spacing: -0.5px;
}

@media (min-width: 600px) {
  .word-search-page {
    padding-block: 8px 48px;
  }

  .word-search-panel {
    gap: 8px;
    padding: 12px;
  }

  .word-search-board {
    width: min(100%, 420px);
  }
}

@media (max-height: 700px) {
  .word-search-site .site-header {
    height: 56px;
  }

  .word-search-page {
    padding-top: 0;
  }

  .word-search-page .breadcrumbs {
    margin-bottom: 0;
  }

  .word-search-intro {
    margin-bottom: 2px;
  }

  .word-search-intro h1 {
    font-size: 28px;
    line-height: 1;
  }

  .word-search-intro p {
    font-size: 12px;
    line-height: 1.25;
  }

  .word-search-panel {
    gap: 2px;
    padding: 4px;
  }

  .word-search-board {
    width: min(100%, 34svh, 380px);
  }

  .word-search-select select {
    min-height: 34px;
  }

  .word-search-list li {
    min-height: 18px;
  }

  .word-search-actions button {
    min-height: 38px;
  }
}

@media (max-width: 520px) {
  .word-search-main {
    width: calc(100% - 24px);
  }
}

