/* ═══════════════════════════════════════════════════════
   PDF Flipbook Viewer — GiGW3 Style
   ═══════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  --bar-bg: #000000;
  --bar-height: 44px;
  --icon-color: #ECF5FB;
  --icon-hover: #ffffff;
  --icon-active: #4fc3f7;
  --page-bg: #E8E8E8;
  --app-bg: #E2E2E2;
  --panel-bg: #1a1a1a;
  --panel-header-bg: #000000;
  --thumb-bg: #333333;
  --thumb-alpha: 0.92;
  --search-highlight: #ffff00;
  --search-keyword: #FFB000;
  --text-light: #ECF5FB;
  --text-muted: #999999;
  --text-dark: #333333;
  --accent: #4fc3f7;
  --divider: rgba(255, 255, 255, 0.12);
  --shadow-bar: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-page: 0 0 20px rgba(0, 0, 0, 0.25);
  --radius: 4px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--app-bg);
  color: var(--text-dark);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

/* ─── App Container ─── */
.app {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   Loading Screen
   ═══════════════════════════════════════════════════════ */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  color: #ECF5FB;
  gap: 20px;
  transition: opacity 0.5s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-screen.hidden {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════
   Upload Screen
   ═══════════════════════════════════════════════════════ */
.upload-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1a2e 40%, #16213e 100%);
}

.upload-screen.hidden {
  display: none;
}

.upload-container {
  text-align: center;
  padding: 48px 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  max-width: 440px;
  width: 90%;
  animation: fadeInUp 0.6s ease both;
}

.upload-icon-wrap {
  margin-bottom: 20px;
}

.upload-big-icon {
  font-size: 72px;
  color: var(--accent);
  display: block;
  animation: float 3s ease-in-out infinite;
}

.upload-container h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.upload-container p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 28px;
  line-height: 1.5;
}

.upload-btn-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, #4fc3f7, #0288d1);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(79, 195, 247, 0.3);
}

.upload-btn-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79, 195, 247, 0.45);
}

.upload-btn-main .material-icons-round {
  font-size: 22px;
}

#pdfInput {
  display: none;
}

.upload-drop-zone {
  margin-top: 24px;
  padding: 24px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.upload-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79, 195, 247, 0.08);
  color: var(--accent);
}

.upload-drop-zone .material-icons-round {
  font-size: 32px;
}

/* ═══════════════════════════════════════════════════════
   Viewer Screen
   ═══════════════════════════════════════════════════════ */
.viewer-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.viewer-screen.hidden {
  display: none;
}

/* ─── Fullscreen Mode ─── */
:fullscreen .app,
:-webkit-full-screen .app {
  width: 100vw !important;
  height: 100vh !important;
}

:fullscreen .viewer-screen,
:-webkit-full-screen .viewer-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9000;
}

:fullscreen .stage,
:-webkit-full-screen .stage {
  flex: 1;
  width: 100%;
  height: 100%;
}

:fullscreen .flipbook-wrap,
:-webkit-full-screen .flipbook-wrap {
  width: 100%;
  height: 100%;
}

/* ═══════════════════════════════════════════════════════
   Top Bar
   ═══════════════════════════════════════════════════════ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--bar-height);
  min-height: var(--bar-height);
  padding: 0 4px;
  background: var(--bar-bg);
  box-shadow: var(--shadow-bar);
  z-index: 50;
  transition: transform var(--transition);
}

.top-bar.auto-hidden {
  transform: translateY(-100%);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.top-bar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--icon-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ═══════════════════════════════════════════════════════
   Toolbar Button (shared top/bottom)
   ═══════════════════════════════════════════════════════ */
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--icon-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.tb-btn .material-icons-round {
  font-size: 22px;
}

.tb-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--icon-hover);
}

.tb-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

.tb-btn.active {
  color: var(--icon-active);
}

.tb-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.bar-divider {
  width: 1px;
  height: 24px;
  background: var(--divider);
  margin: 0 2px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   Stage (Flipbook Area)
   ═══════════════════════════════════════════════════════ */
.stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--app-bg);
  /* Subtle texture background */
  background-image:
    radial-gradient(ellipse at 30% 30%, rgba(0, 0, 0, 0.03) 0%, transparent 70%),
    radial-gradient(ellipse at 70% 70%, rgba(0, 0, 0, 0.05) 0%, transparent 70%);
}

