﻿:root {
  --bg: #21150d;
  --panel: #2b1b10;
  --wood: #6f4423;
  --paper: #fff8eb;
  --ink: #f8ead2;
  --muted: #c9ad88;
  --accent: #c8904d;
  --green: #3f5136;
  --red: #9f1f1f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: 'KO Media', 'Segoe UI', Tahoma, Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(181, 124, 69, 0.16), transparent 42%),
    radial-gradient(circle at 18% 12%, rgba(200, 144, 77, 0.2), transparent 24%),
    var(--bg);
}

button,
a,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  min-height: 104px;
  display: grid;
  place-items: center;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(255, 248, 235, 0.12);
  background:
    linear-gradient(90deg, transparent, rgba(200, 144, 77, 0.12) 50%, transparent),
    rgba(23, 14, 8, 0.94);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.brand-block {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  padding-inline: 30px;
}

.brand-block::before,
.brand-block::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 4px;
  height: calc(100% - 18px);
  border-radius: 999px;
  background: linear-gradient(#e2b06c, #6f4423);
}

.brand-block::before {
  right: 0;
}

.brand-block::after {
  left: 0;
}

.brand-kicker,
.brand-block p,
.brand-block h1 {
  margin: 0;
}

.brand-kicker {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
}

.brand-block h1 {
  font-family: 'KO Media', 'KOUFIBD', 'Segoe UI', Tahoma, Arial, sans-serif;
  color: var(--paper);
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}

.brand-block p {
  color: rgba(255, 248, 235, 0.72);
  font-size: 1rem;
  font-weight: 700;
}

.reader {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: clamp(10px, 2vw, 22px);
}

.book-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 248, 235, 0.06), transparent 28%, rgba(0, 0, 0, 0.2)),
    linear-gradient(135deg, #8f5b2f, #5f361b 54%, #351f11);
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 235, 0.09),
    inset 0 22px 80px rgba(0, 0, 0, 0.28),
    0 28px 80px rgba(0, 0, 0, 0.35);
}

.book-stage.zoomed {
  overflow: auto;
  place-items: start center;
  padding: 28px;
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--paper);
  background: rgba(33, 21, 13, 0.92);
}

.loading.hidden {
  display: none;
}

.loader {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 248, 235, 0.24);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

.flip-book {
  width: min(92vw, calc((100vh - 260px) * 2.826));
  max-width: 1180px;
  height: min(62vh, calc(92vw / 2.826));
  min-height: 300px;
  filter: drop-shadow(0 30px 36px rgba(0, 0, 0, 0.34));
}

.flip-book canvas {
  border-radius: 7px;
}

.nav-hotspot {
  position: absolute;
  top: 50%;
  z-index: 16;
  width: 54px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 248, 235, 0.15);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(33, 21, 13, 0.5);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.nav-hotspot:hover {
  background: rgba(63, 81, 54, 0.78);
  transform: translateY(-50%) scale(1.02);
}

.nav-hotspot:disabled {
  opacity: 0.24;
  cursor: default;
}

.nav-prev {
  right: 18px;
}

.nav-next {
  left: 18px;
}

.controls {
  width: min(850px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 44px 104px 1fr minmax(126px, auto);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 248, 235, 0.12);
  border-radius: 8px;
  background: rgba(33, 21, 13, 0.78);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.tool-button,
.download-button {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 248, 235, 0.14);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(255, 248, 235, 0.08);
  cursor: pointer;
}

.tool-button {
  width: 42px;
}

.download-button {
  padding: 0 15px;
  white-space: nowrap;
  color: var(--paper);
  font-weight: 900;
}

.page-indicator {
  color: var(--paper);
  font-weight: 800;
  text-align: center;
  direction: ltr;
}

.page-range {
  width: 100%;
  accent-color: var(--accent);
}

.intro-line {
  width: min(850px, calc(100% - 32px));
  margin: 0 auto;
  padding: 9px 16px;
  border-right: 3px solid var(--accent);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(255, 248, 235, 0.045);
  font-weight: 900;
  text-align: right;
}

.reader-contact {
  width: min(850px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  align-items: stretch;
  gap: 10px;
}

.contact-heading {
  min-width: 170px;
  display: grid;
  place-items: center;
  padding: 10px 16px;
  border: 1px solid rgba(200, 144, 77, 0.22);
  border-radius: 8px;
  color: var(--accent);
  background: rgba(200, 144, 77, 0.08);
  font-weight: 900;
}

.reader-contact-card {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 248, 235, 0.12);
  border-radius: 8px;
  color: var(--paper);
  background:
    linear-gradient(135deg, rgba(255, 248, 235, 0.065), rgba(0, 0, 0, 0.08)),
    rgba(33, 21, 13, 0.62);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.reader-contact-card:hover {
  transform: translateY(-2px);
  border-color: rgba(200, 144, 77, 0.42);
  background: rgba(255, 248, 235, 0.085);
}

.reader-contact-card.whatsapp {
  border-color: rgba(63, 81, 54, 0.64);
  background:
    linear-gradient(135deg, rgba(80, 105, 67, 0.28), rgba(0, 0, 0, 0.06)),
    rgba(33, 21, 13, 0.55);
}

.reader-contact-card.whatsapp:hover {
  background: rgba(63, 81, 54, 0.38);
}

.reader-contact-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 248, 235, 0.12);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(200, 144, 77, 0.18);
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  font-weight: 900;
}

.reader-contact-card strong,
.reader-contact-card small {
  display: block;
}

.reader-contact-card strong {
  color: var(--paper);
  font-weight: 900;
}

.reader-contact-card small {
  margin-top: 2px;
  color: rgba(255, 248, 235, 0.72);
  direction: ltr;
  unicode-bidi: plaintext;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  font-weight: 850;
}

.contact-strip {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px clamp(16px, 3vw, 34px);
  color: var(--red);
  border-top: 1px solid rgba(159, 31, 31, 0.12);
  background: #fff;
}

.credit-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  text-align: center;
}

.credit-line span,
.credit-line a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(159, 31, 31, 0.14);
  border-radius: 8px;
  color: var(--red);
  background: #fff;
  box-shadow: 0 8px 20px rgba(159, 31, 31, 0.08);
  font-weight: 900;
}

.credit-line a {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 96px;
    padding: 12px 16px;
  }

  .brand-block {
    padding-inline: 22px;
  }

  .brand-block h1 {
    font-size: clamp(1.75rem, 9vw, 2.7rem);
  }

  .brand-block p {
    font-size: 0.88rem;
  }

  .reader {
    gap: 10px;
    padding: 8px;
  }

  .flip-book {
    width: min(92vw, calc((100vh - 310px) * 1.413));
    height: min(56vh, calc(92vw / 1.413));
    min-height: 250px;
  }

  .nav-hotspot {
    width: 44px;
    height: 62px;
  }

  .nav-prev {
    right: 8px;
  }

  .nav-next {
    left: 8px;
  }

  .controls {
    width: calc(100% - 18px);
    grid-template-columns: 38px 72px 1fr minmax(98px, auto);
    gap: 7px;
    padding: 8px;
  }

  .tool-button {
    width: 38px;
    min-height: 38px;
  }

  .download-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .intro-line,
  .reader-contact {
    width: calc(100% - 18px);
  }

  .reader-contact {
    grid-template-columns: 1fr;
  }

  .contact-heading {
    min-width: 0;
  }
}
