/* Two-page tablet spread. Preserve every pixel of existing landscape pictures. */
.reader-modes{display:flex;justify-content:center;align-items:center;gap:8px;padding:8px;margin:0 auto 8px;width:max-content;max-width:100%;background:#fffaf4e8;border-radius:20px;position:relative;z-index:3}
#reader .reader-modes button{min-height:46px;border-radius:14px;padding:8px 18px;font-size:15px;white-space:nowrap;border:2px solid #ddcfee;background:#fff;color:#624787;touch-action:manipulation}#reader .reader-modes button[aria-pressed=true]{background:#8965c4;color:white;border-color:#8965c4}
#reader:not(.screen-reader) .spread{height:calc(100dvh - 245px)}
#reader{padding:0 16px;min-height:100dvh}#reader .spread{grid-template-columns:minmax(0,1fr) minmax(0,1fr);width:100%;max-width:1600px;height:calc(100dvh - 180px);min-height:300px;margin:auto}
#reader .illustration{min-width:0;min-height:0;overflow:hidden;background:#f1eedf}#reader .illustration img{position:absolute;inset:0;display:block;width:100%;height:100%;max-height:none;object-fit:contain}
#reader .reading{min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;display:flex;flex-direction:column;padding:clamp(22px,4vw,64px);background:#fffdf4;scrollbar-width:thin;touch-action:pan-y}
#reader .reading p{flex-shrink:0;margin:auto 0;line-height:1.85;overflow-wrap:anywhere;word-break:normal;font-size:24px}
#reader footer{height:100px;padding:12px;gap:20px;flex-wrap:nowrap}#reader footer #prevPage,#reader footer #nextPage{flex-shrink:0;width:76px;height:76px;min-height:76px;font-size:36px;border:3px solid #cdb9e8;box-shadow:0 5px 0 #d6c8e7;touch-action:manipulation}
#reader #exitReading,#reader #readerSound{display:none}
body.reader-fullscreen{overflow:hidden}
#reader.screen-reader{position:fixed;inset:0;z-index:1000;width:100%;height:100dvh;padding:0;min-height:0;background:#fffdf4}
#reader .reader-canvas{position:relative}#reader.screen-reader .reader-canvas{width:100%;height:100%}
#reader.screen-reader .reader-canvas>header{display:none}
#reader.screen-reader .spread{height:100%;width:100%;max-width:none;min-height:0;border:0;border-radius:0;box-shadow:none;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
#reader.screen-reader .illustration{padding:0 0 90px}#reader.screen-reader .illustration img{height:calc(100% - 90px)}#reader.screen-reader .reading{padding:68px clamp(24px,4vw,70px) 100px}
#reader.screen-reader .illustration span{bottom:100px;left:18px}
#reader.screen-reader footer{position:absolute;inset:auto 0 0;height:88px;padding:8px 18px;pointer-events:none;margin:0;justify-content:center;gap:10px;background:transparent}
#reader.screen-reader footer>*{pointer-events:auto}#reader.screen-reader footer audio,#reader.screen-reader footer label{display:none}
#reader.screen-reader footer #prevPage{position:absolute;left:18px;bottom:12px}#reader.screen-reader footer #nextPage{position:absolute;right:18px;bottom:12px}
#reader.screen-reader #exitReading{display:block;position:absolute;right:max(14px,env(safe-area-inset-right));top:max(12px,env(safe-area-inset-top));width:52px;height:52px;background:#ffffffdc;border:2px solid #e2d6ed;border-radius:50%;font-size:23px;z-index:2}
#reader.screen-reader #readerSound{display:block;position:absolute;left:50%;bottom:20px;transform:translateX(-50%);background:#ffffffdf;border:2px solid #e2d6ed;border-radius:18px;padding:10px 20px;z-index:2}
#reader.screen-reader.sound-open footer{height:160px;background:linear-gradient(transparent,#eee6f9)}#reader.screen-reader.sound-open footer audio{display:block;position:absolute;bottom:90px;left:50%;transform:translateX(-50%);width:min(420px,65vw)}#reader.screen-reader.sound-open footer label{display:flex;position:absolute;bottom:28px;left:110px;background:white;border-radius:12px;padding:0 10px}
@media(max-width:600px){#reader:not(.screen-reader) .spread{grid-template-columns:1fr;height:auto;min-height:0}#reader:not(.screen-reader) .illustration{height:55dvh}#reader:not(.screen-reader) .reading{min-height:220px;max-height:55dvh}#reader:not(.screen-reader) footer{height:auto;flex-wrap:wrap;gap:12px}#reader:not(.screen-reader) footer audio{width:calc(100% - 180px);min-width:120px}#reader.screen-reader .reading{padding:68px 16px 100px}#reader.screen-reader.sound-open footer label{left:100px;font-size:10px}#reader.screen-reader.sound-open #readerSound{left:auto;right:100px;transform:none;padding:8px}}
/* Phones whose browser cannot lock orientation still get a landscape book. */
@media(max-width:600px) and (orientation:portrait){#reader.screen-reader .reader-canvas{position:absolute;left:50%;top:50%;width:100dvh;height:100dvw;transform:translate(-50%,-50%) rotate(90deg)}#reader.screen-reader .reading{padding:52px 20px 86px}#reader.screen-reader .illustration img{height:calc(100% - 86px)}}
@media(max-height:600px) and (orientation:landscape){#reader.screen-reader .reading{padding:52px 22px 86px}}
#reader.screen-reader .reader-modes{position:absolute;left:50%;top:10px;transform:translateX(-50%);margin:0;padding:4px;box-shadow:0 3px 14px #39284720}#reader.screen-reader .reader-modes button{font-size:13px;min-height:44px;padding:6px 12px}
#reader.picture-only .spread{position:relative;display:block;background:#ece8dc}
#reader.picture-only .illustration{width:100%;height:100%!important;min-height:300px;padding:0}
#reader.picture-only .illustration img{height:100%;width:100%;object-fit:contain}
#reader.picture-only .reading{display:none}
#reader.picture-only.show-story-text .reading{display:flex;position:absolute;left:8%;right:8%;bottom:105px;max-height:45%;min-height:0;height:auto;padding:22px 28px;border-radius:22px;border:2px solid #fff;box-shadow:0 8px 32px #1f193e40;background:#fffdf5f5;color:#33283f;z-index:2;overflow:auto}
#reader.picture-only.show-story-text .reading p{font-size:20px!important;line-height:1.8;margin:0}
#reader.picture-only .illustration span{bottom:20px}#reader.picture-only.screen-reader .illustration span{bottom:100px}
@media(max-width:600px){#reader:not(.screen-reader).picture-only .spread{height:60dvh;min-height:320px}#reader:not(.screen-reader).picture-only.show-story-text .reading{left:3%;right:3%;bottom:20px;max-height:65%;padding:16px}#reader:not(.screen-reader) .reader-modes button{font-size:13px;padding:8px 12px}}
@media(max-height:600px),(max-width:600px){#reader.screen-reader.picture-only.show-story-text .reading{left:12%;right:12%;bottom:88px;max-height:50%;padding:14px 18px}#reader.screen-reader .reader-modes{top:6px}}

/* Illustrated pages: separate, editable text over an uncropped landscape image. */
#reader.picture-only:not(.screen-reader) .spread{width:min(100%,calc((100dvh - 245px)*16/9));height:auto;min-height:0;aspect-ratio:16/9}
#reader.picture-only .illustration{min-height:0}
#reader.picture-only.show-story-text .reading{left:12%;right:12%;bottom:3%;max-height:35%;padding:18px 30px;border:0;border-radius:36px;background:radial-gradient(ellipse at center,#fffdf4fa 55%,#fffdf4d9 75%,#fffdf400 100%);box-shadow:none;color:#302b39;text-align:center}
#reader.picture-only.show-story-text .reading p{font-size:clamp(18px,2vw,27px)!important;line-height:1.65;white-space:pre-line;text-wrap:pretty}
#reader.screen-reader .reader-canvas{container-type:size;display:grid;place-items:center}
#reader.picture-only.screen-reader .spread{width:min(100cqw,177.777cqh);height:auto;aspect-ratio:16/9;max-height:100cqh;flex-shrink:0}
#reader.picture-only.screen-reader.show-story-text .reading{bottom:80px;max-height:34%;padding:12px 24px}
#reader.picture-only .illustration span{z-index:3;left:12px;bottom:12px}
@media(max-width:600px){#reader.picture-only:not(.screen-reader) .spread{width:100%;min-height:0}#reader.picture-only:not(.screen-reader).show-story-text .reading{left:5%;right:5%;bottom:2%;max-height:44%;padding:8px 14px}#reader.picture-only.show-story-text .reading p{font-size:18px!important}}
@media(max-height:600px),(max-width:600px){#reader.picture-only.screen-reader.show-story-text .reading{left:13%;right:13%;bottom:76px;max-height:34%;padding:8px 16px}#reader.picture-only.screen-reader.show-story-text .reading p{font-size:18px!important;line-height:1.5}}

#reader .reader-modes{flex-wrap:wrap}
#reader.picture-only.text-at-top.show-story-text .reading{top:3%;bottom:auto}
#reader.picture-only.screen-reader.text-at-top.show-story-text .reading{top:76px;bottom:auto}
@media(max-width:600px){#reader:not(.screen-reader) .reader-modes{width:100%}#reader:not(.screen-reader) .reader-modes button{flex:1 1 40%}}
@media(max-height:600px),(max-width:600px){#reader.screen-reader .reader-modes{width:max-content;max-width:calc(100% - 140px);gap:4px}#reader.screen-reader .reader-modes button{font-size:12px;padding:6px 8px}#reader.picture-only.screen-reader.text-at-top.show-story-text .reading{top:68px}}
/* One shared caption canvas makes exported files match the reader exactly. */
#reader.movable-captions.picture-only .reading{position:absolute!important;width:1px!important;height:1px!important;min-height:0!important;padding:0!important;overflow:hidden!important;clip-path:inset(50%);}
.caption-layer{display:none;position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:4}
#reader.picture-only.show-story-text .caption-layer{display:block}
#reader .caption-layer.editing{pointer-events:auto;touch-action:none;cursor:move;outline:3px dashed #9672cb;outline-offset:-3px}
.book-tools{display:flex;justify-content:center;align-items:center;gap:8px;flex-wrap:wrap;margin:6px auto 10px;max-width:1200px}
.book-tools button{border:2px solid #dcd0f0;background:white;color:#624787;border-radius:14px;min-height:46px;padding:9px 16px;font:inherit}
#downloadBook{background:#8965c4;color:white;border-color:#8965c4}#captionStatus{font-size:12px;color:#695381;width:100%;text-align:center}
#reader.screen-reader .book-tools{display:none}
#bookDownload{width:min(660px,94vw);border:0;border-radius:28px;padding:28px;color:#403359;background:#fffdf5;max-height:90dvh;overflow:auto}
#bookDownload::backdrop{background:#35274b80;backdrop-filter:blur(4px)}#bookDownload h2{margin-top:0}
.download-options{display:flex;gap:10px;flex-wrap:wrap}.download-options button{flex:1 1 130px;min-height:105px;border:2px solid #dcd0f0;border-radius:18px;background:#f1eaff;font:inherit;color:#403359}.download-options small{font-size:12px}
#bookDownload button:disabled{opacity:.5}#bookDownload>button,#downloadReady{display:inline-block;margin:8px;padding:12px 18px;border-radius:14px;border:1px solid #dcd0f0;font:inherit}#bookDownload [hidden]{display:none!important}
#downloadProgress{width:100%;accent-color:#8965c4}#downloadStatus{min-height:28px}
@media(max-width:600px){.book-tools button{font-size:13px;padding:8px}#reader.picture-only:not(.screen-reader) .spread{width:100%}}

#reader.screen-reader #exitReading,#reader.screen-reader #readerSound,#reader.screen-reader footer,#reader.screen-reader .reader-modes{z-index:10}
/* Reading controls fade so they cannot permanently cover the chosen caption. Tap to show. */
#reader.screen-reader .reader-modes,#reader.screen-reader footer,#reader.screen-reader #exitReading,#reader.screen-reader #readerSound{transition:opacity .2s}
#reader.screen-reader.quiet-controls .reader-modes,#reader.screen-reader.quiet-controls footer,#reader.screen-reader.quiet-controls #exitReading,#reader.screen-reader.quiet-controls #readerSound{opacity:0;pointer-events:none}
#reader.screen-reader.quiet-controls footer>*{pointer-events:none}

/* A separate large touch target controls the same native audio player. */
#reader footer #narrationToggle{display:flex;align-items:center;justify-content:center;gap:12px;width:156px;height:76px;min-height:76px;flex-shrink:0;border:3px solid #7651b5;border-radius:22px;background:#8965c4;color:white;font-size:22px;font-weight:700;touch-action:manipulation;box-shadow:0 5px 0 #634399}
#narrationToggle span:first-child{font-size:32px}
#reader:not(.screen-reader) footer{height:auto;min-height:108px;flex-wrap:wrap;gap:14px}
#reader.screen-reader footer #narrationToggle{height:64px;min-height:64px;width:150px;position:absolute;bottom:12px;left:50%;transform:translateX(-50%)}
#reader.screen-reader #readerSound,#reader.screen-reader.sound-open #readerSound{top:12px;bottom:auto;left:12px;right:auto;transform:none;padding:10px 14px}
#reader.screen-reader.sound-open footer label{bottom:95px;left:auto;right:18px}
#reader.screen-reader.sound-open footer audio{bottom:145px}
#reader.screen-reader.sound-open footer{height:210px}
@media(max-width:600px){#reader:not(.screen-reader) footer{display:grid;grid-template-columns:76px minmax(0,1fr) 76px;gap:12px;padding:12px 0}#reader:not(.screen-reader) footer #narrationToggle{width:100%;min-width:0;font-size:20px;gap:8px}#reader:not(.screen-reader) #nextPage{grid-column:3;grid-row:1}#reader:not(.screen-reader) footer audio{grid-row:2;grid-column:1/-1;width:100%}#reader:not(.screen-reader) footer label{grid-row:3;grid-column:1/-1;justify-content:center}}

.caption-language{display:flex;align-items:center;gap:6px;font-size:14px;padding:0 6px}.caption-language[hidden]{display:none}
#readerLanguage,#downloadLanguage{min-height:44px;max-width:100%;border:2px solid #ddcfee;border-radius:12px;background:white;color:#493663;font:inherit;padding:8px}
#pageText{white-space:pre-line}
#bookDownload [data-format][aria-pressed=true]{background:#ece2ff;border-color:#8965c4}
#downloadLanguageLabel{display:flex;align-items:center;gap:12px;margin:16px 0}#downloadLanguageLabel[hidden]{display:none}
/* Book-wide caption look (size, box opacity, hide) inside the 책 설정 drawer. */
#moveCaption:disabled{opacity:.45;cursor:not-allowed}
/* 자막 수정하기: A corner handle and the floating panel live on the picture (they rotate with it on phones). */
.caption-resize{position:absolute;z-index:6;width:40px;height:40px;margin:0;padding:0;transform:translate(-50%,-50%);border:3px solid #fff;border-radius:50%;background:#7954b7;color:#fff;font:800 17px/1 inherit;box-shadow:0 3px 10px #3d2a5e55;cursor:nesw-resize;touch-action:none}
.caption-resize:focus-visible{outline:3px solid #f5c84b;outline-offset:2px}
.caption-panel{position:absolute;z-index:7;display:grid;text-align:left;gap:8px;width:min(300px,46%);max-height:96%;overflow:auto;padding:12px 14px;border:2px solid #dcd0f0;border-radius:16px;background:#fffdf8f5;color:#4b3b66;font-size:14px;box-shadow:0 8px 24px #3d2a5e33}
.caption-panel label{display:flex;flex-direction:column;align-items:stretch;gap:4px;text-align:left}
.caption-panel input[type=range]{accent-color:#7954b7}
.caption-panel textarea{width:100%;box-sizing:border-box;resize:vertical;font:inherit;line-height:1.5;border:1px solid #dcd0f0;border-radius:10px;padding:8px 10px;background:#fff;color:#302b39}
.caption-panel small{color:#8a7d9c;font-size:12px}
.caption-size{display:flex;align-items:center;gap:6px}.caption-size span{flex:1}
.caption-size output{min-width:44px;text-align:center;font-weight:700}
.caption-panel button{border:2px solid #dcd0f0;background:#fff;color:#624787;border-radius:12px;min-height:38px;padding:6px 10px;font:inherit}
.caption-panel button:disabled{opacity:.45}
.caption-panel button[aria-pressed=true]{background:#7954b7;border-color:#7954b7;color:#fff}
.caption-panel button.primary{background:#7954b7;border-color:#7954b7;color:#fff;font-weight:700}
.caption-panel-actions{display:flex;flex-wrap:wrap;gap:6px}.caption-panel-actions .primary{margin-left:auto}
@media(max-width:600px){.caption-panel{width:min(260px,60%);font-size:12px;padding:8px 10px;gap:6px}.caption-resize{width:34px;height:34px}}
.caption-panel [role=status]{margin:0;font-size:12px;color:#695381;min-height:1em}.caption-panel [role=status]:empty{display:none}
.caption-panel.below{position:static;width:auto;max-height:none;margin:8px 0;box-shadow:none}
#reader .caption-panel,#reader .caption-panel label{text-align:left}#reader .caption-panel label{flex-direction:column;align-items:stretch;gap:4px;font-size:inherit}
.caption-scope span{display:flex;align-items:center;gap:6px;font-weight:700}.caption-scope input{width:18px;height:18px;accent-color:#7954b7}
/* Download choices sit in their own section under the file buttons, each label in a fixed column. */
#downloadLayoutLabel,#downloadLanguageLabel{display:grid;grid-template-columns:76px minmax(0,260px);align-items:center;gap:12px;margin:12px 0;font-weight:700;color:#4b3b66}
#downloadLayoutLabel{margin-top:22px;padding-top:18px;border-top:1px solid #eee6f6}
#downloadLayoutLabel select,#downloadLanguageLabel select{min-height:44px;padding:8px 12px;border:1px solid #dcd0f0;border-radius:12px;background:#fff;font:inherit;font-weight:400;color:#403359}
#downloadVoiceNote{margin:4px 0 0 88px;font-size:13px;color:#8a7d9c}
@media(max-width:600px){#downloadLayoutLabel,#downloadLanguageLabel{grid-template-columns:1fr;gap:6px}#downloadVoiceNote{margin-left:0}}
/* Compact 자막 panel (about half the old size). */
.caption-panel{width:min(224px,32%);gap:6px;padding:9px 10px;font-size:12px;border-radius:14px}
.caption-panel .caption-size{gap:4px}.caption-panel .caption-size output{min-width:36px}
#reader .caption-panel label.caption-opacity{flex-direction:row;align-items:center;gap:8px}.caption-opacity input{flex:1;min-width:0}
#reader .caption-panel label.caption-scope{flex-direction:row;align-items:center;gap:6px;font-weight:700;margin:0}.caption-scope input{width:16px;height:16px;margin:0;accent-color:#7954b7}
.caption-panel button{min-height:30px;padding:4px 8px;border-radius:10px;font-size:12px}
.caption-panel-actions{gap:4px}.caption-panel-actions button{flex:1 1 auto}
.caption-panel [role=status]{font-size:11px}
/* Selection frame with eight dots, as in a design tool. */
.caption-frame{position:absolute;z-index:5;box-sizing:border-box;border:2px dashed #9672cb;border-radius:14px;pointer-events:none}
.caption-grip{position:absolute;width:12px;height:12px;margin:-7px 0 0 -7px;background:#fff;border:2px solid #7954b7;border-radius:3px;pointer-events:auto;touch-action:none;box-shadow:0 1px 3px #3d2a5e44}
.caption-grip[data-edge=lt]{left:0;top:0;cursor:nwse-resize}.caption-grip[data-edge=t]{left:50%;top:0;cursor:ns-resize}.caption-grip[data-edge=rt]{left:100%;top:0;cursor:nesw-resize}
.caption-grip[data-edge=r]{left:100%;top:50%;cursor:ew-resize}.caption-grip[data-edge=rb]{left:100%;top:100%;cursor:nwse-resize}.caption-grip[data-edge=b]{left:50%;top:100%;cursor:ns-resize}
.caption-grip[data-edge=lb]{left:0;top:100%;cursor:nesw-resize}.caption-grip[data-edge=l]{left:0;top:50%;cursor:ew-resize}
.caption-write{position:absolute;z-index:6;margin:0;padding:5px 10px;border:2px solid #fff;border-radius:999px;background:#7954b7;color:#fff;font:700 12px/1.2 inherit;box-shadow:0 2px 8px #3d2a5e55;cursor:pointer}
/* Writing right on the box: same place, same size, Enter for a new line. */
.caption-writer{position:absolute;z-index:6;box-sizing:border-box;display:flex;flex-direction:column;gap:.4em;overflow:auto;border-radius:14px;background:#fffdf4f7;box-shadow:0 0 0 3px #7954b7}
.caption-writer textarea{flex:1;min-height:2em;width:100%;box-sizing:border-box;margin:0;padding:0;border:0;outline:0;resize:none;background:transparent;color:var(--caption-color,#302b39);font:inherit;font-family:var(--caption-font,"Noto Sans KR",sans-serif);line-height:1.6}
.caption-writer textarea+textarea{border-top:1px dashed #cdbdea;padding-top:.3em}
@media(max-width:600px){.caption-grip{width:16px;height:16px;margin:-9px 0 0 -9px}.caption-panel.below{font-size:12px}.caption-panel.below .caption-panel-actions button{flex:1 1 40%}}
#reader .caption-write{min-height:0;min-width:0;margin:0;padding:4px 10px;font-size:12px;line-height:1.2}@media(max-width:600px){#reader .caption-write{padding:2px 7px;font-size:10px}}
@media(max-width:900px){.caption-panel.below{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:center;gap:6px 12px}.caption-panel.below .caption-panel-actions,.caption-panel.below [role=status]{grid-column:1/-1}}@media(max-width:480px){.caption-panel.below{grid-template-columns:1fr}}
/* Book cover choice in the download window. */
#downloadCoverLabel{display:flex;align-items:center;gap:8px;margin:22px 0 4px;padding-top:18px;border-top:1px solid #eee6f6;font-weight:700;color:#4b3b66}
#downloadCoverLabel input{width:18px;height:18px;accent-color:#7954b7}
#downloadCoverLabel:not([hidden])~#downloadLayoutLabel{margin-top:12px;padding-top:0;border-top:0}
#downloadCoverLabel{display:flex;align-items:center;flex-wrap:wrap;gap:10px}
#downloadCoverEdit{margin-left:auto;min-height:42px;padding:8px 16px;border:1px solid #cdbbe9;border-radius:999px;background:#f5efff;color:#5b3e98;font-weight:700}
/* 표지 꾸미기: the picture on top (left on wide screens), the child's tools beside it. */
#coverEditor{width:min(1180px,96vw);max-height:94dvh;border:0;border-radius:26px;padding:18px 22px;background:#fffdf5;color:#403359;overflow:auto;display:none}
#coverEditor[open]{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr);grid-template-areas:"head head" "stage tools1" "stage tools2" "hint tools2" "foot foot";grid-template-rows:auto auto auto 1fr auto;gap:10px 22px;align-items:start}
#coverEditor>*{min-width:0}
#coverEditor::backdrop{background:#20163099}
#coverEditor>header{grid-area:head;display:flex;align-items:center;justify-content:space-between}
#coverEditor h2{margin:0;font-family:'Playground','Noto Sans KR',sans-serif;font-weight:400;font-size:24px}
#coverEditor h3{margin:0 0 8px;font-size:14px;color:#6c5a88}
.cover-close{width:44px;height:44px;border:1px solid #e3d9f1;border-radius:50%;background:#fff;font-size:24px}
.cover-stage{grid-area:stage;position:relative;border-radius:14px;overflow:hidden;box-shadow:0 8px 26px #2b1d4426;touch-action:none}
.cover-stage{height:0;padding-top:56.25%}.cover-stage canvas{position:absolute;inset:0;display:block;width:100%;height:100%;background:#eee8f6}
#coverHandles{position:absolute;inset:0}
.cover-handle{position:absolute;min-height:0;padding:0;border:2px dashed transparent;border-radius:10px;background:none;cursor:grab;touch-action:none}
.cover-handle:hover{border-color:#fff9}
.cover-handle[aria-pressed=true]{border-color:#fff;box-shadow:0 0 0 2px #7954b7}
.cover-handle:active{cursor:grabbing}
.cover-hint{grid-area:hint;margin:0;font-size:13px;color:#7b6c90;text-align:center}
.cover-tools:nth-of-type(1){grid-area:tools1}.cover-tools:nth-of-type(2){grid-area:tools2}
.cover-tools{padding:12px 14px;border:1px solid #eee5f7;border-radius:16px;background:#fff}
.cover-pictures{display:flex;gap:8px;overflow-x:auto;padding:2px 2px 8px;scroll-snap-type:x proximity}
.cover-pictures button{flex:0 0 auto;width:92px;min-height:0;padding:0;border:3px solid transparent;border-radius:12px;background:#f4eefb;overflow:hidden;scroll-snap-align:start;font-size:11px;color:#6c5a88}
.cover-pictures button[aria-pressed=true]{border-color:#7954b7}
.cover-pictures img{display:block;width:100%;aspect-ratio:16/9;object-fit:cover}
.cover-pictures span{display:block;padding:2px 0 3px}
.cover-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px}
.cover-row button,#coverEditor footer button{min-height:44px;padding:8px 14px;border:1px solid #dcd0f0;border-radius:999px;background:#fff;color:#4b3b66;font-weight:700}
.cover-row button[aria-pressed=true],.cover-tabs [aria-selected=true]{background:#7954b7;border-color:#7954b7;color:#fff}
#coverStatus{font-size:12px;color:#7b6c90}
#coverText{width:100%;margin-top:10px;min-height:46px;padding:8px 12px;border:1px solid #dcd0f0;border-radius:12px;font:inherit;font-size:16px}
.cover-font.round{font-family:'Playground','Noto Sans KR',sans-serif;font-weight:400}
.cover-colors button{width:40px;height:40px;min-height:0;padding:0;border:3px solid #fff;border-radius:50%;background:var(--swatch);box-shadow:0 0 0 1px #cbbfe0}
#coverEditor .cover-colors button[aria-pressed=true]{background:var(--swatch);border-color:#fff;box-shadow:0 0 0 3px #7954b7}
#coverEditor footer{grid-area:foot;display:flex;align-items:center;gap:12px;padding-top:4px}
#coverStatus{flex:1;text-align:right}
#coverEditor footer .cover-done{background:#7954b7;border-color:#7954b7;color:#fff;padding:8px 26px}
@media(max-width:900px){
 #coverEditor{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;border-radius:0;padding:12px 14px calc(12px + env(safe-area-inset-bottom))}
 #coverEditor[open]{display:flex;flex-direction:column;align-items:stretch;gap:8px}
 #coverEditor>*{flex-shrink:0}
 #coverEditor footer{position:sticky;bottom:0;background:#fffdf5;padding:8px 0}
}
/* Phones held sideways: picture left, tools scroll on the right. */
@media(max-width:900px) and (orientation:landscape) and (max-height:500px){
 #coverEditor[open]{display:grid;align-items:start;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);grid-template-rows:auto auto auto 1fr auto;grid-template-areas:"head head" "stage tools1" "hint tools2" "hint tools2" "foot foot"}
}
/* Caption letters (또박또박 / 동글동글) and color in the editing panel. */
.caption-look{display:flex;gap:6px}.caption-look button{flex:1;min-height:38px;border:1px solid #dcd0f0;border-radius:999px;background:#fff;color:#4b3b66;font-weight:700}
.caption-look .round{font-family:'Playground','Noto Sans KR',sans-serif;font-weight:400}
.caption-look button[aria-pressed=true]{background:#7954b7;border-color:#7954b7;color:#fff}
.caption-colors{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.caption-panel .caption-colors button{width:32px;height:32px;min-height:0;padding:0;border:2px solid #fff;border-radius:50%;background:var(--swatch);box-shadow:0 0 0 1px #cbbfe0}
.caption-panel .caption-colors button[data-capcolor='']{width:auto;padding:0 10px;border-radius:999px;background:#fff;color:#4b3b66;font-size:12px;font-weight:700}
.caption-panel .caption-colors button[aria-pressed=true]{background:var(--swatch);border-color:#fff;box-shadow:0 0 0 3px #7954b7}.caption-panel .caption-colors button[data-capcolor=''][aria-pressed=true]{background:#7954b7;color:#fff}
/* 배경음: pick a song, preview it, upload one's own, and set its volume (책 설정). */
.bgm-control{display:grid;gap:10px}
.bgm-pick{display:flex;align-items:center;gap:10px;font-weight:700;color:#4b3b66}
.bgm-pick select{flex:1;min-width:0;min-height:44px;padding:8px 12px;border:1px solid #dcd0f0;border-radius:12px;background:#fff;font:inherit;font-weight:400}
.bgm-row{display:flex;flex-wrap:wrap;gap:8px}
.bgm-row button{min-height:42px;padding:8px 14px;border:1px solid #dcd0f0;border-radius:999px;background:#fff;color:#5c4780;font-weight:700}
.bgm-row button[aria-pressed=true]{background:#7954b7;border-color:#7954b7;color:#fff}
.bgm-row button:disabled{opacity:.45}
.bgm-volume{display:flex;align-items:center;gap:10px;font-weight:700;color:#4b3b66}
.bgm-volume input{flex:1;min-width:0;accent-color:#7954b7}
.bgm-volume output{min-width:42px;text-align:right;font-size:13px}
.bgm-note{color:#8a7a9c;font-size:11px;line-height:1.5}
#bgmStatus{margin:0;min-height:1em;font-size:12px;color:#6c5a88}
#downloadBgmLabel{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:10px 0 4px;font-weight:700;color:#4b3b66}
#downloadBgmLabel input{width:18px;height:18px;accent-color:#7954b7}#downloadBgmLabel small{font-weight:400;color:#8a7a9c}

/* Download settings: align labels and show the actual cover and applied music. */
#downloadCoverLabel>label{display:flex;align-items:center;gap:8px;margin:0;white-space:nowrap}
#downloadCoverLabel input,#downloadBgmLabel input{flex:0 0 18px;width:18px;height:18px;margin:0;padding:0}
#downloadCoverPreview{display:block;width:128px;height:72px;object-fit:contain;border-radius:8px;border:1px solid #e1d7ee;margin-left:auto}
#downloadCoverEdit{margin-left:0}
#downloadBgmSummary{flex-basis:100%;margin-left:26px;overflow-wrap:anywhere;line-height:1.5}
.bgm-row #bgmApply{background:#7954b7;border-color:#7954b7;color:#fff}
@media(max-width:480px){#downloadCoverPreview{width:104px;height:59px}#downloadCoverEdit{margin-left:auto}#downloadCoverLabel{gap:12px}#downloadCoverLabel>label{font-size:14px}}
#captionTextEditor{box-sizing:border-box;width:min(640px,94vw);max-height:90dvh;overflow:auto;border:0;border-radius:24px;padding:24px;background:#fffdf5;color:#403359}
#captionTextEditor::backdrop{background:#35274b80;backdrop-filter:blur(4px)}
#captionTextEditor h2{margin:0 0 12px}#captionTextEditor p,#captionTextEditor small{line-height:1.6}
#captionTextFields label{display:block;margin:16px 0;font-weight:700}
#captionTextFields textarea{display:block;box-sizing:border-box;width:100%;min-height:160px;margin-top:8px;padding:14px;border:1px solid #cdbbe9;border-radius:12px;background:white;color:#302b39;font:16px/1.7 sans-serif;resize:vertical;white-space:pre-wrap}
#captionTextEditor footer{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
#captionTextEditor button{padding:10px 20px;border:1px solid #cdbbe9;border-radius:12px;font:inherit}
.caption-panel-actions #editCaptionWords{flex-basis:100%;background:#f1e9ff;color:#59368e;font-weight:700}