.flipbook-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 16px;
  transition: transform 0.3s ease;
}

.flipbook {
  box-shadow: var(--shadow-page);
}

/* ─── Rotated / Landscape Mode ─── */
.flipbook-wrap.rotated {
  transform: rotate(90deg);
  transform-origin: center center;
}

.flipbook-wrap.rotated.zoomed {
  transform: rotate(90deg) scale(var(--zoom-level, 1));
}

/* Stage Navigation Arrows */
.stage-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 80px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: all 0.25s ease;
  opacity: 0;
}

.stage:hover .stage-arrow,
.stage-arrow:focus {
  opacity: 1;
}

.stage-arrow:hover {
  background: rgba(0, 0, 0, 0.5);
}

.stage-arrow .material-icons-round {
  font-size: 32px;
}

.stage-arrow-left {
  left: 0;
  border-radius: 0 8px 8px 0;
}

.stage-arrow-right {
  right: 0;
  border-radius: 8px 0 0 8px;
}

/* ─── Page Styles ─── */
.page {
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.page.hard-cover {
  background: linear-gradient(145deg, #2d3250, #424769);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
}

.page.hard-cover .cover-label {
  color: #a29bfe;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.page-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.page-placeholder .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #ddd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.page-placeholder.idle .spinner {
  border-top-color: #ccc;
  animation: none;
}

.page-rendered {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  animation: fadeIn 0.3s ease both;
}

/* ═══════════════════════════════════════════════════════
   Bottom Bar
   ═══════════════════════════════════════════════════════ */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--bar-height);
  min-height: var(--bar-height);
  padding: 0 4px;
  background: var(--bar-bg);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.5);
  z-index: 50;
  transition: transform var(--transition);
}

.bottom-bar.auto-hidden {
  transform: translateY(100%);
}

.bottom-bar-left,
.bottom-bar-right {
  display: flex;
  align-items: center;
  gap: 0;
}

.bottom-bar-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-nav-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 10px;
}

.page-input {
  width: 36px;
  height: 26px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--icon-color);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}

.page-input::-webkit-outer-spin-button,
.page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.18);
}

.page-separator {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.total-pages {
  color: var(--icon-color);
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 20px;
}

/* ═══════════════════════════════════════════════════════
   Panel Backdrop
   ═══════════════════════════════════════════════════════ */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  transition: opacity var(--transition);
}

.panel-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   Side Panels (Thumbnails, TOC, Search)
   ═══════════════════════════════════════════════════════ */
.side-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--panel-bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.panel-left {
  left: 0;
  transform: translateX(-100%);
}

.panel-left.open {
  transform: translateX(0);
}

.panel-left.hidden {
  transform: translateX(-100%);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 16px;
  height: var(--bar-height);
  min-height: var(--bar-height);
  background: var(--panel-header-bg);
  border-bottom: 1px solid var(--divider);
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--icon-color);
}

.panel-close-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--icon-color);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.panel-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ─── Bottom Thumbnail Strip ─── */
.thumb-strip {
  position: absolute;
  bottom: var(--bar-height);
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
  max-height: 180px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateY(0);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.thumb-strip.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.thumb-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.thumb-strip-header .panel-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.thumb-strip-grid {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}

.thumb-strip-grid::-webkit-scrollbar {
  height: 4px;
}

.thumb-strip-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.thumb-strip-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.thumb-item {
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 90px;
}

.thumb-item:hover {
  border-color: rgba(79, 195, 247, 0.4);
  background: rgba(255, 255, 255, 0.1);
}

.thumb-item.active {
  border-color: var(--accent);
  background: rgba(79, 195, 247, 0.12);
}

.thumb-image-wrap {
  width: 100%;
  aspect-ratio: 0.707;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.thumb-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb-image-wrap .thumb-loading {
  width: 20px;
  height: 20px;
  border: 2px solid #ddd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.thumb-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 4px;
}

/* ─── TOC List ─── */
.toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.toc-list::-webkit-scrollbar {
  width: 6px;
}

.toc-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.toc-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.toc-empty {
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.85rem;
  transition: background 0.2s;
  border-bottom: 1px solid var(--divider);
}

.toc-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.toc-item-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-item-page {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── Search Panel ─── */
.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 8px;
  border-bottom: 1px solid var(--divider);
  background: rgba(255, 255, 255, 0.04);
}

.search-icon {
  color: var(--text-muted);
  font-size: 20px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  height: 34px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--icon-color);
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.2s;
}

.search-clear-btn .material-icons-round {
  font-size: 18px;
}

.search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--icon-color);
}

