/* Public play experience. Shared tokens and admin styles stay in styles.css. */
.play-page {
  --font-ar: 'Noto Sans Arabic', Tahoma, Arial, sans-serif;
  --muted: #746b60;
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  .play-page { --muted: #b8ad9d; }
}

.play-page .topbar {
  flex-wrap: wrap;
  justify-content: space-between;
  width: min(100%, 960px);
  margin-inline: auto;
  padding-block: 1rem;
}

.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.8rem;
}

.library-link,
.text-button {
  appearance: none;
  min-height: var(--tap-min);
  padding: 0.4rem 0.55rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.8;
  cursor: pointer;
  touch-action: manipulation;
}

:is(.library-link, .text-button):lang(ar) {
  font-family: var(--font-ar);
  font-size: 0.9rem;
}

:is(.library-link, .text-button):hover { color: var(--ink); background: var(--accent-soft); }
.text-button { text-decoration: underline; text-underline-offset: 0.2em; }
.library-link { display: inline-flex; align-items: center; gap: 0.35rem; }
#likedCount { min-width: 1.3rem; border-radius: 1rem; background: var(--accent-soft); }

.play-page .brand {
  font-size: 1.8rem;
  line-height: 1.6;
  opacity: 1;
  animation: none;
}

.play-page .brand:lang(ar) {
  font-size: 1.65rem;
  font-weight: 600;
}

.play-page .lang-toggle {
  gap: 0.35rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  backdrop-filter: none;
}

.play-page .lang-toggle button {
  padding: 0.35rem 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.8;
  border-radius: 0.65rem;
}

.play-page .lang-toggle button:lang(ar) {
  font-family: var(--font-ar);
  font-size: 0.9rem;
}

.play-page .lang-toggle button.is-active {
  color: var(--ink);
  background: var(--accent-soft);
}

.play-page :is(button, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.play-page .stage {
  flex: 0 0 auto;
  max-width: 700px;
  gap: 1rem;
  padding-block: clamp(1rem, 4vh, 2.5rem) 2rem;
}

.play-page .tagline {
  max-width: 100%;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--ink-soft);
  letter-spacing: 0;
  line-height: 1.8;
  opacity: 1;
  animation: none;
}

.play-page .game-settings { gap: 0.6rem; }
.play-page .settings-label { font-size: 0.8rem; }
.play-page .settings-label:lang(ar) { font-size: 0.9rem; }

.play-page .context-filters {
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
}

.play-page .cat-chip {
  min-height: var(--tap-min);
  padding: 0.45rem 0.9rem;
  line-height: 1.7;
  letter-spacing: 0;
}

.play-page .context-chip {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 0.75rem;
}

.play-page .context-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.question-options {
  width: 100%;
  min-width: 0;
}

.question-options summary {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: fit-content;
  max-width: 100%;
  min-height: var(--tap-min);
  margin-inline: auto;
  padding: 0.35rem 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  list-style: none;
}

.question-options summary:lang(ar) { font-size: 0.9rem; }
.question-options summary::-webkit-details-marker { display: none; }
.question-options summary:hover { color: var(--ink); }

.options-chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.question-options[open] .options-chevron { transform: rotate(180deg); }

.filter-summary {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--ink);
  text-align: center;
}

.options-panel {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  background: var(--card);
  text-align: start;
}

.play-page .deck-picker {
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.85rem;
}

.play-page .deck-picker select {
  min-width: 0;
  width: min(100%, 12rem);
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.8;
}

.filter-field { min-width: 0; }
.filter-field .settings-label { margin-bottom: 0.4rem; }

.play-page :is(.level-filters, .cat-filters) {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.25rem;
  overflow: visible;
  opacity: 1;
  animation: none;
}

