/* Interaction and compact Mini App layout. */
.route-progress{position:fixed;top:8px;left:50%;transform:translateX(-50%);z-index:50;background:var(--ink);color:var(--surface);padding:7px 14px;border-radius:20px;font-size:13px;box-shadow:0 2px 12px #0002;pointer-events:none}
.book-select{display:none}
.books.selecting .book-select{display:block}
.books.selecting .book>a{pointer-events:none}
.book.selected .book-cover{outline:3px solid var(--accent);outline-offset:2px}
.book-cover img{position:absolute;inset:0;content-visibility:auto}
.detail-actions{grid-column:1/-1;margin-top:0}
.detail-top{row-gap:18px}
.chapter-toolbar{padding:14px 0;border-bottom:1px solid var(--line)}
.chapter-toolbar .row{gap:6px}
#chapter-list{contain:layout style}
dialog::backdrop{backdrop-filter:none;background:#10182870}
dialog{overflow:hidden;max-height:min(90dvh,850px)}
#modal-form{display:flex;flex-direction:column;max-height:inherit}
.dialog-head,.dialog-foot{position:static;flex-shrink:0}
.dialog-content{overflow-y:auto;overscroll-behavior:contain;min-height:0}
.dialog-content .tabs{margin-bottom:20px}
.dialog-foot .btn.primary{min-width:130px}
body:has(dialog[open]){overflow:hidden}
button,a,input,select,textarea{touch-action:manipulation}
.btn:active,.icon-btn:active,.filter:active{transform:translateY(1px);filter:brightness(.94)}
.book-info p{overflow-wrap:anywhere}
.mobile-nav a{border-radius:12px}
.mobile-nav a.active{background:var(--accent-soft)}
@media(max-width:760px){
  .main{padding:18px 16px calc(100px + env(safe-area-inset-bottom));padding-top:max(18px,env(safe-area-inset-top))}
  .mobile-brand{margin-bottom:18px;gap:8px}
  .mobile-brand .brand-mark{width:25px;height:28px;font-size:.875rem}
  .mobile-brand strong{font-size:1rem}
  .eyebrow{display:none}
  .topbar{margin-bottom:20px;align-items:center}
  .topbar h1{font-size:1.65rem;letter-spacing:-.035em}
  .subheading{margin-top:6px;line-height:1.4;font-size:.8125rem}
  .topbar>.row{flex-shrink:0}
  .topbar .btn{min-height:42px;font-size:.875rem}
  .library-toolbar{display:grid;grid-template-columns:minmax(0,1fr) 40px 40px 68px;gap:8px;margin-bottom:14px}
  .library-toolbar .search{grid-column:1/4;grid-row:1;min-width:0;width:auto;order:0}
  .library-toolbar .search input{height:44px;padding-left:38px;font-size:16px}
  .library-toolbar .search .icon{left:12px;top:12px;width:18px;height:18px}
  .library-toolbar [data-action=filters]{grid-column:4;grid-row:1;padding:8px 6px;font-size:.8125rem}
  .library-toolbar #sort{grid-column:1;grid-row:2;width:100%;min-width:0;padding:8px;font-size:.75rem;min-height:40px}
  .library-toolbar [data-value=grid]{grid-column:2;grid-row:2;width:40px;height:40px}
  .library-toolbar [data-value=list]{grid-column:3;grid-row:2;width:40px;height:40px}
  .library-toolbar [data-action=select-mode]{grid-column:4;grid-row:2;padding:5px 2px;font-size:.75rem;min-height:40px}
  .filters{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;gap:7px;padding:2px 0 6px;margin-bottom:16px}
  .filters::-webkit-scrollbar{display:none}
  .filter{flex-shrink:0;white-space:nowrap;min-height:38px;padding:8px 13px}
  .empty{min-height:0;padding:28px 20px;gap:12px;border-style:solid;border-radius:16px}
  .empty-symbol{width:46px;height:46px;border-radius:14px;margin-bottom:2px}
  .empty h2{font-size:1.15rem;line-height:1.35}
  .empty p{font-size:.875rem;line-height:1.55}
  .empty .btn{margin-top:4px}
  .books{gap:22px 16px}
  .book-info{padding-top:10px}
  .book-info h3{font-size:.9375rem}
  .book-info p{line-height:1.4}
  .continue-card{padding:16px;gap:16px}
  .continue-card .book-cover{width:90px;min-width:90px}
  .continue-card>.grow{min-width:0}
  .continue-card .row .btn{flex:1}
  .detail-top{grid-template-columns:90px minmax(0,1fr);gap:16px}
  .detail-top .book-cover{width:90px}
  .detail-top h1{font-size:1.35rem;line-height:1.3;margin:10px 0}
  .detail-actions .btn{min-height:44px;font-size:.875rem}
  .detail-actions .btn.primary{flex:1}
  .tabs{gap:22px;margin:22px 0 18px;scrollbar-width:none}
  .tabs button{min-height:44px}
  .chapter .chapter-actions{margin-left:0;width:100%;gap:6px}
  .chapter-actions .btn{min-height:40px;flex:1}
  .chapter-toolbar{align-items:flex-start;gap:8px}
  .mobile-nav{gap:4px;padding:6px 8px calc(6px + env(safe-area-inset-bottom))}
  .mobile-nav a{flex:1;min-width:0;font-size:.6875rem;min-height:48px}
  dialog{width:calc(100% - 24px);max-height:calc(100dvh - 32px);border-radius:18px}
  .dialog-head{padding:16px 18px;gap:12px}
  .dialog-head h2{font-size:1.125rem;line-height:1.35}
  .dialog-head .icon-btn{flex-shrink:0;width:38px;height:38px}
  .dialog-content{padding:18px}
  .dialog-foot{padding:14px 18px;gap:8px}
  .dialog-foot .btn.primary{flex:1}
  .dialog-content input,.dialog-content textarea,.dialog-content select{font-size:16px!important}
  .override-head{display:grid;grid-template-columns:minmax(72px,1fr) minmax(0,185px);gap:8px}
  .override-head select{width:100%;min-width:0}
  .chapter-toolbar .btn{min-height:40px}
}
@media(max-width:500px){.books{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:350px){
  .override-head{grid-template-columns:1fr;gap:6px}
  .override-head select{width:auto;max-width:100%;justify-self:start}
  .topbar{gap:10px}
  .topbar h1{font-size:1.4rem}
  .topbar .btn{padding:9px 12px}
}

.download-filename{overflow-wrap:anywhere;min-width:0}.download-title .history-row{gap:12px}.download-title .row{flex-wrap:wrap}#ranobe-import input{min-width:0;padding:10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
@media(max-width:500px){#ranobe-import .row{flex-direction:column;align-items:stretch}.download-title h2{font-size:1.15rem}}

#chapter-editor textarea{width:100%;min-height:320px;resize:vertical;line-height:1.65;font-size:1rem;padding:12px;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:10px;box-sizing:border-box}.chapter-diff{white-space:pre-wrap;overflow-wrap:anywhere;max-height:400px;overflow:auto;font-size:.85rem;line-height:1.6;padding:12px;background:var(--soft);border-radius:8px}.doc-chapter-row{padding:14px 0;border-bottom:1px solid var(--line)}.doc-chapter-row label{display:flex;gap:8px;align-items:center}.doc-chapter-row input[type=checkbox]{width:18px;height:18px}#download-search input{flex:1;min-width:0;padding:10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}#chapter-editor .row{flex-wrap:wrap}

.editor-history .history-row{gap:12px}.editor-history .history-row>div{min-width:0;flex:1;overflow-wrap:anywhere}.editor-history .history-row>.btn{flex-shrink:0}#chapter-editor textarea{height:min(55dvh,600px);min-height:280px}
@media(max-width:600px){.topbar{flex-direction:column;align-items:stretch;gap:12px}.topbar>.row{flex-wrap:wrap}.topbar>div{min-width:0}}
