/* Scale : feuille de style unique. Mobile d'abord, arabe (RTL) et anglais (LTR), thèmes clair et sombre.
   Les couleurs viennent de l'icône : encre, vert (juste), jaune (en trop), rouge (manquant). */

/* ---------- Jetons ---------- */

:root {
  color-scheme: light dark;

  --bg: #eef3f0;
  --surface: #ffffff;
  --surface-2: #f1f5f3;
  --text: #14323a;
  --muted: #4f6367;
  --line: #d6e0dc;
  --field-border: #7c918f;
  --focus: #14323a;

  --primary: #14323a;
  --primary-hover: #1d4650;
  --on-primary: #ffffff;

  --ok: #2fa870;
  --ok-ink: #156647;
  --ok-soft: #e1f3ea;
  --extra: #f0b414;
  --extra-ink: #775600;
  --extra-soft: #fcf1cf;
  --missing: #e25542;
  --missing-ink: #a52c1c;
  --missing-soft: #fbe5e1;
  --todo: #c9d5d1;

  --lesson-bg: #14323a;
  --lesson-fg: #ffffff;
  --toast-bg: #14323a;
  --toast-fg: #ffffff;

  --shadow-1: 0 1px 2px rgb(20 50 58 / 0.05), 0 4px 14px rgb(20 50 58 / 0.06);
  --shadow-2: 0 2px 6px rgb(20 50 58 / 0.1), 0 12px 32px rgb(20 50 58 / 0.14);

  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --column: 42rem;

  --font: system-ui, -apple-system, 'Segoe UI', 'SF Arabic', 'Geeza Pro', 'Noto Sans Arabic', 'Noto Naskh Arabic', Tahoma, Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Roboto Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1a1e;
    --surface: #13272d;
    --surface-2: #1a333a;
    --text: #e7efec;
    --muted: #9fb2b1;
    --line: #264249;
    --field-border: #6a898c;
    --focus: #8fe0bb;

    --primary: #37b87c;
    --primary-hover: #4cc98d;
    --on-primary: #062017;

    --ok: #37b87c;
    --ok-ink: #7ddcae;
    --ok-soft: #16382d;
    --extra-ink: #f6cf62;
    --extra-soft: #3a3112;
    --missing: #ec6a58;
    --missing-ink: #f59a8b;
    --missing-soft: #41211d;
    --todo: #35525a;

    --lesson-bg: #1a333a;
    --lesson-fg: #e7efec;
    --toast-bg: #e7efec;
    --toast-fg: #0c1a1e;

    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 14px rgb(0 0 0 / 0.25);
    --shadow-2: 0 2px 6px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.45);
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: 72px;
}

/* L'arabe se lit mieux un peu plus grand et plus aéré que le latin. */
html:lang(ar) {
  font-size: 106.25%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  accent-color: var(--ok);
  overflow-wrap: break-word;
}

html:lang(ar) body {
  line-height: 1.75;
}

h1,
h2,
h3,
p {
  margin: 0;
}

img {
  display: block;
}

main {
  width: 100%;
  max-width: var(--column);
  margin-inline: auto;
  padding: 0 var(--gutter) calc(112px + env(safe-area-inset-bottom));
}

