:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #cbd5e1;
  --paper: #ffffff;
  --navy: #1e3a8a;
  --navy-soft: #dbeafe;
  --live: #15803d;
  --hud-bg: rgba(9, 14, 26, 0.82);
  --hud-line: rgba(148, 163, 184, 0.28);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, #172033 0%, #0b0f19 52%, #05070c 100%);
  color: #f8fafc;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

#presentation {
  width: 100%;
  height: 100%;
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.slide {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.48);
}

#slideCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #ffffff;
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #0f172a;
  color: #cbd5e1;
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  letter-spacing: 0.04em;
  z-index: 10;
}

.loading-mark {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-top-color: #93c5fd;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.qr-overlay {
  position: absolute;
  top: 66%;
  left: 50%;
  z-index: 4;
  display: none;
  flex-direction: column;
  align-items: center;
  width: clamp(280px, 28%, 440px);
  padding: clamp(14px, 1.6vw, 24px);
  transform: translate(-50%, -50%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
  box-shadow: 0 18px 52px rgba(15, 23, 42, 0.24);
  color: var(--ink);
  text-align: center;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.slide[data-page="11"] .qr-overlay {
  display: flex;
  animation: qr-in 260ms ease-out both;
}

@keyframes qr-in {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.qr-kicker {
  margin-bottom: 12px;
  color: var(--navy);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(0.68rem, 0.75vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.qr-code {
  width: 100%;
  padding: 7px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}


.qr-live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid #e2e8f0;
  color: var(--muted);
  font-size: clamp(0.66rem, 0.72vw, 0.82rem);
}

.qr-live strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.live-dot.is-live {
  background: var(--live);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.16);
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.14); }
  50% { box-shadow: 0 0 0 6px rgba(21, 128, 61, 0.05); }
}

.hud {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  transform: translateX(-50%);
  background: var(--hud-bg);
  border: 1px solid var(--hud-line);
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  transition: opacity 220ms ease, transform 220ms ease;
}

body.ui-idle .hud {
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
}

body.ui-idle {
  cursor: none;
}

.hud-button {
  min-width: 38px;
  height: 36px;
  padding: 0 11px;
  color: #e2e8f0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.hud-button:hover,
.hud-button:focus-visible {
  background: rgba(148, 163, 184, 0.14);
  border-color: var(--hud-line);
  outline: none;
}

.hud-button-wide {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-indicator {
  min-width: 68px;
  padding: 0 6px;
  color: #cbd5e1;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hud-separator {
  width: 1px;
  height: 20px;
  margin: 0 3px;
  background: var(--hud-line);
}

.error-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 30;
  width: min(520px, 88vw);
  padding: 28px 32px;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border-top: 4px solid #b91c1c;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.error-panel h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.error-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .qr-overlay {
    width: 58%;
    padding: 12px;
  }

  .qr-kicker {
    margin-bottom: 8px;
  }

  .qr-live {
    margin-top: 8px;
    padding-top: 8px;
  }

  .hud {
    bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
