:root {
  --bg: #eff5f0;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #3ac628;
  --accent-dark: #1d8e2a;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, #f5faf5 0%, #e6f1e5 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

.app-shell {
  width: min(1400px, calc(100% - 32px));
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 18px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.7vw, 2.3rem);
  line-height: 1.1;
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.controls {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.select-wrap {
  display: none !important;
}

.select-wrap select,
.btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.95rem;
}

.btn {
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: #d2d6dc;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.06);
}

.btn:active {
  transform: translateY(0);
}

#fullscreenBtn {
  width: auto;
  white-space: nowrap;
}

.viewer-card {
  flex: 1;
  min-height: 0;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(229, 231, 235, 0.95);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.viewer-toolbar,
.mobile-tip {
  display: none !important;
}

.viewer-status {
  display: none;
}

#issueTitle,
#pageInfo {
  display: none;
}

.book-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(198, 40, 40, 0.08), transparent 30%),
    linear-gradient(180deg, #daefe2 0%, #d2e8d6 100%);
  padding: 10px;
  overflow: hidden;
}

#book {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#book canvas,
#book img,
.page,
.page img {
  max-width: 100%;
  max-height: 100%;
}

.page {
  background: #fff;
}

.page img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  font-weight: 600;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(2px);
}

.fullscreen-mode {
  overflow: hidden;
}

.fullscreen-mode .app-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 12px;
}

.fullscreen-mode .viewer-card {
  border-radius: 20px;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100%, calc(100% - 16px));
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .topbar {
    align-items: center;
    gap: 12px;
  }

  .viewer-card {
    padding: 8px;
    border-radius: 18px;
  }

  .book-shell {
    padding: 8px;
  }
}

@media (max-width: 640px) {
  .eyebrow {
    margin-bottom: 4px;
  }

  h1 {
    font-size: clamp(1.25rem, 6vw, 1.8rem);
  }

  .btn {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.92rem;
  }

  #fullscreenBtn {
    align-self: flex-start;
  }
}
