:root {
  --color-base: #000;
  --color-bg: #fff;
  --color-grey: #939393;
  --color-grey-dark: rgba(0, 0, 0, 0.65);
  --color-grey-light: rgba(0, 0, 0, 0.1);
  --color-accent: #0366d6;
  --color-accent-hover: #db4a38;
  --color-white: #fff;
  --color-black: #000;
  --color-slide-bg: #fafafa;
  --color-slide-dark: #1a1a1a;
  --color-slide-light: #f8f9fa;
  --color-progress: #0366d6;
  --color-control: rgba(0, 0, 0, 0.7);
  --color-control-hover: rgba(0, 0, 0, 0.9);
  --font-primary: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-md: 20px;
  --font-size-lg: 24px;
  --font-size-xl: 32px;
  --font-size-2xl: 40px;
  --font-size-3xl: 48px;
  --font-size-4xl: 56px;
  --font-size-5xl: 64px;
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 0.75rem;
  --spacing-base: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  --spacing-4xl: 6rem;
  --container-max-width: 800px;
  --navbar-height: 60px;
  --controls-height: 60px;
  --progress-height: 4px;
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-slide: 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

*,
*:before,
*:after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: var(--color-bg);
  font-size: var(--font-size-base);
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-font-smoothing: greyscale;
}

body {
  margin: 0;
  font-family: var(--font-primary);
  color: var(--color-base);
  background-color: var(--color-bg);
  overflow-x: hidden;
  height: 100vh;
}

.navbar {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-grey-light);
  height: var(--navbar-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--container-max-width);
  padding: 0 var(--spacing-lg);
  z-index: 1000;
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

.navbar.navbar-light {
  background: var(--color-slide-light);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.navbar.navbar-dark {
  background: var(--color-slide-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar.navbar-dark .navbar__logo {
  color: var(--color-white);
}

.navbar.navbar-dark .navbar__menu--links {
  color: rgba(255, 255, 255, 0.8);
}

.navbar.navbar-dark .navbar__menu--links:hover {
  color: var(--color-white);
}

.navbar__logo {
  color: var(--color-grey-dark);
  cursor: pointer;
  text-decoration: none;
  font-size: 1.8rem;
  font-family: var(--font-primary);
  font-weight: var(--font-weight-medium);
  display: flex;
  align-items: center;
  margin: 0;
}

.navbar__bars {
  opacity: 1;
  pointer-events: all;
  position: fixed;
  top: 8px;
  right: var(--spacing-base);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1001;
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
}

.navbar__bars svg {
  display: block;
  color: var(--color-grey-dark);
}

.navbar__bars:hover {
  background-color: var(--color-grey-light);
}

@media (min-width: 1024px) {
  .navbar__bars {
    opacity: 0;
    pointer-events: none;
  }
}

.navbar__menu {
  list-style: none;
  display: none;
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--navbar-height));
  height: calc(100dvh - var(--navbar-height));
  background: var(--color-bg);
  flex-direction: column;
  justify-content: flex-start;
  padding: 1rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  z-index: 999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
}

.navbar__menu.active {
  display: flex;
}

@media (min-width: 1024px) {
  .navbar__menu {
    display: flex;
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0;
    box-shadow: none;
    background: transparent;
    overflow: visible;
  }
}

.navbar__menu--links {
  color: var(--color-grey);
  text-decoration: none;
  padding: 1rem 1.5rem;
  font-weight: var(--font-weight-normal);
  font-size: 1.125rem;
  font-family: var(--font-primary);
  width: 100%;
  text-align: center;
  border-bottom: 1px solid var(--color-grey-light);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.navbar__menu--links:hover {
  color: var(--color-grey-dark);
  background-color: var(--color-grey-light);
}

@media (min-width: 1024px) {
  .navbar__menu--links {
    padding: 0 15px;
    font-size: var(--font-size-sm);
    width: auto;
    border-bottom: none;
    min-height: auto;
  }

  .navbar__menu--links:hover {
    background-color: transparent;
  }
}

.footer {
  position: relative;
  z-index: 0;
}

.slideshow-container {
  width: 100%;
  height: auto;
  min-height: calc(100dvh - var(--navbar-height) - 100px);
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  margin: 0;
  padding: var(--spacing-sm);
  max-width: 100%;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.slideshow-fallback {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.slide-display {
  width: 100%;
  flex: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 70px;
}

.image-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.pdf-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 50vh;
  min-height: 50dvh;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pdf-canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: none;
  object-fit: contain;
}

#pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  display: block;
  object-fit: contain;
  aspect-ratio: 16/9;
  pointer-events: none;
  transform-origin: center center;
}

#loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  display: none;
  z-index: 1000;
  font-family: var(--font-primary);
  font-size: 14px;
}

#debug-info {
  position: fixed;
  bottom: 80px;
  left: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.9);
  color: #0f0;
  padding: 10px;
  border-radius: 5px;
  font-family: monospace;
  font-size: 10px;
  z-index: 10000;
  max-height: 150px;
  overflow-y: auto;
  display: none;
}

