/* Radici: stile dell'app. Solo token da tokens.css, nessun valore di colore grezzo. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--c-bg); color: var(--c-text);
  font: var(--fs-md)/var(--lh-md) var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: var(--layout-max-content); margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.boot { padding: var(--sp-8); text-align: center; color: var(--c-text-muted); }
h1, h2, h3, p { margin: 0; }
a { color: var(--c-accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--c-text-muted); }
.center { text-align: center; }
.hint { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-text-muted); }
.hint.warn { color: var(--c-warning); }
.note { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-text-muted); background: var(--c-surface-2); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); }
.eyebrow { font-size: var(--fs-xs); line-height: var(--lh-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--c-text-muted); font-weight: 600; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i-lg { width: 32px; height: 32px; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
bdi[lang="ar"], .ar-inline { font-family: var(--font-arabic); font-size: 1.15em; }

/* ---------- pulsanti */
.btn {
  font: 600 var(--fs-sm)/1 var(--font-ui); min-height: 44px; padding: 0 var(--sp-5); border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  text-decoration: none; transition: transform var(--motion-fast) var(--motion-ease), background var(--motion-fast);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--c-accent); color: var(--c-on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--c-accent-strong); }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-input); }
.btn-ghost { background: transparent; color: var(--c-accent); padding: 0 var(--sp-2); }
.btn-inline { min-height: 32px; padding: 0; justify-self: start; }
.btn-danger { background: var(--c-danger); color: var(--c-on-accent); }
.btn-success { background: var(--c-success); color: var(--c-on-accent); }
.btn-lg { min-height: 52px; font-size: var(--fs-md); width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { background: none; border: 0; color: var(--c-text-muted); width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; border-radius: var(--r-md); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

/* ---------- barra superiore e tab */
.appbar {
  position: sticky; top: 0; z-index: 5; height: calc(var(--layout-header) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: var(--sp-4); background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
}
.stat { display: inline-flex; align-items: center; gap: var(--sp-1); font-weight: 600; }
.streak { color: var(--c-saffron); }
.ring { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(var(--c-saffron) calc(var(--p) * 360deg), var(--c-surface-2) 0); display: inline-block; margin-right: 2px; }
.due { margin-left: auto; background: var(--c-accent-soft); color: var(--c-accent); border-radius: var(--r-pill); padding: 4px var(--sp-3); font-weight: 600; font-size: var(--fs-xs); text-decoration: none; }
.due.muted-pill { background: var(--c-surface-2); color: var(--c-text-muted); font-weight: 500; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--layout-tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  background: var(--c-surface); border-top: 1px solid var(--c-border);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: var(--fs-xs); color: var(--c-text-muted); text-decoration: none; }
.tab.on { color: var(--c-accent); font-weight: 600; }

/* ---------- schermate */
.screen { flex: 1; padding: var(--sp-5) max(16px, env(safe-area-inset-right)) calc(var(--layout-tabbar) + env(safe-area-inset-bottom) + var(--sp-6)) max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: var(--sp-5); }
.screen-title { font-size: var(--fs-xl); line-height: var(--lh-xl); display: flex; align-items: center; gap: var(--sp-2); }
.count-pill { font-size: var(--fs-xs); background: var(--c-surface-2); color: var(--c-text-muted); padding: 2px 8px; border-radius: var(--r-pill); font-weight: 600; }
.center-screen { align-items: center; justify-content: center; text-align: center; padding-top: var(--sp-10); }

/* ---------- percorso */
.path-screen { padding-top: 0; padding-left: 0; padding-right: 0; gap: 0; }
.unit { padding: var(--sp-4) max(16px, env(safe-area-inset-right)) var(--sp-4) max(16px, env(safe-area-inset-left)); background: var(--c-surface); border-bottom: 1px solid var(--c-border); display: grid; gap: var(--sp-1); }
.unit-title { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 700; text-wrap: balance; }
.unit-sub { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-text-muted); }
.bar { height: 6px; background: var(--c-surface-2); border-radius: var(--r-pill); overflow: hidden; margin-top: var(--sp-2); }
.bar > i { display: block; height: 100%; width: 0; background: var(--c-accent); border-radius: inherit; transition: width var(--motion-base) var(--motion-ease); }
.path { list-style: none; margin: 0; padding: var(--sp-5) max(16px, env(safe-area-inset-right)) var(--sp-2) max(16px, env(safe-area-inset-left)); }
.step { display: grid; grid-template-columns: 64px 1fr; gap: var(--sp-4); align-items: center; position: relative; padding-bottom: var(--sp-4); }
.step:not(:last-child)::after { content: ""; position: absolute; left: 31px; top: 64px; bottom: 0; width: 2px; background: var(--c-border); }
.node { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text-muted); text-decoration: none; }
.node svg.i { width: 26px; height: 26px; }
.node.done { background: var(--c-accent-soft); color: var(--c-accent); border-color: var(--c-accent-soft); }
.node.current { background: var(--c-accent); color: var(--c-on-accent); border-color: var(--c-accent); box-shadow: 0 0 0 6px var(--c-accent-soft); }
.node.mastered { background: var(--c-saffron-soft); color: var(--c-saffron); border-color: var(--c-saffron); }
.node.egy:not(.current) { border-color: var(--c-egy); }
.node.lb:not(.current) { border-color: var(--c-lb); }
.node.soon { opacity: .7; border-style: dashed; }
.step-text { display: grid; gap: 2px; min-width: 0; }
.step-text b { font-size: var(--fs-md); }
.step-text > span { font-size: var(--fs-sm); color: var(--c-text-muted); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.btn-start { justify-self: start; margin-top: var(--sp-2); min-height: 40px; }
.vtag { font: 600 var(--fs-xs)/1 var(--font-ui); padding: 3px 7px; border-radius: var(--r-pill); border: 1px solid currentColor; background: var(--c-surface); }
.vtag.msa { color: var(--c-msa); } .vtag.egy { color: var(--c-egy); } .vtag.lb { color: var(--c-lb); }
.planned-block { padding: var(--sp-4) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); display: grid; gap: var(--sp-3); }
.planned-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.planned { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3); border: 1px dashed var(--c-border); border-radius: var(--r-md); color: var(--c-text-muted); }
.planned b { display: block; color: var(--c-text); font-weight: 600; font-size: var(--fs-sm); }
.planned span { font-size: var(--fs-xs); }
.planned-n { width: 28px; height: 28px; border-radius: 50%; background: var(--c-surface-2); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-xs); flex: none; }

