
:root {
  --bg: #fff4f6; --surface: #ffffff; --ink: #3a1a26; --muted: #8d6575; --line: #f7dbe3;
  --accent: #e0245e; --accent-ink: #ffffff; --accent-soft: #ffe4ec;
  --pink: #ff8fab; --pink-soft: #fff0f4; --green-soft: #fdeede; --green: #c2652a;
  --danger: #c81e4a; --shadow: 0 1px 2px rgba(150,20,70,.06), 0 10px 28px rgba(190,30,90,.10);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b0d15; --surface: #2a1520; --ink: #ffeaf0; --muted: #c79aab; --line: #4a2536;
    --accent: #ff4d84; --accent-soft: #4a1f33; --pink: #ff9db8; --pink-soft: #3d1c2c; --green-soft: #44261b; --green: #ffb27a;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px 60px; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }

/* Barre du haut */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 12px max(20px, calc((100% - 1040px) / 2)); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--pink)); color: #fff; font-family: var(--serif); font-size: 1.25rem; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .95rem; transition: transform .12s, box-shadow .12s, background .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

/* Hero */
.hero { position: relative; text-align: center; padding: 64px 0 28px; }
.hero::before { content: ""; position: absolute; inset: -60px -20px auto; height: 340px; z-index: -1; background: radial-gradient(420px 220px at 22% 40%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 70%), radial-gradient(380px 220px at 78% 30%, color-mix(in srgb, var(--pink) 26%, transparent), transparent 70%); filter: blur(10px); }
.hero h1 { font-family: var(--serif); font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 12px; }
.hero h1 em { font-style: italic; background: linear-gradient(120deg, var(--accent), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0 auto 26px; max-width: 560px; font-size: 1.05rem; }
.search { display: flex; align-items: center; gap: 10px; max-width: 620px; margin: 0 auto; padding: 6px 8px 6px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 1.05rem; padding: 10px 0; min-width: 0; }
.search svg { flex: none; color: var(--muted); }
.stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; color: var(--muted); font-size: .9rem; }
.stats b { color: var(--ink); }

