
body.single-amb_edition { margin:0; background:#f3f1ec; }
.ambde-reader-page,
.ambde-reader-page * { box-sizing:border-box; }

.ambde-reader-page {
  min-height:100vh;
  background:#f3f1ec;
  color:#1f2024;
  font-family:Arial,Helvetica,sans-serif;
}

.ambde-reader-header {
  position:sticky;
  top:0;
  z-index:40;
  background:rgba(255,255,255,.96);
  border-bottom:1px solid #e4e1d9;
  backdrop-filter:blur(12px);
}
.ambde-reader-header-inner {
  width:min(1340px, calc(100% - 26px));
  margin:0 auto;
  min-height:80px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:12px 0;
}
.ambde-reader-brand {
  min-width:0;
  display:flex;
  align-items:center;
  gap:16px;
}
.ambde-reader-logo {
  width:205px;
  max-height:56px;
  object-fit:contain;
  object-position:left center;
  display:block;
}
.ambde-reader-meta { min-width:0; }
.ambde-reader-meta h1 {
  margin:0 0 4px !important;
  font-family:Georgia,"Times New Roman",serif !important;
  font-size:30px !important;
  line-height:1.04 !important;
  font-weight:500 !important;
  color:#17171d !important;
}
.ambde-reader-meta p {
  margin:0 !important;
  color:#686b74 !important;
  font-size:13px !important;
}
.ambde-reader-actions {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.ambde-reader-action {
  min-height:40px;
  padding:0 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  border:1px solid #ddd9cf;
  background:#fff;
  color:#1f2024;
  text-decoration:none !important;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
}
.ambde-reader-action:hover { border-color:#c9c2b6; }
.ambde-reader-action.primary {
  background:#c8102e;
  border-color:#c8102e;
  color:#fff;
}

.ambde-reader-shell {
  width:min(1340px, calc(100% - 26px));
  margin:18px auto 0;
  display:grid;
  grid-template-columns:0 1fr;
  gap:0;
  transition:grid-template-columns .2s ease;
}
body.ambde-thumbs-open .ambde-reader-shell { grid-template-columns:190px 1fr; }

.ambde-thumbs {
  overflow:auto;
  max-height:calc(100vh - 130px);
  padding:12px;
  background:#fff;
  border:1px solid #e5e2db;
  border-right:none;
  border-radius:14px 0 0 14px;
  opacity:0;
  pointer-events:none;
}
body.ambde-thumbs-open .ambde-thumbs {
  opacity:1;
  pointer-events:auto;
}
.ambde-thumb {
  width:100%;
  border:0;
  background:transparent;
  padding:7px;
  border-radius:8px;
  cursor:pointer;
  position:relative;
  margin-bottom:8px;
}
.ambde-thumb:hover { background:#f3f1ec; }
.ambde-thumb canvas {
  width:100%;
  display:block;
  background:#fff;
  border:1px solid #ece9e2;
}
.ambde-thumb-number {
  position:absolute;
  right:10px;
  top:10px;
  min-width:23px;
  height:23px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:rgba(23,23,29,.84);
  color:#fff;
  font-size:10px;
  font-weight:800;
}

.ambde-reader-main {
  min-width:0;
  background:#fff;
  border:1px solid #e5e2db;
  border-radius:14px;
  overflow:hidden;
}
body.ambde-thumbs-open .ambde-reader-main {
  border-radius:0 14px 14px 0;
}

.ambde-reader-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:14px 16px;
  border-bottom:1px solid #ece9e2;
  background:#fff;
}
.ambde-reader-toolbar-group {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.ambde-tool {
  min-height:40px;
  min-width:40px;
  padding:0 12px;
  border:1px solid #ddd9cf;
  border-radius:8px;
  background:#fff;
  color:#17171d;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
}
.ambde-tool:hover { border-color:#c9c2b6; }
.ambde-tool-label {
  min-height:40px;
  padding:0 10px;
  display:inline-flex;
  align-items:center;
  border:1px solid #ddd9cf;
  border-radius:8px;
  font-size:13px;
  font-weight:800;
  color:#17171d;
  background:#fff;
}
.ambde-pagebox {
  display:flex;
  align-items:center;
  gap:6px;
  color:#62656f;
  font-size:13px;
  font-weight:700;
}
.ambde-pagebox input {
  width:58px;
  height:40px;
  padding:0 8px;
  border:1px solid #ddd9cf;
  border-radius:8px;
  background:#fff;
  color:#17171d;
  text-align:center;
}
.ambde-mobile-hint {
  display:none;
  padding:0 16px 14px;
  color:#7a7c83;
  font-size:12px;
  font-weight:700;
}
.ambde-reader-stage {
  min-height:680px;
  padding:22px 16px 30px;
  overflow:auto;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  gap:20px;
  background:#f7f5f0;
  touch-action:pan-x pan-y;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.ambde-reader-stage.ambde-is-zoomed {
  justify-content:flex-start;
}
.ambde-reader-stage canvas {
  flex:0 0 auto;
  background:#fff;
  box-shadow:0 18px 48px rgba(0,0,0,.12);
  max-width:none;
  height:auto;
}
.ambde-reader-stage.is-grabbing { cursor:grabbing; }

.ambde-reader-footer {
  width:min(1180px, calc(100% - 26px));
  margin:22px auto 60px;
}
.ambde-no-pdf {
  width:min(900px, calc(100% - 26px));
  margin:50px auto;
  padding:36px 24px;
  background:#fff;
  border:1px solid #e5e2db;
  border-radius:16px;
  text-align:center;
}
.ambde-no-pdf h1 {
  margin:0 0 10px !important;
  font-family:Georgia,"Times New Roman",serif !important;
}

@media(max-width:1024px) {
  .ambde-reader-header-inner,
  .ambde-reader-shell,
  .ambde-reader-footer { width:min(1340px, calc(100% - 18px)); }
  .ambde-reader-meta h1 { font-size:24px !important; }
}

@media(max-width:900px) {
  .ambde-reader-header-inner {
    flex-direction:column;
    align-items:flex-start;
    gap:12px;
    padding:12px 0;
  }
  .ambde-reader-actions {
    width:100%;
    justify-content:flex-start;
  }
  .ambde-reader-shell,
  body.ambde-thumbs-open .ambde-reader-shell {
    grid-template-columns:1fr;
  }
  .ambde-thumbs {
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    width:180px;
    z-index:80;
    max-height:none;
    border-radius:0;
    border-right:1px solid #e5e2db;
    transform:translateX(-100%);
    opacity:1;
    pointer-events:auto;
    transition:transform .2s ease;
  }
  body.ambde-thumbs-open .ambde-thumbs { transform:translateX(0); }
  .ambde-reader-main,
  body.ambde-thumbs-open .ambde-reader-main { border-radius:14px; }
  .ambde-reader-toolbar {
    flex-direction:column;
    align-items:flex-start;
  }
  .ambde-reader-toolbar-group {
    width:100%;
  }
  .ambde-reader-stage {
    min-height:520px;
    padding:16px 10px 24px;
  }
  .ambde-mobile-hint { display:block; }
  .ambde-reader-stage {
    touch-action:pan-x pan-y;
    justify-content:center;
  }
  .ambde-reader-stage.ambde-is-zoomed {
    justify-content:flex-start;
  }
  .ambde-reader-stage canvas {
    max-width:none;
  }
}

@media(max-width:640px) {
  .ambde-reader-brand {
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
  }
  .ambde-reader-logo { width:180px; max-height:48px; }
  .ambde-reader-meta h1 { font-size:21px !important; }
  .ambde-reader-action,
  .ambde-tool,
  .ambde-tool-label {
    min-height:38px;
    font-size:12px;
    padding:0 10px;
  }
  .ambde-reader-toolbar-group.buttons {
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap:8px;
  }
  .ambde-reader-toolbar-group.utilities {
    display:grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:8px;
  }
  .ambde-tool,
  .ambde-tool-label {
    width:100%;
    justify-content:center;
  }
  .ambde-pagebox {
    width:100%;
    justify-content:flex-start;
  }
  .ambde-pagebox input { width:56px; }
}


/* v0.3.2 — true fullscreen reader behavior */
.ambde-reader-shell:fullscreen,
.ambde-reader-shell:-webkit-full-screen {
  width:100vw !important;
  height:100vh !important;
  max-width:none !important;
  margin:0 !important;
  background:#f3f1ec !important;
  display:grid !important;
  grid-template-columns:0 minmax(0,1fr) !important;
  overflow:hidden !important;
}

body.ambde-thumbs-open .ambde-reader-shell:fullscreen,
body.ambde-thumbs-open .ambde-reader-shell:-webkit-full-screen {
  grid-template-columns:190px minmax(0,1fr) !important;
}

.ambde-reader-shell:fullscreen .ambde-reader-main,
.ambde-reader-shell:-webkit-full-screen .ambde-reader-main {
  height:100vh !important;
  min-height:0 !important;
  display:flex !important;
  flex-direction:column !important;
  border-radius:0 !important;
  border:0 !important;
}

.ambde-reader-shell:fullscreen .ambde-reader-toolbar,
.ambde-reader-shell:-webkit-full-screen .ambde-reader-toolbar {
  flex:0 0 auto !important;
  position:relative !important;
  z-index:10 !important;
}

.ambde-reader-shell:fullscreen .ambde-mobile-hint,
.ambde-reader-shell:-webkit-full-screen .ambde-mobile-hint {
  flex:0 0 auto !important;
  background:#fff !important;
}

.ambde-reader-shell:fullscreen .ambde-reader-stage,
.ambde-reader-shell:-webkit-full-screen .ambde-reader-stage {
  flex:1 1 auto !important;
  min-height:0 !important;
  height:auto !important;
  overflow:auto !important;
  -webkit-overflow-scrolling:touch !important;
  overscroll-behavior:contain !important;
  touch-action:pan-x pan-y !important;
  padding-bottom:40px !important;
}

.ambde-reader-shell:fullscreen .ambde-thumbs,
.ambde-reader-shell:-webkit-full-screen .ambde-thumbs {
  max-height:100vh !important;
  border-radius:0 !important;
}

@media(max-width:900px) {
  .ambde-reader-shell:fullscreen,
  .ambde-reader-shell:-webkit-full-screen,
  body.ambde-thumbs-open .ambde-reader-shell:fullscreen,
  body.ambde-thumbs-open .ambde-reader-shell:-webkit-full-screen {
    grid-template-columns:minmax(0,1fr) !important;
  }

  .ambde-reader-shell:fullscreen .ambde-reader-toolbar,
  .ambde-reader-shell:-webkit-full-screen .ambde-reader-toolbar {
    position:sticky !important;
    top:0 !important;
    background:#fff !important;
    z-index:20 !important;
  }

  .ambde-reader-shell:fullscreen .ambde-reader-stage,
  .ambde-reader-shell:-webkit-full-screen .ambde-reader-stage {
    width:100% !important;
    max-width:100% !important;
  }
}
