/* =========================================================
   粋の間 — iki no ma
   Esthétique reprise de ji no ma : le papier domine,
   hiérarchie par l'espacement, aucune couleur qui ne soit
   fonctionnelle. Le motif au centre, les contrôles s'effacent.
   ========================================================= */

:root {
  --papier:        #f6f3ec;  /* fond général */
  --fond-panneau:  #fbf9f4;  /* panneau de contrôles */
  --encre:         #161310;  /* texte, éléments actifs */
  --discret:       #8b8378;  /* texte secondaire */
  --trait:         rgba(22, 19, 16, 0.12);
  --trait-fort:    rgba(22, 19, 16, 0.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--papier);
  color: var(--encre);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Songti SC", Georgia, serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; height: 100vh; }

/* ---------------- Panneau (à droite, comme ji no ma) ---------------- */
.panel {
  order: 2;               /* le motif d'abord, les contrôles ensuite */
  width: 330px;
  min-width: 330px;
  background: var(--fond-panneau);
  border-left: 1px solid var(--trait);
  display: flex;
  flex-direction: column;
}

/* Titre : kanji puis romaji, à la manière de ji no ma */
.brand {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 2rem 1.8rem 1.2rem;
}
.brand-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.brand-kanji {
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  line-height: 1;
  color: var(--encre);
}
.brand-name {
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--discret);
  text-transform: lowercase;
}

/* Sélecteur de langue : les trois choix restent visibles — un menu fermé
   ne laisserait pas deviner qu'il y a d'autres langues. */
.lang {
  margin-left: auto;
  display: flex;
  gap: 1px;
  background: var(--trait);
  border: 1px solid var(--trait);
}
.lang-opt {
  appearance: none;
  border: none;
  background: var(--fond-panneau);
  color: var(--discret);
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  line-height: 1;
  padding: 0.28rem 0.42rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-opt:hover { color: var(--encre); }
.lang-opt.actif { background: var(--encre); color: var(--papier); }

/* Barre d'outils */
.toolbar {
  display: flex;
  gap: 1px;
  margin: 0 1.8rem 1.4rem;
  background: var(--trait);
  border: 1px solid var(--trait);
}
.tool {
  flex: 1;
  appearance: none;
  background: var(--fond-panneau);
  border: none;
  color: var(--discret);
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 0.5rem 0;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tool:hover { background: var(--encre); color: var(--papier); }
.tool.on { background: var(--encre); color: var(--papier); }
.tool:disabled { color: var(--trait-fort); background: var(--fond-panneau); cursor: default; }

/* Corps scrollable */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.8rem 2rem;
}
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--trait); }

.sec { border-top: 1px solid var(--trait); padding: 1.4rem 0 0.2rem; }
.sec:first-child { border-top: none; padding-top: 0; }

.sec-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}
.sec-num {
  font-size: 0.62rem;
  color: var(--discret);
  font-variant-numeric: tabular-nums;
}
.sec-title {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--discret);
}
.lock-sec { margin-left: auto; }

/* Verrous : l'état se lit au glyphe (○ ◐ ●), pas à la couleur */
.lock {
  appearance: none;
  background: none;
  border: none;
  color: var(--trait-fort);
  font-size: 0.85rem;
  line-height: 1;
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s;
  font-family: inherit;
}
.lock:hover { color: var(--discret); }
.lock.locked, .lock.partial { color: var(--encre); }

/* Contrôles */
.ctrl {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin-bottom: 1.1rem;
}
.ctrl > label {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--encre);
  flex: 1;
  min-width: 0;
}
.ctrl label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.ctrl select { flex-basis: 100%; order: 5; }

select, .btn-line, input[type="text"], textarea {
  appearance: none;
  background: var(--fond-panneau);
  border: 1px solid var(--trait);
  color: var(--encre);
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--discret) 50%),
                    linear-gradient(135deg, var(--discret) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}
select:hover, select:focus,
input[type="text"]:focus, textarea:focus { border-color: var(--trait-fort); }

.btn-line {
  cursor: pointer;
  text-align: center;
  width: 100%;
  margin-top: 0.2rem;
}
.btn-line:hover { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.btn-line:disabled { color: var(--trait-fort); background: var(--fond-panneau); border-color: var(--trait); cursor: default; }
.btn-line.ok { background: var(--encre); color: var(--papier); border-color: var(--encre); }

/* Glissières sobres, sans habillage superflu */
.range-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-basis: 100%;
  order: 5;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 1px;
  background: var(--trait-fort);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--encre);
  border: none;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--encre);
  border: none;
  cursor: pointer;
}
.rv {
  font-family: "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--discret);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: right;
}

/* Couleurs : seule couleur admise, car strictement fonctionnelle */
.color-row { display: flex; align-items: center; gap: 0.55rem; }
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 30px; height: 22px;
  border: 1px solid var(--trait);
  background: none;
  cursor: pointer;
  padding: 0;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; }
.hex {
  font-family: "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--discret);
}

input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border: 1px solid var(--trait-fort);
  background: var(--fond-panneau);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
input[type="checkbox"]:checked { background: var(--encre); border-color: var(--encre); }
input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: -3px; left: 1px;
  font-size: 11px;
  color: var(--papier);
}

/* Palettes : menu déroulant — au repos, seule la palette en cours se voit.
   Le nuancier parle, pas le libellé. */
.pal-select { position: relative; }

.pal-tete {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  appearance: none;
  background: var(--fond-panneau);
  border: 1px solid var(--trait);
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color .15s;
}
.pal-tete:hover { border-color: var(--trait-fort); }
.pal-chev { margin-left: auto; font-size: 0.6rem; color: var(--discret); line-height: 1; }

.pal-menu {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  background: var(--fond-panneau);
  border: 1px solid var(--trait-fort);
  max-height: 264px;
  overflow-y: auto;
}
.pal-select.ouvert .pal-menu { display: block; }
.pal-menu::-webkit-scrollbar { width: 8px; }
.pal-menu::-webkit-scrollbar-thumb { background: var(--trait); }

