/* ============================================================================
   LIBERTY WORD SEARCH — game-specific styles
   Built on shared/design.css tokens only (no off-palette colors).
   Skinned to Liberty Arcade with the operator's signed-off assets:
     Graphics A · Backgrounds A (cozy-study) · Sounds B
   ============================================================================ */

/* --- Immersive scene backdrop (chosen background A) ----------------------- */
/* Fixed cozy-study library scene with a dark scrim so the navy UI panels stay
   legible. No full-frame flashing/strobe (safety rule #2). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(8,16,34,0.82), rgba(8,16,34,0.74) 45%, rgba(8,16,34,0.88)),
    url("../assets/bg/cozy-study.png") center 30% / cover no-repeat;
  pointer-events: none;
}

/* --- Title logo medallion (graphics A: logo.png) -------------------------- */
.ws-title {
  text-align: center;
  margin: 0 0 var(--s-4);
}
.ws-logo {
  display: inline-block;
  width: clamp(180px, 34vw, 280px);
  height: auto;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.55));
}
.ws-title__sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.ws-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
}
@media (min-width: 820px) {
  .ws-wrap { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
}

/* --- Status / meta row ---------------------------------------------------- */
.ws-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.ws-meta__theme { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ws-bankname {
  font-family: var(--font-serif);
  font-size: var(--t-lg);
  color: var(--c-cream);
  margin: 0;
}
.ws-bankblurb { font-size: var(--t-sm); color: var(--text-dim); margin: 0; }

.ws-stats { display: flex; gap: var(--s-4); align-items: center; }
.ws-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: var(--s-2) var(--s-3);
  background: var(--c-navy-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.ws-stat__num {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--t-lg);
  color: var(--c-gold-light);
  line-height: 1;
}
.ws-stat__label {
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 4px;
}

/* --- Win / status banner -------------------------------------------------- */
.ws-banner {
  display: none;
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--c-gold-light);
  background: linear-gradient(180deg, rgba(201,162,39,0.16), rgba(201,162,39,0.05));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
}
.ws-banner.is-on { display: block; }
.ws-banner.is-win { animation: ws-pop 0.4s ease; }
@keyframes ws-pop {
  0% { transform: scale(0.92); opacity: 0; }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); opacity: 1; }
}

/* --- The letter grid ------------------------------------------------------ */
.ws-board { min-width: 0; position: relative; }

/* Eagle corner flourishes (graphics A: corner-flourish.png), bg-removed. */
.ws-flourish {
  position: absolute;
  width: clamp(48px, 9vw, 86px);
  aspect-ratio: 695 / 705;
  background: url("../assets/img/corner-flourish.png") center / contain no-repeat;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
  opacity: 0.96;
}
.ws-flourish--tl { top: -10px; left: -10px; }
.ws-flourish--br { bottom: -10px; right: -10px; transform: rotate(180deg); }
@media (max-width: 560px) {
  .ws-flourish { width: 44px; opacity: 0.85; }
}
.ws-grid {
  --ws-size: 13;
  display: grid;
  grid-template-columns: repeat(var(--ws-size), 1fr);
  gap: clamp(2px, 0.6vw, 5px);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  touch-action: none;          /* let us own the drag gesture on touch */
  user-select: none;
  -webkit-user-select: none;
}
.ws-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(0.72rem, 2.6vw, 1.05rem);
  color: var(--text);
  /* graphics A: chrome-framed tile texture under a navy wash for letter contrast */
  background:
    linear-gradient(180deg, rgba(10,22,46,0.46), rgba(10,22,46,0.58)),
    url("../assets/img/grid-cell.png") center / 118% 118% no-repeat,
    var(--c-navy-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color .08s ease, color .08s ease, transform .08s ease, box-shadow .08s ease;
  -webkit-user-select: none;
  user-select: none;
}
/* Selection lasso (graphics A: selection-lasso.png) — chrome/red frame glow
   on the actively-traced cells, plus the gold pop. */
.ws-cell.is-sel {
  color: var(--c-navy-deep);
  background:
    linear-gradient(180deg, rgba(201,162,39,0.92), rgba(201,162,39,0.82)),
    url("../assets/img/selection-lasso.png") center / 132% 122% no-repeat;
  border-color: var(--c-gold-light);
  box-shadow: 0 0 0 1px var(--c-gold-light), 0 0 10px rgba(201,162,39,0.45);
  transform: scale(1.04);
  z-index: 1;
}
/* Found word — glowing capsule stripe (graphics A: found-word-stripe.png)
   tinted patriotic red under the white letters. */
.ws-cell.is-found {
  color: var(--c-white);
  background:
    linear-gradient(180deg, rgba(178,34,52,0.86), rgba(140,20,38,0.92)),
    url("../assets/img/found-word-stripe.png") center / 150% 150% no-repeat;
  border-color: var(--c-red-deep);
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.ws-cell.is-found.is-sel {
  color: var(--c-navy-deep);
  background:
    linear-gradient(180deg, rgba(201,162,39,0.92), rgba(201,162,39,0.82)),
    url("../assets/img/selection-lasso.png") center / 132% 122% no-repeat;
}
.ws-cell.is-miss {
  background: var(--c-red-deep);
  color: var(--c-white);
  animation: ws-shake 0.26s ease;
}
@keyframes ws-shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* --- Word list ------------------------------------------------------------ */
.ws-aside {
  background: var(--c-navy-deep);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  box-shadow: var(--shadow-1);
}
.ws-aside__title {
  font-family: var(--font-sans);
  font-size: var(--t-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 var(--s-3);
}
.ws-wordlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2) var(--s-4);
}
@media (min-width: 820px) {
  .ws-wordlist { grid-template-columns: 1fr; }
}
.ws-word {
  font-size: var(--t-sm);
  color: var(--text);
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: color .15s ease, opacity .15s ease;
}
.ws-word.is-found {
  color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  opacity: 0.7;
}
.ws-word.is-found::before {
  /* graphics A: gold/navy check medallion (wordlist-check.png), bg-removed */
  content: "";
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  margin-right: 6px;
  vertical-align: -0.22em;
  background: url("../assets/img/wordlist-check.png") center / contain no-repeat;
}

/* --- Controls ------------------------------------------------------------- */
.ws-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}
.ws-bank-field { display: flex; align-items: center; gap: var(--s-2); }
.ws-bank-field label {
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}
.ws-select {
  appearance: none;
  font-family: var(--font-sans);
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--c-cream);
  background: var(--c-navy-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 0.55em 2em 0.55em 1em;
  min-height: 44px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) center,
    calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
