:root {
  --color-bg: var(--game-bg);
  --color-fg: var(--game-fg);
  --color-subtle: var(--game-subtle);
  --color-primary: var(--game-primary); /* teal */
  --button-gradient: linear-gradient(
    135deg,
    var(--game-accent),
    var(--game-accent-secondary)
  );
  --button-shadow: 0 12px 18px rgba(13, 148, 136, 0.25);
  --radius-lg: 16px;
  --hero-height: clamp(160px, 24vw, 240px);
  --hero-image: linear-gradient(
    135deg,
    color-mix(in srgb, var(--game-accent) 25%, #ffffff),
    color-mix(in srgb, var(--game-accent-secondary) 35%, #ffffff)
  );
  --hero-fade-duration: 800ms;
  --pad: clamp(12px, 2.5vw, 24px);
  --wordsearch-card-bg: var(--game-card-bg);
  --wordsearch-border: var(--game-border);
  --wordsearch-select: color-mix(
    in srgb,
    var(--game-accent) 20%,
    rgba(255, 255, 255, 0.8)
  );
  --wordsearch-found: color-mix(
    in srgb,
    var(--game-accent) 15%,
    rgba(255, 255, 255, 0.9)
  );
  --wordsearch-error: #fbcaca;
}

@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 100;
  font-display: swap;
  src: url("/public/assets/fonts/Raleway-Thin.ttf") format("truetype");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/public/assets/fonts/Raleway-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/public/assets/fonts/Raleway-SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/public/assets/fonts/Raleway-Bold.ttf") format("truetype");
}

footer {
  text-align: center;
}

/* Splash overlay */
.site-splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(16px, 4vw, 32px);
  background:
    radial-gradient(
      circle at 20% 10%,
      rgba(255, 255, 255, 0.75),
      transparent 45%
    ),
    linear-gradient(
      180deg,
      rgba(195, 242, 236, 0.95),
      rgba(232, 247, 244, 0.95) 55%,
      #fdfdfd
    );
  z-index: 1600;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 450ms ease,
    visibility 450ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.site-splash--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.site-splash__card {
  width: min(720px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  padding: clamp(24px, 4vw, 40px);
  padding-top: clamp(28px, 5vw, 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(18px, 3vw, 24px);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(15, 23, 42, 0.08);
  position: relative;
}
.site-splash__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(4, 47, 96, 0.12);
  background: var(--game-fg);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.25);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.95;
}
.site-splash__close:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.32);
  opacity: 1;
}
.site-splash__media {
  display: flex;
  justify-content: center;
}
.site-splash__media img {
  width: min(320px, 70vw);
  border-radius: 24px;
  box-shadow: 0 20px 35px rgba(15, 23, 42, 0.25);
}
.site-splash__logo {
  width: min(160px, 60vw);
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.25));
}
.site-splash__eyebrow {
  margin: 0;
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--game-fg);
}
.site-splash__title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
}
.site-splash__subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--game-fg);
}
.site-splash__lede {
  margin: 0;
  color: rgba(15, 23, 42, 0.75);
  font-size: 1rem;
}
.site-splash__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}
.site-splash__form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.site-splash__form .player-modal__label {
  width: 100%;
  max-width: 420px;
}
.site-splash__form .player-modal__actions {
  margin-bottom: 0;
}
@media (max-width: 600px) {
  .site-splash__card {
    border-radius: 22px;
    padding: 20px;
  }
}

* {
  box-sizing: border-box;
}
.pwa-shell {
  min-height: 100vh;
  color: var(--color-fg);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.78),
      rgba(255, 255, 255, 0.65)
    ),
    linear-gradient(180deg, rgba(15, 23, 42, 0.45), rgba(15, 23, 42, 0.1));
}
body.splash-body .pwa-shell {
  background-size: 80% auto;
  background-position: center 15%;
}
body.splash-body .page-header {
  width: min(960px, 95vw);
}
body {
  font-family:
    "Raleway",
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  line-height: 1.5;
  text-align: center;
}
body.site-splash-active,
body.player-modal-open {
  overflow: hidden;
}
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--pad);
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
  position: relative;
}
.lock-status {
  display: none;
}
.lock-status .lock-icon {
  font-size: 1rem;
  line-height: 1;
}
.lock-status.locked {
  color: var(--game-accent);
  background: rgba(13, 148, 136, 0.12);
  border-color: transparent;
}
.lock-status.unlocked {
  color: var(--game-primary);
  background: rgba(5, 150, 105, 0.15);
  border-color: transparent;
}
header {
  margin-bottom: 16px;
}
.sub {
  color: var(--color-subtle);
}