.search-clear-btn.hidden {
  display: none;
}

.search-status {
  padding: 8px 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--divider);
}

.search-status.hidden {
  display: none;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--divider);
  transition: background 0.2s;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.search-result-page {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.search-result-text {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.5;
}

.search-result-text mark {
  background: var(--search-highlight);
  color: #000;
  border-radius: 2px;
  padding: 1px 2px;
}

/* ═══════════════════════════════════════════════════════
   Share Modal
   ═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  transition: opacity var(--transition);
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.share-modal {
  background: var(--panel-bg);
  border-radius: 12px;
  width: 380px;
  max-width: 90vw;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  animation: fadeInUp 0.3s ease both;
}

.share-body {
  padding: 20px;
}

.share-url-group {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.share-url-input {
  flex: 1;
  height: 38px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--icon-color);
  font-family: var(--font);
  font-size: 0.8rem;
  outline: none;
}

.share-copy-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--icon-color);
  cursor: pointer;
  transition: all 0.2s;
}

.share-copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--accent);
}

.share-copy-btn .material-icons-round {
  font-size: 20px;
}

.share-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.share-social-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--icon-color);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.2s;
}

.share-social-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.share-social-btn .material-icons-round {
  font-size: 24px;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   Toast Notification
   ═══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════
   Zoom Mode
   ═══════════════════════════════════════════════════════ */
.flipbook-wrap.zoomed {
  cursor: grab;
  overflow: auto;
}

.flipbook-wrap.zoomed:active {
  cursor: grabbing;
}

/* ═══════════════════════════════════════════════════════
   Utility
   ═══════════════════════════════════════════════════════ */
.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════
   Keyframes
   ═══════════════════════════════════════════════════════ */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* ═══════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .top-bar-title {
    max-width: 100px;
    font-size: 0.78rem;
  }

  .tb-btn {
    width: 36px;
    height: 36px;
  }

  .tb-btn .material-icons-round {
    font-size: 20px;
  }

  .bar-divider {
    display: none;
  }

  .flipbook-wrap {
    padding: 8px;
  }

  .page-input {
    width: 30px;
    height: 24px;
    font-size: 0.75rem;
  }

  .bottom-bar-right {
    gap: 0;
  }

  .side-panel {
    width: 280px;
  }

  .thumbnail-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .share-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .upload-container {
    padding: 32px 24px;
  }

  .upload-big-icon {
    font-size: 56px;
  }

  .upload-container h2 {
    font-size: 1.25rem;
  }
}

@media (max-width: 400px) {
  :root {
    --bar-height: 40px;
  }

  .top-bar-title {
    display: none;
  }

  .tb-btn {
    width: 34px;
    height: 34px;
  }

  .tb-btn .material-icons-round {
    font-size: 19px;
  }

  .page-nav-group {
    padding: 2px 6px;
  }
}

/* ─── Fullscreen adjustments ─── */
:fullscreen,
:-webkit-full-screen,
:-moz-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  background: var(--app-bg);
}

:fullscreen .app,
:-webkit-full-screen .app,
:-moz-full-screen .app {
  width: 100vw !important;
  height: 100vh !important;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
}

:fullscreen .viewer-screen,
:-webkit-full-screen .viewer-screen,
:-moz-full-screen .viewer-screen {
  width: 100vw !important;
  height: 100vh !important;
}

:fullscreen .stage,
:-webkit-full-screen .stage,
:-moz-full-screen .stage {
  flex: 1;
  width: 100%;
  height: 100%;
}

:fullscreen .flipbook-wrap,
:-webkit-full-screen .flipbook-wrap,
:-moz-full-screen .flipbook-wrap {
  width: 100%;
  height: 100%;
}