/* ── Shared modal (📊 Stats & trophies, rules, …) ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--scrim) 72%, transparent);
  padding: 24px;
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(560px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 60px color-mix(in srgb, var(--shadow) 60%, transparent);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 800; letter-spacing: 0.4px; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-body { overflow-y: auto; padding: 12px 18px 18px; }
.modal-body[hidden] { display: none; }

/* Tabs of the 📊 Stats & trophies modal (same look as the ✨ vocab tabs) */
.modal-tabs { display: flex; gap: 6px; padding: 10px 18px 0; }
.modal-tabs [role="tab"] { flex: 1; min-height: 40px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.modal-tabs [role="tab"]:hover { color: var(--text); }
.modal-tabs [role="tab"][aria-selected="true"] { border-color: var(--action); color: var(--text); background: color-mix(in srgb, var(--action) 15%, transparent); }

/* ── Cloud-save account control (topbar) + login modal ──────────────────────── */
#tb-auth { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.tb-auth-btn {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.tb-auth-btn:hover { background: var(--surface-1); }
.tb-account { font-size: 13px; font-weight: 700; opacity: 0.9; max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-sub { margin: 0 0 14px; opacity: 0.8; font-size: 14px; }
.auth-provider {
  width: 100%; padding: 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 14px;
}
.auth-provider:hover { background: var(--surface-1); }
.auth-or { text-align: center; opacity: 0.5; margin: 12px 0; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
#auth-form, #auth-reset-form { display: flex; flex-direction: column; gap: 10px; }
#auth-reset-form.hidden { display: none; }
.auth-link { align-self: flex-start; background: none; border: 0; padding: 2px 0; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; }
.auth-link:hover { color: var(--text); }
#auth-form input, #auth-reset-form input {
  padding: 10px 12px; border-radius: 10px; font-size: 14px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.auth-actions { display: flex; gap: 10px; margin-top: 4px; }
.auth-primary, .auth-secondary {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  border: 1px solid var(--line);
}
.auth-primary { background: var(--action); color: var(--text-strong); border-color: transparent; }
.auth-secondary { background: var(--surface-2); color: var(--text); }
.auth-msg { margin-top: 12px; font-size: 13px; min-height: 18px; opacity: 0.9; }
.auth-msg.error { color: var(--ko-soft); }

/* Login note + "which save to keep?" choice (ui-auth.js) */
.auth-note { margin: -6px 0 14px; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4;
  background: color-mix(in srgb, var(--action) 12%, transparent); border: 1px solid var(--line); color: var(--text); }
.sync-choice-text { margin: 0 0 16px; line-height: 1.5; }
.sync-choice-actions { display: flex; flex-direction: column; gap: 10px; }
.sync-choice-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 600; }
.sync-choice-btn small { font-weight: 400; font-size: 12px; opacity: 0.85; }

/* ── ✨ Mon vocabulaire (ui-custom-vocab.js) ─────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.modal.modal-wide { width: min(94vw, 640px); }
.vocab-intro { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
#vocab-lists h3, .vocab-add h3 { font-size: 14px; margin: 0; }
.vocab-lists-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vocab-empty { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.vocab-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.vocab-list-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.vocab-list-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vocab-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.vocab-play { padding: 5px 12px; border-radius: 16px; border: 1px solid var(--action); background: transparent; color: var(--text); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.vocab-play:hover { background: var(--action); color: var(--text-strong); }
.vocab-icon { background: none; border: 0; cursor: pointer; font-size: 14px; padding: 4px; border-radius: 6px; color: var(--text); }
.vocab-icon:hover { background: var(--surface-1); }
.vocab-rename { flex: 1; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--action); background: var(--bg); color: var(--text); font: inherit; }
.vocab-add { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.vocab-name-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.vocab-name-label input, .vocab-grid input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
.vocab-tabs { display: flex; gap: 6px; }
.vocab-tabs [role="tab"] { flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.vocab-tabs [role="tab"][aria-selected="true"] { border-color: var(--action); color: var(--text); background: color-mix(in srgb, var(--action) 15%, transparent); }
.vocab-help { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.vocab-help a { color: var(--action-lilac); }
.vocab-grid { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.vocab-grid th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; }
.vocab-grid td { padding-right: 6px; }
.vocab-grid td:last-child { width: 28px; padding-right: 0; }
.vocab-grid input { width: 100%; box-sizing: border-box; }
.vocab-link { align-self: flex-start; background: none; border: 0; color: var(--action-lilac); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 0; }
#vocab-preview p { margin: 0; font-size: 13px; }
.vocab-ok { color: var(--ok-soft); font-weight: 600; }
.vocab-warn { color: var(--almost-soft); margin-top: 6px !important; }
.vocab-error { color: var(--ko-soft); }
.vocab-sample { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--text); }
.vocab-more { color: var(--muted); list-style: none; }
#vocab-create { align-self: stretch; flex: none; }
#vocab-create:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── 🚩 Report-a-problem modal (modules/report.js) ─────────────────────────── */
#report-form { display: flex; flex-direction: column; gap: 12px; }
.report-ctx { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.report-ctx-row { display: flex; gap: 8px; padding: 2px 0; }
.report-ctx-label { flex: 0 0 82px; color: var(--muted); font-weight: 700; }
.report-ctx-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.report-fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.report-fieldset legend { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.report-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.report-field textarea, .report-field input {
  padding: 8px 10px; border-radius: 10px; font: inherit; font-weight: 400; font-size: 14px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); resize: vertical;
}
.report-public { margin: 0; font-size: 12px; color: var(--muted); }
.report-msg { font-size: 13px; min-height: 18px; }
.report-msg.error { color: var(--ko-soft); }
#report-answer-fields { display: flex; flex-direction: column; gap: 12px; }
#report-answer-fields[hidden], .report-ctx[hidden] { display: none; }
/* Type labels flow as one sentence (a flex row split the hint into a column on phones). */
.report-type { display: block; padding-left: 22px; text-indent: -22px; font-size: 14px; font-weight: 700; line-height: 1.35; cursor: pointer; }
.report-type input { margin: 0 6px 0 0; vertical-align: -2px; }
.report-type-hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.report-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.report-attach-btn {
  cursor: pointer; padding: 6px 10px; border-radius: 10px; font-weight: 700;
  border: 1px dashed var(--line); background: var(--surface-2);
}
.report-attach-btn:hover, .report-attach-btn:focus-within { background: var(--surface-1); }
.report-attach-tip { color: var(--muted); }
.report-attach-preview { flex-basis: 100%; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.report-attach-preview:empty { display: none; }
.report-attach-preview img { max-width: 160px; max-height: 100px; border-radius: 8px; border: 1px solid var(--line); }
.report-context { font-size: 12px; color: var(--muted); }
.report-context summary { cursor: pointer; }
.report-context pre {
  max-height: 180px; overflow: auto; margin: 6px 0 0; padding: 8px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line); font-size: 11px; white-space: pre-wrap; word-break: break-word;
}
.report-attach-btn { position: relative; }
.report-file { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