.page-header {
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 32px);
  padding: clamp(16px, 3vw, 32px);
  margin: clamp(12px, 3vw, 32px) auto;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  text-align: left;
}
.page-header__media {
  flex: 0 0 clamp(160px, 30vw, 280px);
}
.page-header__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  display: block;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15);
}
.page-header__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  align-items: center;
}
.page-header__eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: rgba(15, 23, 42, 0.7);
}
.page-header__title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--game-fg);
}
.page-header__subtitle {
  margin: 0;
  font-size: 1rem;
  color: rgba(15, 23, 42, 0.75);
}
.page-header__text p {
  margin: 0;
}

@media (max-width: 720px) {
  .page-header {
    flex-direction: column;
    text-align: center;
  }
  .page-header__text {
    text-align: center;
  }
  .page-header__media {
    width: 100%;
  }
}

#card-quiz {
}
#card-quiz {
}
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 16px 0;
  box-shadow: 0 2px 18px rgba(15, 23, 42, 0.12);
  text-align: center;
}
.card,
.page-header,
.leaderboard-grid,
.leaderboard-card,
.slide-leaderboard-card,
.puzzle-header,
footer {
  color: var(--color-fg);
}
.quiz-entry {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.player-panel,
.quiz-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 0 0 auto;
}
.quiz-panel {
  flex: 1 1 auto;
}
#quiz.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
  min-height: 0;
  max-height: calc(100vh - 140px);
  text-align: center;
  overflow: hidden;
}
.player-panel .intro {
  text-align: left;
}
.player-panel input {
  display: none;
}
.player-panel button {
  align-self: center;
  min-width: 60%;
  font-size: 0.95rem;
}
.quiz-panel #answers {
  margin-top: 4px;
}
.quiz-panel #answers {
  max-height: 36vh;
  overflow: auto;
}
.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.actions .back-link {
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--button-gradient);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--button-shadow);
  font-weight: 600;
}
.quiz-footer {
  margin: 18px auto;
  display: flex;
  justify-content: center;
}

#quiz[hidden] {
  display: none;
}
#quiz.card > * {
  display: none;
}
#quiz.card > *:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}
#leaderboard.card,
footer {
  margin-left: auto;
  margin-right: auto;
  width: min(960px, 100%);
}

h1,
h2 {
  margin: 0 0 12px;
  text-align: center;
}
h1 {
  font-size: clamp(1.5rem, 1.2rem + 2vw, 2.25rem);
  line-height: 1.2;
}
h2 {
  font-size: clamp(1.125rem, 1rem + 1vw, 1.5rem);
}

/* Word search */
.wordsearch-app {
  width: min(900px, 100%);
  margin: 0 auto;
  text-align: center;
}
#wordsearch-card h2 {
  color: var(--game-primary);
  margin-bottom: 8px;
}
#wordsearch-card p {
  color: var(--game-subtle);
  margin-bottom: 16px;
}
.wordsearch-grid {
  display: grid;
  grid-template-columns: repeat(var(--wordsearch-cols, 12), minmax(0, 1fr));
  gap: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--wordsearch-border);
}
.wordsearch-grid .cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--wordsearch-border);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}
.wordsearch-grid .cell.selected {
  background: var(--wordsearch-select);
}
.wordsearch-grid .cell.found {
  background: var(--wordsearch-found);
  border-color: #4ade80;
}
.wordsearch-grid .cell.error {
  background: var(--wordsearch-error);
}
.wordsearch-words {
  width: min(760px, 100%);
  margin: 16px auto 16px;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  justify-items: center;
}
.wordsearch-words li {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 6px 10px;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  min-width: 120px;
}
.wordsearch-words li.found {
  text-decoration: line-through;
  color: #475467;
  border-color: #a7f3d0;
}
.leaderboard-card.wordsearch-leaderboard {
  margin-top: 20px;
}
.leaderboard-card.wordsearch-leaderboard table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.leaderboard-card.wordsearch-leaderboard th,
.leaderboard-card.wordsearch-leaderboard td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
}
.leaderboard-card.wordsearch-leaderboard tbody tr:nth-child(odd) {
  background: #f8fafc;
}
#wordsearch-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.65);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 1000;
}
#wordsearch-modal.active {
  opacity: 1;
  visibility: visible;
}
#wordsearch-modal .modal-card {
  background: #fff;
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  text-align: center;
  color: var(--game-primary);
  max-width: 340px;
}
#wordsearch-modal button {
  margin-top: 18px;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  background: var(--game-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
@media (max-width: 600px) {
  .wordsearch-grid {
    gap: 4px;
    padding: 8px;
  }
  .wordsearch-grid .cell {
    font-size: 1rem;
  }
  .wordsearch-words li {
    font-size: 0.85rem;
  }
}

.quiz-panel #answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.answer {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 1rem;
  background: #fff;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.2s ease;
}
.answer:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(15, 23, 42, 0.15);
}
.answer.selected {
  border-color: var(--game-accent);
  background: rgba(13, 148, 136, 0.08);
}
.answer.correct {
  border-color: var(--game-accent);
  background: rgba(18, 161, 80, 0.12);
}
.answer.incorrect {
  border-color: #d33;
  background: rgba(221, 51, 51, 0.12);
}