.reset-filters {
  justify-self: start;
  min-height: var(--tap-min);
  padding: 0.25rem 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: none;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.play-page .card {
  /* Grow with long questions and large text instead of clipping Arabic glyphs
     or putting the conversation inside a second scroll area. */
  height: auto;
  min-height: 280px;
  gap: 1.25rem;
  padding: clamp(1.5rem, 5vw, 3rem);
  border-radius: 1.25rem;
  overflow: visible;
}

.play-page .card.has-content {
  border-color: var(--line-strong);
  box-shadow: 0 4px 20px -16px rgba(45, 36, 25, 0.25);
}

.play-page .card-meta {
  gap: 0.65rem 1rem;
  line-height: 1.8;
}

.play-page :is(.q-level, .eyebrow) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.play-page :is(.q-level, .eyebrow):lang(ar) { font-size: 0.85rem; }
.play-page .eyebrow { flex-shrink: 1; }
.play-page .question {
  max-width: 100%;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  line-height: 1.5;
  text-wrap: pretty;
  overflow-wrap: break-word;
  hyphens: none;
}

.play-page .question:lang(ar) {
  font-family: var(--font-ar);
  font-size: clamp(1.35rem, 3.5vw, 1.9rem);
  font-weight: 500;
  line-height: 1.95;
  letter-spacing: 0;
}

/* Buffered questions should be readable on the next paint. A slow fade
   would hide the benefit of choosing locally and delay reading every card. */
.play-page .question.enter {
  animation: none;
  opacity: 1;
  transform: none;
}

.play-page .actions { margin-top: 0.25rem; max-width: 28rem; gap: 0.5rem; }
.play-page .btn {
  width: 100%;
  max-width: 22rem;
  min-height: 52px;
  padding: 0.65rem 1.4rem;
  border-radius: 0.85rem;
  font-size: 1rem;
  line-height: 1.8;
  box-shadow: none;
}

.play-page .btn:lang(ar) { font-size: 1.05rem; }
.play-page .actions .btn-primary { flex: 1; min-width: 0; }
.play-page .btn-secondary {
  width: auto;
  padding-inline: 1rem;
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
  font-size: 0.85rem;
}
.play-page .btn-secondary:lang(ar) { font-size: 0.95rem; }
.load-notice {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.load-notice:lang(ar) { font-size: 0.95rem; }
.play-page .play-guide {
  max-width: 100%;
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--muted);
}

.play-page .play-guide:lang(ar) { font-size: 0.85rem; }
.play-page .react-bar { gap: 0.5rem; }
.play-page .react-btn {
  min-height: var(--tap-min);
  padding-inline: 0.85rem;
  background: transparent;
  border-color: transparent;
  font-size: 0.8rem;
  line-height: 1.8;
}

.play-page .react-btn:lang(ar) { font-size: 0.9rem; }
.play-page :is(.share-opt, .reason-chip) {
  min-height: var(--tap-min);
  line-height: 1.8;
}

.play-page .session-note { letter-spacing: 0; }

.liked-dialog {
  width: min(36rem, calc(100% - 2rem));
  max-height: calc(100dvh - 3rem);
  margin: auto;
  padding: 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: 1.25rem;
  color: var(--ink);
  background: var(--bg);
  text-align: start;
  overscroll-behavior: contain;
}
.liked-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.play-page:has(.liked-dialog[open]) { overflow: hidden; }
.liked-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.liked-heading h2 { font-size: 1.15rem; font-weight: 600; }
.liked-hint, .liked-status { color: var(--muted); font-size: 0.85rem; line-height: 1.9; }
.liked-status:empty { display: none; }
.liked-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.liked-list li { padding-block: 1rem; border-top: 1px solid var(--line-strong); }
.liked-list p { margin: 0 0 0.35rem; font-size: 1.05rem; line-height: 1.7; overflow-wrap: anywhere; }
.liked-list p:lang(ar) { font-family: var(--font-ar); line-height: 2; }
.remove-liked { font-size: 0.75rem; color: var(--muted); }

@media (max-width: 480px) {
  .play-page .stage { gap: 0.85rem; padding-top: 0.75rem; }
  .play-page .topbar { padding-block: 0.65rem; }
  .topbar-tools { gap: 0.2rem; }
  .library-link { font-size: 0.75rem; }
  .play-page .tagline { font-size: 0.9rem; }
  .play-page .card { min-height: 240px; padding: 1.5rem 1.2rem; }
  .play-page .cat-chip { padding-inline: 0.7rem; }
  .play-page .deck-picker { align-items: stretch; flex-direction: column; }
  .play-page .deck-picker select { width: 100%; }
}
