:root { --web-safe-top: env(safe-area-inset-top, 0px); }
body.web-app { padding-top: 34px; }
.web-sync-bar { position:fixed; z-index:140; inset:0 0 auto; min-height:34px; padding:calc(5px + var(--web-safe-top)) 12px 5px; display:flex; align-items:center; justify-content:space-between; gap:12px; color:#f8f4eb; background:#315b4f; font:12px/1.25 system-ui,sans-serif; }
.web-sync-bar button { border:1px solid rgba(255,255,255,.5); border-radius:999px; padding:4px 11px; color:inherit; background:transparent; cursor:pointer; }
.web-sync-bar .web-sync-actions { display:flex; align-items:center; gap:8px; }
.web-auth-dialog { width:min(420px,calc(100vw - 32px)); padding:0; border:0; border-radius:18px; color:#25231f; background:#f7f3eb; box-shadow:0 25px 90px rgba(0,0,0,.28); }
.web-auth-dialog::backdrop { background:rgba(25,28,26,.45); backdrop-filter:blur(3px); }
.web-auth-dialog form { padding:28px; display:grid; gap:14px; }
.web-auth-dialog h2 { margin:0; font:700 28px/1.1 Georgia,'Songti SC',serif; }
.web-auth-dialog p { margin:0 0 5px; color:#736e64; line-height:1.6; }
.web-auth-dialog label { display:grid; gap:6px; font:13px/1.4 system-ui,sans-serif; }
.web-auth-dialog input { min-width:0; padding:12px 13px; border:1px solid #c9c1b2; border-radius:10px; background:#fffdf8; font:16px system-ui,sans-serif; }
.web-auth-dialog menu { margin:5px 0 0; padding:0; display:flex; justify-content:flex-end; gap:9px; }
.web-auth-dialog button { padding:10px 18px; border:1px solid #315b4f; border-radius:10px; background:#315b4f; color:white; font-weight:600; }
.web-auth-dialog button.secondary { background:transparent; color:#315b4f; }
.web-auth-error { min-height:20px; color:#963a33!important; font-size:12px; }
#browserModeButton { display:none!important; }

@media (max-width: 900px) {
  body.web-app { overflow:auto; }
  .app-shell { min-height:calc(100dvh - 34px); height:auto; display:block; }
  .titlebar { position:sticky; top:34px; z-index:20; width:auto; height:48px; padding:0 12px; display:grid; grid-template-columns:auto minmax(0,1fr) auto; -webkit-app-region:no-drag; }
  .brand-name,.brand-cn { display:none; }
  .library-panel,.insight-panel { display:none; }
  .reader-panel { height:calc(100dvh - 82px); padding:0 18px 42px; }
  .reader-topbar { top:0; margin-bottom:18px; overflow-x:auto; justify-content:flex-start; flex-wrap:nowrap; white-space:nowrap; scrollbar-width:none; }
  .reader-topbar button { flex:0 0 auto; }
  #toggleLibrary,#classroomTopButton,#rangeExportButton,#whiteboardButton { display:none!important; }
  .chapter-heading { grid-template-columns:38px 1fr; gap:10px; margin-bottom:24px; }
  .book-content { font-size:var(--reader-size); line-height:var(--reader-line); }
  .selection-toolbar { max-width:calc(100vw - 20px); overflow-x:auto; }
  .library-overlay,.statistics-overlay,.learning-overlay { top:34px; }
  .library-header,.statistics-header { padding:22px 18px; display:flex; flex-wrap:wrap; }
  .library-grid { padding:24px 18px 55px; grid-template-columns:1fr; }
  .statistics-layout { display:block; overflow:auto; }
  .statistics-book-list { max-height:220px; }
  .statistics-detail { padding:24px 18px 55px; }
  .reading-assistant-dialog { width:100vw; height:calc(100dvh - 34px); max-width:none; max-height:none; border:0; }
}