.pal {
  width: 100%;
  appearance: none;
  border: none;
  border-bottom: 1px solid var(--trait);
  background: var(--fond-panneau);
  cursor: pointer;
  padding: 0.35rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  text-align: left;
  transition: background .15s;
}
.pal:last-child { border-bottom: none; }
.pal:hover { background: var(--papier); }

.pal-bande { display: flex; height: 13px; width: 56px; flex-shrink: 0; border: 1px solid var(--trait); }
.pal-bande i { flex: 1; display: block; }
.pal-nom { font-size: 0.66rem; letter-spacing: 0.06em; color: var(--discret); }

.pal.actif { background: var(--encre); }
.pal.actif .pal-nom { color: var(--papier); }
.pal.actif .pal-bande { border-color: var(--encre); }

/* Séquenceur : 8 pas, plein = trait tracé, vide = interstice */
.seq {
  display: flex;
  gap: 1px;
  flex-basis: 100%;
  order: 5;
  background: var(--trait);
  border: 1px solid var(--trait);
}
.seq-step {
  flex: 1;
  appearance: none;
  border: none;
  background: var(--fond-panneau);
  height: 20px;
  padding: 0;
  cursor: pointer;
  transition: background .15s;
}
.seq-step:hover { background: var(--trait); }
.seq-step.on { background: var(--encre); }
.seq-step.on:hover { background: var(--trait-fort); }

/* Zone de dépôt */
.drop {
  border: 1px dashed var(--trait-fort);
  padding: 1.4rem 0.8rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.drop:hover, .drop.over { border-color: var(--encre); background: var(--papier); }
.drop-label { font-size: 0.85rem; color: var(--encre); }
.drop-hint  { font-size: 0.62rem; color: var(--discret); letter-spacing: 0.1em; }
.img-note {
  font-size: 0.68rem;
  color: var(--discret);
  margin: 0.6rem 0 1rem;
  line-height: 1.45;
}

/* Presets */
.preset-add { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.preset-add input { flex: 1; }
.preset-add .btn-line { width: auto; margin-top: 0; white-space: nowrap; }
.preset-list { display: flex; flex-direction: column; gap: 1px; background: var(--trait); border: 1px solid var(--trait); }
.preset-list:empty { border: none; }
.preset-item {
  display: flex; align-items: center; gap: 0.3rem;
  background: var(--fond-panneau);
  padding: 0.3rem 0.3rem 0.3rem 0.6rem;
}
.preset-item .pname {
  flex: 1; font-size: 0.82rem; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preset-item .pname:hover { text-decoration: underline; text-underline-offset: 3px; }
.preset-item button {
  background: none; border: none; color: var(--discret);
  cursor: pointer; font-size: 0.72rem; padding: 0.25rem 0.4rem; font-family: inherit;
}
.preset-item button:hover { color: var(--encre); }
.preset-empty { font-size: 0.72rem; color: var(--discret); font-style: italic; }

.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.export-grid .btn-line { margin-top: 0; }

/* Champ caractères / texte + pré-sélection */
.char-input {
  flex-basis: 100%;
  order: 4;
  width: 100%;
  min-height: 32px;
  resize: vertical;
  text-align: left;
  font-size: 15px;
  line-height: 1.5;
}

/* Ligne police + bouton d'import */
.font-row { display: flex; gap: 0.4rem; flex-basis: 100%; order: 5; }
.font-row select { flex: 1; }
.font-up {
  appearance: none;
  background: var(--fond-panneau);
  border: 1px solid var(--trait);
  color: var(--discret);
  width: 30px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.font-up:hover { background: var(--encre); color: var(--papier); border-color: var(--encre); }

.char-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  flex-basis: 100%;
  order: 6;
  background: var(--trait);
  border: 1px solid var(--trait);
}
.char-chip {
  appearance: none;
  background: var(--fond-panneau);
  border: none;
  color: var(--encre);
  width: 26px; height: 26px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.char-chip:hover { background: var(--encre); color: var(--papier); }

.panel-footer {
  padding: 0.9rem 1.8rem;
  border-top: 1px solid var(--trait);
  font-size: 0.62rem;
  color: var(--discret);
  letter-spacing: 0.16em;
}

/* ---------------- Aperçu : le motif occupe la place centrale ---------------- */
.preview {
  order: 1;
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--papier);
}
.canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  overflow: hidden;
  min-height: 0;
}
#cvs {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--trait);
  box-shadow: 0 2px 28px rgba(22, 19, 16, 0.07);
}

/* Galerie */
.gallery {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  padding: 0.9rem 1.1rem;
  background: var(--fond-panneau);
  border-top: 1px solid var(--trait);
  max-height: 34vh;
  overflow-y: auto;
}
.gallery.hidden { display: none; }
.gallery canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--papier);
  border: 1px solid var(--trait);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.gallery canvas:hover { border-color: var(--encre); transform: translateY(-2px); }

/* Toast */
.toast {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.6rem);
  background: var(--encre);
  color: var(--papier);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  padding: 0.5rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tip-paysage { display: none; padding: 0.3rem 1rem 0.5rem; text-align: center; font-size: 0.62rem; letter-spacing: 0.1em; color: var(--discret); }
/* téléphone en portrait : l'aperçu reste collé en haut pendant que les réglages défilent */
@media (max-width: 820px) and (orientation: portrait) {
  .app { flex-direction: column; height: auto; overflow: visible; }
  body { overflow: auto; }
  .preview { position: sticky; top: 0; z-index: 5; height: 42vh; min-height: 15rem; border-bottom: 1px solid var(--trait); }
  .canvas-wrap { padding: 0.8rem; }
  .panel { width: 100%; min-width: 0; border-left: none; }
  .gallery { grid-template-columns: repeat(4, 1fr); }
  .tip-paysage { display: block; }
}
/* téléphone en paysage : l'aperçu à gauche, les réglages défilent à droite */
@media (max-height: 520px) and (orientation: landscape) {
  .app { height: 100vh; }
  .panel { width: 48vw; min-width: 0; }
  .preview { flex: 1; min-width: 0; }
  .canvas-wrap { padding: 0.6rem; }
}

