.book-editor[hidden], .editor-panel [hidden] { display: none; }
.book-editor { position: fixed; inset: 100px 24px 24px; z-index: 30; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; background: #cbc5b9; border: 1px solid #b1a898; border-radius: 12px; padding: 16px; box-shadow: 0 16px 50px rgb(31 28 22 / 15%); }
.editor-viewport { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.editor-canvas { position: absolute; left: 50%; top: 50%; transform-origin: center; box-shadow: 0 10px 24px rgb(31 28 22 / 20%); }
.editor-canvas .book-page { position: relative; z-index: 0; }
.editor-canvas img, .editor-canvas .photo-placeholder, .editor-canvas h1, .editor-canvas h2, .editor-canvas h3, .editor-canvas p, .editor-canvas .cover-mark { cursor: pointer; }
.editor-canvas .editor-selected { cursor: move; }
.editor-panel { overflow-y: auto; padding: 16px; background: #f2eee4; border-radius: 8px; color: #29271f; font: 12px/1.5 Arial, "Microsoft YaHei", sans-serif; }
.editor-panel h2 { margin: 0 0 14px; font-size: 16px; font-weight: 500; }
.editor-panel label { display: grid; gap: 4px; margin-bottom: 10px; }
.editor-panel input, .editor-panel textarea, .editor-panel select, .editor-panel button { width: 100%; border: 1px solid #c8c0b0; border-radius: 5px; background: #fcfaf5; color: inherit; padding: 7px 9px; font: inherit; }
.editor-panel input[type="color"] { padding: 2px; height: 32px; }
.editor-panel input[type="file"] { font-size: 11px; }
.editor-panel textarea { resize: vertical; }
.editor-properties { padding: 0; margin: 0; border: 0; }
.editor-properties:disabled { opacity: .45; }
.editor-panel button { background: #243f39; color: #f0e9d8; cursor: pointer; }
.editor-hint { color: #776e60; font-size: 11px; }
.editing-book .stage, .editing-book .controls { visibility: hidden; }
#edit-book[aria-pressed="true"] { background: #243f39; color: #f0e9d8; }
@media (max-width: 700px) { .book-editor { inset: 80px 8px 8px; gap: 8px; padding: 8px; grid-template-columns: minmax(0, 1fr) 180px; } .editor-panel { padding: 10px; } .header-actions { gap: 8px; } }

.editor-canvas { top: calc(50% - 28px); touch-action: none; }
.editor-selection { position: absolute; z-index: 10; outline: 1.5px solid #d7b16b; pointer-events: none; }
.editor-selection[hidden] { display: none; }
.resize-handle { position: absolute; width: 12px; height: 12px; border: 2px solid #243f39; border-radius: 50%; background: #f0e9d8; pointer-events: auto; }
.handle-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.handle-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.handle-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.handle-se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.editor-navigation { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 24px; color: #5c574d; font: 11px Arial, sans-serif; }
.editor-navigation button { width: 42px; height: 42px; border: 1px solid rgb(38 37 31 / 25%); border-radius: 50%; color: #243f39; background: rgb(242 238 228 / 60%); cursor: pointer; }
.editor-navigation button:disabled { opacity: .3; cursor: default; }
.editor-navigation button:hover:not(:disabled) { background: #f2eee4; }
.editor-panel { scrollbar-width: thin; scrollbar-color: #a69e8d #f2eee4; }
.editor-panel input, .editor-panel textarea { appearance: none; outline: none; border-color: #d8d1c3; background: #e9e3d7; border-radius: 8px; }
.editor-panel input:focus, .editor-panel textarea:focus, .editor-panel button:focus-visible { outline: 2px solid #71908b; outline-offset: 2px; }
.editor-panel input[type="number"] { appearance: textfield; }
.editor-panel input[type="number"]::-webkit-inner-spin-button { appearance: none; }
.editor-panel input[type="range"] { padding: 0; height: 5px; accent-color: #243f39; background: #c8c0b0; cursor: pointer; margin: 12px 0 4px; }
.editor-panel input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #243f39; border: 2px solid #f0e9d8; box-shadow: 0 0 0 1px #243f39; }
.editor-panel output { justify-self: end; font-size: 11px; color: #776e60; }
.editor-alignment { display: flex; gap: 8px; margin-bottom: 16px; }
.editor-panel .editor-alignment button { background: #e4ddcf; color: #243f39; font-size: 11px; }
.editor-dropdown { position: relative; }
.editor-panel .dropdown-trigger { display: flex; align-items: center; justify-content: space-between; text-align: left; background: #e9e3d7; color: #243f39; border: 1px solid #d8d1c3; border-radius: 8px; min-height: 36px; }
.dropdown-trigger::after { content: ""; width: 6px; height: 6px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); margin-right: 4px; }
.dropdown-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50; padding: 5px; max-height: 240px; overflow-y: auto; background: #f2eee4; border: 1px solid #c8c0b0; border-radius: 9px; box-shadow: 0 8px 24px rgb(31 28 22 / 18%); }
.editor-panel .dropdown-menu button { text-align: left; border: 0; background: transparent; color: #5c574d; }
.editor-panel .dropdown-menu button:hover, .editor-panel .dropdown-menu button:focus-visible { background: #e4ddcf; outline: none; }
.editor-panel .dropdown-menu button[aria-selected="true"] { background: #243f39; color: #f0e9d8; }
.editor-palette { display: flex; gap: 8px; padding: 6px 2px; grid-row: 2; }
.editor-panel .color-swatch { width: 24px; height: 24px; min-width: 24px; padding: 0; border: 1px solid #c8c0b0; border-radius: 50%; background: var(--swatch-color); }
.editor-panel .color-swatch[aria-pressed="true"] { outline: 2px solid #71908b; outline-offset: 3px; }
.editor-panel input[type="color"] { appearance: none; border: 0; border-radius: 7px; height: 24px; cursor: pointer; padding: 0; }
.editor-panel input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.editor-panel input[type="color"]::-webkit-color-swatch { border: 1px solid #c8c0b0; border-radius: 7px; }
.editor-panel input[type="file"]::file-selector-button { border: 0; border-radius: 5px; background: #243f39; color: #f0e9d8; padding: 6px; margin-right: 6px; font: inherit; cursor: pointer; }
.editor-panel > button { margin-top: 8px; border-radius: 8px; }
.editor-canvas:focus { outline: none; }
.editor-panel .editor-upload { display: flex; align-items: center; gap: 12px; padding: 16px 12px; text-align: left; background: #e9e3d7; color: #243f39; border: 1px dashed #b8b09f; border-radius: 10px; transition: background .15s, border-color .15s; }
.editor-panel .editor-upload:hover { background: #e0d9ca; border-color: #71908b; }
.editor-upload svg { width: 22px; height: 22px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.editor-upload span { display: grid; gap: 4px; min-width: 0; }
.editor-upload strong { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-upload small { color: #8b8272; font-size: 10px; letter-spacing: .025em; }
.editor-actions { border-top: 1px solid #d8d1c3; padding-top: 16px; margin-top: 18px; display: grid; gap: 8px; }
.editor-panel .editor-actions button { min-height: 38px; border-radius: 8px; font-size: 12px; letter-spacing: .03em; }
.editor-panel .editor-save { background: #243f39; border-color: #243f39; color: #f0e9d8; }
.editor-panel .editor-save:hover { background: #31554d; }
.editor-panel .editor-reset { background: transparent; color: #776e60; border: 1px solid #d8d1c3; }
.editor-panel .editor-reset:hover { background: #e9e3d7; color: #243f39; }
.editor-message:empty { display: none; }
.editor-message { margin: 4px 0; font-size: 11px; color: #426b5d; }
.editor-actions .editor-hint { margin: 6px 0 0; line-height: 1.8; font-size: 10px; color: #938a7a; }
.editor-insert { display: flex; gap: 8px; margin: 14px 0 20px; }
.editor-panel .editor-insert button { background: #e9e3d7; color: #243f39; border: 1px solid #c8c0b0; min-height: 36px; border-radius: 8px; }
.editor-panel .editor-insert button:hover { background: #ddd6c7; border-color: #71908b; }
.editor-hint:empty { display: none; }
.editor-hint { margin: 12px 0; font-size: 12px; line-height: 1.7; }
.editor-properties[hidden] { display: none; }
.editor-canvas .inline-text-editing { cursor: text; outline: none; user-select: text; }
.inline-text-editing::selection, .inline-text-editing *::selection { background: #71908b66; }
.editor-icon-actions { display: flex; justify-content: center; gap: 12px; padding-top: 4px; }
.editor-panel .editor-actions .editor-action-icon { display: grid; place-items: center; width: 38px; height: 38px; min-height: 38px; padding: 0; border: 1px solid #c8c0b0; border-radius: 50%; background: transparent; color: #655f55; }
.editor-action-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.editor-panel .editor-action-icon:hover { color: #243f39; background: #e9e3d7; border-color: #71908b; }
.editor-panel .editor-delete-icon:hover { color: #6f493f; border-color: #6f493f; background: #e9dcd3; }
.editor-background { border-top: 1px solid #d8d1c3; margin: 0 0 18px; padding-top: 16px; }
.editor-background h3 { margin: 0 0 12px; font-size: 12px; font-weight: 500; color: #243f39; }
.background-controls { display: grid; gap: 14px; }
.background-colors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.background-controls .editor-palette { gap: 7px; grid-row: auto; padding: 4px 0; flex-wrap: wrap; }
.editor-panel input.background-custom-color { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; }
.editor-panel input.background-custom-color::-webkit-color-swatch { border-radius: 50%; border: 2px solid #fcfaf5; box-shadow: 0 0 0 1px #c8c0b0; }
.background-actions { display: flex; gap: 8px; }
.editor-panel .background-actions button { border-radius: 8px; background: #fcfaf5; color: #243f39; }
.editor-panel .background-actions .background-reset { flex: 0 0 34px; width: 34px; padding: 7px; border-radius: 50%; }
.background-reset svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.editor-layers { margin-bottom: 18px; }
.editor-layers h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: #243f39; }
.layer-actions { display: flex; gap: 12px; }
.editor-panel .layer-actions button { display: grid; place-items: center; width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: transparent; color: #243f39; }
.layer-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.editor-panel .layer-actions button:hover:not(:disabled) { background: #e4ddcf; border-color: #71908b; }
.editor-panel .layer-actions button:disabled { opacity: .3; cursor: default; }
