:root {
  --purple: #4811a6;
  --purple-deep: #220557;
  --pink: #f60062;
  --orange: #ff7600;
  --yellow: #ffd300;
  --cyan: #03cfdb;
  --green: #9be100;
  --ink: #10121c;
  --paper: #ffffff;
  --muted: #807d9b;
  --glass: rgba(255,255,255,.86);
  --border: rgba(72,17,166,.12);
  --shadow: 0 24px 70px rgba(29, 8, 65, .22);
  --radius: 22px;
  --toolbar-h: 76px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;
  color: var(--ink);
  font-family: Montserrat, Inter, "Segoe UI", Arial, sans-serif;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image: linear-gradient(135deg, rgba(72,17,166,.035) 25%, transparent 25%), linear-gradient(315deg, rgba(72,17,166,.035) 25%, transparent 25%);
  background-size: 62px 62px;
  background-position: 0 0, 31px 31px;
  mask-image: radial-gradient(circle, rgba(0,0,0,.7), transparent 78%);
}

body {
    overflow: hidden;
background-size: cover !important;
    color: white;
    font-family: Montserrat, Inter, "Segoe UI", Arial, sans-serif;
    background: url(https://commsman.com/flipbook/fondo.svg);
}

button, a, input { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.svg-sprite { position: absolute; width: 0; height: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#i-grid path { fill: currentColor; stroke: none; }
.bg-shape { position: fixed; pointer-events: none; filter: blur(0); opacity: .95; z-index: 0; }
.bg-shape--pink { width: 330px; height: 180px; left: -80px; bottom: -65px; border-radius: 48% 60% 44% 70%; background: var(--pink); transform: rotate(-9deg); }
.bg-shape--orange { width: 260px; height: 160px; right: -65px; top: 95px; border-radius: 54% 40% 66% 38%; background: var(--orange); transform: rotate(14deg); opacity: .88; }
.app { position: relative; height: 100%; z-index: 1; display: flex; flex-direction: column; }
.toolbar {
  height: var(--toolbar-h); flex: 0 0 var(--toolbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px clamp(14px, 3vw, 32px);
  background: var(--glass); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 190px; }
.brand__mark { position: relative; width: 38px; height: 38px; border-radius: 13px; background: var(--purple); display: inline-block; box-shadow: 0 10px 20px rgba(72,17,166,.22); }
.brand__mark::after { content: ""; position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; border: 4px solid var(--yellow); border-top-color: transparent; border-right-color: transparent; transform: rotate(45deg); }
.brand__copy { display: grid; line-height: 1; gap: 5px; }
.brand__copy strong { font-weight: 800; color: var(--purple); font-size: 22px; letter-spacing: -.05em; }
.brand__copy small { color: #6a6682; font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.toolbar__actions { display: flex; align-items: center; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; gap: 7px; height: 48px; padding: 0 15px;
  border-radius: 14px; color: var(--purple); background: white; border: 1px solid var(--border);
  font-size: 14px; font-weight: 650; transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.tool:hover { transform: translateY(-1px); box-shadow: 0 9px 18px rgba(72,17,166,.12); background: #fdfbff; }
.tool:active { transform: translateY(0); }
.tool--icon { width: 48px; padding: 0; justify-content: center; }
.tool--download { background: var(--purple); color: white; border-color: var(--purple); }
.tool--download:hover { background: #5917c2; }
.counter { height: 48px; padding: 0 12px; display: flex; align-items: center; gap: 6px; color: #77718d; border-radius: 14px; background: #f3eefb; font-weight: 700; }
.counter input { width: 38px; border: 0; outline: 0; color: var(--purple); background: transparent; text-align: right; font-weight: 800; }
.workspace { position: relative; flex: 1; min-height: 0; display: flex; }
.stage { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; padding: 24px 30px 58px; }
.book-shell { width: min(94vw, 1670px); height: min(calc(100vh - 155px), 850px); display: grid; place-items: center; }
.book { filter: drop-shadow(0 30px 24px rgba(30, 10, 67, .24)); }
.page { position: relative; background: #fff; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.page__img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.page__links { position: absolute; inset: 0; }
.page__link { position: absolute; display: block; cursor: pointer; background: transparent; border: 0; padding: 0; border-radius: 7px; }
.page__link:hover { background: rgba(255, 211, 0, .11); box-shadow: inset 0 0 0 1px rgba(255, 211, 0, .26); }
.page__link:focus-visible { outline: 3px solid var(--yellow); outline-offset: -1px; background: rgba(255,211,0,.16); }
.gesture-hint { position: absolute; bottom: 19px; margin: 0; font-size: 13px; color: white; display: flex; align-items: center; gap: 9px; font-weight: 550; }
.gesture-hint span { width: 24px; height: 1px; background: var(--purple); position: relative; opacity: .55; }
.gesture-hint span::after { content: ""; position: absolute; right: 0; top: -3px; width: 6px; height: 6px; border-right: 1px solid var(--purple); border-top: 1px solid var(--purple); transform: rotate(45deg); }
.loading { position: absolute; inset: 0; z-index: 8; display: grid; align-content: center; justify-items: center; gap: 10px; color: var(--purple); background: rgba(250,248,254,.84); transition: opacity .4s ease, visibility .4s ease; }
.loading[hidden] { opacity: 0; visibility: hidden; pointer-events: none; display: grid; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(72,17,166,.15); border-top-color: var(--purple); animation: spin .85s linear infinite; }
.loading strong { margin-top: 7px; font-size: 18px; }
.loading small { color: #736c8b; }
@keyframes spin { to { transform: rotate(360deg); } }
.drawer {
  position: absolute; top: 0; left: 0; bottom: 0; z-index: 25; width: min(370px, 93vw); padding: 22px 18px 22px;
  background: rgba(255,255,255,.97); backdrop-filter: blur(18px); border-right: 1px solid var(--border);
  transform: translateX(-102%); transition: transform .3s cubic-bezier(.2,.8,.2,1); overflow-y: auto; box-shadow: 18px 0 38px rgba(41,12,87,.1);
}
.drawer.open { transform: translateX(0); }
.drawer__header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 16px; }
.overline { margin: 0 0 3px; color: var(--purple); text-transform: uppercase; font-weight: 800; font-size: 11px; letter-spacing: .13em; }
.drawer h2 { margin: 0; font-size: 26px; letter-spacing: -.05em; }
.close { background: #f4effd; color: var(--purple); border-radius: 12px; width: 42px; height: 42px; display: grid; place-items: center; }
.chapters { display: grid; gap: 7px; margin: 0 0 21px; }
.chapter { --accent: var(--purple); display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; text-align: left; border-radius: 12px; color: var(--ink); background: #faf8fe; transition: background .16s ease, transform .16s ease; }
.chapter:hover, .chapter.active { background: #f1e9ff; transform: translateX(2px); }
.chapter::before { content: ""; width: 6px; height: 31px; flex-shrink: 0; border-radius: 8px; background: var(--accent); }
.chapter strong { display: block; font-size: 13px; }
.chapter small { color: #7b7690; font-size: 11px; }
.tone-purple { --accent: var(--purple); }
.tone-yellow { --accent: var(--yellow); }
.tone-pink { --accent: var(--pink); }
.tone-orange { --accent: var(--orange); }
.tone-cyan { --accent: var(--cyan); }
.tone-green { --accent: var(--green); }
.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.thumb { position: relative; padding: 0; overflow: hidden; border-radius: 10px; border: 2px solid transparent; background: #f1eff4; transition: transform .18s ease, border-color .18s ease; }
.thumb:hover { transform: translateY(-2px); }
.thumb.active { border-color: var(--purple); }
.thumb img { display: block; width: 100%; aspect-ratio: 842/595; object-fit: cover; }
.thumb span { position: absolute; right: 5px; bottom: 5px; min-width: 22px; height: 22px; border-radius: 8px; display: grid; place-items: center; padding: 0 5px; color: white; background: rgba(20,10,38,.74); font-size: 11px; font-weight: 700; }
.viewer { position: fixed; inset: 0; z-index: 40; display: none; flex-direction: column; background: rgba(15,10,26,.94); color: white; }
.viewer.open { display: flex; }
.viewer__bar { height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(14px,4vw,34px); font-weight: 650; border-bottom: 1px solid rgba(255,255,255,.13); }
.viewer__controls { display: flex; gap: 8px; align-items: center; }
.viewer__controls button { color: white; min-width: 43px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.12); font-weight: 700; }
.viewer__controls button:hover { background: rgba(255,255,255,.2); }
.viewer__close svg { width: 21px; height: 21px; }
.viewer__canvas { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 18px; }
.viewer__canvas img { display: block; max-width: none; max-height: none; box-shadow: var(--shadow); transition: width .18s ease; }
@media (max-width: 920px) {
  :root { --toolbar-h: 68px; }
  .toolbar { padding-inline: 12px; gap: 8px; }
  .brand__copy small { display: none; }
  .brand__copy strong { font-size: 18px; }
  .brand__mark { width: 34px; height: 34px; }
  .tool span, .optional { display: none; }
  .tool { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .counter { height: 44px; padding-inline: 8px; }
  .stage { padding: 12px 8px 50px; }
  .book-shell { width: 100%; height: min(calc(100vh - 125px), 68vw); min-height: 230px; }
  .gesture-hint { font-size: 11px; bottom: 13px; }
  .bg-shape { display: none; }
}
@media (max-width: 530px) {
  .brand__copy { display: none; }
  .brand { min-width: auto; }
  .toolbar__actions { gap: 4px; }
  .tool, .counter { border-radius: 11px; }
  .book-shell { height: min(calc(100vh - 122px), 78vw); }
}
