.tablet-toolbar{position:sticky;top:8px;z-index:18;display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px;margin:10px 0;background:#eddfc4f5;border:1px solid #b49770;border-radius:8px;box-shadow:0 4px 14px #39241422;backdrop-filter:blur(8px)}
.tablet-toolbar>div{display:flex;align-items:center;gap:4px}.tablet-toolbar button{min-width:44px;min-height:44px;border:1px solid #ae926c;border-radius:6px;padding:7px 11px;background:#f6ebd5;font:12px 'DM Sans',sans-serif;color:#57422f;touch-action:manipulation}.tablet-toolbar button[aria-pressed=true]{background:#5f6649;color:#fff7e3;border-color:#5f6649}.tablet-toolbar button:disabled{opacity:.35;cursor:default}.editor-history #page-undo,.editor-history #page-redo{font-size:25px}.editor-view{margin-left:auto}.tablet-toolbar small{font-size:10px;color:#786449}.tablet-toolbar #editor-sync{margin-left:auto;max-width:100%;font-size:10px;color:#5f6649}.journal-viewport{flex:1;min-width:0;max-width:100%;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}.journal-stage{position:relative;width:100%}.journal-stage>.journal{width:100%;transform-origin:top left;max-width:none;flex:none}.paper[data-editor-mode=select]{touch-action:none;user-select:none}.paper[data-editor-mode=select] #writing{caret-color:transparent}.editor-confirm-dialog{position:fixed;inset:18px 0 auto;margin:0 auto;max-height:calc(100dvh - 36px);overflow:auto}.editor-confirm-dialog .primary{display:block;width:100%;margin-top:12px;padding:14px}.sticker-handle{position:absolute;display:grid;place-items:center;width:44px;height:44px;pointer-events:auto;touch-action:none;border-radius:50%;border:1px solid #c5a77a;background:#694739;color:#fff3d6;font:21px Georgia;text-shadow:none;z-index:5;filter:none}.sticker-resize{right:-17px;bottom:-17px;cursor:nwse-resize}.sticker-rotate{right:-17px;top:-30px;cursor:crosshair}.placed-sticker.is-locked.selected{outline-style:solid;outline-color:#596445}.paper.is-exporting .sticker-handle{display:none!important}#quick-lock-sticker{font-size:16px!important}body[data-editor-hand=left] .tablet-toolbar{flex-direction:row-reverse}body[data-editor-hand=left] #sticker-quick-actions{left:auto;right:max(12px,env(safe-area-inset-right))}
@media(any-pointer:coarse),(max-width:1100px){.toolbar>button,.toolbar>select,.toolbar>input{min-height:44px;min-width:44px}.drawing-tools button{min-height:44px;min-width:44px}.tablet-toolbar{top:max(6px,env(safe-area-inset-top))}.has-selected-sticker .tablet-toolbar{top:var(--sticker-tools-height,80px)}.tablet-toolbar small{flex-basis:100%}#sticker-quick-actions{max-width:calc(100vw - 24px)}.page-nav button{min-width:44px;min-height:44px}.paper #writing{scroll-margin:110px 0 90px}}
@media(max-width:650px){.tablet-toolbar{gap:5px;padding:6px}.tablet-toolbar button{padding:7px 9px;font-size:11px}.editor-view{margin-left:0}.tablet-toolbar small{font-size:9px}.tablet-toolbar #editor-sync{margin-left:0}.editor-history #page-clear{font-size:10px}.paper .sticker-handle{width:40px;height:40px}}

#mobile-editor-dock,.mobile-page-sheet,#mobile-more-sheet{display:none}
.mobile-book-title,.mobile-history,.mobile-photo-shortcut,.mobile-format-bar{display:none}
.mobile-more-icon-label{display:none}
@media(max-width:650px){
  #settings-dialog>form:first-child,#soundtrack-dialog>form:first-child{position:sticky;top:0;z-index:12;float:right;width:44px;height:0;margin:0}
  #settings-dialog>form:first-child .dialog-close,#soundtrack-dialog>form:first-child .dialog-close{position:static;display:grid;place-items:center;width:44px;height:44px;border:1px solid #c6b397;border-radius:50%;background:#f8efdf;color:#57422f;box-shadow:0 2px 8px #3e2d2826}
  body.mobile-editor-active #app{padding:0 8px 20px}
  body.mobile-editor-active #app>.topbar{height:46px;padding:0 4px}
  #editor .soundtrack-dock{width:100%;margin:4px auto 6px;padding:6px 8px;gap:4px 8px}
  #editor .soundtrack-label{min-width:0}#editor .soundtrack-label>span,#editor .soundtrack-label small{display:none}
  #editor .soundtrack-label strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px}
  #editor .soundtrack-dock audio{min-height:44px;height:44px}
  #editor .soundtrack-actions button,#editor .soundtrack-actions #soundtrack-loop{width:44px;height:44px;min-width:44px}
  body.mobile-editor-active .topbar .brand{font-size:29px}
  body.mobile-editor-active #editor{padding-left:0;padding-right:0}
  #editor .editor-nav{min-height:44px;padding:0 2px;gap:4px;justify-content:flex-start}
  #editor .editor-nav #back{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0;font-size:22px}
  #editor .editor-nav #back span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  #editor .mobile-book-title{display:block;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 17px Georgia,serif;color:#f0dfbe}
  #editor .editor-nav #save-state{flex:none;max-width:70px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:9px}
  #editor .mobile-history{display:flex;flex:none;gap:2px}
  #editor .mobile-history button{width:38px;height:44px;border:0;background:transparent;color:#ecd6b0;font:24px Georgia,serif}
  #editor .mobile-history button:disabled{opacity:.35}
  #editor .mobile-photo-shortcut{display:inline-grid;place-items:center;flex:none;width:38px;height:44px;border:0;background:transparent;color:#ecd6b0;font:22px Georgia,serif}
  #editor:not(.mobile-tools-open) .editor-heading,#editor:not(.mobile-tools-open) .editor-nav .export-actions{display:none}
  #editor.mobile-tools-open .editor-nav{flex-wrap:wrap}
  #editor.mobile-tools-open .editor-nav .export-actions{flex-basis:100%;display:flex;gap:14px}
  #editor.mobile-tools-open .editor-heading{margin:8px 0}
  #editor.mobile-tools-open .editor-heading h1{font-size:24px;margin:3px 0}
  #editor .desk{margin-top:0}
  #editor .journal{margin:0;width:100%;padding-top:5px}
  #editor .paper:not(.is-exporting) .paper-top>span:first-child{display:none}
  #editor .paper-top{align-items:center;gap:2px;padding:0 0 3px;margin-bottom:10px}
  #editor .mobile-format-bar{position:relative;z-index:5;display:flex;align-items:center;gap:0;flex:1;min-width:0;overflow-x:auto;overscroll-behavior-x:contain;padding:0;margin:0;border:0;background:transparent;color:#674d34;scrollbar-width:thin;scrollbar-color:#b5a182 transparent}
  #editor .mobile-format-bar::-webkit-scrollbar{height:3px}#editor .mobile-format-bar::-webkit-scrollbar-thumb{background:#b5a182;border-radius:3px}
  #editor .mobile-format-bar>button,#editor .mobile-format-bar>select,#editor .mobile-format-bar>input{flex:none;min-height:calc(44px * var(--phone-format-scale,1));min-width:calc(44px * var(--phone-format-scale,1));border:0;border-radius:0;background:transparent;color:#654a31;padding:calc(3px * var(--phone-format-scale,1));font:calc(13px * var(--phone-format-scale,1)) Georgia,serif;touch-action:manipulation}
  #editor .mobile-format-bar #font{width:calc(75px * var(--phone-format-scale,1))}#editor .mobile-format-bar #font-size{width:calc(48px * var(--phone-format-scale,1))}#editor .mobile-format-bar #bold,#editor .mobile-format-bar #italic{width:calc(44px * var(--phone-format-scale,1));font-size:calc(16px * var(--phone-format-scale,1))}
  #editor .mobile-format-bar #ink{width:calc(44px * var(--phone-format-scale,1));height:calc(44px * var(--phone-format-scale,1));padding:calc(10px * var(--phone-format-scale,1))}#editor .mobile-format-bar .mobile-letter-case{width:calc(50px * var(--phone-format-scale,1))}
  #editor .paper-top .page-read-aloud{width:calc(44px * var(--phone-format-scale,1));height:calc(44px * var(--phone-format-scale,1));min-width:calc(44px * var(--phone-format-scale,1));margin:0 0 0 calc(4px * var(--phone-format-scale,1))}
  #editor .paper-top .page-read-aloud svg{width:calc(18px * var(--phone-format-scale,1));height:calc(18px * var(--phone-format-scale,1))}
  .paper.is-exporting .mobile-format-bar{display:none!important}
  body.mobile-keyboard-open #mobile-editor-dock{display:none}
  body.mobile-keyboard-open #sticker-quick-actions{display:none!important}
  #editor{padding-bottom:calc(86px + env(safe-area-inset-bottom))}
  #editor:not(.mobile-tools-open):not(.mobile-format-open)>.toolbar,#editor:not(.mobile-tools-open)>.tablet-toolbar{display:none}
  #editor:not(.mobile-tools-open)>.notebook-actionbar{display:none}
  #editor.mobile-format-open>.toolbar{display:flex}
  #mobile-editor-dock{position:fixed;z-index:40;bottom:0;left:0;right:0;display:flex;justify-content:space-around;gap:3px;padding:6px 8px calc(6px + env(safe-area-inset-bottom));background:#f5e8d3;border-top:1px solid #d2b997;box-shadow:0 -5px 20px #513c2c22}
  #mobile-editor-dock button{flex:1;min-width:0;min-height:54px;display:grid;place-content:center;gap:2px;border:0;border-radius:9px;background:transparent;color:#4d3a29;touch-action:manipulation}
  #mobile-editor-dock button span{font:24px/1 Georgia,serif}#mobile-editor-dock button small{font:11px/1.2 sans-serif}#mobile-editor-dock button.active{background:#656c49;color:#fff9eb}
  #editor .mobile-page-sheet:not([hidden]){position:fixed;z-index:39;left:8px;right:8px;bottom:calc(68px + env(safe-area-inset-bottom));display:block;padding:12px 16px 15px;border:1px solid #c8ae83;border-radius:16px;background:#f8eddb;color:#513d2c;box-shadow:0 -6px 30px #30221844}
  body.mobile-keyboard-open #editor .mobile-page-sheet:not([hidden]){bottom:max(8px,env(safe-area-inset-bottom))}
  .mobile-page-sheet-head,.mobile-page-sheet-actions,.mobile-page-sheet-links{display:flex;align-items:center;gap:8px}.mobile-page-sheet-head{justify-content:space-between}.mobile-page-sheet-head strong{font:22px Georgia,serif}.mobile-page-sheet button{min-height:44px;border:1px solid #d9c7aa;border-radius:8px;background:#fff8e9;color:#513d2c;padding:6px 12px}.mobile-page-sheet button:disabled{opacity:.35}.mobile-page-sheet-head button{width:44px;font-size:24px}.mobile-page-sheet-actions{justify-content:center;margin:6px 0 10px}.mobile-page-sheet-actions button{min-width:52px;font-size:22px}.mobile-page-count{min-width:95px;text-align:center;font:14px Georgia,serif}.mobile-page-sheet-links button{flex:1;font:13px Georgia,serif}
  #editor.mobile-tools-open #mobile-more-sheet{position:fixed;z-index:39;left:8px;right:8px;bottom:calc(68px + env(safe-area-inset-bottom));display:block;max-height:58dvh;overflow:auto;padding:10px 14px 16px;border:1px solid #c8ae83;border-radius:16px;background:#f8eddb;color:#513d2c;box-shadow:0 -6px 30px #30221844;overscroll-behavior:contain}
  #mobile-more-sheet .mobile-more-head{display:flex;align-items:center;justify-content:space-between}.mobile-more-head strong{font:22px Georgia,serif}.mobile-more-head button{min-width:44px;min-height:44px;border:0;background:transparent;color:#513d2c;font-size:25px}
  #mobile-more-sheet .editor-heading{margin:4px 0 8px;color:#513d2c}#mobile-more-sheet .editor-heading h1{color:#513d2c;text-shadow:none}#mobile-more-sheet .editor-heading .eyebrow{color:#806a4b}#mobile-more-sheet .mode-label{color:#513d2c}
  #mobile-more-sheet .export-actions{display:flex;flex-wrap:wrap;gap:8px}#mobile-more-sheet .export-actions #export{display:inline-block}#mobile-more-sheet .export-actions .text-button{min-height:42px;padding:8px;color:#513d2c;font-size:12px}
  #mobile-more-sheet .toolbar{position:static;display:flex;flex-wrap:wrap;overflow:visible;gap:5px;padding:7px;margin:5px 0}#mobile-more-sheet .toolbar .tool-label{display:inline}#mobile-more-sheet .toolbar>button{flex:0 0 auto;min-height:42px;padding:5px 9px}
  #mobile-more-sheet .toolbar .compact-draw,#mobile-more-sheet .toolbar .compact-bookmark{display:inline-flex;align-items:center;gap:6px;width:auto;height:auto;min-width:44px}#mobile-more-sheet .mobile-more-icon-label{display:inline;font:12px/1.25 Georgia,serif}
  #mobile-more-sheet .tablet-toolbar{position:static;margin:8px 0}#mobile-more-sheet .notebook-actionbar{margin:8px 0}body.mobile-tools-visible #sticker-quick-actions{display:none!important}
  #sticker-panel:not([hidden]){position:fixed;z-index:39;left:0;right:0;bottom:calc(66px + env(safe-area-inset-bottom));width:100%;max-height:min(58dvh,550px);overflow:auto;border-radius:18px 18px 0 0;padding:12px 14px 16px;background:#f8eddb;box-shadow:0 -10px 36px #3e2d283d}
  #sticker-panel .panel-head{top:-12px;margin:-12px -14px 0;padding:10px 14px 8px}
  #sticker-panel>p[data-i18n="stickerHelp"]{display:none}
  #sticker-panel .sticker-pack-picker{position:static;margin:5px 0 8px;padding:0;border:0;background:transparent;box-shadow:none;backdrop-filter:none}
  #sticker-panel .sticker-pack-picker>span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  #sticker-panel .sticker-categories{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin;margin:8px 0}#sticker-panel .sticker-categories button{white-space:nowrap;flex:none;min-height:38px}
  #sticker-panel #sticker-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}#sticker-panel .sticker-card{min-width:0;width:100%}#sticker-panel .sticker-pick{max-width:100%;min-width:0}#sticker-panel .panel-head h2{margin:2px 0}#sticker-panel .panel-head .eyebrow{display:none}
  #editor .journal-viewport{overscroll-behavior-y:auto}
  #editor .paper[data-editor-mode=select]:not(.is-drawing){touch-action:pan-y}
  body.mobile-editor-active #sticker-quick-actions,body.mobile-editor-active #photo-quick-actions,body.mobile-editor-active #voice-quick-actions{position:fixed;top:auto;left:50%;right:auto;bottom:calc(76px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:41;max-width:calc(100vw - 16px)}
  body.mobile-editor-active #sticker-quick-actions{width:max-content;flex-wrap:nowrap}
  body.mobile-keyboard-open #photo-quick-actions,body.mobile-keyboard-open #voice-quick-actions,body.mobile-tools-visible #photo-quick-actions,body.mobile-tools-visible #voice-quick-actions{display:none!important}
  .page-nav{scroll-margin-bottom:90px}
}
.page-jump{display:inline-flex;align-items:center;gap:6px;margin:0 4px}
.page-jump input{box-sizing:border-box;width:68px;min-height:44px;padding:6px;border:1px solid #b79c70;border-radius:7px;background:#fff8e9;color:#513d2c;text-align:center;font:16px Georgia,serif}
.page-jump button{min-height:44px;padding:6px 12px;border:1px solid #b79c70;border-radius:7px;background:#f7e9d2;color:#513d2c;font:14px Georgia,serif}
@media(max-width:650px){.mobile-page-sheet .page-jump-mobile{display:flex;justify-content:center;margin:0 0 10px}.mobile-page-sheet .page-jump-mobile input{width:80px}.mobile-page-sheet .page-jump-mobile button{min-width:60px}}
@media(max-width:650px){.mobile-page-sheet-links{flex-wrap:wrap}.mobile-page-sheet-links [data-page-action=templates]{flex:1 0 100%}}
/* Keep the notebook closer to the tools on tablet without shrinking touch targets. */
@media(min-width:651px) and (max-width:1100px){
  #editor .editor-heading{margin:8px 0 10px}
  #editor .editor-heading h1{margin:3px 0}
  #editor .notebook-actionbar{margin:7px 0}
  #editor .tablet-toolbar{margin:7px 0}
  #editor .desk{margin-top:10px}
}