/* ---------- lezione */
body[data-screen="lezione"] #app { height: 100vh; height: 100dvh; }
.lesson { padding: 0; gap: 0; height: 100%; min-height: 0; }
.lesson-top { display: flex; align-items: center; gap: var(--sp-2); padding: calc(env(safe-area-inset-top) + var(--sp-2)) max(12px, env(safe-area-inset-right)) var(--sp-2) max(8px, env(safe-area-inset-left)); }
.lesson-top .bar { flex: 1; height: 8px; margin: 0; }
.count { font-size: var(--fs-sm); color: var(--c-text-muted); font-variant-numeric: tabular-nums; min-width: 3.5em; text-align: right; }
.lesson-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--sp-2) max(16px, env(safe-area-inset-right)) var(--sp-4) max(16px, env(safe-area-inset-left)); }
.lesson-foot { padding: var(--sp-3) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + var(--sp-4)) max(16px, env(safe-area-inset-left)); border-top: 1px solid var(--c-border); background: var(--c-bg); }
.lesson-foot:has(.sheet) { padding: 0; border-top: 0; }
.ex { display: grid; gap: var(--sp-5); }
.ex-eyebrow { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--c-text-muted); font-weight: 600; }
.new-tag { text-transform: none; letter-spacing: 0; background: var(--c-saffron-soft); color: var(--c-saffron); padding: 2px 8px; border-radius: var(--r-pill); }
.prompt { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; text-wrap: balance; }
.sentence { display: flex; align-items: flex-start; gap: var(--sp-3); }
.artext { font-family: var(--font-arabic); direction: rtl; text-align: right; margin: 0; flex: 1; min-width: 0; }
.ar-sm { font-size: var(--fs-ar-sm); line-height: var(--lh-ar-sm); }
.ar-md { font-size: var(--fs-ar-md); line-height: var(--lh-ar-md); }
.ar-lg { font-size: var(--fs-ar-lg); line-height: var(--lh-ar-lg); }
.word { font: inherit; color: inherit; background: none; border: 0; padding: 0 2px; border-bottom: 1px dashed var(--c-border-input); cursor: pointer; border-radius: 4px; }
.word.active, .word:hover { background: var(--c-accent-soft); }
.audio { border: 0; border-radius: var(--r-md); background: var(--c-accent); color: var(--c-on-accent); display: grid; place-items: center; cursor: pointer; flex: none; }
.audio-md { width: 48px; height: 48px; }
.audio-sm { width: 36px; height: 36px; }
.audio-lg { width: 64px; height: 64px; }
.audio-xl { width: 96px; height: 96px; border-radius: var(--r-lg); }
.audio-xl svg.i { width: 40px; height: 40px; }
.audio-lg svg.i { width: 28px; height: 28px; }
.audio-slow { background: var(--c-accent-soft); color: var(--c-accent); }
.listen { display: flex; gap: var(--sp-4); justify-content: center; align-items: flex-end; padding: var(--sp-4) 0; }
.answer { min-height: 112px; border-bottom: 2px solid var(--c-border); display: flex; flex-wrap: wrap; gap: var(--sp-2); align-content: flex-start; padding-bottom: var(--sp-3); }
.bank { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; }
.tile {
  font: var(--fs-md)/1.2 var(--font-ui); background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-border-input);
  border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); min-height: 44px; cursor: pointer; box-shadow: 0 2px 0 var(--c-border);
  touch-action: manipulation;
}
.tile-ar { font-family: var(--font-arabic); font-size: var(--fs-ar-sm); line-height: 1.5; padding: 2px var(--sp-3); }
.tile.used { color: transparent; background: var(--c-surface-2); border-style: dashed; box-shadow: none; cursor: default; }
.tile:disabled:not(.used) { cursor: default; opacity: .8; }
.type-input { width: 100%; border: 1px solid var(--c-border-input); border-radius: var(--r-md); background: var(--c-surface); padding: var(--sp-3); font-size: var(--fs-md); resize: vertical; min-height: 96px; }
.type-ar { font-family: var(--font-arabic); font-size: var(--fs-ar-sm); line-height: var(--lh-ar-sm); }
.lemma-big { display: flex; align-items: center; justify-content: center; gap: var(--sp-4); font-family: var(--font-arabic); font-size: var(--fs-ar-lg); line-height: var(--lh-ar-lg); padding: var(--sp-4) 0 0; }
.options { display: grid; gap: var(--sp-2); }
.option { display: flex; align-items: center; gap: var(--sp-3); text-align: left; padding: var(--sp-3); min-height: 52px; background: var(--c-surface); border: 1px solid var(--c-border-input); border-radius: var(--r-md); cursor: pointer; box-shadow: 0 2px 0 var(--c-border); }
.option.selected { border-color: var(--c-accent); background: var(--c-accent-soft); box-shadow: 0 2px 0 var(--c-accent); }
.option.right { border-color: var(--c-success); background: var(--c-success-soft); box-shadow: 0 2px 0 var(--c-success); }
.option.wrong { border-color: var(--c-danger); background: var(--c-danger-soft); box-shadow: 0 2px 0 var(--c-danger); }
.option:disabled { cursor: default; color: var(--c-text); }
.option-ar .opt-t { font-family: var(--font-arabic); font-size: var(--fs-ar-sm); line-height: 1.5; flex: 1; text-align: right; }
.opt-n { width: 24px; height: 24px; border: 1px solid var(--c-border); border-radius: 6px; display: grid; place-items: center; font-size: var(--fs-xs); color: var(--c-text-muted); flex: none; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.match-col { display: grid; gap: var(--sp-2); align-content: start; }
.match-item { min-height: 56px; padding: var(--sp-2); background: var(--c-surface); border: 1px solid var(--c-border-input); border-radius: var(--r-md); cursor: pointer; box-shadow: 0 2px 0 var(--c-border); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.match-ar { font-family: var(--font-arabic); font-size: var(--fs-ar-sm); line-height: 1.4; }
.match-item.selected { border-color: var(--c-accent); background: var(--c-accent-soft); }
.match-item.matched { background: var(--c-success-soft); border-color: var(--c-success-soft); color: var(--c-success); box-shadow: none; opacity: .55; }
.match-item.mismatch { background: var(--c-danger-soft); border-color: var(--c-danger); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .match-item.mismatch { animation: none; } }

/* feedback */
.sheet { padding: var(--sp-5) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + var(--sp-5)) max(16px, env(safe-area-inset-left)); display: grid; gap: var(--sp-3); animation: rise var(--motion-base) var(--motion-ease); max-height: 60vh; overflow-y: auto; }
@keyframes rise { from { transform: translateY(16px); opacity: .4; } }
.sheet.ok { background: var(--c-success-soft); } .sheet.almost { background: var(--c-warning-soft); } .sheet.wrong { background: var(--c-danger-soft); }
.sheet h3 { font-size: var(--fs-lg); display: flex; align-items: center; gap: var(--sp-2); }
.ok h3 { color: var(--c-success); } .almost h3 { color: var(--c-warning); } .wrong h3 { color: var(--c-danger); }
.sol-ar { font-family: var(--font-arabic); direction: rtl; text-align: right; font-size: var(--fs-ar-sm); line-height: var(--lh-ar-sm); }
.sol-it, .why { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.sol-word { font-size: var(--fs-md); }
.sol-word span { font-family: var(--font-arabic); font-size: var(--fs-ar-sm); }
.sheet-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.sheet-actions .btn-ghost { font-weight: 500; font-size: var(--fs-xs); color: var(--c-text-muted); }

/* fine lezione */
.end { justify-content: flex-start; padding-top: calc(env(safe-area-inset-top) + var(--sp-8)); }
.end-head h1 { font-size: var(--fs-2xl); line-height: var(--lh-2xl); }
.tiles3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.stat-tile { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-3); display: grid; gap: 2px; text-align: center; font-variant-numeric: tabular-nums; }
.stat-tile b { font-size: var(--fs-xl); line-height: var(--lh-xl); }
.stat-tile span { font-size: var(--fs-xs); color: var(--c-text-muted); }
.end-words h2 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.end-foot { position: sticky; bottom: 0; padding: var(--sp-3) 0 calc(env(safe-area-inset-bottom) + var(--sp-3)); background: var(--c-bg); }
body[data-screen="lezione"] .screen.end { padding-bottom: 0; }

/* elenchi di parole */
.word-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--c-border); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; }
.word-list li { background: var(--c-surface); display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); min-height: 52px; }
.word-list.words li { padding: 0; }
.word-row { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto 56px; gap: var(--sp-3); align-items: center; width: 100%; padding: var(--sp-2) var(--sp-4); min-height: 52px; }
.word-row:focus-visible { outline: 3px solid var(--c-accent); outline-offset: -3px; }
.wl-ar { font-family: var(--font-arabic); font-size: var(--fs-ar-sm); line-height: 1.5; min-width: 0; }
.wl-it { font-size: var(--fs-sm); color: var(--c-text-muted); flex: 1; min-width: 0; }
.word-list li.empty { flex-direction: column; text-align: center; padding: var(--sp-8) var(--sp-4); gap: var(--sp-3); color: var(--c-text-muted); }
.strength { height: 6px; background: var(--c-surface-2); border-radius: var(--r-pill); overflow: hidden; }
.strength i { display: block; height: 100%; background: var(--c-success); }
.strength i.weak { background: var(--c-saffron); }
.pill { font-size: var(--fs-xs); font-weight: 600; border-radius: var(--r-pill); padding: 2px 8px; white-space: nowrap; }
.pill-warn { background: var(--c-warning-soft); color: var(--c-warning); }
.search { width: 100%; min-height: 44px; border: 1px solid var(--c-border-input); border-radius: var(--r-md); background: var(--c-surface); padding: 0 var(--sp-3); }

