:root{--keyboard-offset:0px}.story-shell{--editor-accent:#2481cc;--editor-border:#dce3ea;--editor-muted:#708090;--editor-surface:#fff;position:relative;max-width:820px;margin:0 auto;padding:clamp(18px,4vw,42px) clamp(16px,4vw,44px) 120px;background:var(--editor-surface);color:#17212b;min-height:100dvh}
.story-top{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;background:color-mix(in srgb,var(--editor-surface) 92%,transparent);backdrop-filter:blur(14px)}
.story-actions{display:flex;align-items:center;gap:8px}.story-button{min-height:44px;border:0;border-radius:12px;padding:0 16px;background:#edf3f8;color:#263746;font:600 14px/1 system-ui;cursor:pointer;touch-action:manipulation}.story-button.primary{background:var(--editor-accent);color:#fff}.story-button:disabled{opacity:.55;cursor:wait}.save-state{font:13px/1.2 system-ui;color:var(--editor-muted);min-width:90px}.save-state.error{color:#c83737}.save-state.saved{color:#2f8a55}
.story-title,.story-author{display:block;width:100%;border:0;outline:0;background:transparent;color:inherit}.story-title{margin-top:24px;font:700 clamp(30px,7vw,48px)/1.08 Georgia,serif;letter-spacing:-.025em}.story-author{margin:14px 0 24px;font:16px/1.4 system-ui;color:var(--editor-muted)}
.story-editor{min-height:50vh;outline:0;font:18px/1.7 Georgia,serif;overflow-wrap:anywhere;caret-color:var(--editor-accent)}.story-editor:empty:before{content:attr(data-placeholder);color:#9aa6b2;pointer-events:none}.story-editor p{margin:0 0 1em}.story-editor h1,.story-editor h2,.story-editor h3{line-height:1.2;margin:1.25em 0 .55em}.story-editor blockquote{margin:1.2em 0;padding:.2em 0 .2em 1em;border-left:4px solid var(--editor-accent);color:#52616f}.story-editor pre{padding:16px;border-radius:12px;background:#f1f4f7;overflow:auto;white-space:pre-wrap}.story-editor code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;background:#f1f4f7;border-radius:5px;padding:.1em .3em}.story-editor pre code{padding:0;background:none}.story-editor img,.story-editor video{display:block;max-width:100%;height:auto;margin:20px auto;border-radius:12px}.story-editor .media-selected{outline:3px solid var(--editor-accent);outline-offset:3px}.story-editor ul,.story-editor ol{padding-left:1.4em}.story-editor a{color:var(--editor-accent)}
.media-tools{position:fixed;z-index:950;display:none;gap:4px;padding:5px;border-radius:12px;background:#17212b;box-shadow:0 10px 30px rgba(0,0,0,.28)}.media-tools.visible{display:flex}.media-tools button{width:42px;height:42px;border:0;border-radius:8px;background:transparent;color:#fff;font-size:18px}.media-tools button:hover{background:rgba(255,255,255,.14)}
.bubble-toolbar{position:fixed;z-index:1000;display:none;align-items:center;gap:2px;max-width:calc(100vw - 16px);padding:6px;border-radius:13px;background:#17212b;color:#fff;box-shadow:0 12px 36px rgba(0,0,0,.3);overflow-x:auto;overscroll-behavior:contain;scrollbar-width:none}.bubble-toolbar.visible{display:flex}.bubble-toolbar::-webkit-scrollbar{display:none}.bubble-toolbar button{flex:0 0 auto;width:40px;height:40px;border:0;border-radius:9px;background:transparent;color:inherit;font:600 14px/1 system-ui;cursor:pointer}.bubble-toolbar button:hover,.bubble-toolbar button:focus-visible{background:rgba(255,255,255,.14)}
.link-popover{position:fixed;z-index:1001;display:none;gap:6px;width:min(360px,calc(100vw - 24px));padding:8px;border-radius:14px;background:#fff;box-shadow:0 12px 40px rgba(0,0,0,.28)}.link-popover.open{display:flex}.link-popover input{min-width:0;flex:1;height:42px;border:1px solid #d8e0e7;border-radius:9px;padding:0 11px;font-size:16px}.link-popover button{border:0;border-radius:9px;padding:0 13px;background:var(--editor-accent);color:#fff}
.media-add{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(max(18px,env(safe-area-inset-bottom)) + var(--keyboard-offset));z-index:30;width:56px;height:56px;border:0;border-radius:50%;background:var(--editor-accent);color:#fff;font-size:30px;line-height:1;box-shadow:0 10px 28px rgba(36,129,204,.35);cursor:pointer}.media-queue{position:fixed;z-index:40;right:16px;bottom:calc(86px + var(--keyboard-offset));width:min(360px,calc(100vw - 32px));display:grid;gap:8px}.media-job{display:grid;grid-template-columns:48px 1fr auto;align-items:center;gap:10px;padding:8px;border-radius:13px;background:#fff;box-shadow:0 8px 28px rgba(0,0,0,.18);font:13px/1.3 system-ui;color:#273747}.media-job img,.media-job video{width:48px;height:48px;object-fit:cover;border-radius:8px}.media-job progress{width:100%;height:5px}.media-job button{border:0;background:none;color:#b33434;padding:8px;cursor:pointer}
.editor-toast{position:fixed;z-index:2000;left:50%;bottom:24px;transform:translate(-50%,16px);opacity:0;pointer-events:none;max-width:calc(100vw - 32px);padding:11px 16px;border-radius:11px;background:#17212b;color:#fff;font:14px/1.35 system-ui;transition:.2s}.editor-toast.show{opacity:1;transform:translate(-50%,0)}
.preview-dialog{border:0;border-radius:18px;padding:0;width:min(760px,calc(100vw - 24px));max-height:90dvh;box-shadow:0 24px 80px rgba(0,0,0,.35)}.preview-dialog::backdrop{background:rgba(12,20,28,.65)}.preview-head{position:sticky;top:0;display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#fff;border-bottom:1px solid #e5eaee;font:600 15px system-ui}.preview-body{padding:24px clamp(16px,5vw,48px);font:18px/1.7 Georgia,serif;overflow-wrap:anywhere}.preview-body img,.preview-body video{max-width:100%;height:auto;border-radius:10px}.preview-body pre{white-space:pre-wrap;overflow-wrap:anywhere}.preview-head button{min-width:44px;min-height:44px;border:0;border-radius:10px;background:#edf2f6}
@media(max-width:600px){.story-shell{padding-top:8px}.story-top{padding-top:max(8px,env(safe-area-inset-top))}.story-actions .story-button.secondary{padding:0 12px}.save-state{min-width:0;font-size:12px}.story-editor{font-size:17px;min-height:55vh}.bubble-toolbar button{width:44px;height:44px}.media-add{bottom:calc(14px + env(safe-area-inset-bottom) + var(--keyboard-offset))}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}.editor-toast{transition:none}}
.story-editor img{image-orientation:from-image}
