/* Focused découpage: one planned page and one case at a time. */
.storyboard-guide{padding:12px 14px;background:var(--tramea-soft);border-radius:10px;margin-bottom:16px;font-size:13px;line-height:1.6}
.storyboard-guide strong{font-weight:700}.storyboard-guide p{margin:4px 0 0;color:var(--muted)}
.storyboard-page-picker{display:flex;gap:10px;align-items:end;margin-bottom:16px}.storyboard-page-picker>.field{flex:1;min-width:0;margin:0}.storyboard-page-picker>.btn{margin-bottom:1px;flex-shrink:0}
.storyboard-focused-page{padding:0!important;margin:0!important;border:0!important;background:transparent!important}
.storyboard-focused-page>summary{display:none}
.storyboard-focused-page[hidden],.storyboard-case-editor[hidden]{display:none!important}
.storyboard-case-nav{display:flex;flex-wrap:wrap;gap:6px;margin:14px 0}
.storyboard-case-nav .btn[aria-current=step]{border-color:var(--ink);background:var(--tramea-soft);box-shadow:inset 0 -2px var(--gold)}
.storyboard-focused-page .storyboard-case-editor{border:0;margin:0;padding:0}
.storyboard-case-editor legend{font:700 15px var(--tramea-font);padding:0;margin-bottom:14px}
.storyboard-case-editor .field{margin-bottom:16px;font-size:13px}
.storyboard-case-editor textarea{min-height:72px;height:72px;resize:vertical;padding:10px;font-size:14px;line-height:1.5}
.storyboard-case-editor .field-help{margin:2px 0 0;font-size:12px;font-weight:400}
.storyboard-case-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin:12px 0 18px}
.storyboard-remove{font:400 12px var(--tramea-font);text-decoration:underline;text-underline-offset:4px;color:var(--tramea-error);padding:9px 0}
.storyboard-remove:disabled{opacity:.45;cursor:not-allowed}
.storyboard-settings{border-top:1px solid var(--line);margin-top:14px;padding-top:6px}
.storyboard-settings summary{font-size:12px;color:var(--muted);padding:10px 0;cursor:pointer}
.storyboard-settings .field{margin:12px 0}.storyboard-settings .field-help{margin-bottom:10px}
.storyboard-transfer{padding-top:14px;margin-top:14px;border-top:1px solid var(--line)}
.storyboard-transfer p{font-size:12px;line-height:1.6;color:var(--muted);margin:0 0 12px}
#storyboard-status{font-size:13px;color:var(--tramea-error);margin-top:12px}
@media(max-width:560px){.storyboard-guide{padding:10px;font-size:12px;margin-bottom:12px}.storyboard-page-picker{gap:6px}.storyboard-page-picker .btn{min-height:44px;font-size:12px}.storyboard-case-nav .btn{min-height:44px}.storyboard-case-editor legend{font-size:14px}.storyboard-case-editor textarea{font-size:16px;min-height:80px}.storyboard-case-editor .field-help{font-size:12px}.storyboard-transfer>.btn{width:100%;min-height:44px}.storyboard-settings select{width:100%}.storyboard-remove{min-height:44px}.storyboard-case-actions{gap:8px}}
.story-fields:has(>input#draft[type=hidden]){display:block}
.storyboard-focused-page .storyboard-case-editor{display:block;min-width:0}
.compact-atelier:has(.storyboard-focused-page){overflow:hidden}
body.compact-editing:has(.storyboard-focused-page){position:fixed;inset:0;width:100%;height:100%;overflow:hidden}

/* Live preview of the planned page, separate from saved illustration data. */
.storyboard-live-preview{display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:12px;padding:18px 14px;overflow:hidden}
.storyboard-preview-heading{display:flex;flex-direction:column;gap:6px;font-size:13px}
.storyboard-preview-heading strong{font-weight:750}.storyboard-preview-heading>span{font-size:12px;color:var(--muted)}
.storyboard-preview-desk{min-height:0;min-width:0;display:grid;place-items:center;container-type:size;background:var(--tramea-soft);padding:10px;border-radius:10px}
.storyboard-preview-sheet{position:relative;background:#fffefa;aspect-ratio:1240/1754;width:min(100cqw,calc(100cqh * 1240 / 1754));box-shadow:0 3px 12px #123f3d15}
.storyboard-preview-cell{position:absolute;overflow:hidden;background:#f3f1e9;border:1px solid #82948b;color:var(--ink);padding:0;border-radius:0;cursor:pointer;min-width:0;text-align:left}
.storyboard-preview-cell[aria-pressed=true]{outline:3px solid var(--ink);outline-offset:2px;z-index:2;box-shadow:inset 0 0 0 2px var(--gold)}
.storyboard-preview-cell>img{position:absolute;width:100%;height:100%;object-fit:cover;inset:0}
.preview-case-number{position:absolute;top:2px;left:2px;font:600 10px/1.3 var(--tramea-font);padding:1px 4px;background:var(--ink);color:var(--white);z-index:3;border-radius:3px}
.preview-scene{position:absolute;inset:22px 8px 8px;display:grid;place-items:center;font:400 11px/1.4 var(--tramea-font);color:var(--muted);text-align:center;overflow:hidden}
.preview-caption{position:absolute;top:5%;left:5%;max-width:90%;max-height:38%;background:#fffefa;color:#123f3d;border:1px solid #b9c6bb;padding:3px 5px;font:400 11px/1.35 var(--tramea-font);white-space:pre-wrap;overflow:hidden;z-index:2}
.preview-paroles{position:absolute;transform:translate(-50%,-50%);max-width:90%;min-width:40%;max-height:54%;border:1px solid #123f3d;border-radius:16px;background:#fffefa;color:#123f3d;padding:5px 7px;font:400 11px/1.35 var(--tramea-font);text-align:center;white-space:pre-wrap;overflow:hidden;z-index:2}
.storyboard-preview-note{font-size:11px!important;line-height:1.5!important;margin:0!important;color:var(--muted)}
.storyboard-mobile-live{display:none}
@media(max-width:740px) and (min-width:561px){.compact-story-grid:has(.storyboard-focused-page){grid-template-columns:120px minmax(0,1fr) 230px}.storyboard-live-preview{display:grid}}
@media(max-width:560px){
 .story-mobile-preview:has(.storyboard-mobile-live){padding:5px 10px}
 .storyboard-mobile-live{display:grid;grid-template-columns:minmax(90px,125px) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);width:100%;height:100%;gap:6px 14px;min-height:0}
 .storyboard-mobile-live .storyboard-preview-desk{grid-column:1;grid-row:1/3;height:100%;padding:4px}
 .storyboard-mobile-live .storyboard-preview-heading{grid-column:2;font-size:12px;gap:4px}
 .storyboard-mobile-live .storyboard-preview-note{grid-column:2;font-size:10px!important;line-height:1.4!important;overflow:hidden}
 .compact-story-grid:has(.storyboard-focused-page){grid-template-rows:auto minmax(115px,28%) minmax(0,1fr)}
 .storyboard-mobile-live .preview-caption,.storyboard-mobile-live .preview-paroles{font-size:10px;padding:2px 3px}
 .storyboard-mobile-live .preview-scene{font-size:10px;inset:16px 3px 3px}
 .compact-atelier.is-focused .compact-story-grid:has(.storyboard-focused-page){grid-template-rows:auto minmax(0,1fr)}
}
.preview-paroles{width:max-content;min-width:0;overflow-wrap:anywhere}
.storyboard-preview-selected-copy{display:none}
@media(max-width:560px){
 .storyboard-live-preview{display:none}
 .storyboard-mobile-live .storyboard-preview-note{display:none}
 .storyboard-mobile-live .storyboard-preview-selected-copy{display:block;grid-column:2;grid-row:2;min-height:0;overflow-y:auto;font-size:11px;line-height:1.4}
 .storyboard-preview-selected-copy p{margin:0 0 5px;white-space:pre-wrap;overflow-wrap:anywhere}
 .storyboard-preview-selected-copy strong{display:block;font-weight:650}
}
.storyboard-case-nav .storyboard-delete-case{margin-left:auto;color:var(--tramea-error);border-color:#d8b7b1}
.storyboard-case-nav .storyboard-delete-case:hover:not(:disabled){background:#f7e9e5;color:var(--tramea-error);border-color:var(--tramea-error)}

/* Compact writing: one text type at a time, with the transfer action kept in view. */
.storyboard-writing-tabs{display:flex;gap:6px;margin:0 0 10px}
.storyboard-writing-tabs button{flex:1}
.storyboard-writing-tabs [aria-pressed=true]{background:var(--tramea-soft);border-color:var(--ink);box-shadow:inset 0 -2px var(--gold)}
.storyboard-case-editor .field[hidden]{display:none!important}
.storyboard-destination{font-size:11px;line-height:1.4;color:var(--muted);margin:0 0 8px}
.storyboard-page-picker{margin-bottom:8px;gap:8px}
.storyboard-page-picker>.field{margin:0!important}
.storyboard-case-nav{margin:6px 0 10px}
.storyboard-case-editor legend{font-size:13px;margin-bottom:8px}
.storyboard-case-editor .field{margin-bottom:6px!important}
.storyboard-case-editor textarea{height:100px;min-height:80px;max-height:190px}
.storyboard-case-actions{margin:6px 0;gap:8px}
.storyboard-settings{margin-top:6px;padding-top:0}
.storyboard-settings>summary{padding:8px 0}
.storyboard-transfer{position:sticky;bottom:0;z-index:3;background:var(--paper);margin-top:8px;padding:8px 0 4px;border-top:1px solid var(--line)}
.storyboard-transfer p{font-size:11px;margin:0 0 6px;line-height:1.4}
.storyboard-transfer>.btn{min-height:38px}
#storyboard-status:empty{display:none}
.story-writing:has(.storyboard-focused-page){padding-top:14px;gap:8px}
.story-writing:has(.storyboard-focused-page) header p{display:none}
.story-writing:has(.storyboard-focused-page) header h2{font-size:19px;margin:0}
@media(max-width:560px){
 .storyboard-case-nav{flex-wrap:nowrap;overflow-x:auto;min-width:0;padding:3px 2px 6px;scrollbar-width:thin}
 .storyboard-case-nav .btn{flex-shrink:0;padding-inline:9px}
 .storyboard-case-nav .storyboard-delete-case{margin-left:4px}
 .storyboard-writing-tabs button{min-height:44px;padding:7px;font-size:12px}
 .storyboard-case-editor textarea{height:90px;min-height:90px;resize:none}
 .storyboard-case-editor .field-help{font-size:11px;line-height:1.4}
 .storyboard-case-actions>.btn{min-height:40px;font-size:12px}
 .storyboard-transfer p{display:none}
 .storyboard-transfer>.btn{min-height:44px}
 .storyboard-settings>summary{min-height:40px;align-content:center}
 .story-writing:has(.storyboard-focused-page){padding-top:8px;gap:6px}
}
@media(max-width:560px){
 .compact-story-grid:has(.storyboard-focused-page){grid-template-rows:auto minmax(100px,21%) minmax(0,1fr)}
 .story-writing:has(.storyboard-focused-page)>header{display:none}
 .storyboard-page-picker>.field{font-size:0!important;gap:0}
 .storyboard-page-picker>.field select{font-size:16px!important}
 .storyboard-destination{display:none}
 .storyboard-case-editor legend{font-size:0;height:0;margin:0;padding:0}
 .storyboard-case-nav{margin:0 0 5px}
 .storyboard-writing-tabs{margin-bottom:6px}
 .storyboard-case-editor .field-help{font-size:11px}
 .storyboard-preview-heading{gap:2px}
}

/* Larger preview while retaining the active writing field in the visible workspace. */
@media(min-width:1101px){
 .compact-story-grid:has(.storyboard-focused-page){grid-template-columns:150px minmax(340px,1fr) 380px}
 .storyboard-live-preview{padding:14px 12px;gap:9px}
 .storyboard-preview-desk{padding:7px}
 .storyboard-live-preview .preview-caption,.storyboard-live-preview .preview-paroles{font-size:12px}
}
@media(min-width:741px) and (max-width:1100px){
 .compact-story-grid:has(.storyboard-focused-page){grid-template-columns:130px minmax(270px,1fr) 310px}
 .storyboard-live-preview{padding:12px 9px;gap:8px}
}
@media(max-width:560px){
 /* The main journey already identifies Mon histoire; remove its repeated toolbar. */
 .compact-stage-workspace:has(.storyboard-focused-page){grid-template-rows:minmax(0,1fr)}
 .compact-stage-workspace:has(.storyboard-focused-page)>.compact-toolbar{display:none}
 .compact-story-grid:has(.storyboard-focused-page)>.mobile-story-picker{display:none}
 .compact-story-grid:has(.storyboard-focused-page){grid-template-rows:minmax(135px,38%) minmax(0,1fr)}
 .compact-atelier.is-focused .compact-story-grid:has(.storyboard-focused-page){grid-template-rows:minmax(0,1fr)}
 .storyboard-mobile-live{grid-template-columns:minmax(140px,56%) minmax(0,1fr);gap:6px 10px}
 .story-mobile-preview:has(.storyboard-mobile-live){padding:6px 10px}
 .storyboard-mobile-live .storyboard-preview-desk{padding:4px}
 .storyboard-mobile-live .preview-paroles,.storyboard-mobile-live .preview-caption{font-size:11px;line-height:1.25}
 .storyboard-mobile-live .storyboard-preview-selected-copy{font-size:12px;line-height:1.4}
 .storyboard-mobile-live .preview-scene{font-size:11px;line-height:1.3}
 .story-writing:has(.storyboard-focused-page){padding:5px 10px 3px;gap:0}
 .story-fields:has(>input#draft[type=hidden]){display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:3px;overflow:hidden;padding:0}
 .storyboard-page-picker{margin:0;gap:6px}
 .storyboard-page-picker select{min-height:40px;padding-block:6px}
 .storyboard-page-picker .btn{min-height:40px}
 .storyboard-pages{min-height:0;overflow-y:auto;overscroll-behavior:contain;scroll-padding-block:4px}
 .storyboard-case-nav{padding:1px 1px 3px;margin:0 0 3px;gap:4px}
 .storyboard-case-nav .btn{min-height:40px;padding:5px 8px}
 .storyboard-writing-tabs{gap:4px;margin:0 0 4px}
 .storyboard-writing-tabs .btn{min-height:40px;padding:5px}
 .storyboard-case-editor .field{font-size:12px!important;gap:3px;margin:0!important}
 .storyboard-case-editor textarea{height:80px;min-height:70px;padding:7px;resize:none}
 .storyboard-case-editor .field-help{display:none}
 .storyboard-case-actions{display:none}
 .storyboard-transfer{position:static;margin:0;padding:4px 0 0;background:var(--paper)}
 .storyboard-transfer>.btn{min-height:40px;font-size:12px}
 .storyboard-settings{margin-top:6px}
 .storyboard-settings>summary{min-height:40px}
}
@media(max-width:560px) and (max-height:650px){
 .compact-story-grid:has(.storyboard-focused-page){grid-template-rows:minmax(125px,35%) minmax(0,1fr)}
 .storyboard-mobile-live{grid-template-columns:minmax(115px,50%) minmax(0,1fr)}
 .storyboard-case-editor textarea{height:70px;min-height:65px}
}
@media(max-width:560px) and (max-height:650px){
 /* The selected writing tab labels the field; avoid a repeated label on short screens. */
 .storyboard-case-editor .field{font-size:0!important;gap:0}
 .storyboard-case-editor textarea{font-size:16px!important}
}
@media(max-width:560px){
 body.mobile-keyboard .compact-atelier:has(.storyboard-focused-page){grid-template-rows:auto minmax(0,1fr) auto}
 body.mobile-keyboard .compact-story-grid:has(.storyboard-focused-page){grid-template-rows:minmax(70px,28%) minmax(0,1fr)}
 body.mobile-keyboard .storyboard-case-editor .field{font-size:0!important;gap:0}
 body.mobile-keyboard .storyboard-case-editor textarea{height:65px;min-height:55px}
 body.mobile-keyboard .storyboard-case-nav .btn,body.mobile-keyboard .storyboard-writing-tabs .btn{min-height:34px}
 body.mobile-keyboard .storyboard-preview-heading{font-size:11px}
 body.mobile-keyboard .storyboard-mobile-live{grid-template-columns:minmax(75px,40%) minmax(0,1fr)}
}
@media(max-width:560px){
 body.mobile-keyboard .storyboard-page-picker{display:none}
 body.mobile-keyboard .story-fields:has(>input#draft[type=hidden]){grid-template-rows:minmax(0,1fr) auto}
 body.mobile-keyboard .storyboard-transfer>.btn{min-height:34px;padding-block:5px}
}
