/* 千の間 — interface.
   Même socle que iki, ji et ten : le papier domine, hiérarchie par l'espacement,
   aucune couleur qui ne soit fonctionnelle, angles vifs. Le texte au centre,
   les réglages s'effacent à droite. */

:root {
  --papier: #f6f3ec;
  --encre: #161310;
  --discret: #8b8378;
  --trait: rgba(22, 19, 16, 0.12);
  --fond-panneau: #fbf9f4;
}

* { box-sizing: border-box; margin: 0; padding: 0 }
html, body { height: 100% }

body {
  background: var(--papier);
  color: var(--encre);
  font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'Songti SC', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

#scene { display: grid; grid-template-columns: 1fr 300px; height: 100vh; overflow: hidden }
/* sans min-height nul, le contenu d'une case de grille l'étire : la feuille
   cesserait de se répartir en colonnes et deviendrait une seule ligne. */
#scene > * { min-height: 0; min-width: 0 }

/* ---- la feuille ---- */
#stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 2rem 2rem 1rem }

/* le titre vit dans le panneau, comme dans 篆, 粋, 色 et 字 : le hanko rouge y
   ramène à l'accueil, et c'est le seul chemin de retour depuis l'outil. */
.accroche { display: flex; align-items: baseline; gap: 0.6rem; flex: none; padding-bottom: 1.1rem;
  font-size: 0.74rem; letter-spacing: 0.1em; color: var(--discret) }
.accroche .sujet { font-size: 1rem; letter-spacing: 0.18em; color: var(--encre) }

/* le compte vit dans le panneau, sous les sources */
.compte {
  font-size: 0.68rem; letter-spacing: 0.1em; color: var(--discret);
  padding-top: 0.5rem; line-height: 1.6;
}

.feuille {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  writing-mode: vertical-rl;
  text-orientation: upright;
  padding: 0.4rem 0;
  line-height: 1.5;
  font-size: var(--taille, 1.7rem);
}
.feuille.horizontal { writing-mode: horizontal-tb; text-orientation: mixed }

/* une expression : un groupe insécable, souligné d'un filet discret */
.mot {
  display: inline-block;
  cursor: pointer;
  border-inline-end: 1px solid transparent;
  padding-inline-end: 0.06em;
  margin-block-end: 0.34em;
  transition: background 0.12s;
}
.feuille.horizontal .mot { margin-inline-end: 0.34em; margin-block-end: 0 }
.mot:hover, .mot.actif { background: rgba(22, 19, 16, 0.07) }
.mot .kana { color: var(--discret) }

/* le filet qui sépare les séries, quand on classe par longueur */
.serie {
  display: block;
  font-size: 0.56rem;
  letter-spacing: 0.24em;
  color: var(--discret);
  border-inline-start: 1px solid var(--trait);
  margin-inline-start: 0.5em;
  padding-inline-start: 0.5em;
  writing-mode: inherit;
}

/* le point de séparation : présent, mais qui ne compte pas comme un caractère */
.sep { color: var(--discret); opacity: 0.55; font-size: 0.62em; margin-block-end: 0.34em; display: inline-block }

.vide { color: var(--discret); font-size: 0.86rem; writing-mode: horizontal-tb; letter-spacing: 0.1em }

/* ---- le panneau ---- */
#panel {
  background: var(--fond-panneau);
  border-left: 1px solid var(--trait);
  padding: 1.6rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', system-ui, sans-serif;
}

.marque { display: flex; flex-direction: column; gap: 0.3rem; padding-bottom: 1rem }
.marque-ligne { display: flex; align-items: center; gap: 0.6rem }
.marque-kanji { font-size: 1.5rem; letter-spacing: 0.15em; line-height: 1; font-weight: 400;
  font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif; display: flex; align-items: center }
.marque-nom { font-size: 0.7rem; letter-spacing: 0.35em; color: var(--discret); text-transform: lowercase }
.langues { display: flex; gap: 0.3rem; margin-left: auto }
.lang-opt {
  appearance: none; border: 1px solid var(--trait); background: none; color: var(--discret);
  font: inherit; font-size: 0.6rem; letter-spacing: 0.16em; padding: 0.1rem 0.45rem; cursor: pointer;
}
.lang-opt.actif { background: var(--encre); color: var(--papier); border-color: var(--encre) }