button {
  padding: 12px 16px;
  border: none;
  border-radius: 14px;
  background: var(--button-gradient);
  color: #fff;
  cursor: pointer;
  min-height: 46px;
  touch-action: manipulation;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--button-shadow);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}
button:hover,
.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 22px rgba(13, 148, 136, 0.35);
}
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.cta {
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: var(--button-gradient);
  border: none;
  box-shadow: var(--button-shadow);
}
.cta.secondary,
.cta.accent {
  background: linear-gradient(
    135deg,
    var(--game-primary),
    var(--game-accent-secondary)
  );
}
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  grid-auto-rows: 3fr;
  gap: 16px;
}

.permanent-cta .action-grid.three-up {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
.permanent-cta {
  margin: 0 auto 24px;
  max-width: min(920px, 100%);
  padding: 0 12px;
}
.permanent-cta.action-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.permanent-cta.action-stack .cta {
  width: 72%;
  max-width: 300px;
  min-height: 48px;
  padding: 10px 14px;
  aspect-ratio: unset;
}
.action-grid button,
.action-grid .cta {
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 1rem;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.16);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  background: var(--game-fg);
  color: #fff;
}
.action-grid .cta.secondary {
  background: var(--game-accent);
}
.action-grid .cta.accent {
  background: var(--game-primary);
}
.action-grid .cta.tertiary {
  background: var(--game-subtle);
}
.action-grid button:hover,
.action-grid .cta:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 45px rgba(15, 23, 42, 0.25);
}
.back-link {
  margin: 24px auto 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 18px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  width: min(280px, 100%);
  box-shadow: 0 18px 30px rgba(13, 148, 136, 0.35);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.back-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(13, 148, 136, 0.45);
}
.leaderboards {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.leaderboard-grid {
  margin: 24px auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.1);
}
.leaderboard-grid header {
  text-align: center;
}
.leaderboard-grid-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.leaderboard-grid .leaderboard-card {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: #fff;
}
.leaderboard-link-row {
  text-align: center;
  margin-top: 8px;
}
.name-actions {
  text-align: center;
  margin: 12px 0 0;
}
.name-actions .ghost-link {
  font-size: 0.95rem;
}
.ghost-link {
  background: rgba(13, 98, 150, 0.12);
  border: 1px solid rgba(13, 98, 150, 0.45);
  color: var(--color-fg);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 12px;
  font-size: 1rem;
  border-radius: 999px;
  transition:
    background 0.2s ease,
    border 0.2s ease;
}
.ghost-link:hover {
  background: rgba(13, 98, 150, 0.2);
  border-color: var(--color-primary);
  color: var(--color-fg);
}
.ghost-link:focus-visible {
  outline: 2px solid var(--color-primary);
  border-radius: 999px;
}
.name-trigger {
  align-self: center;
}
.quiz-error {
  margin: 12px auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fee2e2;
  color: #b91c1c;
  max-width: 600px;
}
.leaderboard-card table,
.slide-leaderboard-card table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.leaderboard-card th,
.slide-leaderboard-card th,
.leaderboard-card td,
.slide-leaderboard-card td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
}
.slide-leaderboard-card {
  background: #fff;
}
label {
  display: block;
  margin: 8px 0;
  text-align: center;
}
input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ccc;
  width: 100%;
  max-width: 100%;
  text-align: center;
}
/* Prevent iOS Safari zoom-on-focus by ensuring 16px font size */
input,
select,
textarea,
button {
  font-size: 16px;
}