/* ---- shiki 色 : ajouts ---- */
.kasane-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--trait); border: 1px solid var(--trait); max-height: 15rem; overflow-y: auto; }
.kasane { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.55rem; background: var(--fond-panneau); cursor: pointer; border: 0; font: inherit; color: var(--encre); text-align: left; }
.kasane:hover { background: var(--papier); }
.kasane.actif { background: var(--encre); color: var(--papier); }
.kasane-bande { display: flex; width: 34px; height: 22px; flex-shrink: 0; border: 1px solid var(--trait); }
.kasane-bande span { flex: 1; }
.kasane-nom { font-size: 0.74rem; letter-spacing: 0.06em; line-height: 1.2; }
.kasane-saison { font-size: 0.58rem; color: var(--discret); letter-spacing: 0.1em; display: block; }
.kasane.actif .kasane-saison { color: var(--papier); opacity: .7; }
.saisons { display: flex; gap: 0.9rem; margin: 0 0 0.6rem; font-size: 0.66rem; letter-spacing: 0.14em; color: var(--discret); }
.saisons button { font: inherit; color: inherit; background: none; border: 0; border-bottom: 1px solid transparent; padding: 0.1rem 0; cursor: pointer; letter-spacing: inherit; }
.saisons button.actif { color: var(--encre); border-color: var(--encre); }
.format-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; }
.format-grid button { font: inherit; font-size: 0.68rem; letter-spacing: 0.06em; padding: 0.45rem 0.2rem; border: 1px solid var(--trait-fort, rgba(22,19,16,.32)); background: none; color: var(--encre); cursor: pointer; line-height: 1.3; }
.format-grid button.actif { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.format-grid small { display: block; font-size: 0.58rem; color: var(--discret); letter-spacing: 0.08em; }
.format-grid button.actif small { color: var(--papier); opacity: .7; }
.canvas-wrap canvas { box-shadow: 0 24px 50px -28px rgba(22,19,16,.35); }

.preview { flex-direction: column; }
.uta-num { width: 5.5rem; font: inherit; font-size: 0.8rem; padding: 0.35rem 0.5rem; border: 1px solid var(--trait-fort); background: var(--papier); color: var(--encre); outline: none; }
.uta-num:focus { border-color: var(--encre); }
.img-note a { color: var(--encre); text-decoration: none; border-bottom: 1px solid var(--trait-fort); }
.img-note a:hover { border-color: var(--encre); }

/* galerie de shiki : formats variés, vignettes ajustées à leur ratio */
#gallery { grid-template-columns: repeat(8, 1fr); align-items: center; }
#gallery canvas { aspect-ratio: auto; width: 100%; height: auto; max-height: 26vh; object-fit: contain; }
.tool.on { background: var(--encre); color: var(--papier); }

.font-load { display: none; color: #b8372a; font-size: 0.66rem; line-height: 1.5; letter-spacing: 0.06em; margin: 0 0 0.4rem; flex-basis: 100%; }
.font-load.on { display: block; }
#uta_font.chargement { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }

/* titres de section : numéro inversé en encre, titre en encre, filet plein (marquage lisible de chaque section) */
.sec-head { align-items: center; gap: 0.55rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--encre); margin-bottom: 0.9rem; }
.sec-num { /* sec-num-badge */ background: var(--encre); color: var(--papier); font-size: 0.62rem; letter-spacing: 0.06em; padding: 0.1rem 0.42rem; line-height: 1.5; }
.sec-title { color: var(--encre); font-size: 0.74rem; letter-spacing: 0.22em; }
.lock-sec { color: var(--discret); }
.plie-toggle, .lib-toggle { font-size: 0.8rem; letter-spacing: 0.06em; }

/* ---- refonte du 26/10 (_commun/ERGONOMIE.md) : règles reprises de 篆の間 et de 粋の間 ---- */
.choix { display: flex; gap: 0; }
.choix button { flex: 1; font: inherit; font-size: 0.74rem; letter-spacing: 0.06em; padding: 0.45rem 0.3rem; border: 1px solid var(--trait-fort); background: none; color: var(--encre); cursor: pointer; margin-left: -1px; line-height: 1.3; }
.choix button:first-child { margin-left: 0; }
.choix button.actif { background: var(--encre); color: var(--papier); border-color: var(--encre); position: relative; z-index: 1; }
/* les formes du catalogue (gourde, œuf…) : une grille sous carré, rond et rectangle, chaque bouton avec sa silhouette */
.choix.formes { flex-basis: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 0.3rem; }
.choix.formes button { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; margin: -1px 0 0 -1px; padding: 0.4rem 0.2rem 0.35rem; }
.choix.formes button svg { display: block; height: 30px; width: auto; }
/* ---- audit des menus (26/10, docs/audit-menus/RAPPORT.md) ----
   le regard ne doit pas sauter : sur grand écran, le sceau et le panneau forment un seul bloc centré
   (l'aperçu se resserre autour du sceau, app.js calcule sa taille sur la place libre) ;
   tout ce qui se lit est en taille normale et à l'encre (contraste wcag ≥ 4,5) ;
   chaque commande porte son mot ; cibles de 44 px au doigt (apple, fitts). */
:root { --discret: #5f584f; }
@media not all and (max-width: 820px), (orientation: landscape) {
  .app { justify-content: center; }
  .preview { flex: 0 0 auto; }
  .canvas-wrap { padding: 2.5rem 2.5rem 1rem; }
  /* les propositions suivent la largeur de l'aperçu sans l'élargir : l'interface ne change pas de forme */
  /* largeur fixe, quelle que soit la forme du sceau : rien ne bouge quand on applique une proposition ; le sceau reste collé au panneau */
  .preview { width: clamp(34rem, calc(100vh - 4rem), calc(100vw - 330px)); }
  .canvas-wrap { justify-content: flex-end; align-items: flex-end; } /* le sceau posé juste au-dessus de ses propositions */
  .gallery { width: 0; min-width: 100%; }
}
.lang-opt { font-size: 0.8rem; padding: 0.4rem 0.55rem; }
.brand-name { font-size: 0.8rem; letter-spacing: 0.25em; }
.toolbar { margin-bottom: 0.6rem; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; color: var(--encre); padding: 0.45rem 0 0.4rem; }
.tool .ico { font-size: 15px; line-height: 1; }
.tool:disabled { color: var(--discret); opacity: .55; }
.tool { flex: 1 1 auto; min-width: 0; }
.tool .mot { font-size: 0.72rem; letter-spacing: 0; line-height: 1.2; text-align: center; padding: 0 0.15rem; hyphens: auto; -webkit-hyphens: auto; max-width: 100%; }
.sec-num { font-size: 0.75rem; }
.sec-title { font-size: 0.92rem; letter-spacing: 0.18em; text-transform: none; }
.lock { color: #968e83; font-size: 1rem; width: 24px; height: 24px; }
.lock-sec { color: var(--discret); }
.ctrl > label { font-size: 0.92rem; }
select, .btn-line, input[type="text"], textarea { font-size: 0.9rem; }
.choix button { font-size: 0.86rem; }
.choix.formes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choix.formes button { padding-left: 0.1rem; padding-right: 0.1rem; }
.choix.formes button span { font-size: 0.78rem; letter-spacing: 0; }
.img-note { font-size: 0.82rem; color: var(--encre); }
.rv, .hex { font-size: 0.82rem; color: var(--encre); }
.fd { font-size: 0.82rem; color: var(--encre); }
.lib-toggle { font-size: 0.88rem; color: var(--encre); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--trait-fort); }
input[type="checkbox"] { width: 16px; height: 16px; }
input[type="checkbox"]:checked::after { top: -2px; left: 2px; }
.panel-footer { font-size: 0.75rem; letter-spacing: 0.08em; }
.zoom-row { justify-content: center; font-size: 0.82rem; letter-spacing: 0.08em; padding: 0 1.4rem 1.2rem; color: var(--encre); }
.zoom-row input[type=range] { flex: 0 0 10rem; width: 10rem; }
.tip-paysage { font-size: 0.78rem; }
/* bibliothèque de secours : chaque niveau a sa forme (taille, filet, retrait) */
.lib-cat-head { font-size: 0.92rem; border-bottom-color: var(--encre); }
.lib-sub-head { color: var(--encre); font-size: 0.85rem; margin-left: 0.7rem; padding-left: 0.7rem; border-left: 2px solid #b8372a; }
.lib-item { color: var(--encre); font-size: 0.82rem; margin-left: 1.6rem; padding-left: 0.8rem; border-left: 1px dotted var(--encre); }
.lib-cat-count { font-size: 0.78rem; }
/* l'essentiel d'abord (caractères, écriture, forme, enregistrer) ; le reste se replie.
   chaque niveau a sa forme : « 細かく整える » grand, avec un filet d'encre ; ses rubriques plus petites, en retrait, repère vermillon */
.toolbar { margin-bottom: 1.4rem; }
.formes-base { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.plus-formes { margin: -0.5rem 0 1.1rem 2rem; }

.plus-formes > .choix.formes { margin-top: 0.4rem; }
.affiner { border-top: 1px solid var(--encre); margin-top: 1.2rem; }
.affiner > summary { display: flex; align-items: center; gap: 0.6rem; font-size: 1rem; letter-spacing: 0.14em; padding: 0.9rem 0; }
.affiner > summary::after { content: "＋"; margin-left: auto; }
.affiner[open] > summary::after { content: "−"; }
.sous { margin-left: 0.4rem; border-left: 2px solid #b8372a; padding-left: 0.9rem; border-bottom: 1px solid var(--trait); }
.sous > summary { display: flex; align-items: center; font-size: 0.9rem; letter-spacing: 0.06em; padding: 0.7rem 0; }
.sous > summary::after { content: "＋"; margin-left: auto; font-size: 0.85rem; }
.sous[open] > summary::after { content: "−"; }
.sous[open] { padding-bottom: 0.4rem; }
@media (pointer: coarse), (max-width: 820px) { .affiner > summary, .sous > summary, .plus-formes > summary { min-height: 44px; } }
/* le menu des écritures sur la ligne de son verrou */
.ctrl:has(> #fontSel) > select, .ctrl:has(> #fontSel) > .pal-select, .ctrl:has(> #fontSel) > :last-child { flex: 1 1 0; flex-basis: 0; min-width: 0; order: 0; }
/* téléphone : en-tête plus court, et pas de verrous (secondaires, sans infobulle au doigt) */
@media (max-width: 820px) and (orientation: portrait) {
  .brand { padding: 1rem 1.2rem 0.8rem; }
  .brand-name { display: none; }
  .ctrl > .lock { display: none; }
}
/* le verrou se range à gauche de son réglage au lieu d'occuper une ligne vide */
.ctrl > span.lock[style*="hidden"] { display: none; }
.ctrl > .lock + .texte-sceau, .ctrl > .lock + .choix.formes { flex: 1 1 0; flex-basis: 0; width: auto; min-width: 0; }
.ctrl:has(> .choix.formes) { align-items: flex-start; }
.ctrl:has(> .choix.formes) > .lock { margin-top: 0.4rem; }
/* téléphone en portrait : l'aperçu est toujours à sa taille pleine, le réglage « 表示 » n'y sert pas */
@media (max-width: 820px) and (orientation: portrait) { .zoom-row { display: none; } }
/* au doigt : des cibles de 44 px */
@media (pointer: coarse), (max-width: 820px) {
  .lang-opt { min-width: 44px; min-height: 44px; }
  .tool { min-height: 52px; }
  .lock { width: 44px; height: 44px; }
  .choix button, .btn-line, select, input[type="text"], .mask-add { min-height: 44px; }
  .ctrl label.check { min-height: 44px; }
  .lib-row .de, .lib-toggle { min-height: 44px; }
  input[type="range"] { height: 32px; background: linear-gradient(var(--trait-fort), var(--trait-fort)) center / 100% 1px no-repeat; }
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
}

/* ---- quatre étapes (kuma, 26/10 : « attirer l'attention… on perd en beauté mais on gagne en facilité d'usage ») ----
   chaque étape est une carte cernée d'encre, numérotée en vermillon (repère), avec un verbe ; une flèche mène à la suivante.
   le champ des caractères se voit modifiable : fond blanc, cadre d'encre, crayon, appel discret tant qu'on n'y a pas touché. */
.sec.etape { border: 2px solid var(--encre); background: #fff; padding: 0.85rem 0.9rem 0.5rem; }
.sec.etape:first-child { padding-top: 0.85rem; border-top: 2px solid var(--encre); }
.etape-tete { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.8rem; }
.etape-num { flex: none; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; background: #b8372a; color: #fff; font-size: 1.1rem; font-weight: 700; line-height: 1; }
.etape-titre { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.08em; color: var(--encre); }
.fleche { text-align: center; color: #b8372a; font-size: 1.6rem; line-height: 1; margin: 0.3rem 0; font-weight: 700; }
input.texte-sceau { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M3 21l3.8-1 11-11-2.8-2.8-11 11L3 21zM14.8 5.4l2.8 2.8 1.6-1.6a1 1 0 000-1.4l-1.4-1.4a1 1 0 00-1.4 0l-1.6 1.6z' fill='%23161310'/%3E%3C/svg%3E") no-repeat right 0.7rem center;
  border: 2px solid var(--encre); font-size: 1.5rem; padding: 0.6rem 2.4rem; cursor: text; }
input.texte-sceau:focus { border-color: #b8372a; outline: none; }
input.texte-sceau.appel { animation: appel 1.8s ease-in-out infinite; }
@keyframes appel { 0%, 100% { box-shadow: 0 0 0 0 rgba(184,55,42,0); } 50% { box-shadow: 0 0 0 4px rgba(184,55,42,.35); } }
@media (prefers-reduced-motion: reduce) { .texte-sceau.appel { animation: none; box-shadow: 0 0 0 3px rgba(184,55,42,.35); } }
.etape select, .etape .pal-tete { border: 2px solid var(--encre); background-color: #fff; }
.etape .export-grid .btn-line { border: 2px solid var(--encre); font-weight: 700; background: #fff; }
.etape .export-grid .btn-line:hover { background: var(--encre); color: var(--papier); }
.etape .choix button { border-color: var(--encre); }
.panel-body > .toolbar { margin: 1.4rem 0 0.4rem; }
.excl { display: flex; align-items: center; gap: 0.6rem; margin: 0.2rem 0 0.6rem; font-size: 0.9rem; cursor: pointer; }
@media (pointer: coarse), (max-width: 820px) { .excl { min-height: 44px; margin: 0; } }

/* ---- 26/10 (suite) : propositions au-dessus du sceau, gourde, réglages avancés dans leur boîte, chien 点, bouton 道具 ---- */
.brand-line { gap: 0.5rem; }
.outils-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; font: inherit; font-size: 0.88rem; letter-spacing: 0.08em; color: var(--encre); background: #fff; border: 1px solid var(--encre); padding: 0.35rem 0.7rem; cursor: pointer; }
.outils-btn:hover { background: var(--encre); color: var(--papier); }
.brand-sous { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.brand-sous .lang { margin-left: auto; border: none; background: none; gap: 0.15rem; }
.brand-sous .lang-opt { font-size: 0.72rem; padding: 0.15rem 0.3rem; background: none; color: var(--discret); }
.brand-sous .lang-opt.actif { background: none; color: var(--encre); text-decoration: underline; text-underline-offset: 3px; }
.plus-formes { margin: 0.5rem 0 1rem; }
.plus-formes > summary { display: flex; align-items: center; justify-content: space-between; font-size: 0.92rem; padding: 0.55rem 0.75rem; border: 1px solid var(--encre); background: #fff; }
.plus-formes > summary::after { content: "▼"; color: #b8372a; font-size: 0.8rem; }
.plus-formes[open] > summary::after { content: "▲"; }
.plus-formes > summary:hover { background: var(--papier); }
.affiner { border: 2px dashed var(--encre); background: #fff; padding: 0 0.9rem; margin-top: 0; }
.affiner > summary { font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; }
.affiner[open] { padding-bottom: 0.6rem; }
.chien { display: block; width: fit-content; margin: 1.8rem auto 0.6rem; }
.chien .fig { display: block; position: relative; transition: transform .35s ease; }
.chien img { display: block; height: 120px; width: auto; }
.chien:hover .fig { transform: translateY(-6px); }
.chien .queue { position: absolute; left: 0; top: 0; height: 100%; width: auto; transform-origin: 86% 88.5%; animation: remue .55s ease-in-out infinite alternate; }
@keyframes remue { from { transform: rotate(-7deg); } to { transform: rotate(9deg); } }
@media (prefers-reduced-motion: reduce) { .chien .queue { animation: none; } }
/* propositions : sous le sceau, exactement à sa largeur (--l-sceau, posée par app.js), une rangée de huit ; commandes petites */
.propositions { width: var(--l-sceau, 30rem); max-width: calc(100% - 5rem); margin: 0.2rem 2.5rem 0 auto; }
.propositions[hidden] { display: none; }
.propos-tete { display: flex; justify-content: flex-end; align-items: center; gap: 0.4rem; margin-top: 0.35rem; }
.propos-de, .propos-fermer, .propos-ouvrir { font: inherit; font-size: 0.78rem; line-height: 1.2; color: var(--encre); background: none; border: 1px solid var(--trait-fort); padding: 0.2rem 0.5rem; cursor: pointer; }
.propos-fermer { padding: 0.2rem 0.45rem; }
.propos-de:hover, .propos-fermer:hover, .propos-ouvrir:hover { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.propos-ouvrir { align-self: flex-end; margin: 0.4rem 2.5rem 0 0; }
.propos-ouvrir[hidden] { display: none; }
#gallery { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.35rem; padding: 0; background: none; border: 0; max-height: none; overflow: visible; }
#gallery canvas { width: 100%; height: auto; max-height: none; aspect-ratio: auto; object-fit: contain; background: none; border: 1px solid transparent; }
#gallery canvas:hover { border-color: var(--encre); }
@media (max-width: 820px) and (orientation: portrait) {
  .preview { height: 52vh; }
  .propositions { width: auto; margin: 0.2rem 0.8rem 0; max-width: none; } /* au téléphone, le sceau est trop petit : les propositions prennent la largeur de l'écran */
  .propos-ouvrir { align-self: center; margin: 0.3rem auto 0; }
  .outils-btn { padding: 0.5rem 0.8rem; }
}

/* ---- 26/10 (suite) : le sceau en haut, « 表示 » entre lui et ses propositions ---- */
@media not all and (max-width: 820px), (orientation: landscape) {
  .canvas-wrap { align-items: center; padding: 2rem 2.5rem 0; } /* à 60 % (défaut, kuma) le sceau se tient au milieu de sa zone */
  .zoom-row { width: var(--l-sceau, 30rem); max-width: calc(100% - 5rem); margin: 0.9rem 2.5rem 0 auto; padding: 0; justify-content: center; }
  .propositions { margin-top: 0.9rem; padding-bottom: 1.4rem; }
}

/* ---- « 細かな調整 » : mêmes règles que les quatre étapes — chaque niveau a sa forme ----
   niveau 1 : la boîte en pointillés, titre gras ;
   niveau 2 fermé : une ligne cernée, flèche ▸ vermillon ; ouvert : bandeau d'encre (on sait où l'on est), contenu cerné d'encre ;
   niveau 3 : les réglages, sur fond blanc, dans ce cadre. */
.affiner > summary { padding: 0.95rem 0; }
.affiner[open] > summary { border-bottom: 2px solid var(--encre); margin-bottom: 0.6rem; }
.sous { margin: 0 0 0.45rem; padding: 0; border: 0; }
.sous > summary { display: flex; align-items: center; gap: 0.6rem; font-size: 0.95rem; letter-spacing: 0.05em; padding: 0.65rem 0.8rem; border: 1px solid var(--encre); background: #fff; color: var(--encre); }
.sous > summary::before { content: "▸"; color: #b8372a; font-size: 0.9rem; width: 0.8rem; }
.sous > summary::after { content: ""; }
.sous > summary:hover { background: var(--papier); }
.sous[open] { padding: 0; margin-bottom: 0.8rem; }
.sous[open] > summary { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.sous[open] > summary::before { content: "▾"; color: var(--papier); }
.sous[open] > summary::after { content: "✕"; margin-left: auto; font-size: 0.8rem; opacity: .8; }
.sous[open] > :not(summary) { margin-left: 0; margin-right: 0; }
.sous[open] { border: 2px solid var(--encre); }
.sous[open] > summary { border: 0; }
.sous[open] > *:not(summary) { padding-left: 0.8rem; padding-right: 0.8rem; }
.sous[open] > *:not(summary):first-of-type { padding-top: 0.8rem; }
.sous[open] > *:last-child { padding-bottom: 0.6rem; }

/* vignettes de hauteur fixe : la rangée des propositions garde toujours la même taille, quel que soit le zoom */
@media not all and (max-width: 820px), (orientation: landscape) {
  #gallery { height: 5.2rem; align-items: center; }
  #gallery canvas { max-height: 5.2rem; width: auto; max-width: 100%; justify-self: center; }
}
.outils-btn .fleche-menu { color: #b8372a; font-size: 0.75rem; }
.outils-btn:hover .fleche-menu { color: var(--papier); }
/* le sceau, son curseur et ses propositions sur un même axe ; le zoom part du centre */
@media not all and (max-width: 820px), (orientation: landscape) {
  .canvas-wrap { justify-content: center; }
  .zoom-row, .propositions { margin-left: auto; margin-right: auto; }
}
/* kuma, 26/10 : le panneau reste collé au sceau ; le sceau, son curseur et ses propositions s'alignent sur le bord du panneau ; vignettes serrées les unes contre les autres */
@media not all and (max-width: 820px), (orientation: landscape) {
  .canvas-wrap { justify-content: flex-end; }
  .zoom-row, .propositions { margin-left: auto; margin-right: 2.5rem; }
  .zoom-row { justify-content: flex-end; }
  #gallery { display: flex; justify-content: flex-end; gap: 0.25rem; height: auto; }
  #gallery canvas { flex: 0 1 auto; min-width: 0; max-width: calc((100% - 1.75rem) / 8); max-height: 5.2rem; width: auto; height: auto; }
}

/* ---- 26/10 (suite) : bloc centré à l'écran — la zone du sceau a la largeur du sceau à 100 % (--cote, posée par app.js) ;
   le sceau se réduit autour de son centre, l'échelle « 表示 » centrée dessous sépare le sceau de ses propositions ---- */
@media not all and (max-width: 820px), (orientation: landscape) {
  .preview { width: min(calc(var(--cote, 40rem) + 5rem), calc(100vw - 330px)); }
  .canvas-wrap { justify-content: center; }
  .zoom-row { width: auto; max-width: none; margin: 0.9rem auto 0; justify-content: center; }
  .propositions { width: auto; max-width: none; margin: 0.9rem 2.5rem 0; }
  #gallery { justify-content: center; }
}
/* langue : sous « 共有 / 最初から » */
.panel-body > .lang { margin: 0.9rem 0 0; justify-content: center; border: none; background: none; gap: 0.3rem; }
.panel-body > .lang .lang-opt { font-size: 0.75rem; padding: 0.2rem 0.4rem; background: none; color: var(--discret); }
.panel-body > .lang .lang-opt.actif { color: var(--encre); text-decoration: underline; text-underline-offset: 3px; background: none; }

/* « peaufiner » : les titres de rubrique deviennent de vrais boutons — cadre d'encre épais, titre en gras, ＋ sur carré vermillon (comme les numéros d'étape) */
.sous > summary { border: 2px solid var(--encre); font-weight: 700; font-size: 0.95rem; padding: 0.6rem 0.6rem 0.6rem 0.8rem; min-height: 44px; }
.sous > summary::before { content: none; }
.sous > summary::after { content: "＋"; margin-left: auto; width: 1.6rem; height: 1.6rem; display: flex; align-items: center; justify-content: center; background: #b8372a; color: #fff; font-size: 0.95rem; font-weight: 700; opacity: 1; }
.sous > summary:hover { background: var(--papier); }
.sous[open] > summary { border: 0; }
.sous[open] > summary::after { content: "−"; background: var(--papier); color: var(--encre); }
/* kuma, 26/10 : les commandes des propositions ne font plus une ligne à part ; ⚄ et ✕ se rangent au bout de la rangée, l'un sur l'autre */
.propositions { display: flex; align-items: center; gap: 0.35rem; }
.propositions { justify-content: center; }
.propositions #gallery { flex: 0 1 auto; min-width: 0; width: auto; }
.propos-tete { flex-direction: column; margin: 0; gap: 0.25rem; }
.propos-de, .propos-fermer { width: 1.7rem; height: 1.7rem; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
@media (pointer: coarse), (max-width: 820px) { .propos-de, .propos-fermer { width: 2.2rem; height: 2.2rem; } }
/* kuma, 26/10 : le sceau reste collé au menu à tous les zooms ; l'échelle se place sous le sceau (--l-cur) ; les propositions gardent leur largeur */
@media not all and (max-width: 820px), (orientation: landscape) {
  .canvas-wrap { justify-content: flex-end; }
  .zoom-row { width: max(var(--l-cur, 20rem), 16rem); margin: 0.9rem calc(2.5rem + (var(--l-cur, 20rem) - max(var(--l-cur, 20rem), 16rem)) / 2) 0 auto; justify-content: center; }
  .propos-de, .propos-fermer { width: 2.6rem; height: 2.6rem; font-size: 1.25rem; }
}
/* une rubrique ouverte garde son bandeau d'encre au survol (son titre disparaissait) */
.sous[open] > summary:hover { background: var(--encre); color: var(--papier); }
/* kuma, 26/10 : le sceau vraiment collé au menu (1 rem) ; propositions fermées : un simple carré ⚄ sous l'échelle, sans texte */
@media not all and (max-width: 820px), (orientation: landscape) {
  .canvas-wrap { padding-right: 1rem; padding-left: 1rem; }
  .preview { width: min(calc(var(--cote, 40rem) + 2rem), calc(100vw - 330px)); }
  .zoom-row { margin-right: calc(1rem + (var(--l-cur, 20rem) - max(var(--l-cur, 20rem), 16rem)) / 2); }
  .propositions { margin-left: 1rem; margin-right: 1rem; }
  .propos-ouvrir { width: 2.6rem; height: 2.6rem; padding: 0; font-size: 1.25rem; display: flex; align-items: center; justify-content: center; align-self: center; margin: 0.6rem auto 0; }
  .propos-ouvrir[hidden] { display: none; }
}
@media not all and (max-width: 820px), (orientation: landscape) {
  .propos-ouvrir { margin: 0.6rem calc(1rem + (var(--l-cur, 20rem) - 2.6rem) / 2) 0 auto; align-self: auto; }
}

/* ---- kuma, 26/10 (capture d'un grand écran) : la zone du sceau suit le sceau affiché (--l-cur), avec un minimum pour la rangée des propositions ;
   le bloc sceau + menu se centre vraiment ; propositions centrées sous le sceau, à taille fixe ---- */
@media not all and (max-width: 820px), (orientation: landscape) {
  .preview { width: max(calc(var(--l-cur, 30rem) + 2rem), 46rem); max-width: calc(100vw - 330px); }
  .canvas-wrap { justify-content: center; overflow: visible; }
  #cvs { max-width: none; max-height: none; }
  .zoom-row { width: 16rem; margin: 0.9rem auto 0; }
  .propositions { width: auto; margin: 0.9rem auto 0; justify-content: center; }
  .propositions #gallery { flex: 0 0 auto; width: auto; min-width: 0; }
  #gallery canvas { max-width: 5.2rem; max-height: 5.2rem; }
  .propos-ouvrir { margin: 0.6rem auto 0; }
}
/* le champ des caractères : une flèche noire à sa gauche, plus de crayon */
input.texte-sceau { background-image: none; padding-right: 0.6rem; padding-left: 0.6rem; }
.fleche-champ { flex: none; font-size: 1.6rem; line-height: 1; color: var(--encre); font-weight: 700; }
.ctrl:has(> .fleche-champ) { flex-wrap: nowrap; }
.ctrl > .fleche-champ + .texte-sceau { flex: 1 1 0; width: auto; min-width: 0; }
/* le sceau toujours collé au menu ; l'échelle centrée sous lui ; la rangée des propositions (taille fixe) alignée sur son bord droit */
@media not all and (max-width: 820px), (orientation: landscape) {
  .preview { width: max(calc(var(--l-cur, 30rem) + 2rem), 43.5rem); }
  .canvas-wrap { justify-content: flex-end; }
  .zoom-row { margin: 0.9rem calc(1rem + (var(--l-cur, 16rem) - 16rem) / 2) 0 auto; }
  .propositions { margin: 0.9rem 1rem 0 auto; justify-content: flex-end; }
  #gallery canvas { max-width: 4.6rem; max-height: 4.6rem; }
  .propos-ouvrir { margin: 0.6rem calc(1rem + (var(--l-cur, 20rem) - 2.6rem) / 2) 0 auto; }
}
/* kuma, 26/10 : au zoom, le sceau reste centré sur son centre ; l'échelle, centrée dessous, ne bouge pas et n'est plus coupée */
@media not all and (max-width: 820px), (orientation: landscape) {
  .canvas-wrap { justify-content: center; }
  .zoom-row { width: 16rem; margin: 0.9rem auto 0; }
  .propositions { margin: 0.9rem auto 0; justify-content: center; }
  .propos-ouvrir { margin: 0.6rem auto 0; }
}
/* la zone ne s'élargit plus pour les propositions : elle suit le sceau (collé au menu), la rangée dépasse vers la gauche s'il le faut */
@media not all and (max-width: 820px), (orientation: landscape) {
  .preview { width: max(calc(var(--l-cur, 30rem) + 2rem), 18rem); overflow: visible; }
  .propositions { width: max-content; max-width: none; margin: 0.9rem 1rem 0 0; align-self: flex-end; } /* aligné à droite : si la rangée est plus large que le sceau, elle déborde vers la gauche */
}
/* kuma, 26/10 : le menu reste fixe — la zone du sceau a la largeur du sceau à 100 % (--l-sceau), quel que soit le zoom ; le sceau se réduit autour de son centre */
@media not all and (max-width: 820px), (orientation: landscape) {
  .preview { width: max(calc(var(--l-sceau, 30rem) + 2rem), 18rem); }
  .canvas-wrap { justify-content: center; }
}
/* le chien plus près du reste (kuma) */
.chien { margin: 0.6rem auto 0.4rem; }
.panel-body { padding-bottom: 0.8rem; }
/* retouche : le bouton d'entrée est inutile (la rubrique ouverte = retouche active) ; le menu d'écriture du caractère au-dessus des quatre boutons */
.ret-police { flex-wrap: wrap; margin: 0.4rem 0 0.6rem; }
.ret-police label { flex-basis: 100%; }
.ret-police select { flex: 1 1 100%; order: 2; }
.ctrl[hidden] { display: none; }
/* le menu d'écriture du caractère reste dans sa boîte (kuma) */
.retouche-zone, .ret-police { min-width: 0; max-width: 100%; }
.ret-police select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.fleche-champ { font-size: 1.1rem; }

/* ---- propre à 色の間 ---- */
@media not all and (max-width: 820px), (orientation: landscape) {
  .preview { width: min(calc(var(--cote, 40rem) + 2rem), calc(100vw - 330px)); overflow: visible; }
  .canvas-wrap { padding: 2rem 1rem 0; justify-content: flex-end; align-items: center; }
  #cvs { max-width: none; max-height: none; }
  .propositions { width: auto; max-width: none; margin: 0.9rem 1rem 0; align-self: stretch; justify-content: center; }
  .propositions #gallery { display: flex; justify-content: center; align-items: center; gap: 0.3rem; flex: 0 1 auto; }
  #gallery canvas { max-width: 5.6rem; max-height: 5.6rem; width: auto; height: auto; }
  .propos-ouvrir { margin: 0.6rem auto 0; }
}
.choix.decor { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.choix.decor button svg { width: 30px; height: 30px; }
.sous .sec-head { display: none; }
.sous .sec { border-top: none; padding-top: 0; }
.sous > .sec, .sous > div { padding-left: 0.8rem; padding-right: 0.8rem; }
.sous .lock, .sous .lock-sec { display: none; }
/* les tuiles des formats et des 襲 : lisibles, cernées d'encre comme les étapes */
.etape .format-grid button, .etape .kasane { border-color: var(--encre); }
.saisons button { font-size: 0.88rem; color: var(--encre); padding: 0.35rem 0.5rem; }
.kasane-nom, .kasane small, .format-grid small { font-size: 0.78rem; color: var(--encre); }
.format-grid button { font-size: 0.85rem; } .kasane-nom { font-size: 0.85rem; } .saisons { font-size: 0.88rem; color: var(--encre); }
.kasane.actif .kasane-nom, .kasane.actif small, .kasane.actif span { color: var(--papier); } /* le nom du 襲 choisi reste lisible sur le fond d'encre */
.format-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.format-grid button { font-size: 0.8rem; padding: 0.45rem 0.1rem; overflow-wrap: anywhere; }
.format-grid button small { display: block; font-size: 0.72rem; }
.saisons { flex-wrap: wrap; gap: 0.2rem 0.8rem; }
.format-grid button small { letter-spacing: 0; white-space: nowrap; font-size: 0.68rem; } /* « 242×273 » ne se coupe plus */
@media not all and (max-width: 820px), (orientation: landscape) { .canvas-wrap { justify-content: center; } } /* kuma, 26/10 : un format étroit (短冊) se centre dans sa zone au lieu de se coller au menu */
/* kuma, 26/10 : rien ne dépasse de sa boîte dans les réglages fins (le menu des polices du texte débordait) */
.sous select, .sous input[type="text"], .sous textarea, .sous .ctrl > * { min-width: 0; max-width: 100%; }
.sous select { width: 100%; }
.sous .ctrl { flex-wrap: wrap; }
.sous .ctrl > label:not(.check) { flex-basis: 100%; }
.sous .ctrl > input[type="text"], .sous .ctrl > textarea { flex: 1 1 100%; width: 100%; }
