:root{
  --title:#5a4d7a;
  --text:#4e4e5f;
  --muted:#7b7b92;
}

*{
  box-sizing:border-box;
}

html, body{
  margin:0;
  padding:0;
  font-family:"Segoe UI", Arial, sans-serif;
  color:var(--text);
}

body.viewer-page{
  min-height:100vh;
  background:
    radial-gradient(circle at 15% 10%, #fff2f8 0%, transparent 35%),
    radial-gradient(circle at 85% 0%, #eef6ff 0%, transparent 35%),
    radial-gradient(circle at 50% 100%, #f2fff5 0%, transparent 40%),
    linear-gradient(135deg, #fdf7fb, #f6fbff, #f7fff5);
  display:flex;
  flex-direction:column;
}

/* üst bar */
.viewer-topbar{
  position:sticky;
  top:0;
  z-index:50;
  display:grid;
  grid-template-columns:auto 1fr;
  align-items:center;
  gap:10px;
  padding:6px 14px 4px;
  background:rgba(255,255,255,.88);
  backdrop-filter:blur(10px);
  box-shadow:0 2px 10px rgba(0,0,0,.04);
  border-bottom:1px solid rgba(0,0,0,.05);
}

.viewer-title{
  text-align:center;
  font-weight:600;
  color:var(--title);
  font-size:.92rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* kontrol satırı */
.viewer-toolbar{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  padding:6px 12px 4px;
}

.btn{
  border:none;
  cursor:pointer;
  padding:10px 14px;
  border-radius:14px;
  font-size:16px;
  font-weight:700;
  line-height:1;
  box-shadow:0 4px 12px rgba(110,110,150,.10);
  transition:transform .18s ease, box-shadow .18s ease;
  min-width:46px;
  min-height:46px;
}

.btn:hover{
  transform:translateY(-1px);
}

.pastel-pink{
  background:#f6d9e6;
  color:#7b4d66;
}

.pastel-blue{
  background:#d9e9f7;
  color:#355f7d;
}

.pastel-soft{
  background:#e8f5ec;
  color:#3d6d49;
}

.pastel-gold{
  background:#f7e6b6;
  color:#8b6a00;
}

.page-indicator{
  padding:10px 14px;
  background:#fff;
  border-radius:999px;
  min-width:86px;
  text-align:center;
  font-weight:700;
  color:var(--title);
  box-shadow:0 3px 10px rgba(0,0,0,.06);
}

/* okuyucu alanı */
.viewer-wrap{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px 14px;
  min-height:0;
}

.viewer-shell{
  width:min(98vw, 1320px);
  background:rgba(255,255,255,.48);
  border:1px solid rgba(255,255,255,.88);
  border-radius:24px;
  box-shadow:
    0 16px 40px rgba(90,80,120,0.12),
    0 4px 12px rgba(0,0,0,0.06);
  padding:10px;
}

#book{
  position:relative;
  width:min(96vw, 1180px);
  height:min(82vh, 860px);
  margin:auto;
  display:flex;
  justify-content:center;
  align-items:center;
  transition:transform .25s ease;
}

/* sayfa görünümü */
.page{
  position:relative;
  width:100%;
  height:100%;
  background:linear-gradient(180deg, #ffffff 0%, #fffdfd 100%);
  overflow:hidden;
  border-radius:6px;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.04),
    0 10px 26px rgba(0,0,0,0.10);
}

.page::before{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  right:0;
  width:14px;
  pointer-events:none;
  background:linear-gradient(
    to left,
    rgba(0,0,0,0.045),
    rgba(0,0,0,0.015),
    rgba(0,0,0,0)
  );
}

.page::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:linear-gradient(
    105deg,
    rgba(255,255,255,0.00) 0%,
    rgba(255,255,255,0.10) 28%,
    rgba(255,255,255,0.18) 46%,
    rgba(255,255,255,0.05) 62%,
    rgba(255,255,255,0.00) 100%
  );
}

.page canvas{
  width:100% !important;
  height:100% !important;
  display:block;
  object-fit:contain;
  border-radius:6px;
}

.loading{
  text-align:center;
  padding:30px;
  font-size:1rem;
  color:var(--title);
}

/* mobil */
@media (max-width: 768px){
  .viewer-topbar{
    grid-template-columns:1fr;
    justify-items:center;
    gap:10px;
    padding:10px 12px 6px;
  }

  #homeBtn{
    justify-self:start;
  }

  .viewer-title{
    font-size:10px;
    max-width:100%;
  }

  .viewer-toolbar{
    gap:8px;
    padding:8px 10px 4px;
  }

  .btn{
    font-size:14px;
    padding:8px 12px;
    min-width:42px;
    min-height:42px;
    border-radius:12px;
  }

  .page-indicator{
    min-width:72px;
    font-size:10px;
    padding:8px 10px;
  }

  .viewer-wrap{
    padding:8px;
  }

  .viewer-shell{
    width:100%;
    border-radius:18px;
    padding:8px;
    overflow:auto;
  }

  #book{
    width:100%;
    height:min(72vh, 640px);
    transform-origin:top center !important;
  }

  #zoomInBtn,
  #zoomOutBtn{
    display:none;
  }
}