/* ═══════════════════════════════════════════════════════
   WORD STACK — extra styles on top of the shared Emojle stylesheet (style.css)
═══════════════════════════════════════════════════════ */

/* ---------- Logo: WORD / STACK stacked, with a BETA pill ---------- */
.ws-logo-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; flex-shrink: 0; }
.ws-logo {
  display: flex; flex-direction: column; align-items: center;
  line-height: 0.92;
  font-size: clamp(0.95rem, 4.4vw, 1.3rem) !important;
  letter-spacing: clamp(2px, 1vw, 5px) !important;
}
.ws-logo span { display: block; }
.ws-beta {
  font-size: 0.55rem; font-weight: 900; letter-spacing: 1.5px;
  color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444);
  padding: 3px 6px; border-radius: 20px;
  box-shadow: 0 2px 6px #f59e0b55;
}

/* ---------- Progress pips in the top card ---------- */
.ws-progress { display: flex; justify-content: center; gap: 7px; margin: 4px 0 8px; }
.ws-pip {
  width: 14px; height: 14px; border-radius: 4px;
  background: var(--surface2); border: 2px solid var(--border);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.ws-pip.solved { background: var(--correct); border-color: var(--correct); transform: scale(1.1); }
.ws-pip.hinted { background: var(--gacha); border-color: var(--gacha-dark); transform: scale(1.1); }
.ws-pip.revealed { background: var(--present); border-color: var(--present); }

/* ---------- Board ---------- */
.ws-board-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ws-board { display: flex; flex-direction: column; gap: 5px; padding: 6px; border-radius: 16px; position: relative; }
.ws-row {
  display: flex; gap: 5px; justify-content: center; align-items: center;
  padding: 3px; border-radius: 12px;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ws-row.active {
  background: linear-gradient(90deg, #e0f4ff, #ede0ff);
  border-color: #b9a6f5;
  box-shadow: 0 2px 12px #6d28d922;
}
.ws-row.done { cursor: default; }

.ws-tile {
  width: 52px;
  height: 46px;
  height: clamp(30px, calc((100vh - 500px) / 7 - 8px), 46px);
  height: clamp(30px, calc((100dvh - 500px) / 7 - 8px), 46px);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; font-weight: 900; text-transform: uppercase;
  user-select: none; -webkit-user-select: none;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}
/* letters from the three hidden words */
.ws-tile.given {
  background: linear-gradient(180deg, #f3eeff, #e9e1ff);
  border-color: #c4b5fd;
  color: var(--purple);
}
.ws-tile.given.hidden { color: #c4b5fd; }
/* gaps the player fills */
.ws-tile.blank { border-style: dashed; background: #fbfcff; }
.ws-tile.blank.filled { border-style: solid; border-color: var(--purple-lt); background: #f0eaff; animation: tpop 0.1s ease; }
.ws-tile.blank.cursor {
  border-style: solid; border-color: var(--correct); border-width: 3px;
  box-shadow: 0 0 0 3px #0099cc22, 0 0 14px #0099cc55;
  animation: wsCursor 1.1s ease infinite;
}
.ws-tile.invalid { border-color: var(--danger) !important; background: #fee2e2 !important; color: var(--danger) !important; }

/* solved states (whole row) */
.ws-row .ws-tile.solved { background: var(--correct); border-color: var(--correct); color: #fff; box-shadow: 0 2px 10px #0099cc44; border-style: solid; }
.ws-row .ws-tile.hinted { background: linear-gradient(135deg, #f59e0b, #f97316); border-color: var(--gacha-dark); color: #fff; box-shadow: 0 2px 10px #f59e0b55; border-style: solid; }
.ws-row .ws-tile.revealed { background: var(--present); border-color: var(--present); color: #fff; box-shadow: 0 2px 10px #d4006a44; border-style: solid; }
.ws-tile.flip { animation: treveal 0.45s ease forwards; }

/* hidden words light up at the end */
.ws-board.finished .ws-col-0, .ws-board.finished .ws-col-2, .ws-board.finished .ws-col-4 {
  outline: 3px solid #6d28d955; outline-offset: -1px;
}
.ws-reveal {
  width: 100%; max-width: 340px;
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px;
  padding: 10px 14px; text-align: center; box-shadow: var(--shadow-sm);
}
.ws-reveal-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ws-reveal-words { font-size: clamp(0.85rem, 4vw, 1.1rem); font-weight: 900; letter-spacing: 2px; color: var(--purple); line-height: 1.5; }
.ws-reveal-words .dot { color: #c4b5fd; margin: 0 3px; }

/* the start sweep: given letters pop in column by column */
.ws-tile.given.pop { animation: wsPop 0.35s ease both; }

/* ---------- Controls ---------- */
.ws-clock {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 92px; height: 50px; padding: 0 12px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid #22c55e; border-radius: 50px;
  box-shadow: 0 3px 0 #15803daa;
}
.ws-clock-label { font-size: 0.5rem; font-weight: 700; letter-spacing: 2px; color: #15803d; }
.ws-clock-value { font-size: 1.25rem; font-weight: 900; color: #15803d; font-variant-numeric: tabular-nums; line-height: 1.05; }
.ws-hint-btn { background: linear-gradient(135deg, #f59e0b, #ea580c); box-shadow: 0 4px 0 #92400e, var(--shadow-md); }
.ws-hint-btn.reveal-mode { background: linear-gradient(135deg, #d4006a, #6d28d9); box-shadow: 0 4px 0 #4c1d95, var(--shadow-md); }

/* ---------- Link to the other game ---------- */
.ws-other-game { gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.ws-other-game a {
  display: inline-block; padding: 9px 16px; border-radius: 50px;
  background: var(--surface); border: 2px solid #c4b5fd;
  color: var(--purple); font-weight: 700; font-size: 0.95rem; text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.ws-other-game a:hover { background: #f3eeff; }
.ws-other-game-modal { display: flex; margin: 0 0 14px; }

/* ---------- How-to-play mini tiles ---------- */
.ws-mini-row { display: flex; gap: 4px; justify-content: center; margin: 4px 0; }
.ws-mini { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-weight: 900; border: 2px solid var(--border); }
.ws-mini.given { background: #f3eeff; border-color: #c4b5fd; color: var(--purple); }
.ws-mini.blank { border-style: dashed; color: var(--absent-txt); background: #fff; }
.ws-mini.solved { background: var(--correct); border-color: var(--correct); color: #fff; }
.htp-colour-tile.ws-hinted-swatch { background: linear-gradient(135deg, #f59e0b, #f97316); border-color: var(--gacha-dark); color: #fff; }
.ws-answer-box { font-size: 1.25rem; letter-spacing: 6px; line-height: 1.45; }

/* ---------- Animations ---------- */
@keyframes wsCursor { 0%,100% { box-shadow: 0 0 0 3px #0099cc22, 0 0 10px #0099cc44; } 50% { box-shadow: 0 0 0 3px #0099cc33, 0 0 20px #0099cc88; } }
@keyframes wsPop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }

/* ---------- Phones ---------- */
@media (max-width: 400px) {
  .ws-tile { width: 46px; font-size: 1.15rem; }
  .ws-board { gap: 4px; padding: 4px; }
  .ws-row { gap: 4px; }
  .ws-clock { min-width: 78px; height: 44px; }
  .ws-clock-value { font-size: 1.05rem; }
}
@media (max-height: 700px) {
  .ws-progress { margin: 2px 0 4px; }
  .ws-board { gap: 3px; padding: 2px; }
  .ws-row { padding: 1px 3px; }
  body.ws-playing .qwerty-key { height: 40px; }
  body.ws-playing .qwerty-keyboard { gap: 4px; margin-top: 2px; }
  body.ws-playing .ws-clock, body.ws-playing .clear-btn, body.ws-playing .ws-hint-btn { height: 42px; min-height: 42px; }
  body.ws-playing main { gap: 4px; }
}
/* while playing, the top card gets slimmer so the grid and keyboard fit */
body.ws-playing .decoder-screen { padding: 8px 14px; }
body.ws-playing .screen-hint { font-size: 0.75rem; }
body.ws-playing .ws-progress { margin: 3px 0 4px; }

/* ---------- Colorblind mode ---------- */
body.colorblind-mode .ws-tile.given { background: #ffffff; border: 3px solid #000; color: #000; }
body.colorblind-mode .ws-tile.blank { border: 3px dashed #000; }
body.colorblind-mode .ws-row .ws-tile.solved { background: #0055cc; border: 3px solid #000; color: #fff; }
body.colorblind-mode .ws-row .ws-tile.hinted { background: #ffcc00; border: 3px solid #000; color: #000; text-decoration: underline; }
body.colorblind-mode .ws-row .ws-tile.revealed { background: #000; border: 3px solid #000; color: #fff; }
body.colorblind-mode .ws-row.active { background: #fff8cc; border: 3px solid #000; }
body.colorblind-mode .ws-pip.solved { background: #0055cc; border-color: #000; }
body.colorblind-mode .ws-pip.hinted { background: #ffcc00; border-color: #000; }
body.colorblind-mode .ws-pip.revealed { background: #000; border-color: #000; }
body.colorblind-mode .ws-clock { background: #fff; border: 3px solid #000; box-shadow: 0 3px 0 #000; }
body.colorblind-mode .ws-clock-label, body.colorblind-mode .ws-clock-value { color: #000; }
body.colorblind-mode .decode-submit-btn.ws-hint-btn { background: #ffcc00; color: #000; border: 3px solid #000; box-shadow: 0 4px 0 #000; }
body.colorblind-mode .ws-other-game { border: 3px solid #000; color: #000; }
body.colorblind-mode .ws-logo { -webkit-text-fill-color: #000; color: #000; background: none; }

/* the two-line logo is wider than EMOJLE, so drop the "How to Play" text sooner */
@media (max-width: 500px) {
  .btn-how .btn-label { display: none; }
  .btn-how { padding: 6px 10px; }
}
@media (max-width: 350px) {
  .ws-logo { letter-spacing: 1px !important; }
  .ws-beta { font-size: 0.48rem; padding: 2px 4px; letter-spacing: 1px; }
  .ws-logo-wrap { gap: 3px; }
}
body.colorblind-mode .decode-submit-btn.ws-hint-btn.reveal-mode { background: #000; color: #fff; }
