/*
 * play.css — Wordable web demo styling.
 * Palette + metrics mirror the iOS app (ArcadeModeView / LetterCell):
 *   bg #FF6699 · tile white r8 · selected #FFD700 w/ pink letter ·
 *   header white bar, pink bold text · submit black 50% → green/red ·
 *   countdown purple heavy 150pt · warnings amber #FFAB4C / tangerine #FF6348
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* touch-action does NOT inherit — setting it on every element is what
     actually kills iOS Safari's double-tap zoom during rapid play. The
     board and word field override to 'none' where they need it. */
  touch-action: manipulation;
}

:root {
  --pink: #FF6699;
  --gold: #FFD700;
  --green: #55DDAA;
  --purple: #7B2FBE;
  --cell: 50px;
  --gap: 4px;
  --grid-pad: 12px;
  --scale: 1;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--pink);
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  background: var(--pink);
}
.screen.active { display: flex; }

/* ---------- Board ---------- */

.board-wrap {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0;
  overflow: hidden; /* clip falling tiles to the grid, matching the app's .clipped() */
}

.board {
  position: relative;
}

.cell {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  font-weight: 700;
  font-size: calc(var(--cell) * 0.4);
  color: #000;
  transition: transform 0.165s cubic-bezier(0.3, 1.4, 0.6, 1);
}

