:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f4efe7;
  --line: #e6ded2;
  --text: #1f1b16;
  --muted: #6b6258;
  --accent: #c2410c;
  --accent-soft: #fdeee6;
  --radius: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* En-tête */
.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.top-in { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 22px var(--serif); }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 19px; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 15px; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }

/* Titres et texte */
.hero { padding: 40px 0 16px; }
h1 { font: 700 clamp(30px, 5vw, 44px)/1.12 var(--serif); letter-spacing: -.01em; margin: 0 0 12px; }
h2 { font: 700 24px/1.25 var(--serif); margin: 44px 0 10px; }
h3 { font-size: 18px; margin: 22px 0 6px; }
p { margin: 0 0 14px; }
.lead { color: var(--muted); font-size: 19px; max-width: 700px; margin: 0; }
.prose { max-width: 740px; }
.prose li { margin-bottom: 6px; }
.note { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.empty { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: var(--radius); }
.status { color: var(--muted); font-size: 14px; min-height: 1.4em; margin: 8px 0 0; }

/* Formulaires */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 20px 0 8px; }
.searchbar { display: flex; gap: 10px; }
.searchbar input { flex: 1; min-width: 0; }
label.lbl { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
input[type=text], input[type=search], select, textarea {
  min-height: 48px; padding: 10px 14px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font: inherit;
}
input[type=search] { font-size: 19px; }
textarea { width: 100%; min-height: 200px; resize: vertical; line-height: 1.7; font-family: var(--serif); font-size: 18px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn { min-height: 48px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: 600 16px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #9a3412; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: 500 15px var(--sans); cursor: pointer; }
.btn-ghost:hover { border-color: var(--muted); }
.options { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; margin-top: 14px; font-size: 15px; }
.options label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.options input[type=radio], .options input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font: 500 14px var(--sans); cursor: pointer; color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.try { font-size: 15px; color: var(--muted); margin-top: 12px; }
.try a { margin-right: 8px; }

/* Résultats */
.res-head { margin: 28px 0 0; }
.res-word { font-size: 34px; margin: 0 0 6px; }
.res-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 15px; margin: 0; }
.res-meta a { font-weight: 600; }
.res-block h2 { font-size: 21px; margin-top: 30px; }
.count { font: 500 14px var(--sans); color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; vertical-align: middle; }
.rhymes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.rhymes li { display: flex; align-items: baseline; gap: 6px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.rhymes li > a, .rhymes li > span, .rhymes .w { font: 600 17px var(--serif); color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rhymes li > a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(194, 65, 12, .3); }
.rhymes .w { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.rhymes .w:hover { color: var(--accent); }
.rhymes li > a, .rhymes li > span, .rhymes .w { flex: 0 0 auto; max-width: calc(100% - 34px); }
.rhymes small { flex: 1 1 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rhymes b { margin-left: auto; font: 600 12px var(--sans); color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; flex: none; }
.tag { font: 600 11px var(--sans); font-style: normal; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }
.vow { display: inline-block; min-width: 24px; text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 6px; margin-right: 3px; font-weight: 700; }

/* Compteur de syllabes */
.syl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.syl-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.syl-summary { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; font-size: 15px; }
.syl-lines { list-style: none; padding: 0; margin: 0; }
.syl-lines li { display: grid; grid-template-columns: 40px 1fr 30px; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.syl-lines li.blank { min-height: 14px; border: 0; display: block; padding: 4px 0; }
.syl-lines .n { font: 700 22px var(--serif); color: var(--accent); text-align: right; }
.syl-lines .line { font-family: var(--serif); font-size: 17px; line-height: 1.9; }
.syl-lines .line span { white-space: nowrap; }
.syl-lines sub { font: 600 11px var(--sans); color: var(--muted); margin-left: 1px; }
.syl-lines .mute sub { color: var(--accent); }
.syl-lines .unk { text-decoration: underline dotted var(--muted); }
.syl-lines .scheme { font: 700 16px var(--sans); text-align: center; background: var(--surface-2); border-radius: 6px; }
.syl-lines .metre { grid-column: 2 / 4; font-size: 13px; color: var(--muted); margin-top: -6px; }
.syl-lines .metre:empty { display: none; }

/* Freestyle */
.fs { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.fs-word { font: 700 40px var(--serif); margin: 0; }
.fs-timer { font: 700 30px var(--sans); font-variant-numeric: tabular-nums; color: var(--accent); }
.fs-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Listes de liens */
.wordlist { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.wordlist a { font-family: var(--serif); font-size: 17px; }
.letter { font-size: 22px; margin-top: 28px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 0; list-style: none; margin: 20px 0 0; }
.cards a { display: block; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); height: 100%; }
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; font: 700 19px var(--serif); margin-bottom: 4px; }
.cards span { color: var(--muted); font-size: 15px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

/* Pied de page */
.foot { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
.foot-in { display: flex; gap: 32px; justify-content: space-between; flex-wrap: wrap; }
.foot-in p { max-width: 520px; margin: 6px 0 0; }
.foot nav { display: grid; gap: 6px; align-content: start; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .top-in { gap: 6px; padding: 10px 0; }
  .nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; padding: 8px 10px; }
  .syl-grid { grid-template-columns: 1fr; }
  .rhymes { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .fs { grid-template-columns: 1fr; }
  .searchbar { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
