/* ── Emoji-only definitions render larger ─────────────── */
.emoji-def {
  font-size: 3em !important;
  line-height: 1.2;
}
.emoji-def .def-pos {
  font-size: 0.28em;
}

/* ── Back link ────────────────────────────────────────── */
.back-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}

/* ── Spinner ──────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--line);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Modal overlay ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}
.modal-card h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ── Focus ring ─────────────────────────────────────── */
.focus-ring:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

/* ── Label utilities ────────────────────────────────── */
.label-sm {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Narrow page containers ──────────────────────────── */
.narrow-body { max-width: 480px; margin: 0 auto; padding: 0 1rem 2rem; }
.narrow-page { max-width: 520px; margin: 3rem auto; padding: 0 1.5rem; color: var(--ink); }
.narrow-page-md { max-width: 600px; margin: 3rem auto; padding: 0 1.5rem; color: var(--ink); }

/* ── Loading row ─────────────────────────────────────── */
.loading-row { display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0; }

/* ── Field error ─────────────────────────────────────── */
.field-error { font-size: 0.85rem; color: var(--warn); margin: 0.5rem 0 0; }

/* ── Form input ──────────────────────────────────────── */
.form-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  box-sizing: border-box;
}
textarea.form-input {
  resize: vertical;
}

/* ── Definition feedback (click-to-flag) ─────────────── */
.def-clickable {
  cursor: help;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.15s;
  padding: 2px 4px;
  margin: -2px -4px;
}
.def-clickable:hover { border-color: var(--line); }
.def-flag-wrap { position: relative; display: inline-block; }
.def-flag-drop {
  position: absolute; left: 0; top: 100%; z-index: 10;
  margin-top: 6px; padding: 10px 14px;
  background: var(--card-bg, #fff); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
.def-flag-x { font-size: 0.85em; line-height: 1; }
.def-flag-btn {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 0.85rem;
  color: var(--fg); transition: background 0.15s, border-color 0.15s;
  display: flex; align-items: center; gap: 8px;
}
.def-flag-btn:hover { background: var(--hover-bg, #f5f5f5); border-color: var(--accent); }
.def-flag-btn.flagged { border-color: var(--accent); color: var(--accent); }
.def-flag-drop-sm { padding: 6px 10px; }
.def-flag-drop-sm .def-flag-x { font-size: 0.75em; }
.def-flag-drop-sm .def-flag-btn { font-size: 0.75rem; padding: 4px 8px; gap: 6px; }

/* ── Feedback toast ──────────────────────────────────── */
.feedback-toast {
  position: fixed;
  transform: translate(-50%, 0);
  background: var(--ink); color: white;
  font-size: 0.85rem; padding: 0.5rem 1rem;
  border-radius: 6px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  z-index: 200; white-space: nowrap;
  width: max-content; height: auto;
}
.feedback-toast.visible {
  opacity: 1;
}

/* ── Admin shared utilities ────────────────────────────── */
.admin-card { border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.text-detail { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }
.text-meta { font-size: 0.8rem; color: var(--muted); }
.action-row { display: flex; gap: 0.25rem; }
.badge { font-size: 0.75rem; padding: 0.15rem 0.4rem; border-radius: 3px; font-weight: 600; text-transform: uppercase; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger { background: #fef2f2; color: #991b1b; }
.event-badge { display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 3px; background: var(--surface, #f5f5f5); white-space: nowrap; text-transform: capitalize; }

/* ── Word prompt (landing + quiz) ─────────────────────── */
.word-prompt {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
  padding-bottom: 0.25rem;
  transition: opacity 0.15s;
  pointer-events: none;
}

/* ── Game shared (choose-def, match, quiz) ───────────── */
.game-main .back-link {
  display: inline-block;
  color: var(--muted);
  margin-bottom: 1rem;
}
.game-main .back-link:hover { color: var(--ink); }

.game-intro {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.game-intro h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.25rem; }
.game-intro-sub { font-size: 1rem; color: var(--muted); margin: 0 0 0.25rem; }
.game-intro-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.game-progress-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.game-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.game-result {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.25rem;
}
.game-result h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.game-result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 280px;
}
.game-result-actions .quiz-action-btn { width: 100%; }
