/* ============================================
   E-Ranyx Overview — PDF slide player
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --purple-900: #0B0615;
  --purple-800: #140A23;
  --purple-600: #3A1B6B;
  --purple-400: #7C45D4;
  --accent-gold: #E8C872;
  --white: #FFFFFF;
  --font-ui: 'Outfit', 'Noto Sans TC', sans-serif;
  --font-body: 'Noto Sans TC', 'Outfit', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --chrome-h: 56px;
  --bottom-zone: 120px;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--purple-900);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124, 69, 212, 0.35), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(91, 192, 190, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 110%, rgba(232, 200, 114, 0.08), transparent 45%);
}

img {
  max-width: 100%;
  display: block;
}

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

button {
  font: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

.ov-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ov-stars span {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  animation: ovTwinkle 3.5s ease-in-out infinite;
}

@keyframes ovTwinkle {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 0.95;
  }
}

.ov-chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--chrome-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(0.75rem, 2vw, 1.5rem);
  background: linear-gradient(to bottom, rgba(11, 6, 21, 0.88), transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
}

body.ov-top-on .ov-chrome {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ov-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.ov-brand img {
  height: 36px;
  width: auto;
}

.ov-brand-text {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ov-chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.ov-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
}

.ov-lang button {
  color: rgba(255, 255, 255, 0.7);
  padding: 0.2rem 0.15rem;
  transition: color 0.2s ease;
}

.ov-lang button:hover,
.ov-lang button.is-active {
  color: var(--white);
}

.ov-lang button.is-active {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ov-lang-sep {
  opacity: 0.4;
}

.ov-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  transition: transform 0.25s var(--ease), background 0.2s ease;
}

.ov-btn:hover {
  transform: translateY(-1px);
}

.ov-btn-ghost {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ov-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.ov-btn-solid {
  color: var(--purple-900);
  background: var(--white);
}

.ov-btn-solid:hover {
  background: var(--accent-gold);
}

.ov-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 50;
  background: rgba(255, 255, 255, 0.08);
}

.ov-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--purple-400), var(--accent-gold));
  transition: width 0.35s var(--ease);
  box-shadow: 0 0 12px rgba(232, 200, 114, 0.45);
}

/* ---------- Stage / PDF canvas ---------- */
.ov-deck {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.ov-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Near full-bleed — chrome floats over the edges */
  padding: 0.35rem;
}

#ov-canvas[hidden] {
  display: none !important;
}

.ov-slide-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  line-height: 0;
}

.ov-slide-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 0.7rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  background: #12081f;
  user-select: none;
  -webkit-user-drag: none;
}

.ov-link-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.ov-hotlink {
  position: absolute;
  display: block;
  border-radius: 4px;
  /* Invisible but clickable; subtle cue on hover */
  background: transparent;
  cursor: pointer;
  z-index: 3;
}

.ov-hotlink:hover,
.ov-hotlink:focus-visible {
  outline: 2px solid rgba(232, 200, 114, 0.85);
  outline-offset: 2px;
  background: rgba(232, 200, 114, 0.12);
}

.ov-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 2;
  background: rgba(11, 6, 21, 0.35);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
}

.ov-loader[hidden] {
  display: none !important;
}

.ov-loader.is-error {
  color: #ffb4a8;
}

.ov-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-gold);
  animation: ovSpin 0.8s linear infinite;
}

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

/* Bottom edge cue — discoverable when controls are hidden */
.ov-edge-cue {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  z-index: 34;
  pointer-events: none;
  background: linear-gradient(to top, rgba(11, 6, 21, 0.55), transparent);
  opacity: 0.85;
  transition: opacity 0.25s ease;
}

body.ov-bottom-on .ov-edge-cue {
  opacity: 0;
}

