/* =====================================================================
   Mini-Anki — styles (limités au conteneur #ma et aux classes ma-*)
   Reprend les variables d'Otoolia (--ot-*) : thème clair / sombre du site.
   ===================================================================== */
.ma {
  --ma-red: #d62839;    --ma-red-bg: #fde7e9;
  --ma-orange: #c26a00; --ma-orange-bg: #fff0d6;
  --ma-green: #1f8a5b;  --ma-green-bg: #dcf5e9;
  --ma-blue: #1f6fd1;   --ma-blue-bg: #e1edfd;
  max-width: 860px; margin: 0 auto;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ma {
    --ma-red: #f2727e; --ma-red-bg: #3b1a1f; --ma-orange: #f4b45a; --ma-orange-bg: #3a2a12;
    --ma-green: #5fd3a0; --ma-green-bg: #12332a; --ma-blue: #7fb2f5; --ma-blue-bg: #14273f;
  }
}
:root[data-theme="dark"] .ma {
  --ma-red: #f2727e; --ma-red-bg: #3b1a1f; --ma-orange: #f4b45a; --ma-orange-bg: #3a2a12;
  --ma-green: #5fd3a0; --ma-green-bg: #12332a; --ma-blue: #7fb2f5; --ma-blue-bg: #14273f;
}

.ma-head { max-width: 860px; margin: 0 auto calc(var(--ot-space) * 1.5); }
.ma-head h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
.ma-head p { margin: 0; }
.ma h2 { font-size: 1.15rem; margin-bottom: .8em; }

/* ---------- Import ---------- */
.ma-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 2px dashed var(--ot-border); border-radius: var(--ot-radius); padding: 22px 16px;
  cursor: pointer; color: var(--ot-text-soft); transition: border-color .15s, background .15s;
}
.ma-drop strong { color: var(--ot-text); font-size: 1.02rem; }
.ma-drop span { font-size: .88rem; }
.ma-drop:hover, .ma-drop--over, .ma-drop:focus-within { border-color: var(--ot-brand); background: var(--ot-surface-2); }
.ma-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ma-drop__icon { font-size: 1.8rem; line-height: 1; }
.ma-status { min-height: 1.4em; margin: 10px 0 0; font-size: .9rem; color: var(--ot-success); font-weight: 600; }
.ma-status--error { color: var(--ot-danger); }

.ma-decks { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.ma-empty { text-align: center; color: var(--ot-text-soft); font-size: .92rem; margin: 10px 0; }
.ma-deck {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 14px;
  background: var(--ot-surface-2); border: 1px solid var(--ot-border); border-radius: var(--ot-radius-s);
}
@media (min-width: 640px) { .ma-deck { flex-direction: row; align-items: center; } }
.ma-deck__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ma-deck__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-deck__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .8rem; color: var(--ot-text-soft); }
.ma-deck__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ma-deck__actions .ot-btn { padding: 6px 12px; font-size: .85rem; min-height: 36px; }
.ma-del:hover { color: var(--ot-danger); border-color: var(--ot-danger); }
.ma-pill { padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: .75rem; }
.ma-pill--due { background: var(--ma-red-bg); color: var(--ma-red); }
.ma-pill--new { background: var(--ma-blue-bg); color: var(--ma-blue); }

/* ---------- Révision ---------- */
.ma-stats { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  font-size: .85rem; color: var(--ot-text-soft); margin-bottom: 6px; }
.ma-bar { height: 6px; border-radius: 3px; background: var(--ot-border); overflow: hidden; margin-bottom: 12px; }
.ma-bar > div { height: 100%; width: 0; background: var(--ot-brand); transition: width .25s; }