/* Filtres */
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin: 24px 0 10px; }
.tabs { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: .92rem; }
.tab[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.alphabet { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 18px; }
.letter { min-width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--ink); text-transform: uppercase; }
.letter:hover:not([disabled]) { background: var(--accent-soft); }
.letter[disabled] { color: var(--muted); opacity: .35; cursor: default; }
.letter[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* Cartes */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { position: relative; display: flex; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: transform .15s, box-shadow .15s, border-color .15s; overflow: hidden; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card-body { flex: 1; min-width: 0; }
.card h3 { font-family: var(--serif); font-size: 1.35rem; margin: 6px 0 4px; line-height: 1.2; overflow-wrap: anywhere; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.thumb { flex: none; width: 78px; height: 78px; border-radius: 12px; object-fit: cover; background: var(--accent-soft); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent); }
.badge.expression { background: var(--pink-soft); color: var(--pink); }
.more { display: flex; justify-content: center; margin-top: 26px; }

/* Etats vides */
.empty { text-align: center; padding: 56px 20px; background: var(--surface); border: 2px dashed var(--line); border-radius: 24px; margin-top: 10px; }
.empty .big { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.empty h2 { font-family: var(--serif); margin: 0 0 6px; font-size: 1.6rem; }
.empty p { color: var(--muted); margin: 0 0 20px; }

/* Page d'un mot */
.back { display: inline-flex; margin: 26px 0 6px; color: var(--muted); font-weight: 600; font-size: .92rem; }
.back:hover { color: var(--accent); }
.entry { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: clamp(22px, 4vw, 44px); box-shadow: var(--shadow); }
.entry h1 { font-family: var(--serif); font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.05; letter-spacing: -.02em; margin: 10px 0 18px; overflow-wrap: anywhere; }
.entry .def { font-size: 1.15rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry figure { margin: 24px 0 0; }
.entry figure img { display: block; max-width: 100%; max-height: 460px; border-radius: 16px; border: 1px solid var(--line); }
.example { margin: 22px 0 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--pink); color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 1.1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.rel-group { margin-top: 28px; }
.rel-group h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .95rem; border: 0; }
a.chip:hover { background: var(--accent); color: var(--accent-ink); }
.chip.antonyme { background: var(--pink-soft); color: var(--pink); }
a.chip.antonyme:hover { background: var(--pink); color: #fff; }
.chip.voir_aussi, .chip.generique, .chip.specifique { background: var(--green-soft); color: var(--green); }
.meta { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; color: var(--muted); font-size: .88rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Formulaire */
.form { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: clamp(20px, 4vw, 40px); box-shadow: var(--shadow); max-width: 760px; margin: 8px auto 0; }
.form h1 { font-family: var(--serif); margin: 0 0 4px; font-size: 2rem; }
.form .sub { color: var(--muted); margin: 0 0 24px; }
.field { margin-bottom: 20px; }
.field > label, .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.hint { color: var(--muted); font-weight: 400; font-size: .85rem; }
.input, textarea.input, select.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); outline: none; transition: border-color .12s; }
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 130px; resize: vertical; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 20px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.drop { display: flex; align-items: center; gap: 16px; padding: 14px; border: 2px dashed var(--line); border-radius: 14px; background: var(--bg); }
.drop img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; }
.drop .ph { width: 96px; height: 96px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); font-size: 2rem; }
.rel-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rel-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.rel-row .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-row select { width: auto; max-width: 48%; padding: 6px 8px; }
.x { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 1.2rem; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.x:hover { color: var(--danger); background: var(--pink-soft); }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.ac-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 10px 14px; border: 0; background: transparent; cursor: pointer; }
.ac-item:hover, .ac-item:focus { background: var(--accent-soft); outline: none; }
.ac-note { padding: 10px 14px; color: var(--muted); font-size: .9rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 28px; flex-wrap: wrap; }
.error { background: var(--pink-soft); color: var(--danger); padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; }
.error a { text-decoration: underline; }

/* Modale */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10,8,30,.55); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); }
.modal { width: 100%; max-width: 620px; max-height: 85vh; overflow: auto; background: var(--surface); border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.modal h2 { font-family: var(--serif); margin: 0 0 16px; }
.rev { padding: 14px 0; border-top: 1px solid var(--line); }
.rev-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.rev p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }

/* Toasts */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); animation: pop .25s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 26px 20px; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .hide-sm { display: none; } .grid { grid-template-columns: 1fr; } .rel-row { flex-wrap: wrap; } .rel-row select { max-width: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- Touche romantique --- */
.logo { font-family: var(--sans); font-size: 1.1rem; box-shadow: 0 4px 12px rgba(224,36,94,.35); }
.hero .names { display: inline-block; margin-bottom: 14px; padding: 6px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--accent); font-weight: 700; font-size: .9rem; letter-spacing: .04em; box-shadow: var(--shadow); }
.hero { overflow: visible; }
.hearts { position: absolute; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.hearts span { position: absolute; color: var(--accent); opacity: .16; animation: float 7s ease-in-out infinite; }
.hearts span:nth-child(1) { left: 8%; top: 22%; font-size: 2rem; }
.hearts span:nth-child(2) { left: 86%; top: 14%; font-size: 1.6rem; animation-delay: -2s; }
.hearts span:nth-child(3) { left: 18%; top: 72%; font-size: 1.2rem; animation-delay: -4s; }
.hearts span:nth-child(4) { left: 78%; top: 66%; font-size: 2.3rem; animation-delay: -1s; }
.hearts span:nth-child(5) { left: 50%; top: 4%; font-size: 1.1rem; animation-delay: -3s; }
@keyframes float { 50% { transform: translateY(-14px) rotate(8deg); } }
.card::after { content: "\2665"; position: absolute; right: 12px; bottom: 6px; font-size: .9rem; color: var(--accent); opacity: 0; transition: opacity .2s, transform .2s; }
.card:hover::after { opacity: .55; transform: scale(1.2); }
.entry { border-top: 5px solid var(--accent); }
.entry h1 { color: var(--ink); }
.entry .sig { margin-top: 18px; color: var(--accent); font-family: var(--serif); font-style: italic; }
.divider { text-align: center; color: var(--accent); opacity: .5; margin: 26px 0 0; letter-spacing: .5em; }
.footer b { color: var(--accent); }