/* pratica e profilo */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-4); display: grid; gap: var(--sp-2); }
.card h2 { font-size: var(--fs-md); display: flex; align-items: center; gap: var(--sp-2); }
.big-n { font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.settings { display: grid; gap: var(--sp-3); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-4); }
.settings .eyebrow { margin-top: var(--sp-3); }
.settings .eyebrow:first-child { margin-top: 0; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.toggle-row label { display: grid; gap: 2px; cursor: pointer; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--c-border-input); transition: background var(--motion-fast); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--c-surface); transition: transform var(--motion-fast) var(--motion-ease); }
.switch input:checked + i { background: var(--c-accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--c-border-input); border-radius: var(--r-md); overflow: hidden; }
.seg button { min-height: 44px; background: var(--c-surface); border: 0; border-left: 1px solid var(--c-border); cursor: pointer; font-size: var(--fs-sm); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--c-accent); color: var(--c-on-accent); font-weight: 600; }
.select { width: 100%; min-height: 44px; border: 1px solid var(--c-border-input); border-radius: var(--r-md); background: var(--c-surface); padding: 0 var(--sp-3); }
.field-label { font-size: var(--fs-sm); font-weight: 600; }
input[type="range"] { flex: 1; accent-color: var(--c-accent); min-width: 0; }

