:root {
  --tlp-red: #9e1b14;
  --tlp-red-dark: #6f110c;
  --cream: #f6efe5;
  --ink: #27211e;
  --line: rgba(255,255,255,.18);
  --toolbar-h: 74px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #fff;
  background:
    radial-gradient(circle at 50% 0%, rgba(158,27,20,.28), transparent 34%),
    linear-gradient(145deg, #211e1c, #0f0e0d 72%);
  overflow: hidden;
}
button, input, select, a { font: inherit; }
button, select, input { color: inherit; }
.topbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px;
  background: rgba(20,18,17,.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 10px;
  background: linear-gradient(145deg, #b6241a, var(--tlp-red-dark));
  display: grid; place-items: center; font-weight: 900; letter-spacing: -.5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 5px 16px rgba(0,0,0,.28);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 15px; letter-spacing: .3px; }
.brand-copy span { font-size: 12px; color: #d9d2cd; margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.toolbar button, .toolbar .text-btn, .toolbar select, .pager {
  height: 40px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.07);
  border-radius: 9px;
}
.toolbar button {
  min-width: 40px; padding: 0 12px; cursor: pointer; font-size: 22px;
}
.toolbar button:hover, .toolbar .text-btn:hover, .toolbar select:hover { background: rgba(255,255,255,.12); }
.toolbar .text-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 14px; color: #fff; text-decoration: none; font-size: 13px; white-space: nowrap;
}
.toolbar .primary { background: var(--tlp-red); border-color: #b9342b; font-weight: 700; }
.toolbar .primary:hover { background: #b5261c; }
.section-wrap select {
  width: 190px; padding: 0 34px 0 12px; outline: none; cursor: pointer;
}
.section-wrap option { color: #111; }
.pager { display: flex; align-items: center; padding: 0 8px; gap: 4px; }
.pager input {
  width: 46px; height: 30px; border: 0; border-radius: 6px;
  background: rgba(255,255,255,.10); text-align: center; outline: none;
}
.pager span { font-size: 13px; color: #ded8d4; white-space: nowrap; }
.viewer-shell {
  height: calc(100vh - var(--toolbar-h) - 34px);
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px 10px;
  position: relative;
  overflow: hidden;
}
.book { width: 100%; height: 100%; opacity: 0; transition: opacity .25s ease; }
.book.ready { opacity: 1; }
.page {
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.page img {
  width: 100%; height: 100%; display: block; object-fit: contain;
  background: #fff; pointer-events: none; user-select: none;
}
.loading {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  color: #e8dfd8; font-size: 14px; z-index: 2;
}
.hint {
  height: 34px; display: flex; align-items: center; justify-content: center;
  color: #c9c1bb; font-size: 12px; border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.18); padding: 0 12px; text-align: center;
}
.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;
}
/* Fallback if the flip library cannot load */
.book.fallback {
  opacity: 1; overflow-y: auto; display: block; padding: 12px;
}
.book.fallback .page {
  width: min(820px, 96%); height: auto; aspect-ratio: 595.5 / 842.25;
  margin: 0 auto 18px; box-shadow: 0 8px 28px rgba(0,0,0,.38);
}
@media (max-width: 860px) {
  :root { --toolbar-h: 112px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; padding: 8px 10px; gap: 7px; }
  .brand { min-width: 170px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 8px; font-size: 13px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy span { font-size: 11px; }
  .toolbar { width: 100%; justify-content: center; gap: 5px; }
  .section-wrap { display: none; }
  .toolbar button, .toolbar .text-btn, .toolbar select, .pager { height: 36px; }
  .toolbar button { min-width: 36px; padding: 0 9px; }
  .toolbar .text-btn { padding: 0 9px; font-size: 12px; }
  .viewer-shell { padding: 6px 4px 4px; }
}
@media (max-width: 480px) {
  .toolbar .text-btn:not(.primary) { display: none; }
  .hint { font-size: 10.5px; }
}
