/* 升の間 — interface.
   Même socle que 仮, 千, 篆, 粋, 色 et 字 : le papier domine, hiérarchie par
   l'espacement, aucune couleur qui ne soit fonctionnelle, angles vifs.
   Les seules couleurs sont celles des lignes du sous-main, choisies par la personne. */

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

* { 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 320px; height: 100vh; overflow: hidden }
#scene > * { min-height: 0; min-width: 0 }

#stage { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 2rem }

/* ---- la feuille ---- */
#feuille-cadre { flex: 1 1 auto; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center }
#feuille { display: block; box-shadow: 0 26px 60px -32px rgba(22, 19, 16, 0.8); border: 1px solid var(--trait) }
.sous-feuille { flex: none; padding-top: 0.9rem; font-size: 0.8rem; letter-spacing: 0.08em; color: var(--encre); text-align: center }

/* ---- le panneau ---- */
#panel { background: var(--fond-panneau); border-left: 1px solid var(--trait);
  overflow-y: auto; padding: 1.4rem 1.2rem 3rem }

.marque { padding-bottom: 1.4rem; border-bottom: 1px solid var(--trait); margin-bottom: 1.2rem }
.marque-ligne { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem }
.marque-kanji { font-size: 1.24rem; font-weight: 400; letter-spacing: 0.14em }
.marque-nom { font-size: 0.66rem; letter-spacing: 0.22em; color: var(--discret) }
.langues { display: flex; gap: 0.45rem }
.lang-opt { font: inherit; font-size: 0.68rem; letter-spacing: 0.1em; background: none; border: 0;
  color: var(--discret); cursor: pointer; padding: 0.1rem 0 }
.lang-opt.actif { color: var(--encre); border-bottom: 1px solid var(--encre) }

.bloc { display: flex; gap: 0.5rem; margin-bottom: 1rem }
.action { flex: 1 1 auto; font: inherit; font-size: 0.8rem; letter-spacing: 0.1em;
  padding: 0.55rem 0.4rem; background: var(--fond-panneau); border: 1px solid var(--trait);
  color: var(--encre); cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s }
.action:hover { background: var(--encre); color: var(--papier); border-color: var(--encre) }
.action.majeure { background: var(--encre); color: var(--papier); border-color: var(--encre) }
.action.majeure:hover { background: var(--shu); border-color: var(--shu) }
.modele { margin-bottom: 1.6rem }

.section { margin-bottom: 1.6rem }
.section-tete { display: flex; align-items: center; gap: 0.55rem; font-weight: 400;
  padding-bottom: 0.45rem; border-bottom: 1px solid var(--encre); margin-bottom: 0.9rem }
.sec-num { background: var(--encre); color: var(--papier); font-size: 0.62rem;
  letter-spacing: 0.06em; padding: 0.1rem 0.42rem; line-height: 1.5 }
.sec-titre { color: var(--encre); font-size: 0.8rem; letter-spacing: 0.22em }

select { width: 100%; font: inherit; font-size: 0.82rem; padding: 0.45rem 0.5rem;
  background: var(--papier); border: 1px solid var(--trait); color: var(--encre); border-radius: 0 }

.note { font-size: 0.8rem; line-height: 1.75; color: var(--encre); margin: 0.2rem 0 0.8rem }
textarea.texte { width: 100%; font: inherit; font-size: 1rem; line-height: 1.6; padding: 0.45rem 0.5rem; resize: vertical;
  background: var(--papier); border: 1px solid var(--trait); color: var(--encre); border-radius: 0 }
.etiquette { font-size: 0.8rem; color: var(--encre); margin: 0.2rem 0 0.35rem }

.choix { display: flex; gap: 0.35rem; margin-bottom: 0.8rem }
.choix button { flex: 1 1 auto; font: inherit; font-size: 0.78rem; padding: 0.4rem 0.2rem;
  background: var(--papier); border: 1px solid var(--trait); color: var(--encre); cursor: pointer }
.choix button.actif { background: var(--encre); color: var(--papier); border-color: var(--encre) }

.choix.choix-col { flex-direction: column }
.case { display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; padding: 0.3rem 0;
  color: var(--encre); cursor: pointer }
.case input { accent-color: var(--encre) }

.glissiere { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.5rem; align-items: center;
  margin-bottom: 0.7rem; font-size: 0.82rem; color: var(--encre) }
.glissiere input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--encre) }
.glissiere .val { font-size: 0.8rem; color: var(--encre); font-variant-numeric: tabular-nums }
.glissiere .bouts { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--encre); opacity: 0.7 }

.dimensions { display: flex; gap: 0.6rem; margin-bottom: 0.8rem }
.dimensions label { flex: 1 1 0; font-size: 0.8rem; display: flex; flex-direction: column; gap: 0.25rem }
.dimensions input { font: inherit; font-size: 0.85rem; padding: 0.35rem 0.4rem; width: 100%;
  background: var(--papier); border: 1px solid var(--trait); color: var(--encre); border-radius: 0 }

/* ---- les couches de lignes ---- */
.couche { border-top: 1px solid var(--trait); padding: 0.35rem 0 }
.couche:last-child { border-bottom: 1px solid var(--trait) }
.couche-tete { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem }
.couche-tete .case { flex: 1 1 auto }
.plier { font: inherit; font-size: 0.74rem; background: none; border: 0; color: var(--encre); cursor: pointer; padding: 0.3rem 0.1rem; white-space: nowrap }
.plier:hover { color: var(--shu) }
.couche-corps { padding: 0.5rem 0 0.4rem 1.4rem }

.nuancier { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.8rem; flex-wrap: wrap }
.nuancier button { width: 1.6rem; height: 1.6rem; border: 1px solid var(--trait); cursor: pointer; padding: 0 }
.nuancier button.actif { outline: 2px solid var(--encre); outline-offset: 2px }
.nuancier input[type=color] { width: 2.2rem; height: 1.7rem; border: 1px solid var(--trait); background: none; padding: 0; cursor: pointer }

/* ---- l'éditeur de la case à main levée ---- */
#editeur { display: block; width: 100%; max-width: 240px; aspect-ratio: 1; margin: 0.2rem auto 0.6rem;
  background: var(--papier); border: 1px solid var(--trait); touch-action: none; cursor: crosshair }

.version { font-size: 0.66rem; letter-spacing: 0.12em; color: var(--discret); padding-top: 0.6rem }
.credit { font-size: 0.72rem; padding-top: 0.4rem }
.credit a { color: var(--encre) }
.credit a:hover { color: var(--shu) }

.toast { position: fixed; left: 50%; bottom: 1.6rem; transform: translateX(-50%); z-index: 60;
  background: var(--encre); color: var(--papier); font-size: 0.82rem; letter-spacing: 0.08em; padding: 0.55rem 1rem }

@media (max-width: 820px) {
  /* comme kana, genji, ten, shiki et iki : la feuille reste en haut, le panneau défile dessous */
  #scene { display: block; height: auto; overflow: visible }
  #panel { border-left: 0 }
  #stage { position: sticky; top: 0; z-index: 5; height: 46svh; min-height: 15rem; padding: 0.7rem 1rem;
    background: var(--papier); border-bottom: 1px solid var(--trait) }
  .sous-feuille { padding-top: 0.4rem; font-size: 0.74rem }
}