/* sincronizzazione */
.sync-box { display: grid; gap: var(--sp-3); }
.sync-box .hint svg.i { width: 16px; height: 16px; vertical-align: -3px; color: var(--c-success); }
.code-box { font: 600 var(--fs-md)/1.6 var(--font-mono); letter-spacing: .04em; text-align: center; background: var(--c-surface-2); border-radius: var(--r-md); padding: var(--sp-3); user-select: all; -webkit-user-select: all; }
.code-box span { white-space: nowrap; }
.code-input { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }

/* finestra della parola */
.pop { position: fixed; z-index: 30; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: var(--sp-4); display: grid; gap: var(--sp-2); animation: rise var(--motion-fast) var(--motion-ease); }
.pop-lemma { font-family: var(--font-arabic); font-size: var(--fs-ar-md); line-height: 1.5; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-direction: row-reverse; }
.pop-tr { font-size: var(--fs-sm); color: var(--c-text-muted); }
.pop-mean { font-weight: 600; }
.pop-more { font-size: var(--fs-sm); color: var(--c-text-muted); }
.pop-root { font: var(--fs-xs)/1.6 var(--font-ui); color: var(--c-text-muted); }

/* modale e toast */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .5); display: grid; place-items: end center; padding: var(--sp-4); padding-bottom: calc(env(safe-area-inset-bottom) + var(--sp-4)); animation: fade var(--motion-fast); }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 600px) { .backdrop { place-items: center; } }
.modal { width: min(100%, 460px); max-height: 85vh; overflow-y: auto; background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: var(--sp-5); display: grid; gap: var(--sp-4); animation: rise var(--motion-base) var(--motion-ease); }
.modal-title { font-size: var(--fs-lg); line-height: var(--lh-lg); }
.modal-body { display: grid; gap: var(--sp-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.card-lemma { font-family: var(--font-arabic); font-size: var(--fs-ar-lg); line-height: var(--lh-ar-lg); }
.card-tags { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; font-size: var(--fs-sm); }
.facts dt { color: var(--c-text-muted); }
.facts dd { margin: 0; min-width: 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--layout-tabbar) + env(safe-area-inset-bottom) + var(--sp-4)); z-index: 50; background: var(--c-text); color: var(--c-bg); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); font-size: var(--fs-sm); box-shadow: var(--shadow-2); max-width: calc(100% - 32px); transition: opacity var(--motion-base); }
.toast-danger { background: var(--c-danger); color: var(--c-on-accent); }
.toast.out { opacity: 0; }