noscript {
  display: block;
  padding: 24px;
  text-align: center;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Boutons et liens ---------- */

button,
.primary,
.secondary,
.ghost,
.fab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s, transform 0.14s;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:active:not(:disabled),
.primary:active,
.secondary:active,
.fab:active {
  transform: scale(0.98);
}

.primary {
  min-height: 48px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.secondary {
  background: var(--surface);
  border-color: var(--field-border);
}

.secondary.danger {
  border-color: var(--missing);
  color: var(--missing-ink);
}

.ghost {
  padding: 0 12px;
}

.link {
  min-height: 44px;
  padding: 0 8px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link.danger {
  color: var(--missing-ink);
}

.icon-btn {
  flex: none;
  width: 40px;
  padding: 0;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
}

@media (hover: hover) {
  .primary:hover:not(:disabled) {
    background: var(--primary-hover);
  }
  .secondary:hover:not(:disabled),
  .ghost:hover {
    background: var(--surface-2);
  }
  .secondary.danger:hover:not(:disabled) {
    background: var(--missing-soft);
  }
  .link:hover {
    color: var(--text);
  }
  .link.danger:hover {
    color: var(--missing-ink);
    text-decoration-thickness: 2px;
  }
  .icon-btn:hover:not(:disabled) {
    background: var(--missing-soft);
    color: var(--missing-ink);
  }
}

/* ---------- Champs ---------- */

input,
textarea {
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  /* 16 px au minimum : en dessous, iOS zoome sur le champ. */
  font: inherit;
  font-size: max(1rem, 16px);
  line-height: 1.4;
  transition: border-color 0.14s, box-shadow 0.14s, background-color 0.14s;
}

textarea {
  min-height: 0;
  line-height: 1.6;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent);
}

input:disabled,
textarea:disabled {
  opacity: 1;
  background: var(--surface-2);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}

input[type='number'] {
  -moz-appearance: textfield;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type='date'] {
  text-align: start;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.label {
  font-size: 0.875rem;
  font-weight: 600;
}

.help {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* ---------- Barre du haut ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  margin-inline: calc(-1 * var(--gutter));
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}

.top > * {
  min-width: 0;
}

.wordmark {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.wordmark img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

/* Boutons de la barre : une pastille, pour qu'on voie que c'est cliquable. */
.top .ghost {
  display: block;
  min-height: 0;
  padding: 0 14px;
  border-color: var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top a[href='#/']::before {
  content: '‹';
  margin-inline-end: 6px;
  font-weight: 400;
}

[dir='rtl'] .top a[href='#/']::before {
  content: '›';
}

.top-title {
  overflow: hidden;
  font-size: 1.05rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Connexion ---------- */

.auth {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 30rem;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

.hero {
  display: grid;
  gap: 14px;
  padding-top: 8px;
}

.hero h1 {
  font-size: clamp(1.75rem, 1.1rem + 3.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

html:lang(ar) .hero h1 {
  line-height: 1.4;
  letter-spacing: 0;
}

.pitch {
  max-width: 36em;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* L'exemple : une vraie carte, posée comme une photo du produit. */
.card.demo {
  max-width: 26rem;
  margin-top: 10px;
  box-shadow: var(--shadow-2);
  pointer-events: none;
  transform: rotate(-1.2deg);
}

.panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.panel h2 {
  font-size: 1.25rem;
  line-height: 1.3;
}

.panel .link {
  justify-self: center;
}

.tabs {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.tab {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
}

.tab.on {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 1px 3px rgb(20 50 58 / 0.18), 0 0 0 1px var(--line);
}

.error {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--missing-soft);
  color: var(--missing-ink);
  font-size: 0.9rem;
  font-weight: 500;
}

.steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  counter-increment: step;
  font-weight: 500;
  line-height: 1.4;
}

.steps li::before {
  content: counter(step);
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.9375rem;
  font-weight: 700;
}

.steps li:nth-child(1)::before {
  box-shadow: inset 0 0 0 2px var(--ok);
}

.steps li:nth-child(2)::before {
  box-shadow: inset 0 0 0 2px var(--extra);
}

.steps li:nth-child(3)::before {
  box-shadow: inset 0 0 0 2px var(--missing);
}

.install {
  color: var(--muted);
  font-size: 0.8125rem;
}

.code {
  padding: 16px 12px;
  border: 1px dashed var(--field-border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: clamp(1.05rem, 0.6rem + 2.4vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  user-select: all;
  -webkit-user-select: all;
}

/* Grand écran : le discours à gauche, le formulaire à droite et toujours visible. */
@media (min-width: 60rem) {
  .auth:has(.hero) {
    display: grid;
    grid-template-areas: 'top top' 'hero panel' 'steps panel' 'install panel' '. panel';
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 24rem);
    grid-template-rows: auto auto auto auto 1fr;
    align-items: start;
    gap: 28px 64px;
    max-width: 66rem;
  }
  .auth:has(.hero) .top {
    grid-area: top;
  }
  .auth:has(.hero) .hero {
    grid-area: hero;
    padding-top: 32px;
  }
  .auth:has(.hero) .panel {
    grid-area: panel;
    position: sticky;
    top: 92px;
    margin-top: 32px;
    padding: 28px;
  }
  .auth:has(.hero) .steps {
    grid-area: steps;
    margin-top: 12px;
  }
  .auth:has(.hero) .install {
    grid-area: install;
  }
}

/* ---------- Liste ---------- */

.search {
  margin-top: 4px;
  padding-inline-start: 42px;
  border-color: var(--line);
  border-radius: 999px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8c8e' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-position: left 14px center;
  background-repeat: no-repeat;
  background-size: 18px;
  box-shadow: var(--shadow-1);
}

[dir='rtl'] .search {
  background-position: right 14px center;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 12px calc(-1 * var(--gutter)) 0;
  padding: 2px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border-color: var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.chip.on {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.list h2 {
  margin: 16px 2px 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
}

html:lang(en) .list h2 {
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}

@media (hover: hover) {
  a.card[href]:hover {
    border-color: var(--field-border);
    box-shadow: var(--shadow-1);
    transform: translateY(-1px);
  }
}

.emoji {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 1.4rem;
  line-height: 1;
}

.card-body {
  display: grid;
  flex: 1;
  gap: 6px;
  min-width: 0;
}

.card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.meta span + span::before {
  content: '·';
  margin-inline: 6px;
}

.summary {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

/* La barre : la part de la liste qui était juste, en trop, manquante. */
.bar {
  display: flex;
  gap: 2px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
}

.seg {
  flex-basis: 0;
  min-width: 6px;
  background: var(--todo);
}

.seg-ok {
  background: var(--ok);
}

.seg-extra {
  background: var(--extra);
}

.seg-missing {
  background: var(--missing);
}

.marks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mark {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
}

.mark-ok {
  background: var(--ok-soft);
  color: var(--ok-ink);
}

.mark-extra {
  background: var(--extra-soft);
  color: var(--extra-ink);
}

.mark-missing {
  background: var(--missing-soft);
  color: var(--missing-ink);
}

/* Le conseil pour la prochaine fois : ce que l'app sert à retenir. */
.advice {
  display: -webkit-box;
  margin-top: 2px;
  padding-inline-start: 10px;
  overflow: hidden;
  border-inline-start: 3px solid var(--ok);
  font-size: 0.875rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

html:lang(ar) .advice {
  line-height: 1.7;
}

.fab {
  position: fixed;
  inset-inline-end: max(var(--gutter), calc((100vw - var(--column)) / 2 + var(--gutter)));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 20;
  min-height: 56px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  box-shadow: var(--shadow-2);
}

.fab span {
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
}

@media (hover: hover) {
  .fab:hover {
    background: var(--primary-hover);
  }
}

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 56px 8px 24px;
  text-align: center;
}

.empty::before {
  content: '';
  width: 76px;
  height: 76px;
  margin-bottom: 8px;
  border-radius: 20px;
  background: url('/icon.svg') center / contain no-repeat;
  box-shadow: var(--shadow-2);
}

.empty h1 {
  font-size: 1.5rem;
  line-height: 1.3;
}

.empty p {
  max-width: 30em;
  color: var(--muted);
}

.empty .primary {
  margin-top: 12px;
  padding: 0 24px;
}

.empty-note {
  padding: 32px 0;
  color: var(--muted);
  text-align: center;
}

.banner {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--extra-soft);
  color: var(--extra-ink);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ---------- Une entrée ---------- */

.editor {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.block {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

main > .block {
  margin-top: 12px;
}

.block h2 {
  font-size: 1.0625rem;
  line-height: 1.3;
}

.block h2 + .help {
  margin-top: -8px;
}

.block.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.block.row .ghost {
  border-color: var(--field-border);
}

/* Dans une entrée, les catégories passent à la ligne au lieu de défiler. */
.block .chips {
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.title-input {
  min-height: 52px;
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  background: none;
  font-size: max(1.3rem, 16px);
  font-weight: 700;
}

.title-input:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 2px 0 var(--focus);
}

.grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid .wide,
.grid .rescale {
  grid-column: 1 / -1;
}

.rescale {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok-ink);
}

.items {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.items:empty {
  display: none;
}

.item {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--todo);
  border-radius: var(--r-md);
}

.item-ok {
  border-inline-start-color: var(--ok);
}

.item-extra {
  border-inline-start-color: var(--extra);
}

.item-missing {
  border-inline-start-color: var(--missing);
}

.item-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-row input {
  min-height: 44px;
  padding: 8px 10px;
  border-color: var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.item-row input:focus-visible {
  border-color: var(--focus);
  background: var(--surface);
}

.item-name {
  flex: 1 1 0;
  font-weight: 600;
}

.item-row .item-qty {
  flex: 0 0 3.75rem;
  padding-inline: 4px;
  text-align: center;
}

.item-row .item-unit {
  flex: 0 0 4rem;
  padding-inline: 6px;
  text-align: center;
}

.states {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.state {
  min-height: 40px;
  padding: 0 6px;
  border-color: var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
}

.state.on {
  font-weight: 700;
}

.state-ok.on {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok-ink);
}

.state-extra.on {
  border-color: var(--extra);
  background: var(--extra-soft);
  color: var(--extra-ink);
}

.state-missing.on {
  border-color: var(--missing);
  background: var(--missing-soft);
  color: var(--missing-ink);
}

.hint {
  justify-self: start;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
}

.hint-missing {
  background: var(--missing-soft);
  color: var(--missing-ink);
}

.hint-extra {
  background: var(--extra-soft);
  color: var(--extra-ink);
}

.add-row {
  display: flex;
  gap: 8px;
}

.add-row input {
  flex: 1;
}

.add-row .secondary {
  flex: none;
  min-height: 48px;
}

/* Ce qu'on s'était dit la dernière fois : en tête, impossible à rater. */
.lesson {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--lesson-bg);
  color: var(--lesson-fg);
  box-shadow: inset 4px 0 0 var(--extra);
}

[dir='rtl'] .lesson {
  box-shadow: inset -4px 0 0 var(--extra);
}

.lesson h2 {
  font-size: 0.8125rem;
  font-weight: 700;
  opacity: 0.8;
}

html:lang(en) .lesson h2 {
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lesson p {
  font-size: 1.0625rem;
  font-weight: 500;
  white-space: pre-line;
}

.stars {
  display: flex;
  gap: 2px;
  margin-inline-start: -8px;
}

.star {
  width: 44px;
  padding: 0;
  color: var(--todo);
  font-size: 2rem;
  line-height: 1;
}

.star.on {
  color: var(--extra);
}

.next {
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--ok-soft);
  box-shadow: inset 0 0 0 1px var(--ok);
}

.next .label {
  color: var(--ok-ink);
  font-weight: 700;
}

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-inline: calc(-1 * var(--gutter));
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}

.savebar .primary {
  width: 100%;
  min-height: 52px;
  font-size: 1.0625rem;
}

.repeat-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.repeat-row .field {
  flex: 1 1 6rem;
}

.repeat-row .secondary {
  flex: none;
  min-height: 48px;
}

main > .link.danger {
  display: flex;
  margin: 20px auto 0;
}

/* ---------- Message bref ---------- */

.toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
  animation: toast-in 0.18s ease-out;
}

.toast-bad {
  background: #a52c1c;
  color: #ffffff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ---------- Écrans étroits et mouvement réduit ---------- */

@media (max-width: 22.5rem) {
  .block {
    padding: 12px;
  }
  .repeat-row {
    flex-wrap: wrap;
  }
  .repeat-row .secondary {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .card.demo {
    transform: none;
  }
}