.section { margin-top: 0.9rem }
.section-tete {
  width: 100%; border: none; border-bottom: 1px solid var(--encre); background: none;
  color: var(--encre); font-size: 0.74rem; letter-spacing: 0.22em; text-transform: uppercase;
  padding: 1.5rem 0 0.45rem; margin-bottom: 0.5rem; text-align: left; font-weight: 400;
}

.bloc { display: flex; gap: 0.4rem; flex-wrap: wrap }
.action {
  appearance: none; border: 1px solid var(--encre); background: none; color: var(--encre);
  font: inherit; font-size: 0.74rem; letter-spacing: 0.18em; padding: 0.4rem 0.8rem; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.action:hover { background: var(--encre); color: var(--papier) }
.action.majeure { flex: 1 1 auto; padding-block: 0.5rem }
.action[disabled] { opacity: 0.35; cursor: default }
.action[disabled]:hover { background: none; color: var(--encre) }

.cibles { display: flex; gap: 0.3rem; flex-wrap: wrap }
.cible {
  appearance: none; border: 1px solid var(--trait); background: none; color: var(--discret);
  font: inherit; font-size: 0.72rem; letter-spacing: 0.1em; padding: 0.25rem 0.6rem; cursor: pointer;
}
.cible.actif { border-color: var(--encre); color: var(--encre) }
/* réservé à la licence : lisible, mais visiblement sous clé */
.cible.reserve { color: rgba(139, 131, 120, 0.7) }
.cible.reserve::after { content: '許'; font-size: 0.56rem; margin-left: 0.3rem; color: var(--shu, #b8372a) }
.cible.reserve:hover { border-color: var(--discret); color: var(--encre) }
.note-licence { font-size: 0.66rem; line-height: 1.7; color: var(--discret); padding-top: 0.5rem }
.note-licence:empty { display: none }

.cases { display: flex; flex-direction: column; gap: 0.1rem }
.case {
  display: flex; align-items: baseline; gap: 0.45rem; font-size: 0.78rem; color: var(--encre);
  cursor: pointer; padding: 0.12rem 0;
}
.case input { accent-color: var(--encre); flex: none }
.case .nb { margin-left: auto; font-size: 0.64rem; color: var(--discret); font-variant-numeric: tabular-nums }

/* glissières : filet de 1 px, pastille d'encre — comme dans les autres modules */
.glissiere { padding: 0.45rem 0 0.2rem }
.glissiere .tete { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.74rem; color: var(--encre) }
.glissiere .valeur { margin-left: auto; font-size: 0.66rem; color: var(--discret); font-variant-numeric: tabular-nums }
.glissiere input[type='range'] { width: 100%; margin-top: 0.3rem; accent-color: var(--encre); height: 1rem }
.bornes { display: flex; justify-content: space-between; font-size: 0.58rem; color: var(--discret); letter-spacing: 0.1em }

.choix {
  width: 100%; appearance: none; border: 1px solid var(--trait); background: none; color: var(--encre);
  font: inherit; font-size: 0.78rem; padding: 0.3rem 0.4rem; cursor: pointer; border-radius: 0;
}
.note-police { font-size: 0.64rem; color: var(--discret); min-height: 1rem; padding-top: 0.25rem }

.version { margin-top: 1.6rem; font-size: 0.58rem; letter-spacing: 0.18em; color: var(--discret) }

.credit { margin-top: 0.8rem; font-size: 0.58rem; line-height: 1.7; color: var(--discret) }
.credit a { color: inherit }

/* ---- la fiche d'un mot ---- */
.fiche {
  position: fixed; z-index: 20; max-width: min(22rem, 86vw);
  background: var(--fond-panneau); border: 1px solid var(--encre); padding: 0.9rem 1rem;
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', system-ui, sans-serif;
  box-shadow: 0 6px 24px rgba(22, 19, 16, 0.12);
}
.fiche[hidden] { display: none }
.fiche .mot-t { font-size: 1.5rem; letter-spacing: 0.08em; font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif }
.fiche .mot-y { font-size: 0.76rem; color: var(--discret); letter-spacing: 0.1em; margin-top: 0.15rem }
.fiche .mot-s { font-size: 0.78rem; line-height: 1.6; margin-top: 0.45rem }
.fiche .mot-c { font-size: 0.62rem; letter-spacing: 0.14em; color: var(--discret); margin-top: 0.3rem }
.fiche .kanjis { margin-top: 0.7rem; border-top: 1px solid var(--trait); padding-top: 0.5rem; display: flex; flex-direction: column; gap: 0.35rem }
.fiche .kj { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.7rem; line-height: 1.4 }
.fiche .kj .c { font-size: 1.25rem; font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif; flex: none; width: 1.5em }
.fiche .kj .d { color: var(--discret); flex: 1 1 auto; min-width: 0 }
.fiche .kj .x { appearance: none; border: 1px solid var(--trait); background: none; color: var(--discret); font: inherit; font-size: 0.6rem; padding: 0 0.3rem; cursor: pointer; flex: none }
.fiche .kj .x:hover { border-color: var(--encre); color: var(--encre) }
.fiche .outils { display: flex; gap: 0.4rem; margin-top: 0.7rem }
.fiche .outils .action { font-size: 0.68rem; padding: 0.25rem 0.6rem }

.exclus { font-size: 0.66rem; color: var(--discret); line-height: 1.8; margin-top: 0.4rem }
.exclus button { appearance: none; border: 1px solid var(--trait); background: none; font: inherit; cursor: pointer; padding: 0 0.25rem; margin: 0 0.1rem; color: inherit }
.exclus button:hover { border-color: var(--encre); color: var(--encre) }

/* ---- écran étroit : le panneau passe dessous ---- */
@media (max-width: 760px) {
  #scene { grid-template-columns: 1fr; height: auto }
  #stage { padding: 1rem 1rem 0; height: 68vh }
  #panel { border-left: none; border-top: 1px solid var(--trait) }
}

/* ---- impression : rien que la feuille ---- */
@media print {
  #panel, #entete, .fiche { display: none !important }
  #scene { display: block; height: auto }
  #stage { padding: 0 }
  .feuille { overflow: visible; height: auto; font-size: 1.5rem }
  body { background: #fff }
}

/* ---- refonte du 27/10 (même logique que les autres outils : _commun/ERGONOMIE.md) ---- */
:root { --discret: #5f584f; --shu: #b8372a; }
/* grand écran : le texte et le menu se tiennent ensemble, centrés */
@media (min-width: 761px) {
  #scene { display: flex; justify-content: center; }
  #stage { flex: 0 1 1500px; padding-right: 16px; }
  #panel { flex: 0 0 320px; }
}
#panel { padding: 1.4rem 1.2rem 3rem; gap: 0; font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'Songti SC', Georgia, serif; }
.marque { padding-bottom: 1.2rem; border-bottom: 1px solid var(--trait); margin-bottom: 1.2rem; }
.marque-nom { font-size: 0.85rem; letter-spacing: 0.2em; }
.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); }
.outils-btn .fleche-menu { color: var(--shu); font-size: 0.75rem; }
.outils-btn:hover .fleche-menu { color: var(--papier); }
#panel > .bloc:first-of-type { margin-bottom: 0.9rem; }
.action { font-size: 0.9rem; letter-spacing: 0.08em; min-height: 44px; }
.action.majeure { background: var(--encre); color: var(--papier); font-size: 1rem; }
/* les quatre étapes */
.etape { border: 2px solid var(--encre); background: #fff; padding: 0.85rem 0.9rem 0.9rem; }
.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: var(--shu); 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: var(--shu); font-size: 1.6rem; line-height: 1; margin: 0.3rem 0; font-weight: 700; }
.etape .bloc .action { flex: 1 1 0; }
.cible { font-size: 0.9rem; color: var(--encre); min-height: 44px; padding: 0.3rem 0.7rem; background: #fff; }
.cible.actif { outline: 2px solid var(--encre); outline-offset: -2px; font-weight: 700; }
.cible.reserve { color: var(--encre); }
.cible.reserve::after { font-size: 0.75rem; }
.note-licence, .note-police, .compte { font-size: 0.85rem; color: var(--encre); }
.case { font-size: 0.9rem; padding: 0.3rem 0; align-items: center; }
.case input { width: 1.1rem; height: 1.1rem; }
.case .nb { font-size: 0.85rem; color: var(--encre); }
.choix { font-size: 0.95rem; min-height: 44px; border: 1px solid var(--encre); background: #fff; }
.glissiere .tete { font-size: 0.9rem; }
.glissiere .valeur, .bornes { font-size: 0.82rem; color: var(--encre); }
/* 「細かな調整」 : niveau 1 en pointillés ; niveau 2 en boutons cernés, ＋ sur carré vermillon ; ouvert, un bandeau d'encre */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.affiner { border: 2px dashed var(--encre); background: #fff; padding: 0 0.9rem; }
.affiner > summary { display: flex; align-items: center; gap: 0.6rem; font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; padding: 0.95rem 0; }
.affiner > summary::after { content: "＋"; margin-left: auto; }
.affiner[open] > summary::after { content: "−"; }
.affiner[open] > summary { border-bottom: 2px solid var(--encre); margin-bottom: 0.6rem; }
.affiner[open] { padding-bottom: 0.6rem; }
.sous { margin: 0 0 0.45rem; }
.sous > summary { display: flex; align-items: center; gap: 0.6rem; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.05em; padding: 0.6rem 0.6rem 0.6rem 0.8rem; min-height: 44px; border: 2px solid var(--encre); background: #fff; color: var(--encre); }
.sous > summary::after { content: "＋"; margin-left: auto; width: 1.6rem; height: 1.6rem; flex: none; display: flex; align-items: center; justify-content: center; background: var(--shu); color: #fff; font-weight: 700; }
.sous > summary:hover { background: var(--papier); color: var(--encre); }
.sous[open] { border: 2px solid var(--encre); margin-bottom: 0.8rem; }
.sous[open] > summary { border: 0; background: var(--encre); color: var(--papier); }
.sous[open] > summary:hover { background: var(--encre); color: var(--papier); }
.sous[open] > summary::after { content: "−"; background: var(--papier); color: var(--encre); }
.sous[open] > *:not(summary) { margin-left: 0.8rem; margin-right: 0.8rem; }
.sous[open] > *:not(summary):first-of-type { margin-top: 0.6rem; }
.sous[open] > *:last-child { margin-bottom: 0.7rem; }
/* en bas : 共有, 言葉を選ぶ, la langue, le chien */
.bloc.bas { margin-top: 1.2rem; }
.bloc.bas .action { flex: 1 1 auto; }
.vers-kotoba { display: block; text-align: center; font-size: 0.9rem; color: var(--encre); margin: 0.8rem 0 0.4rem; }
.vers-kotoba:hover { color: var(--shu); }
#panel > .langues { justify-content: center; margin: 0.2rem 0; gap: 0; }
#panel > .langues .lang-opt { border: 0; font-size: 0.9rem; color: var(--encre); padding: 0.5rem 0.4rem; min-width: 44px; min-height: 44px; background: none; }
#panel > .langues .lang-opt.actif { background: none; color: var(--encre); text-decoration: underline; text-underline-offset: 0.3em; }
.chien { display: block; width: fit-content; margin: 0.6rem auto 0.4rem; }
.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; } }
.version, .credit { font-size: 0.85rem; color: var(--encre); text-align: center; }
/* la fiche d'un mot : lisible */
.fiche .mot-y, .fiche .mot-c, .fiche .kj, .fiche .kj .d, .exclus { font-size: 0.85rem; color: var(--encre); }
.accroche { font-size: 0.95rem; color: var(--encre); }
#panel > .bloc:has(#tirer) { margin-bottom: 1rem; }
#tirer { min-height: 48px; }
.accroche .sujet { white-space: nowrap; flex: none; }