.ma-card {
  position: relative; min-height: 280px; padding: 18px 20px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--ot-surface); border: 1px solid var(--ot-border); border-radius: var(--ot-radius);
  box-shadow: var(--ot-shadow); cursor: pointer; transition: border-color .15s;
}
.ma-card:hover { border-color: var(--ot-brand); }
.ma-card--back { cursor: default; }
.ma-card--back:hover { border-color: var(--ot-border); }
.ma-side, .ma-tip { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ot-text-soft); }
.ma-card--back .ma-tip { visibility: hidden; }
.ma-text {
  width: 100%; margin: auto 0; text-align: center; font-size: 1.2rem; line-height: 1.5;
  overflow-wrap: anywhere; cursor: auto;
}
.ma-text img { display: inline-block; max-width: 100%; height: auto; vertical-align: middle; border-radius: 6px; }
.ma-text video { display: block; max-width: 100%; max-height: 60vh; margin: 10px auto; border-radius: 6px; background: #000; }
.ma-text audio { display: block; margin: 10px auto; max-width: 100%; }
.ma-text table { margin: 10px auto; border-collapse: collapse; }
.ma-text td, .ma-text th { border: 1px solid var(--ot-border); padding: 4px 8px; }
.ma-text pre, .ma-text code { font-family: var(--ot-mono); font-size: .9em; text-align: left; }
.ma-text pre { background: var(--ot-surface-2); padding: 10px; border-radius: 6px; overflow-x: auto; }
.ma-text hr, .ma-text hr#answer { border: none; border-top: 1px solid var(--ot-border); margin: 14px 0; }
.ma-text ul, .ma-text ol { display: inline-block; text-align: left; }
.ma-text .katex-display { margin: .6em 0; overflow-x: auto; overflow-y: hidden; }
.ma-text .cloze { font-weight: 700; color: var(--ma-blue); background: var(--ma-blue-bg); padding: 1px 6px; border-radius: 4px; }
.ma-text .cloze--hidden { color: var(--ot-brand); background: var(--ot-surface-2); }
.ma-extra { margin-top: 12px; font-size: .92em; color: var(--ot-text-soft); }
.ma-hint { display: inline-block; margin: 6px 0; font-size: .9em; }
.ma-hint summary { cursor: pointer; color: var(--ot-brand); font-weight: 600; }
.ma-missing { display: inline-block; font-size: .8rem; font-style: italic; color: var(--ot-danger);
  background: var(--ma-red-bg); padding: 2px 8px; border-radius: 4px; margin: 4px; }

.ma-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.ma-controls .ot-btn { flex: 1 1 130px; min-height: 48px; }
.ma-grade { flex-direction: column; gap: 0; line-height: 1.2; color: #fff; border-color: transparent; }
.ma-grade small { font-weight: 500; font-size: .75rem; opacity: .9; }
.ma-grade kbd { display: none; }
@media (hover: hover) and (pointer: fine) { .ma-grade kbd { display: inline; } }
.ma-again { background: var(--ma-red); }
.ma-hard  { background: var(--ma-orange); }
.ma-good  { background: var(--ma-green); }
.ma-easy  { background: var(--ma-blue); }
:root[data-theme="dark"] .ma-grade { color: #0f0f17; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ma-grade { color: #0f0f17; } }
.ma-tools { margin-top: 10px; }
.ma-tools .ot-btn { flex: 0 1 auto; min-height: 40px; padding: 6px 14px; font-size: .88rem; }
.ma-flag--on { border-color: var(--ma-red); color: var(--ma-red); }
.ma kbd {
  font-family: var(--ot-mono); font-size: .72rem; padding: 0 5px; border-radius: 4px;
  border: 1px solid currentColor; opacity: .75; margin-left: 4px;
}

/* ---------- Fin de session ---------- */
.ma-end { text-align: center; }
.ma-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.ma-tile { background: var(--ot-surface-2); border: 1px solid var(--ot-border); border-radius: var(--ot-radius-s); padding: 10px; }
.ma-tile b { display: block; font-size: 1.4rem; }
.ma-tile span { font-size: .8rem; color: var(--ot-text-soft); }
.ma-tile--again b { color: var(--ma-red); }
.ma-tile--hard b  { color: var(--ma-orange); }
.ma-tile--good b  { color: var(--ma-green); }
.ma-tile--easy b  { color: var(--ma-blue); }

.ma-toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 99;
  max-width: calc(100vw - 32px); padding: 10px 18px; font-size: .9rem; text-align: center;
  background: var(--ot-text); color: var(--ot-bg); border-radius: var(--ot-radius-s); box-shadow: var(--ot-shadow-h);
}

/* ---------- Aide ---------- */
.ma-help { max-width: 860px; margin: calc(var(--ot-space) * 2.5) auto 0; }
.ma-help code { font-family: var(--ot-mono); font-size: .88em; background: var(--ot-surface-2); padding: 1px 5px; border-radius: 4px; }
.ma-help kbd { font-family: var(--ot-mono); font-size: .8em; padding: 0 5px; border: 1px solid var(--ot-border); border-radius: 4px; }