.intro {
  color: var(--color-subtle);
  margin-bottom: 12px;
  text-align: center;
}
#question-text {
  overflow-wrap: anywhere;
}
#q-meta {
  display: flex;
  justify-content: space-between;
  color: #555;
  margin-bottom: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #eee;
}
th:first-child,
td:first-child {
  width: 90px;
}
.actions {
  display: block;
  gap: 10px;
}
.lobby-card {
  padding: 20px;
}
.lobby-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.lobby-header h2 {
  margin: 0;
}
.lobby-actions {
  width: 100%;
}

.player-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}
.player-modal[hidden] {
  display: none;
}
.player-modal__card {
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  width: min(360px, 100%);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  text-align: center;
}
.player-modal__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.player-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: auto;
  margin-bottom: 5%;
}
.player-name-error {
  color: #c53030;
  min-height: 1.2rem;
  font-size: 0.9rem;
  margin-top: 6px;
}
.puzzle-card {
  padding: 20px;
}
.puzzle-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.puzzle-header h1,
.puzzle-header h2 {
  margin: 0;
  color: var(--game-primary);
}
.puzzle-header p,
#slide-instructions,
#wordsearch-card .puzzle-header p {
  text-align: center;
}
.puzzle-header .subtle-actions {
  gap: 4px;
  margin-top: 6px;
}
.puzzle-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.wordsearch-app .puzzle-actions {
  justify-content: center;
  margin: 16px 0 0;
}
.slide-board {
  margin: 0 auto;
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: repeat(var(--puzzle-grid, 3), minmax(0, 1fr));
  gap: 1px;
}
.slide-tile {
  aspect-ratio: 1/1;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #f8f8f8;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  padding: 0;
  font-size: 0;
  color: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  cursor: pointer;
}
.slide-tile.blank {
  background: linear-gradient(180deg, #fff, #f6f6f6);
  border-style: dashed;
  cursor: default;
}

body.wordsearch-body .pwa-shell {
  background: transparent;
}

body.wordsearch-body .page-header {
  background: var(--game-card-bg);
  border: 1px solid var(--game-border);
  box-shadow: var(--game-shadow);
  text-align: center;
}
.slide-tile:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.slide-status {
  text-align: center;
  font-weight: 600;
  margin-top: 12px;
  color: #333;
}
.slide-status.solved {
  color: var(--color-primary);
}

.completion-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2200;
}
.completion-modal[hidden] {
  display: none;
}
.completion-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  width: min(360px, 100%);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  text-align: center;
}
.completion-card .completion-message {
  margin: 0 0 12px;
  font-size: 1rem;
  line-height: 1.4;
  color: #111;
}

:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}
#leaderboard {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#leaderboard table {
  min-width: 360px;
}

@media (max-width: 640px) {
  .container {
    padding: 18px max(var(--pad), env(safe-area-inset-left)) 24px;
  }
  .card {
    padding: 18px 16px;
  }
  .action-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  #splash {
    padding: clamp(12px, 3vw, 18px);
  }
  .splash-card {
    max-height: calc(100vh - 32px);
  }
  .leaderboards {
    grid-template-columns: 1fr;
  }
  .leaderboard-card table,
  .slide-leaderboard-card table {
    font-size: 0.9rem;
  }
}
@media (min-width: 900px) {
  .container {
    padding: 24px;
  }
}
@media (max-width: 599px) {
  button,
  #start-btn,
  #play-again-btn {
    width: 100%;
  }
  .actions {
    flex-direction: column;
  }
  th,
  td {
    padding: 10px 8px;
  }
  #q-meta {
    font-size: 0.95rem;
  }
}
@media (max-width: 599px) {
  .back-link {
    width: 100%;
  }
}
@media (max-width: 520px) {
  #quiz.card {
    max-height: calc(100vh - 24px - env(safe-area-inset-bottom, 0));
  }
  header h1 {
    font-size: 1.75rem;
  }
  header h2 {
    font-size: 1rem;
  }
  #question-text {
    font-size: 1.1rem;
  }
  #answers {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .hero {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .hero {
    opacity: 1;
  }
}
