/* header/.nav-link/#theme-toggle now live in shared/theme.css (the site-wide
   nav bar rendered by nav.js). */

main {
  width: 100%;
  max-width: 640px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
}

.status {
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  width: 100%;
}

blockquote {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.6;
}

blockquote.poetry {
  white-space: pre-line;
}

.hints {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hints li {
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
}

.hints .hint-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.5rem;
}

.stage-label {
  font-family: system-ui, sans-serif;
  font-weight: 600;
  margin: 0;
  text-align: center;
}

/* A one-off celebratory pill (see renderAuthorReveal in daily.js) — shows
   right after a correct author guess, then fades itself out a few seconds
   later. Not the persistent "which author am I guessing a book by" label;
   the guess-history list covers that once this has faded. */
.reveal-pill {
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  color: var(--fg);
  background: color-mix(in srgb, var(--success-color) 28%, transparent);
  opacity: 1;
  transition: opacity 0.4s ease;
}

.reveal-pill.fading {
  opacity: 0;
}

.reveal-pill[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-pill {
    transition: none;
  }
}

/* Persistent (non-fading) context label — see createAnswerContext in
   puzzleUI.js — distinct from .reveal-pill's one-off celebratory flash. */
.answer-context {
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin: 0;
}

.answer-context strong {
  color: var(--fg);
}

.answer-context[hidden] {
  display: none;
}

.guess-form {
  width: 100%;
  display: flex;
  gap: 0.5rem;
}

.guess-form[hidden] {
  display: none;
}

.guess-input-wrap {
  position: relative;
  flex: 1;
}

.guess-form input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: system-ui, sans-serif;
  background: var(--card-bg);
  color: var(--fg);
}

.suggestions {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.suggestions li {
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
}

.suggestions li:hover,
.suggestions li.active {
  background: color-mix(in srgb, var(--accent-color) 18%, transparent);
}

/* On mobile, the on-screen keyboard covers whatever's below the input, so
   the dropdown opens upward instead of downward there. */
@media (max-width: 640px) {
  .suggestions {
    top: auto;
    bottom: calc(100% + 0.35rem);
    max-height: 160px;
  }
}

.guess-form button {
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}

.guess-form button:hover {
  filter: brightness(1.1);
}

.guesses-remaining {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
}

.guesses-remaining.invalid {
  color: var(--accent-color);
  font-weight: 600;
}

.guess-history {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.4rem;
}

.guess-history li {
  font-family: system-ui, sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

/* Every guess is a small pill — bold/solid green if it was right, muted
   strikethrough red if not — kept in the list for the rest of the round
   (across both the author and title stages) rather than cleared away. */
.guess-history li span.hit,
.guess-history li span.miss {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
}

.guess-history li span.hit {
  color: var(--fg);
  font-weight: 700;
  background: color-mix(in srgb, var(--success-color) 25%, transparent);
}

.guess-history li span.miss {
  color: var(--muted);
  text-decoration: line-through;
  background: color-mix(in srgb, var(--accent-color) 16%, transparent);
}

@keyframes correct-flash {
  from {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-color) 55%, transparent);
  }
  to {
    box-shadow: 0 0 0 3px transparent;
  }
}

/* Plays once on the row holding a just-submitted correct guess — a fading
   glow around span.hit's persistent pill above, distinguishing "you just
   got this right" from history scrollback. */
.guess-history li.correct-flash span.hit {
  border-radius: 999px;
  animation: correct-flash 1.6s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .guess-history li.correct-flash span.hit {
    animation: none;
  }
}

button#skip-passage {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

button#skip-passage:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.result {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  font-family: system-ui, sans-serif;
  text-align: center;
}

.result p {
  margin: 0.25rem 0;
}

.result p.result-squares {
  font-size: 1.3rem;
  letter-spacing: 0.15em;
  margin: 0.1rem 0 0.75rem;
}

button#copy-results {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.25rem;
}

button#copy-results:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

button#new-round {
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}

button#new-round:hover {
  filter: brightness(1.1);
}
