/* Word search sits on the felt table. The letter square stays a fixed size. */

.ws-directory {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ws-hub .game-root {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  min-height: 0;
  overflow: visible;
}

.ws-hub .game-root::before,
.ws-page .game-root::before {
  content: none;
}

.ws-group h2 {
  margin: 0.85rem 0 0.4rem;
  color: var(--primary);
  font-family: var(--font-serif);
  font-weight: normal;
  font-size: 1.35rem;
}

.ws-group:first-child h2 { margin-top: 0; }

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

@media (min-width: 720px) {
  .ws-theme-list { grid-template-columns: 1fr 1fr; }
}

.ws-theme {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ws-theme:hover,
.ws-theme:focus-within {
  border-color: var(--gold);
}

.ws-theme:has(.ws-theme-link:focus-visible) {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.ws-theme-link:focus-visible {
  outline: none;
}

.ws-theme-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: var(--tap-min);
  color: var(--text);
  text-decoration: none;
}

.ws-theme-art {
  display: block;
  width: 100%;
  height: 200px;
  max-height: 200px;
  object-fit: cover;
  object-position: center;
  background: #efe8d8;
}

.ws-theme-copy {
  padding: 0.65rem 0.85rem 0.75rem;
  min-width: 0;
}

.ws-theme:has(.ws-theme-credit) .ws-theme-copy {
  padding-bottom: 0.2rem;
}

.ws-theme-credit {
  margin: 0;
  padding: 0 0.85rem 0.65rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
}

.ws-theme-credit a {
  color: inherit;
  text-underline-offset: 0.15em;
}

.ws-theme-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text);
}

.ws-theme-count {
  display: block;
  margin-top: 0.05rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ws-theme-blurb {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
}

.ws-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.ws-board-wrap {
  width: min(100%, 34rem);
}

.ws-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  container-type: inline-size;
  background: #fffdf8;
  color: #1d2433;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ws-cells {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  height: 100%;
}

.ws-cell {
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: calc(58cqi / var(--n));
  line-height: 1;
  touch-action: none;
}

.ws-svg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ws-svg line {
  fill: none;
  stroke-linecap: round;
}

.ws-stroke { stroke-width: 0.38; opacity: 0.34; }
.ws-live { stroke: #2c6e8a; stroke-width: 0.36; opacity: 0.5; }
.ws-arm { fill: #2c6e8a; stroke: none; opacity: 0.5; }
.ws-c0 { stroke: #b8923a; }
.ws-c1 { stroke: #2f6f52; }
.ws-c2 { stroke: #8f4a3a; }
.ws-c3 { stroke: #3d5a80; }
.ws-c4 { stroke: #6b5344; }
.ws-c5 { stroke: #3f6b5a; }

.ws-list-wrap {
  width: min(100%, 34rem);
}

.ws-play-list {
  list-style: none;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.8rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ws-list-wrap.is-hidden { display: none; }

.game-toolbar a.btn,
.ws-nav a {
  text-decoration: none;
}

.ws-play-list li.is-found {
  text-decoration: line-through;
  color: var(--text-muted);
}

.ws-nav {
  display: flex;
  gap: 0.5rem;
  margin: 0.6rem 0 0;
}

.ws-nav[hidden] {
  display: none !important;
}

.ws-nav .btn,
.ws-pager .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ws-nav .btn { flex: 1 1 0; }

.ws-pager {
  display: flex;
  gap: 0.6rem;
}

@media (max-width: 640px) {
  .ws-page .ws-pager {
    flex: 1 1 100%;
  }

  .ws-page .ws-pager .btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

.stat b#ws-theme {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  max-width: 12rem;
  white-space: normal;
}

.ws-theme-words {
  columns: 2;
  padding-left: 1.2rem;
  max-height: 14rem;
  overflow-y: auto;
}

@media (min-width: 860px) {
  .ws-play {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
  }

  .ws-list-wrap {
    width: 16rem;
    flex: 0 0 16rem;
  }

  .ws-theme-words { columns: 3; }
}

@media (max-width: 700px) {
  main.ws-page {
    display: flex;
    flex-direction: column;
  }

  .ws-page .game-header { display: contents; }
  .ws-page .breadcrumb { order: 0; }
  .ws-page .game-header h1 { order: 1; }
  .ws-page .ad-slot--banner { order: 2; }
  .ws-page #game-root { order: 3; }
  .ws-page .game-intro { order: 4; }
  .ws-page .game-below { order: 5; }
}

@media print {
  .site-header,
  .site-footer,
  .breadcrumb,
  .pwa-hint,
  .skip-link,
  .ad-slot,
  .game-toolbar,
  .win-banner,
  .game-below,
  .game-intro,
  .ws-nav,
  #ws-toolbar {
    display: none !important;
  }

  .ws-list-wrap,
  .ws-list-wrap.is-hidden {
    display: block !important;
  }

  .ws-play-list {
    display: grid !important;
  }

  .game-root,
  .game-root::before {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
  }

  .game-root::before { display: none !important; }

  .ws-board {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000;
  }

  .ws-cell { color: #000 !important; }

  .ws-svg line {
    stroke: #333 !important;
    opacity: 0.9 !important;
  }

  .ws-play-list {
    background: #fff !important;
    color: #000 !important;
    border-color: #000 !important;
  }
}
