* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, system-ui, Roboto, "Segoe UI", sans-serif; background: #f3f5f8; color: #1b1f24;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
header { text-align: center; padding: 14px 0 4px; }
h1 { margin: 0; font-size: 26px; color: #1565c0; }
main { max-width: 560px; margin: 0 auto; padding: 12px 18px 40px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; border: 0; border-radius: 22px;
  font: inherit; font-weight: 700; cursor: pointer; margin: 14px 0; color: #fff; }
.btn:active { transform: scale(0.98); filter: brightness(0.92); }
.btn:disabled { opacity: 0.5; }
.huge { font-size: 34px; min-height: 130px; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
#bigPhoto.huge { flex-direction: column; min-height: 46vh; font-size: 36px; gap: 10px; }
#bigPhoto .ico { font-size: 90px; }
.big { font-size: 26px; min-height: 84px; }
.small { font-size: 19px; min-height: 58px; }
.ico { font-size: 1.3em; line-height: 1; }
.blue { background: #1565c0; }
.green { background: #1faa55; }
.red { background: #c62828; }
.ghost { background: transparent; color: #1565c0; border: 2px solid #b8c7da; box-shadow: none; }
.ghostdark { background: #444; }
.hint { text-align: center; font-size: 21px; color: #4a5561; margin: 6px 0 18px; line-height: 1.4; }
#pages { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.page { display: block; width: 100%; border: 0; font: inherit; cursor: pointer; position: relative; background: #fff; border-radius: 12px; padding: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.page img { display: block; width: 100%; height: 190px; object-fit: contain; background: #fff; }
.page .num { position: absolute; left: 10px; top: 10px; background: #1565c0; color: #fff; font-weight: 700;
  font-size: 18px; border-radius: 10px; padding: 3px 10px; }
.page.single { grid-column: 1 / span 2; }
.page.single img { height: 320px; }
.sent { text-align: center; font-size: 26px; font-weight: 700; color: #1faa55; margin: 0; }
#busy { position: fixed; inset: 0; background: rgba(255,255,255,.92); display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 28px; font-weight: 700; z-index: 20; }
#busy[hidden], #viewer[hidden], #preview[hidden], [hidden] { display: none !important; }
.spinner { width: 80px; height: 80px; border: 10px solid #cfe0f5; border-top-color: #1565c0; border-radius: 50%;
  animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#viewer { position: fixed; inset: 0; background: #111; z-index: 10; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom); }
#viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; margin-top: 10px; background: #111; }
.viewbar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.viewbar .btn { font-size: 20px; margin: 10px 0; min-height: 70px; }
#install { margin-top: 26px; padding: 14px; background: #fff; border-radius: 14px; font-size: 17px; color: #4a5561; text-align: center; }
#install p { margin: 0 0 6px; }
.tip { text-align: center; font-size: 17px; color: #6a7580; margin: 10px 0 0; }
#preview { position: fixed; inset: 0; background: #2b2f36; z-index: 9; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.phead { color: #fff; text-align: center; font-size: 24px; font-weight: 700; padding: 14px 10px 8px; }
#pvPages { flex: 1; overflow-y: auto; padding: 4px 12px 12px; -webkit-overflow-scrolling: touch; }
#pvPages figure { margin: 0 0 16px; }
#pvPages img { display: block; width: 100%; background: #fff; box-shadow: 0 3px 12px rgba(0,0,0,.5); }
#pvPages figcaption { color: #cfd6de; text-align: center; font-size: 18px; margin-top: 6px; }
.pbar { background: #1f2227; padding: 4px 14px 8px; }
.pbar .btn { margin: 8px 0; }
.pbar .big { min-height: 72px; font-size: 24px; }
.pbar .small { min-height: 50px; }
