/* Kiff Kiff · l’atelier — une page de travail, dans les couleurs du Red Corner */
:root {
  --wine: #5A0A1E;
  --velvet: #3A0510;
  --velvet-lo: #23030A;
  --gold: #C9A04E;
  --gold-hi: #F6DDA0;
  --cream: #FBF3E6;
  --paper: #FFFDF8;
  --ink: #2A0710;
  --muted: #7A5560;
  --line: #E7D6C2;
  --chili: #E2304E;
  --ok: #2F7D4F;
  --warn: #B3203A;
  --f-title: "Cinzel", "Trajan Pro", Georgia, serif;
  --f-words: "Baskervville", "Baskerville", Georgia, serif;
  --f-ui: "Jost", "Futura", "Trebuchet MS", sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--cream); }
body { margin: 0; font-family: var(--f-ui); font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--cream); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--wine); }
code { font-size: .92em; background: #F1E4D2; padding: 0 4px; border-radius: 4px; }

/* En-tête de velours */
.top {
  position: sticky; top: 0; z-index: 5;
  padding: max(10px, env(safe-area-inset-top)) 16px 0;
  background: radial-gradient(ellipse 120% 140% at 50% 0%, #7A0F24, var(--velvet) 70%);
  color: var(--cream);
  box-shadow: 0 1px 0 var(--gold), 0 6px 18px rgba(35, 3, 10, .25);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; max-width: 980px; margin: 0 auto; }
.brand img { border-radius: 10px; box-shadow: 0 0 0 1px var(--gold); }
.brand span { font-size: 15px; letter-spacing: .02em; color: var(--gold-hi); }
.brand b { font-family: var(--f-title); font-weight: 700; font-size: 20px; letter-spacing: .06em; color: var(--gold-hi); margin-right: 6px; }
.tabs { display: flex; gap: 4px; max-width: 980px; margin: 10px auto 0; overflow-x: auto; }
.tabs button {
  flex: none; border: 0; background: none; padding: 10px 14px 12px; cursor: pointer;
  color: rgba(251, 243, 230, .7); font-weight: 500; border-bottom: 3px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--gold-hi); border-bottom-color: var(--gold); }

main { max-width: 980px; margin: 0 auto; padding: 18px 16px 120px; }
.banner { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: #FFF1D6; border: 1px solid #EBCB8B; }
.banner.is-error { background: #FDE6E9; border-color: #F0B3BD; }
.note { color: var(--muted); font-size: 14px; margin: 8px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(#F6DDA0, #C9A04E 55%, #A9802F); color: var(--velvet-lo); font-weight: 600;
  box-shadow: 0 2px 0 #8C6A20;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn--line { background: transparent; color: var(--wine); box-shadow: inset 0 0 0 1.5px var(--gold); }
.btn--small { min-height: 34px; padding: 0 14px; font-size: 14px; margin-left: 6px; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.row-end .note { margin: 0 auto 0 0; }

/* Compteurs */
.counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.counter { padding: 14px 14px 12px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.counter .n { display: block; font-family: var(--f-ui); font-weight: 600; font-size: 34px; line-height: 1.05; color: var(--wine); font-variant-numeric: lining-nums tabular-nums; }
.counter .l { font-size: 14px; color: var(--muted); }
.counter--main {
  grid-column: 1 / -1;
  background: radial-gradient(ellipse 90% 140% at 20% 0%, #8E1430, var(--velvet) 75%);
  color: var(--cream); box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 0 5px var(--velvet), inset 0 0 0 6px rgba(201, 160, 78, .5);
  padding: 18px 20px;
}
.counter--main .n { font-size: 56px; color: var(--gold-hi); }
.counter--main .l { color: var(--gold-hi); font-size: 16px; }

.by { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 22px 0 10px; font-size: 15px; }
.chip { border: 0; cursor: pointer; padding: 6px 12px; border-radius: 999px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--wine); color: var(--gold-hi); box-shadow: none; }

.tops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.top-card { padding: 16px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.top-card h3 { margin: 0 0 8px; font-family: var(--f-title); font-size: 13px; font-weight: 600; letter-spacing: .08em; color: var(--muted); }
.top-word { font-family: var(--f-words); font-weight: 700; font-size: 24px; line-height: 1.2; color: var(--wine); margin: 0 0 4px; overflow-wrap: anywhere; }
.top-sub { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.top-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 14.5px; }
.top-list .w { font-family: var(--f-words); font-size: 16px; overflow-wrap: anywhere; }
.top-list .v { font-variant-numeric: tabular-nums; color: var(--muted); }
.top-list .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: #F1E4D2; overflow: hidden; }
.top-list .bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--chili)); }
.empty { padding: 18px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }

/* Les mots */
.wheels { display: flex; gap: 6px; margin-bottom: 6px; overflow-x: auto; }
.wheels button { flex: none; border: 0; cursor: pointer; padding: 9px 14px; border-radius: 999px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.wheels button[aria-selected="true"] { background: var(--wine); color: var(--gold-hi); box-shadow: none; }
.count { font-size: 13px; opacity: .75; margin-left: 2px; }
.group { margin-top: 18px; }
/* Mots à ajouter */
.sugg { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: #FFFAEE; box-shadow: inset 0 0 0 1.5px var(--gold); }
.sugg > summary { cursor: pointer; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.sugg > summary .n { color: var(--muted); font-size: 14px; }
.sugg .note { margin: 8px 0 4px; }
.sg-head { margin: 14px 0 6px; font-size: 14px; font-weight: 600; color: var(--wine); }
.sg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sg { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.sg.is-off { opacity: .5; }
.sg > input[type="checkbox"] { width: 20px; height: 20px; }
.sg-tags { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 64px; }
.sg-ton { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sg-ton.is-dc { color: #4E7F2A; }
.sg-fields { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; align-items: center; }
.sg-fields input[type="text"] { flex: 1 1 180px; min-width: 0; min-height: 36px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-family: var(--f-words); font-size: 16px; }
.sg-note { font-size: 12.5px; color: var(--muted); }
#sugg-add { margin-top: 12px; }
.group-head { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.group-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.group-head .n { color: var(--muted); font-size: 14px; }
.chilis { display: inline-flex; color: var(--chili); }
.chilis svg { width: 16px; height: 16px; margin-right: -3px; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.word {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 10px; border-radius: 14px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line);
}
.word.is-new { box-shadow: inset 0 0 0 1.5px var(--gold); }
.word.is-changed { box-shadow: inset 0 0 0 1.5px #E3B65C; background: #FFFAEE; }
.lvl { display: flex; flex-direction: column; gap: 4px; }
.lvl button { width: 34px; height: 26px; border: 0; border-radius: 8px; cursor: pointer; background: #F4EADC; color: var(--muted); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.lvl button[aria-pressed="true"] { background: var(--chili); color: #fff; }
.fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field .pre { flex: none; font-size: 13px; color: var(--muted); width: 72px; }
.field input[type="text"] {
  flex: 1; min-width: 0; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-family: var(--f-words); font-size: 18px;
}
.field input[type="text"]:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.field input::placeholder { color: #B69AA0; font-style: italic; }
.opts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--muted); padding-left: 80px; }
.opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.del { width: 36px; height: 36px; border: 0; border-radius: 10px; cursor: pointer; background: none; color: var(--muted); display: grid; place-items: center; }
.del:hover { background: #FBE7EA; color: var(--warn); }
.del svg { width: 18px; height: 18px; }
.add { margin-top: 8px; border: 1.5px dashed var(--gold); background: none; color: var(--wine); border-radius: 12px; padding: 10px 14px; cursor: pointer; width: 100%; font-weight: 500; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100vw - 980px) / 2 + 16px)) max(12px, env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, .96); box-shadow: 0 -1px 0 var(--line), 0 -6px 18px rgba(35, 3, 10, .08);
  font-size: 14.5px;
}
.savebar.is-dirty #dirty { color: var(--wine); font-weight: 600; }

/* Réglages */
.card { padding: 18px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-family: var(--f-title); font-size: 18px; font-weight: 600; letter-spacing: .04em; color: var(--wine); }
.card label { display: block; font-size: 14px; font-weight: 500; margin: 12px 0 6px; }
.card input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.ok { color: var(--ok); font-weight: 600; }
.ko { color: var(--warn); font-weight: 600; }

@media (max-width: 720px) {
  .tops { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .counter .n { font-size: 28px; }
  .counter--main .n { font-size: 46px; }
  .field .pre { width: 58px; font-size: 12.5px; }
  .opts { padding-left: 66px; }
}

/* Tableau de bord */
.sec { margin: 30px 0 10px; font-family: var(--f-title); font-size: 15px; font-weight: 600; letter-spacing: .08em; color: var(--wine); }
.funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.funnel li { display: grid; grid-template-columns: 190px minmax(0, 1fr) 120px; gap: 12px; align-items: center; font-size: 14.5px; }
.funnel .fb, .split .sb { height: 14px; border-radius: 4px; background: #F1E4D2; overflow: hidden; }
.funnel .fb i, .split .sb i { display: block; height: 100%; border-radius: 4px; background: var(--wine); }
.funnel .fv, .split .sv { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; font-size: 13.5px; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.chart { padding: 14px 14px 8px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.chart .ct { margin: 0 0 6px; font-weight: 600; font-size: 14.5px; }
.chart .ct span { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .mark { fill: var(--wine); }
.chart .hit { fill: transparent; }
.chart .bar:hover .hit { fill: rgba(90, 10, 30, .06); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { font-size: 12px; fill: var(--muted); font-family: var(--f-ui); }
.tip { position: fixed; z-index: 20; pointer-events: none; padding: 4px 8px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.kpi .kv { font-weight: 600; font-size: 26px; line-height: 1.1; color: var(--wine); font-variant-numeric: lining-nums tabular-nums; }
.kpi .kl { font-size: 14px; }
.kpi .ks { font-size: 12.5px; color: var(--muted); }
.splits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin-top: 16px; }
.sh { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.split { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.split li { display: grid; grid-template-columns: 150px minmax(0, 1fr) 96px; gap: 10px; align-items: center; font-size: 13.5px; }
@media (max-width: 720px) {
  .charts, .splits { grid-template-columns: minmax(0, 1fr); }
  .funnel li { grid-template-columns: 130px minmax(0, 1fr) 96px; gap: 8px; font-size: 13.5px; }
  .split li { grid-template-columns: 120px minmax(0, 1fr) 86px; }
}
.perf { margin: 2px 0 0; padding-left: 80px; font-size: 13px; color: var(--muted); }
.perf--weak { color: var(--warn); font-weight: 600; }
.perf--good { color: var(--ok); font-weight: 600; }
@media (max-width: 420px) { .perf { padding-left: 66px; } }

/* Mots par réglage */
.counts { margin: 10px 0 4px; overflow-x: auto; }
.counts table { border-collapse: separate; border-spacing: 4px; font-size: 14px; }
.counts caption { text-align: left; color: var(--muted); font-size: 13.5px; padding: 0 4px 2px; }
.counts th { font-weight: 500; text-align: left; padding: 2px 8px; color: var(--muted); }
.counts thead th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.counts td { min-width: 96px; padding: 6px 10px; border-radius: 10px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.counts td b { font-size: 18px; margin-right: 6px; }
.counts td span { font-size: 12.5px; color: var(--muted); }
.counts td.is-ok b { color: var(--ok); }
.counts td.is-low { background: #FDECEE; box-shadow: inset 0 0 0 1px #F0B3BD; }
.counts td.is-low b { color: var(--warn); }
.sg-head .n { color: var(--muted); font-weight: 400; }

/* Les textes */
.tx-tools { display: flex; gap: 8px; align-items: center; margin: 12px 0 6px; }
.tx-tools input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tx-group { margin-top: 10px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.tx-group > summary { cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 8px; font-size: 16px; list-style-position: inside; }
.tx-group > summary .n { color: var(--muted); font-size: 14px; }
.tx-badge { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--wine); background: #FFF1D6; padding: 2px 8px; border-radius: 999px; }
.tx-list { display: flex; flex-direction: column; gap: 14px; padding: 0 12px 14px; }
.tx { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.tx.is-changed { box-shadow: inset 0 0 0 1.5px #E3B65C; background: #FFFAEE; }
.tx-shot { display: block; width: 100%; padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--velvet-lo); }
.tx-shot svg { display: block; width: 100%; height: auto; aspect-ratio: 2.2; }
.tx-shot.is-whole svg { aspect-ratio: 2.2; }
.tx-mock { padding: 12px 14px; border-radius: 12px; background: #F4EADC; color: var(--muted); font-size: 14px; }
.tx-mock--notif { display: flex; flex-direction: column; gap: 2px; background: #EDE7E0; color: var(--ink); box-shadow: 0 2px 8px rgba(35, 3, 10, .12); }
.tx-mock--notif b { font-size: 13px; }
.tx-mock--msg { align-self: flex-end; max-width: 88%; background: #DCF3D3; color: var(--ink); border-radius: 14px 14px 4px 14px; }
.tx-mock--msg u { color: #2B6CB0; }
.tx-where { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.tx textarea { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: var(--f-words); font-size: 17px; line-height: 1.35; resize: none; overflow: hidden; }
.tx textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.tx-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tx-foot:empty { display: none; }
.tx-warn { font-size: 13px; color: var(--warn); font-weight: 600; }
.tx-reset { margin-left: auto; border: 0; background: none; padding: 4px 0; color: var(--wine); text-decoration: underline; cursor: pointer; font-size: 13.5px; }
.tx-box { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(20, 2, 6, .82); cursor: zoom-out; }
.tx-box figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; max-height: 100%; }
.tx-box svg { display: block; max-width: 100%; max-height: calc(100vh - 80px); width: auto; height: calc(100vh - 80px); border-radius: 12px; }
.tx-box figcaption { color: var(--cream); font-size: 14px; }
#panel-textes .savebar.is-dirty #tx-dirty { color: var(--wine); font-weight: 600; }
.sugg--fix { margin-bottom: 12px; }
.fx { grid-template-columns: auto auto minmax(0, 1fr); }
.fx-text { font-family: var(--f-words); font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.fx-text s { color: var(--muted); }
.fx-del { color: var(--warn); font-family: var(--f-ui); font-size: 14px; }
/* Longueur des mots : 32 caractères au plus */
.len { margin: 0; padding-left: 80px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.len--ko { color: var(--warn); font-weight: 600; }
.word.is-toolong { box-shadow: inset 0 0 0 1.5px #F0B3BD; background: #FFF6F7; }
.long-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 11.5px; font-weight: 700; }
.chip--long { margin: 4px 0 0; color: var(--warn); box-shadow: inset 0 0 0 1px #F0B3BD; }
.chip--long[aria-pressed="true"] { background: var(--warn); color: #fff; }
@media (max-width: 420px) { .len { padding-left: 66px; } }
/* Ce téléphone : ne pas compter ses propres parties */
.card label.self-row { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 15px; cursor: pointer; }
.card .self-row input { width: 22px; height: 22px; min-height: 0; flex: none; padding: 0; }
/* Version gratuite : le compte des mots cochés */
.gratuit-n { margin: 8px 0 0; font-size: 14px; }
.gratuit-n.is-ok b { color: #2E7D32; }
.opts label.gr { font-weight: 600; }
/* Journal : les derniers comptes */
.journal { list-style: none; margin: 0; padding: 0; font-size: 14px; max-height: 420px; overflow-y: auto; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line, #ddd); }
.journal li { display: grid; grid-template-columns: 9.5em 1fr auto; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line, #eee); }
.journal li:first-child { border-top: 0; }
.journal .jt { color: #777; font-variant-numeric: tabular-nums; }
.journal .jv { color: #777; }

/* Le récapitulatif d’une roue (26 octobre 2026) */
.counts td span { display: block; }
.counts td span.g { color: var(--muted); }
.counts td span.g-ok { color: var(--ok); }
.counts td span.g-low { color: var(--warn); }
.counts td.is-sum { background: #F6F1EA; }
.counts tfoot th, .counts tfoot td b { font-weight: 700; }
.gratuit-n { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 4px 0; font-size: 14px; }
.gratuit-lead { color: var(--muted); }
.chip-g { padding: 4px 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); background: var(--paper); }
.chip-g.is-ok b { color: var(--ok); }
.chip-g.is-low { background: #FDECEE; box-shadow: inset 0 0 0 1px #F0B3BD; }
.sec .sec-note { font-family: var(--f-ui, inherit); font-size: 12px; font-weight: 400; letter-spacing: 0; opacity: .7; margin-left: 6px; }