.cell.filled {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.cell.selected {
  background: var(--gold);
  color: var(--pink);
}

.cell.popping {
  transform: scale(1.1);
}

.cell .pts {
  position: absolute;
  left: calc(var(--cell) * 0.2 - var(--cell) * 0.18);
  top: calc(var(--cell) * 0.2 - var(--cell) * 0.18);
  width: calc(var(--cell) * 0.36);
  height: calc(var(--cell) * 0.36);
  border-radius: 50%;
  background: rgba(0, 82, 255, 0.55);
  color: #fff;
  font-size: calc(var(--cell) * 0.26);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.falling {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: calc(var(--cell) * 0.4);
  color: #000;
  pointer-events: none;
  will-change: transform;
}

/* ---------- Game screen chrome ---------- */

.game-col {
  width: 100%;
  max-width: 430px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Bottom: sit into part of the home-indicator inset (like the app) so
     Submit lands visibly lower on notched phones; floor of 4px elsewhere. */
  padding: max(2px, env(safe-area-inset-top)) 16px max(4px, calc(env(safe-area-inset-bottom) - 14px));
}
/* Board width-capped (tall/narrow viewport): center the stack instead of
   leaving a void between the word builder and Submit. Set by sizeBoard(). */
.game-col.capped { justify-content: center; }

/* flex-shrink 0 everywhere: when Safari's dynamic chrome (iMessage banner
   etc.) shrinks the viewport after layout, the bars must never squish or
   clip — the resize handler re-sizes the board instead. */
.opp-bar {
  width: calc(100% - 20px);
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 5px 12px;
  margin-bottom: 5px;
  position: relative;
  flex-shrink: 0;
}
.opp-bar .opp-name {
  color: var(--pink);
  font-weight: 700;
  font-size: calc(19px * var(--scale));
  display: flex;
  align-items: center;
  gap: 6px;
}
.opp-bar .opp-score {
  margin-left: auto;
  color: var(--pink);
  font-weight: 700;
  font-size: calc(19px * var(--scale));
  padding-right: 12px;
  font-variant-numeric: tabular-nums;
}
.opp-bar .diff-tag {
  font-size: 11px;
  font-weight: 600;
  color: rgba(0,0,0,0.35);
  margin-left: 8px;
}

.game-header {
  width: calc(100% - 20px);
  background: #fff;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 5px 25px;
  margin: 0 0 6px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.game-header .hdr {
  color: var(--pink);
  font-weight: 700;
  font-size: calc(20px * var(--scale));
  font-variant-numeric: tabular-nums;
  transition: opacity 0.1s;
}
.game-header .warning-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: calc(19px * var(--scale));
  opacity: 0;
  pointer-events: none;
}
.game-header.warn-thirty { background: #FFAB4C; }
.game-header.warn-ten { background: #FF6348; }
.game-header.warn-thirty .hdr, .game-header.warn-ten .hdr { opacity: 0; }
.game-header.warn-thirty .warning-flash, .game-header.warn-ten .warning-flash { opacity: 1; }

.board-zone { position: relative; }

.board-flash {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.board-flash.thirty { background: #FFAB4C; opacity: 0.18; }
.board-flash.ten { background: #FF6348; opacity: 0.18; }

/* ✕ / shuffle strip nested between the timer bar and the board (mirrors the
   app's mute/shuffle placement). Negative top margin tucks it into the
   header's bottom margin so it costs almost no height. */
.icon-row {
  width: calc(100% - 20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  height: 16px;
  margin: -3px 0 1px;
  flex-shrink: 0;
}
.icon-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 8px;
  display: flex;
  align-items: center;
}
.icon-btn:disabled { opacity: 0.5; }

/* Word builder */
.word-builder {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: calc(44px * var(--scale));
  margin-top: 6px;
  flex-shrink: 0;
}
.wb-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
  height: 100%;
  display: flex;
  align-items: center;
  visibility: hidden;
}
.word-builder.has-word .wb-btn { visibility: visible; }
.word-field {
  flex: 1;
  height: 100%;
  border: 2px solid #fff;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(24px * var(--scale));
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  touch-action: none; /* cursor is draggable — don't let touch scroll the page */
  cursor: text;
}
.word-field .cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: #fff;
  vertical-align: text-bottom;
  opacity: 0;
}
.word-field .cursor.on { opacity: 1; }

.points-preview {
  height: 26px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.points-preview span {
  background: rgba(30, 80, 255, 0.3);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: calc(14px * var(--scale));
  color: #fff;
  display: none;
}
.points-preview.visible span { display: inline; }

.submit-btn {
  width: calc(100% - 132px);
  max-width: 280px;
  height: calc(52px * var(--scale));
  flex-shrink: 0;
  /* auto top margin: any viewport height the board can't use (tile-size cap)
     pushes the submit button toward the bottom instead of pooling under it */
  margin-top: auto;
  margin-bottom: 4px;
  border: none;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: calc(24px * var(--scale));
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.15s;
  position: relative;
}
.submit-btn:disabled { background: rgba(128, 128, 128, 0.5); }
.submit-btn.valid { background: rgba(46, 204, 113, 0.85); }
.submit-btn.invalid { background: rgba(231, 76, 60, 0.85); }
.submit-btn:active { transform: scale(0.95); }

.invalid-toast {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: rgba(231, 76, 60, 0.85);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 5px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
}
.invalid-toast.show { opacity: 1; transform: translateX(-50%) scale(1); }

/* Countdown */
.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.countdown-overlay.visible { display: flex; }
.countdown-overlay .num {
  font-size: 150px;
  font-weight: 900;
  color: rgba(160, 82, 222, 0.85);
  text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
  animation: countPop 0.35s cubic-bezier(0.2, 1.6, 0.5, 1);
}
@keyframes countPop {
  from { transform: scale(0.5); opacity: 0.3; }
  to { transform: scale(1); opacity: 1; }
}

/* Confetti canvas overlays the board */
.confetti-canvas {
  position: absolute;
  inset: -60px 0 0 0;
  height: calc(100% + 60px);
  width: 100%;
  pointer-events: none;
  z-index: 15;
}

/* ---------- Welcome screen (scrollable, mirrors TutorialPlayNowView) ---------- */

.welcome-screen {
  overflow-y: auto;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
}

.welcome-col {
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(18px, env(safe-area-inset-top)) 16px 30px;
}

/* The H1 is the wordmark image (alt "Wordable") + the tagline — same visual
   as before, now a real heading for crawlers/screen readers. */
.welcome-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
}

.welcome-logo {
  height: 64px;
  width: auto;
  filter: drop-shadow(0 4px 10px rgba(123, 47, 190, 0.35));
  margin-bottom: 4px;
}

.welcome-tagline {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 10px;
}

.stats-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: 10px;
}
.hs-line {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.vs-line {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.demo-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.demo-builder {
  width: 100%;
  padding: 10px 24px 0;
}
.demo-word-field {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.demo-confetti {
  inset: 0;
  height: 100%;
}

/* Tutorial-style Play Now: horizontal purple gradient, play icon, pulse */
.play-now-btn {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: calc(100% - 40px);
  max-width: 340px;
  border: none;
  border-radius: 18px;
  padding: 20px 0;
  font-size: 26px;
  font-weight: 900;
  font-family: inherit;
  letter-spacing: 0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(to right, #7B2FBE 0%, #9B59B6 50%, #8E44AD 100%);
  box-shadow: 0 8px 12px rgba(123, 47, 190, 0.55);
  cursor: pointer;
  z-index: 6;
  animation: playPulse 1.2s ease-in-out infinite alternate;
}
.play-now-btn .play-icon { width: 20px; height: 22px; }
.play-now-btn:active { animation: none; transform: translate(-50%, -50%) scale(0.95); }
.play-now-btn:disabled { opacity: 0.6; animation: none; }
@keyframes playPulse {
  from { transform: translate(-50%, -50%) scale(1); }
  to { transform: translate(-50%, -50%) scale(1.03); }
}

.appstore-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  margin-top: 14px;
}
.appstore-badge { height: 44px; display: block; }

/* Welcome: App Store badge + How to Play side by side under the board */
.under-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.under-board-copy {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.under-board-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.under-board-row .appstore-cta { margin-top: 0; }
.howto-btn {
  height: 44px;
  border: none;
  border-radius: 10px;
  padding: 0 14px;
  background: linear-gradient(to right, #7B2FBE 0%, #9B59B6 50%, #8E44AD 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
}
.howto-btn:active { transform: scale(0.95); }

.loading-note { font-size: 12px; color: rgba(255,255,255,0.75); height: 14px; margin-top: 6px; }

/* ---------- Page content below the demo (about / how-to / features / download) ---------- */
.ws-section {
  width: 100%;
  margin-top: 36px;
  text-align: center;
  color: #fff;
}
.ws-section h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}
.ws-section p {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.94);
  margin-bottom: 10px;
}
.ws-lead {
  font-size: 17px !important;
  font-weight: 800;
  color: #fff !important;
}

/* How to play: numbered steps */
.howto-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.howto-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 14px;
  padding: 12px 14px;
}
.howto-steps p { margin: 0; font-size: 14.5px; }
.howto-steps strong { color: var(--gold); }
.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: var(--pink);
  font-weight: 900;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.howto-link {
  margin-top: 14px;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.howto-link:active { transform: scale(0.96); }

/* Features: 2-up cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  text-align: left;
}
.feature-card {
  background: #fff;
  color: #333;
  border-radius: 14px;
  padding: 14px 12px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.feature-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.feature-card h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--pink);
  margin-bottom: 5px;
  line-height: 1.2;
}
.feature-card p {
  font-size: 13px;
  line-height: 1.45;
  color: #555;
  margin: 0;
}
@media (max-width: 360px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* Download section reuses the results cta-card */
.ws-download .cta-card { margin-top: 2px; }
.rating-line {
  font-size: 12.5px !important;
  color: #777 !important;
  margin: 4px 0 0 !important;
}
.rating-line .stars { color: #F5A623; letter-spacing: 1px; }
.ws-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.ws-pill {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
}

.ws-screens {
  width: 100vw;
  max-width: 100vw;
  margin-top: 30px;
  overflow: hidden;
}
.ws-screens-title { margin-bottom: 4px; }
.ws-screens-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 6px 16px 14px;
}
.ws-screens-track::-webkit-scrollbar { display: none; }
.ws-screens-track picture { flex-shrink: 0; display: block; }
.ws-screens-track img {
  height: 380px;
  width: auto;
  border-radius: 18px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  flex-shrink: 0;
  display: block;
}

.ws-footer {
  display: flex;
  gap: 18px;
  margin-top: 26px;
  padding-bottom: env(safe-area-inset-bottom);
}
.ws-footer a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.ws-footer a:hover { text-decoration: underline; }

/* ---------- Difficulty picker (port of WordabotDifficultyPicker) ---------- */

.picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.picker-overlay[hidden] { display: none; }
.picker-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.picker-card {
  position: relative;
  width: min(320px, 82vw);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: pickerIn 0.22s cubic-bezier(0.2, 1.4, 0.5, 1);
}
@keyframes pickerIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.picker-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 0;
  background: linear-gradient(to right, #3498DB 0%, #5DADE2 40%, #85C1E9 100%);
}
.picker-bot { font-size: 32px; }
.picker-title { font-size: 18px; font-weight: 700; color: #fff; }
.picker-close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.picker-body {
  background: #fff;
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.picker-sub {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #999;
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(to right, #3498DB, #2980B9);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
  transition: transform 0.1s;
}
.picker-row:active { transform: scale(0.96); }
.picker-row .pe { font-size: 22px; }
.picker-row .row-play { width: 13px; height: 15px; margin-left: auto; }

/* ---------- Purple-header cards (intro / how-to-play / name editor) ---------- */

.htp-card { width: min(340px, 88vw); }

.htp-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 0;
  background: linear-gradient(to right, #7B2FBE 0%, #9B59B6 50%, #8E44AD 100%);
}
.htp-title { font-size: 18px; font-weight: 800; color: #fff; }

.htp-body {
  background: #fff;
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #333;
}

.htp-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: center;
  font-size: 15px;
  color: #444;
}
.htp-bullets strong { color: var(--purple); }

.htp-go-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 0;
  font-size: 19px;
  font-weight: 800;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(to right, #7B2FBE 0%, #9B59B6 50%, #8E44AD 100%);
  box-shadow: 0 4px 10px rgba(123, 47, 190, 0.4);
  cursor: pointer;
  transition: transform 0.1s;
}
.htp-go-btn:active { transform: scale(0.96); }

/* Mini demo board (intro popup + how-to page 1) */
.mini-board {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--pink);
  border-radius: 12px;
  padding: 12px;
}
.mini-row { display: flex; gap: 5px; }
.mini-cell {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: #000;
}
.mini-cell.sel { background: var(--gold); color: var(--pink); }
.mini-cell i {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-builder {
  min-width: 150px;
  border: 2px solid var(--pink);
  border-radius: 8px;
  background: rgba(255, 102, 153, 0.08);
  color: var(--pink);
  text-align: center;
  padding: 8px 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
}

/* How-to-play pager */
#htp-page {
  width: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.htp-copy { font-size: 14.5px; color: #555; text-align: center; line-height: 1.45; }
.htp-copy strong { color: var(--purple); }

.htp-dots { display: flex; gap: 7px; margin-top: 2px; }
.htp-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ddd;
  transition: background-color 0.2s;
}
.htp-dot.on { background: var(--purple); }

.htp-nav { display: flex; gap: 10px; width: 100%; }
.htp-nav-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  background: #f1e8fa;
  color: var(--purple);
  font-size: 22px;
  font-weight: 800;
  padding: 6px 0;
  cursor: pointer;
}
.htp-nav-btn:disabled { opacity: 0.35; }

/* letter-value rows (page 2) */
.lv-rows { display: flex; flex-direction: column; gap: 6px; }
.lv-row { display: flex; align-items: center; gap: 7px; }
.lv-pts { width: 30px; text-align: right; font-weight: 800; color: var(--purple); font-size: 15px; }
.lv-tile {
  width: 26px; height: 26px; border-radius: 5px;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #000;
  border: 1px solid #eee;
}

/* word→score climb rows (pages 3/5) + versus (page 4) */
.climb { display: flex; flex-direction: column; gap: 7px; align-items: center; }
.climb-row {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 16px; letter-spacing: 1px;
}
.climb-row .cw { color: #333; }
.climb-row .cs { border-radius: 999px; padding: 2px 10px; color: #fff; font-size: 14px; }
.cs.red { background: #E74C3C; }
.cs.yellow { background: #E6A817; }
.cs.green { background: #2ECC71; }
.mult-table {
  display: flex; gap: 10px;
  font-size: 13.5px; font-weight: 700; color: #555;
}
.mult-table span { background: #f4f4f6; border-radius: 8px; padding: 6px 10px; }
.htp-foot { font-size: 12.5px; color: #888; text-align: center; margin-top: 4px; }

/* builder mock with cursor (page 5) */
.builder-mock {
  display: flex; align-items: center; gap: 10px;
}
.builder-mock .bm-x, .builder-mock .bm-bs { font-size: 20px; }
.bm-field {
  border: 2px solid var(--pink);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--pink);
  display: flex;
  align-items: center;
}
.bm-cursor {
  display: inline-block;
  width: 2px; height: 1.1em;
  background: var(--purple);
  margin: 0 1px;
  animation: bmBlink 1s steps(1) infinite;
}
@keyframes bmBlink { 50% { opacity: 0; } }

/* Results: how-to button */
.htp-open-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 13px 0;
  font-size: 16px;
  font-weight: 800;
  font-family: inherit;
  color: #fff;
  background: rgba(123, 47, 190, 0.85);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.12s;
}
.htp-open-btn:active { transform: scale(0.96); }

/* Name + emoji editor */
.name-body { gap: 14px; }
.name-preview { font-size: 44px; line-height: 1; }
.name-input {
  width: 100%;
  border: 2px solid #e5d5f5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  color: #333;
  outline: none;
}
.name-input:focus { border-color: var(--purple); }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
}
.emoji-grid button {
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f7f2fb;
  font-size: 22px;
  padding: 5px 0;
  cursor: pointer;
  transition: transform 0.1s;
}
.emoji-grid button:active { transform: scale(0.9); }
.emoji-grid button.sel { border-color: var(--purple); background: #efe2fb; }

/* ---------- Results screen ---------- */

#screen-results {
  overflow-y: auto;
  justify-content: flex-start;
}
.results-col {
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(28px, env(safe-area-inset-top)) 20px 40px;
  gap: 16px;
}
.result-banner {
  font-size: 30px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.result-sub {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-top: -8px;
}
.new-high {
  background: var(--gold);
  color: #8a5a00;
  font-weight: 800;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
}

.score-cards {
  display: flex;
  gap: 12px;
  width: 100%;
}
.score-card {
  flex: 1;
  background: #fff;
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #333;
}
.score-card.winner { outline: 3px solid var(--gold); }
.score-card .who { font-size: 14px; font-weight: 700; color: var(--pink); }
.score-card .pts-big { font-size: 34px; font-weight: 900; color: #222; font-variant-numeric: tabular-nums; }
.score-card .emoji { font-size: 26px; }

.word-cols {
  display: flex;
  gap: 12px;
  width: 100%;
}
.word-col {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 60px;
}
.word-col .wrow {
  display: flex;
  justify-content: space-between;
  background: #fff;
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 700;
  color: #333;
}
.word-col .wrow .ws { color: var(--pink); font-variant-numeric: tabular-nums; }
.word-col .none { font-size: 12px; color: rgba(255,255,255,0.7); text-align: center; padding: 8px 0; }

.play-again-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px 0;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.12s;
}
.play-again-btn:active { transform: scale(0.96); }

.cta-card {
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #333;
  text-align: center;
}
.cta-card h3 { font-size: 18px; font-weight: 800; color: var(--pink); }
.cta-card p { font-size: 13.5px; line-height: 1.45; color: #555; }
.cta-card .appstore-cta { color: #888; margin-top: 2px; }

.nick-line {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}
.nick-line button {
  background: none;
  border: none;
  color: #fff;
  text-decoration: underline;
  font-size: 12px;
  cursor: pointer;
}

.home-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-height: 700px) {
  .welcome-logo { width: min(220px, 60vw); }
  .play-now-btn { padding: 16px 0; font-size: 26px; }
}