/* ---------- Bottom nav (auto-reveal) ---------- */
.ov-nav {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translate(-50%, 28px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
  background: rgba(20, 10, 35, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  max-width: min(calc(100vw - 5.5rem), 720px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
}

body.ov-bottom-on .ov-nav {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.ov-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  transition: background 0.2s ease, transform 0.2s var(--ease);
  flex-shrink: 0;
}

.ov-nav-btn:hover:not(:disabled) {
  background: rgba(124, 69, 212, 0.45);
  transform: scale(1.05);
}

.ov-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ov-dots {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(52vw, 360px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 0.2rem 0.35rem;
  mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 10px), transparent);
}

.ov-dots::-webkit-scrollbar {
  display: none;
}

.ov-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: width 0.3s var(--ease), background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.ov-dot.is-active {
  width: 18px;
  border-radius: 999px;
  background: var(--accent-gold);
}

.ov-page-num {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 3.4rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  flex-shrink: 0;
}

.ov-autoplay {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 36px;
  padding: 0 0.7rem 0 0.55rem;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
  overflow: hidden;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ov-autoplay:hover {
  background: rgba(124, 69, 212, 0.35);
}

.ov-autoplay.is-on {
  color: var(--purple-900);
  background: linear-gradient(135deg, var(--accent-gold), #d4b45a);
  border-color: rgba(232, 200, 114, 0.85);
}

.ov-autoplay-icon {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
}

.ov-autoplay-pause,
.ov-autoplay.is-on .ov-autoplay-play {
  display: none;
}

.ov-autoplay.is-on .ov-autoplay-pause {
  display: block;
}

.ov-autoplay-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.ov-autoplay-track {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 3px;
  height: 2px;
  border-radius: 999px;
  background: rgba(11, 6, 21, 0.18);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ov-autoplay.is-on .ov-autoplay-track {
  opacity: 1;
}

.ov-autoplay-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: rgba(11, 6, 21, 0.55);
}

.ov-fab-dock {
  position: fixed;
  right: 0.85rem;
  bottom: 0.9rem;
  z-index: 45;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.55rem;
  max-height: calc(100vh - 1.2rem);
  opacity: 0;
  transform: translateY(28px);
  pointer-events: none;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
}

body.ov-bottom-on .ov-fab-dock {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ov-fab-main {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--purple-400), var(--purple-600));
  color: var(--white);
  box-shadow: 0 10px 30px rgba(85, 39, 153, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 0.3s var(--ease), background 0.25s ease;
  flex-shrink: 0;
}

body.ov-bottom-on .ov-fab-main:hover {
  transform: scale(1.06);
}

.ov-fab-dock.is-open .ov-fab-main {
  background: linear-gradient(145deg, var(--accent-gold), #c9a84a);
  color: var(--purple-900);
}

.ov-fab-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  width: max-content;
  max-width: min(78vw, 260px);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    max-height 0.35s var(--ease),
    opacity 0.25s ease,
    transform 0.28s var(--ease);
}

.ov-fab-dock.is-open .ov-fab-menu {
  max-height: min(70vh, 420px);
  opacity: 1;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: auto;
  transform: translateY(0);
  padding: 0.15rem 0.1rem 0.15rem 0;
  scrollbar-width: thin;
}

.ov-fab-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.6rem 0.95rem 0.6rem 0.65rem;
  border-radius: 999px;
  background: rgba(20, 10, 35, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.ov-fab-item > span:last-child {
  flex: 1 1 auto;
  min-width: 0;
}

.ov-fab-item:hover {
  background: rgba(85, 39, 153, 0.9);
}

.ov-fab-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.ov-hint {
  position: fixed;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  z-index: 33;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.38);
  pointer-events: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.25s ease;
}

body.ov-bottom-on .ov-hint {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .ov-stars span,
  .ov-spinner,
  .ov-progress-bar,
  .ov-chrome,
  .ov-nav,
  .ov-fab-dock {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 900px) {
  :root {
    --bottom-zone: 140px;
  }

  .ov-stage {
    padding: 0.2rem;
  }

  #ov-canvas {
    border-radius: 2px;
  }
}

@media (max-width: 640px) {
  .ov-brand-text {
    display: none;
  }

  .ov-btn-label {
    display: none;
  }

  .ov-nav {
    bottom: 0.75rem;
    left: 0.75rem;
    right: 4.6rem;
    width: auto;
    max-width: none;
    transform: translate(0, 28px);
  }

  body.ov-bottom-on .ov-nav {
    transform: translate(0, 0);
  }

  .ov-fab-dock {
    right: 0.65rem;
    bottom: 0.65rem;
  }

  .ov-fab-main {
    width: 48px;
    height: 48px;
  }

  .ov-dots {
    max-width: none;
  }

  .ov-autoplay-label {
    font-size: 0.68rem;
  }

  .ov-autoplay {
    padding: 0 0.55rem 0 0.45rem;
    height: 34px;
  }

  .ov-fab-menu {
    max-width: min(82vw, 240px);
  }

  .ov-fab-dock.is-open .ov-fab-menu {
    max-height: min(62vh, 380px);
  }

  .ov-hint {
    bottom: 0.35rem;
    font-size: 0.62rem;
  }
}