.slide-controls {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 16px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.85);
  padding: 10px 16px;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  margin-bottom: 8px;
}

.slide-controls button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.slide-controls button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.slide-controls button:active {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0.95);
}

.slide-controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#slide-info {
  color: white;
  font-family: var(--font-primary);
  font-size: 13px;
  min-width: 90px;
  text-align: center;
  white-space: nowrap;
}

.ra-content {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: var(--spacing-xs);
}

@media (min-width: 480px) {
  .slideshow-container {
    padding: var(--spacing-base);
  }

  .pdf-container {
    min-height: 55vh;
    min-height: 55dvh;
    border-radius: 10px;
  }

  .slide-controls {
    gap: 14px;
    padding: 12px 20px;
  }

  #slide-info {
    font-size: 14px;
    min-width: 100px;
  }
}

@media (min-width: 768px) {
  .slideshow-container {
    min-height: calc(100vh - var(--navbar-height) - 80px);
    padding: var(--spacing-base);
    border-radius: 10px;
  }

  .slide-display {
    padding-bottom: 80px;
  }

  .pdf-container {
    min-height: 65vh;
    height: 70vh;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }

  .slide-controls {
    left: var(--spacing-lg);
    transform: none;
    bottom: var(--spacing-lg);
    gap: 15px;
    padding: 12px 20px;
    margin-bottom: 0;
  }

  .slide-controls button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 20px;
  }

  #slide-info {
    min-width: 120px;
  }

  .ra-content {
    padding: var(--spacing-sm);
  }
}

@media (min-width: 1024px) {
  .slideshow-container {
    height: 95vh;
    min-height: auto;
    max-width: 1800px;
    margin: 1rem auto;
  }

  .slide-display {
    height: 100%;
    padding-bottom: 0;
  }

  .pdf-container {
    height: 80vh;
    min-height: auto;
  }

  .slide-controls {
    bottom: 20px;
    left: 20px;
  }

  .ra-content {
    max-width: 1900px;
    padding: 0.5rem;
  }
}

@media (min-width: 1400px) {
  .pdf-container {
    height: 85vh;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .slideshow-container {
    min-height: calc(100vh - var(--navbar-height));
    min-height: calc(100dvh - var(--navbar-height));
  }

  .pdf-container {
    height: calc(100vh - var(--navbar-height) - 80px);
    height: calc(100dvh - var(--navbar-height) - 80px);
    min-height: auto;
  }

  .slide-display {
    padding-bottom: 60px;
  }

  .slide-controls {
    padding: 8px 14px;
    gap: 10px;
  }

  .slide-controls button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: 16px;
  }

  #slide-info {
    font-size: 12px;
    min-width: 80px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .slide-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: none;
  }

  .slide-controls button:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
  }
}
