:root {
  --kb-bg: #1a1c20;
  --kb-panel: #121417;
  --kb-bar: #0e1013;
  --kb-line: rgba(255, 255, 255, 0.08);
  --kb-text: #f3f4f6;
  --kb-muted: #9ca3af;
  --kb-accent: #d3284c;
  --kb-accent-hover: #e63d60;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--kb-bg);
  color: var(--kb-text);
  font-family: "Outfit", "Segoe UI", sans-serif;
}

body.kb-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kb-top,
.kb-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 14px;
  background: var(--kb-bar);
  border-color: var(--kb-line);
  z-index: 20;
}

.kb-top {
  border-bottom: 1px solid var(--kb-line);
  justify-content: space-between;
}

.kb-top-left,
.kb-top-right,
.kb-bar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.kb-logo img {
  height: 28px;
  width: auto;
}

.kb-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.kb-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--kb-text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.kb-btn:hover,
.kb-btn.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.kb-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kb-btn-label {
  width: auto;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  background: var(--kb-accent);
}

.kb-btn-label:hover {
  background: var(--kb-accent-hover);
}

.kb-stage-wrap {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.kb-thumbs {
  width: 132px;
  background: var(--kb-panel);
  border-right: 1px solid var(--kb-line);
  overflow-y: auto;
  padding: 10px;
  display: none;
}

.kb-thumbs.is-open {
  display: block;
}

.kb-thumb {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}

.kb-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.kb-thumb.is-current {
  border-color: var(--kb-accent);
}

.kb-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 12px 56px;
  background:
    radial-gradient(ellipse at center, #2a2d33 0%, #15171b 70%);
}

.kb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.45);
}

.kb-nav:hover {
  background: rgba(0, 0, 0, 0.7);
}

.kb-prev { left: 8px; }
.kb-next { right: 8px; }

#book {
  width: min(100%, 1180px);
  height: 100%;
  max-height: 100%;
}

.stf__parent {
  margin: 0 auto;
  height: 100%;
}

.stf__wrapper {
  height: 100% !important;
  padding-bottom: 0 !important;
}

.stf__block {
  height: 100%;
}

.flip-page {
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.flip-page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.kb-bar {
  border-top: 1px solid var(--kb-line);
  justify-content: center;
}

.kb-page-num {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--kb-muted);
}

.kb-page-num input {
  width: 52px;
  height: 32px;
  border: 1px solid var(--kb-line);
  background: #1b1e23;
  color: #fff;
  border-radius: 6px;
  text-align: center;
  font: inherit;
}

.kb-zoom {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 10, 0.94);
  z-index: 40;
  display: none;
  overflow: auto;
  padding: 56px 16px 16px;
}

.kb-zoom.is-open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
}

.kb-zoom img {
  max-width: 100%;
  height: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.kb-zoom-close {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 41;
}

@media (max-width: 860px) {
  .kb-title { display: none; }
  .kb-stage { padding: 8px 46px; }
  .kb-thumbs { position: absolute; inset: 0 auto 0 0; z-index: 15; height: 100%; }
  #book { width: 100%; }
}

@media (max-width: 640px) {
  .kb-btn-label span { display: none; }
  .kb-stage { padding: 6px 42px; }
  .kb-logo img { height: 22px; }
}
