:root { color-scheme:dark; --navy:#0b111a; --ink:#edf5f8; --muted:#9fb0bb; --green:#62d5ee; --green-strong:#8ce9fa; --line:rgba(255,255,255,.13); --topbar:64px; --controls:68px; }
* { box-sizing:border-box; }
html,body { height:100%; }
body { margin:0; overflow:hidden; background:var(--navy); color:var(--ink); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif; }
button,a { font:inherit; }
button { color:inherit; }
.topbar { height:var(--topbar); padding:0 max(18px,env(safe-area-inset-right)) 0 max(18px,env(safe-area-inset-left)); display:flex; align-items:center; justify-content:space-between; gap:16px; background:rgba(11,17,26,.97); border-bottom:1px solid var(--line); position:relative; z-index:20; }
.brand { display:flex; align-items:center; min-width:0; }
.brand-logo { display:inline-flex; align-items:center; gap:2px; flex:none; color:var(--green-strong); white-space:nowrap; }
.brand-mark { display:block; font-size:2rem; font-weight:900; font-style:italic; line-height:1; letter-spacing:0; transform:skew(-7deg); }
.brand-name { display:block; font-family:Georgia,"Times New Roman",serif; font-size:1.12rem; font-weight:700; font-style:italic; line-height:1; letter-spacing:.01em; }
.brand-divider { width:1px; height:23px; background:var(--line); margin:0 14px; }
.catalog-name { color:#dce5e9; font-size:.86rem; font-weight:600; white-space:nowrap; }
.top-actions { display:flex; align-items:center; gap:9px; }
.icon-button,.control-button,.fit-button,.tray-header button,.search-header button { border:1px solid var(--line); background:rgba(255,255,255,.05); border-radius:8px; cursor:pointer; transition:background .16s ease,border-color .16s ease,transform .16s ease; }
.icon-button:hover,.control-button:hover,.fit-button:hover,.tray-header button:hover,.search-header button:hover { background:rgba(255,255,255,.11); border-color:rgba(255,255,255,.22); }
.icon-button:active,.control-button:active,.fit-button:active { transform:scale(.96); }
.icon-button { width:40px; height:40px; display:grid; place-items:center; padding:0; }
.icon-button svg,.download-button svg,.control-button svg,.nav-button svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.download-button { height:40px; padding:0 15px; display:inline-flex; align-items:center; gap:8px; border-radius:8px; background:var(--green); color:#07151b; text-decoration:none; font-size:.88rem; font-weight:800; transition:background .16s ease,transform .16s ease; }
.download-button:hover { background:var(--green-strong); }
.download-button:active { transform:scale(.97); }
.viewer { position:relative; height:calc(100dvh - var(--topbar) - var(--controls)); display:grid; grid-template-columns:64px minmax(0,1fr) 64px; background:radial-gradient(circle at 50% 38%,rgba(98,213,238,.1),transparent 34%),linear-gradient(135deg,#152234,#080d14 68%); }
.catalog-stage { min-width:0; min-height:0; display:grid; place-items:center; overflow:auto; padding:22px 0; perspective:2200px; overscroll-behavior:contain; scrollbar-color:rgba(255,255,255,.25) transparent; cursor:default; }
.catalog-stage.wheel-zoom { cursor:zoom-in; }
.catalog-stage.zoomed { cursor:grab; }
.catalog-stage.dragging { cursor:grabbing; user-select:none; }
.mobile-reader,.mobile-page-control,.mobile-nav-buttons,.mobile-zoom-controls { display:none; }
.mobile-zoom-toggle { display:none; }
.book { width:min(100%,calc((100dvh - var(--topbar) - var(--controls) - 44px)*1.414)); max-width:1500px; aspect-ratio:1.414/1; position:relative; flex:none; transform-style:preserve-3d; -webkit-transform-style:preserve-3d; transition:width .22s ease; }
.book-page { position:absolute; top:0; width:50%; height:100%; overflow:hidden; background:transparent; }
.book-page img { width:100%; height:100%; display:block; object-fit:fill; user-select:none; }
.book-left { left:0; border-radius:5px 0 0 5px; box-shadow:inset -10px 0 18px -17px rgba(0,0,0,.55),0 24px 38px rgba(0,0,0,.36); }
.book-right { right:0; border-radius:0 5px 5px 0; box-shadow:inset 10px 0 18px -17px rgba(0,0,0,.55),0 24px 38px rgba(0,0,0,.36); }
.book-page.empty { background:transparent; box-shadow:none; }
.book-gutter { position:absolute; z-index:8; left:calc(50% - 7px); top:0; width:14px; height:100%; pointer-events:none; background:linear-gradient(90deg,rgba(0,0,0,.12),rgba(255,255,255,.08) 46%,rgba(0,0,0,.13)); opacity:.65; }
.book.cover-state .book-gutter,.book.back-state .book-gutter { opacity:0; }
.flip-sheet { position:absolute; z-index:10; top:0; width:50%; height:100%; transform-style:preserve-3d; -webkit-transform-style:preserve-3d; will-change:transform; }
.flip-sheet.next { left:50%; transform-origin:left center; animation:flipNext .72s cubic-bezier(.48,.02,.22,1) forwards; }
.flip-sheet.prev { left:0; transform-origin:right center; animation:flipPrev .72s cubic-bezier(.48,.02,.22,1) forwards; }
.flip-face { position:absolute; inset:0; overflow:hidden; backface-visibility:hidden; -webkit-backface-visibility:hidden; transform-style:preserve-3d; -webkit-transform-style:preserve-3d; background:#fff; }
.flip-face img { width:100%; height:100%; display:block; object-fit:fill; user-select:none; }
.flip-front { box-shadow:inset 12px 0 20px -18px rgba(0,0,0,.7),12px 8px 26px rgba(0,0,0,.2); }
.flip-back { transform:rotateY(180deg); -webkit-transform:rotateY(180deg); box-shadow:inset -12px 0 20px -18px rgba(0,0,0,.7),-12px 8px 26px rgba(0,0,0,.2); }
.flip-sheet.prev .flip-front { box-shadow:inset -12px 0 20px -18px rgba(0,0,0,.7),-12px 8px 26px rgba(0,0,0,.2); }
.flip-sheet.prev .flip-back { box-shadow:inset 12px 0 20px -18px rgba(0,0,0,.7),12px 8px 26px rgba(0,0,0,.2); }
@keyframes flipNext { 0%{transform:rotateY(0)} 100%{transform:rotateY(-180deg)} }
@keyframes flipPrev { 0%{transform:rotateY(0)} 100%{transform:rotateY(180deg)} }
.loading { position:absolute; inset:0; display:grid; place-items:center; background:rgba(20,32,40,.72); z-index:30; border-radius:5px; }
.loading span { width:36px; height:36px; border:3px solid rgba(255,255,255,.18); border-top-color:var(--green); border-radius:50%; animation:spin .7s linear infinite; }
.loading.hidden { display:none; }
@keyframes spin { to{transform:rotate(360deg)} }
.nav-button { align-self:center; justify-self:center; width:44px; height:58px; display:grid; place-items:center; border:1px solid var(--green-strong); border-radius:10px; background:var(--green); color:#07151b; cursor:pointer; z-index:4; box-shadow:0 8px 22px rgba(0,0,0,.34),0 0 0 1px rgba(140,233,250,.16); transition:background .16s ease,color .16s ease,opacity .16s ease,transform .16s ease; }
.nav-button:hover:not(:disabled) { background:var(--green-strong); transform:translateY(-1px); }
.nav-button:disabled { border-color:rgba(255,255,255,.18); background:rgba(255,255,255,.06); color:#82939e; box-shadow:none; opacity:.55; cursor:default; }
.controls { height:var(--controls); padding:0 max(18px,env(safe-area-inset-right)) max(0px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left)); display:grid; grid-template-columns:1fr auto 1fr; align-items:center; border-top:1px solid var(--line); background:rgba(11,17,26,.98); position:relative; z-index:20; }
.control-button { justify-self:start; height:44px; padding:0 16px; display:flex; align-items:center; gap:9px; font-size:.9rem; font-weight:700; }
.control-button svg { width:20px; height:20px; stroke-width:1.7; }
.page-status,.desktop-page-status { display:flex; align-items:baseline; gap:9px; color:var(--muted); font-variant-numeric:tabular-nums; }
.page-status strong { color:#fff; font-size:1.08rem; min-width:54px; text-align:center; }
.page-status .total-pages { font-size:.88rem; }
.zoom-controls { justify-self:end; display:flex; align-items:center; gap:8px; color:var(--muted); font-size:.9rem; }
.icon-button.small { width:40px; height:40px; font-size:1.28rem; }
.zoom-mode-button { width:auto!important; min-width:132px; padding:0 12px; display:inline-flex; align-items:center; justify-content:center; gap:7px; color:#dce5e9; font-size:.88rem!important; font-weight:700; white-space:nowrap; }
.zoom-mode-button svg { width:20px; height:20px; flex:none; }
.zoom-mode-button.active { border-color:var(--green-strong); background:var(--green); color:#07151b; box-shadow:0 0 0 2px rgba(98,213,238,.17); }
.zoom-mode-button.active:hover { background:var(--green-strong); border-color:var(--green-strong); }
#zoomLabel { min-width:48px; text-align:center; font-weight:700; }
.fit-button { height:40px; padding:0 13px; color:var(--ink); font-size:.88rem; font-weight:700; }
.thumbnail-tray { position:fixed; left:0; top:var(--topbar); bottom:var(--controls); width:min(360px,88vw); background:#12202a; border-right:1px solid var(--line); box-shadow:20px 0 45px rgba(0,0,0,.25); z-index:40; transform:translateX(-105%); transition:transform .24s ease; }
.thumbnail-tray.open { transform:translateX(0); }
.tray-header { height:54px; padding:0 14px 0 18px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); }
.tray-header strong { font-size:.92rem; }
.tray-header button { width:32px; height:32px; color:var(--muted); font-size:1.25rem; }
.thumbnails { height:calc(100% - 54px); overflow-y:auto; padding:16px; display:grid; grid-template-columns:1fr 1fr; gap:12px; align-content:start; }
.thumbnail { border:1px solid var(--line); border-radius:8px; padding:6px; background:rgba(255,255,255,.035); cursor:pointer; color:var(--muted); text-align:left; }
.thumbnail:hover { border-color:rgba(98,213,238,.58); }
.thumbnail.active { border-color:var(--green); box-shadow:0 0 0 1px var(--green); color:var(--ink); }
.thumbnail img { display:block; width:100%; aspect-ratio:1488/2105; object-fit:cover; border-radius:3px; margin-bottom:7px; }
.thumbnail span { display:block; font-size:.74rem; line-height:1.45; }
.search-panel { position:fixed; right:0; top:var(--topbar); bottom:var(--controls); width:min(410px,94vw); background:#12202a; border-left:1px solid var(--line); box-shadow:-20px 0 45px rgba(0,0,0,.25); z-index:40; transform:translateX(105%); transition:transform .24s ease; }
.search-panel.open { transform:translateX(0); }
.search-header { height:54px; padding:0 14px 0 18px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); }
.search-header strong { font-size:.92rem; }
.search-header button { width:32px; height:32px; color:var(--muted); font-size:1.25rem; }
.search-field { height:44px; margin:16px 16px 0; padding:0 12px; display:flex; align-items:center; gap:9px; border:1px solid rgba(255,255,255,.2); border-radius:9px; background:rgba(255,255,255,.07); }
.search-field:focus-within { border-color:var(--green); box-shadow:0 0 0 2px rgba(98,213,238,.17); }
.search-field svg { width:19px; height:19px; flex:none; fill:none; stroke:var(--muted); stroke-width:1.8; stroke-linecap:round; }
.search-field input { min-width:0; width:100%; border:0; outline:0; background:transparent; color:var(--ink); font-size:.88rem; }
.search-field input::placeholder { color:#82939e; }
.search-help { margin:8px 18px 12px; color:var(--muted); font-size:.74rem; }
.search-results { height:calc(100% - 136px); overflow-y:auto; padding:0 16px 18px; }
.search-empty { padding:24px 8px; color:var(--muted); text-align:center; font-size:.84rem; }
.search-result { width:100%; margin-bottom:9px; padding:12px 13px; display:block; border:1px solid var(--line); border-radius:9px; background:rgba(255,255,255,.04); color:var(--ink); text-align:left; cursor:pointer; transition:border-color .16s ease,background .16s ease; }
.search-result:hover { border-color:var(--green); background:rgba(98,213,238,.08); }
.search-result strong { display:block; margin-bottom:5px; color:var(--green-strong); font-size:.84rem; }
.search-result span { display:-webkit-box; overflow:hidden; color:#c4d0d6; font-size:.76rem; line-height:1.55; -webkit-line-clamp:3; -webkit-box-orient:vertical; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.scrim { position:fixed; inset:var(--topbar) 0 var(--controls); background:rgba(3,8,11,.55); z-index:35; backdrop-filter:blur(2px); }
:focus-visible { outline:3px solid var(--green-strong); outline-offset:2px; }
@media (max-width:720px) {
  :root { --topbar:56px; --controls:64px; }
  .topbar { padding-left:12px; padding-right:12px; }
  .brand-mark { font-size:1.7rem; }
  .brand-name { font-size:.9rem; }
  .brand-divider { margin:0 9px; }
  .catalog-name { font-size:.75rem; }
  #fullscreenButton { display:none; }
  .mobile-zoom-toggle { display:grid; }
  .download-button { width:40px; padding:0; justify-content:center; }
  .download-button span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .viewer { display:block; height:calc(100dvh - var(--topbar) - var(--controls) - var(--mobile-zoombar,0px)); }
  .catalog-stage { height:100%; padding:0; overflow:hidden; place-items:stretch; cursor:default; }
  .book,.nav-button { display:none; }
  .mobile-reader { position:relative; display:block; width:100%; height:100%; overflow:hidden; touch-action:none; }
  .mobile-track { display:flex; width:100%; height:100%; transform:translate3d(0,0,0); transition:transform .28s cubic-bezier(.22,.7,.2,1); will-change:transform; }
  .mobile-track.dragging { transition:none; }
  .mobile-page { flex:0 0 100%; width:100%; height:100%; padding:10px 8px; display:grid; place-items:center; }
  .mobile-page img { display:block; width:auto; height:auto; max-width:100%; max-height:100%; object-fit:contain; border-radius:3px; box-shadow:0 16px 34px rgba(0,0,0,.35); user-select:none; -webkit-user-drag:none; transform-origin:center; transition:transform .16s ease; will-change:transform; }
  .mobile-reader.gesturing .mobile-page img { transition:none; }
  .mobile-zoom-controls { height:0; min-height:0; padding:0 max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left)); display:flex; align-items:center; justify-content:center; gap:4px; overflow:hidden; border-bottom:0 solid var(--line); background:rgba(11,17,26,.98); opacity:0; transition:height .18s ease,opacity .14s ease,border-width .18s ease; }
  body.mobile-zoom-open { --mobile-zoombar:52px; }
  body.mobile-zoom-open .mobile-zoom-controls { height:52px; border-bottom-width:1px; opacity:1; }
  .mobile-zoom-title { margin-right:5px; color:var(--muted); font-size:.8rem; font-weight:700; }
  .mobile-zoom-button,.mobile-zoom-reset { height:38px; border:0; border-radius:8px; background:transparent; color:#fff; font-weight:800; cursor:pointer; }
  .mobile-zoom-button { width:40px; font-size:1.35rem; }
  .mobile-zoom-reset { min-width:48px; padding:0 9px; color:var(--green-strong); font-size:.8rem; }
  .mobile-zoom-button:active,.mobile-zoom-reset:active { background:rgba(255,255,255,.14); }
  .mobile-zoom-button:disabled { color:#65747d; cursor:default; }
  #mobileZoomLabel { min-width:45px; color:#fff; font-size:.76rem; font-weight:700; text-align:center; font-variant-numeric:tabular-nums; }
  .controls { padding-left:10px; padding-right:10px; grid-template-columns:38px minmax(0,1fr) auto; gap:10px; }
  .control-button span,.fit-button,#zoomLabel,.total-pages { display:none; }
  .control-button { width:38px; height:38px; padding:0; justify-content:center; }
  .desktop-page-status,.zoom-controls { display:none; }
  .page-status { display:block; min-width:0; color:var(--muted); }
  .mobile-page-control { width:100%; display:flex; align-items:center; gap:9px; }
  .mobile-page-control strong { min-width:42px; color:#fff; font-size:.8rem; text-align:center; font-variant-numeric:tabular-nums; }
  .mobile-page-control input { width:100%; min-width:0; margin:0; accent-color:var(--green); cursor:pointer; }
  .mobile-nav-buttons { display:flex; align-items:center; gap:5px; }
  .mobile-nav-buttons .icon-button { width:38px; height:38px; }
  .mobile-nav-buttons .icon-button:disabled { opacity:.28; cursor:default; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration:.01ms!important; transition-duration:.01ms!important; } }
