/* Personnages dans les pages : éditeur de zones (studio), extraits et apparitions (fiche de personnage) */
.appearance-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .appearance-layout { grid-template-columns: 1fr; } }
.appearance-editor { position: relative; touch-action: none; user-select: none; cursor: crosshair; border-radius: var(--radius, 6px); overflow: hidden; }
.appearance-editor img { display: block; width: 100%; height: auto; }
.appearance-zone { position: absolute; border: 2px solid #e91e63; background: rgba(233, 30, 99, .12); border-radius: 4px; box-sizing: border-box; }
.appearance-zone.is-nsfw { border-style: dashed; }
.appearance-zone.is-new { border-color: #2196f3; background: rgba(33, 150, 243, .15); }
.appearance-zone.is-active { background: rgba(233, 30, 99, .32); box-shadow: 0 0 0 3px rgba(233, 30, 99, .35); }
.appearance-zone-label { position: absolute; left: 0; top: 0; padding: 1px 6px; background: #e91e63; color: #fff; font-size: 12px; border-bottom-right-radius: 4px; white-space: nowrap; }
.appearance-side label { display: block; margin: 8px 0; font-size: .92rem; }
.appearance-side select { display: block; width: 100%; margin-top: 2px; }
.appearance-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(0, 0, 0, .08); }
.appearance-item form { margin: 0; }
.appearance-excerpt { display: block; width: 100%; background-repeat: no-repeat; border-radius: 4px; background-color: #eee; }
.appearance-item .appearance-excerpt { max-height: 110px; }

/* fiche de personnage : galerie des extraits et apparitions */
.excerpt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 24px; }
.excerpt-card { display: block; text-decoration: none; color: inherit; }
.excerpt-card .appearance-excerpt { box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.excerpt-frame .appearance-excerpt { border-radius: 0; }
.excerpt-card .small { display: block; margin-top: 4px; }
.excerpt-frame { display: block; overflow: hidden; border-radius: 4px; }
.appearance-list { padding-left: 1.2rem; }
.appearance-list li { margin: 4px 0; }
/* carte de personnage (cadre 3:4) : l'extrait garde ses proportions (--r) et couvre le cadre, comme object-fit: cover */
.character-card-image { container-type: size; }
.character-card-image .appearance-excerpt { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: max(100cqw, calc(100cqh * var(--r, .75))); height: max(100cqh, calc(100cqw / var(--r, .75)));
  aspect-ratio: auto !important; border-radius: 0; }
.excerpt-item { display: flex; flex-direction: column; gap: 6px; }
.excerpt-item img { display: block; width: 100%; height: auto; }
.excerpt-cover-form { margin: 0; }
.excerpt-cover-form .btn, .excerpt-cover-badge { width: 100%; justify-content: center; text-align: center; }
.character-cover { display: block; }
.character-cover .appearance-excerpt { border-radius: var(--radius, 6px); }

/* lecture : tracer les personnages sur la planche (gestionnaires) */
.reader-image.is-drawing { touch-action: none; user-select: none; cursor: crosshair; }
.reader-image.is-drawing .reader-zone { pointer-events: none; }
.reader-image .appearance-zone { display: none; z-index: 3; }
.reader-image.is-drawing .appearance-zone:not([hidden]) { display: block; }
.reader-characters { margin: 14px auto; max-width: 640px; padding: 14px 16px; border: 1px solid rgba(0, 0, 0, .12); border-radius: var(--radius, 6px); }
.reader-characters form { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; margin: 0; }
.reader-characters label { margin: 0; font-size: .92rem; }
[data-new-character][hidden] { display: none !important; }
.character-thumb { width: 64px; flex: none; border-radius: 6px; }
.character-thumb img { width: 100%; height: 100%; object-fit: cover; }
.character-thumb .character-initial { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 1.6rem; }

/* galerie de tous les personnages */
.gallery-index { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 14px 0 24px; }
.gallery-character { margin: 28px 0; }
.gallery-character h2 { margin-bottom: 4px; }
/* panneau latéral de lecture : personnages */
.sidebar-characters ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.sidebar-characters li a { display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: .78rem; line-height: 1.2; text-align: center; }
.sidebar-character-thumb { width: 100%; border-radius: 6px; box-shadow: var(--shadow-1); }
.sidebar-character-thumb .character-initial { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 1.3rem; }
.sidebar-characters li a span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
