/* Story trigger thumbnail */
#story-trigger {
  cursor: pointer;
}

#story-trigger img {
  width: 100%;
  object-fit: contain;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: opacity 0.2s;
}

#story-trigger img:hover {
  opacity: 0.8;
}

/* Story Gallery Container */
#story-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 26, 0.9);
  z-index: 9999;
  overflow: hidden;
}

#blur-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  background-blend-mode: darken;
  filter: blur(40px);
  z-index: 1;
}

@keyframes fillProgress {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

.story-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  z-index: 2;
}

.story-content {
  position: relative;
  width: 100%;
  max-width: 450px;
  aspect-ratio: 9 / 16;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.95);
  border-radius: 12px;
  overflow: hidden;
}

.story-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.story-page.active {
  opacity: 1;
  pointer-events: auto;
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.6), transparent);
  color: white;
  text-align: center;
  z-index: 2;
}

.story-title {
  font-size: 1.4em;
  font-weight: bold;
  margin: 0 0 8px 0;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.story-meta {
  font-size: 0.8em;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.progress-bars {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 3px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.4);
  z-index: 11;
  box-sizing: border-box;
}

.progress-bar {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: white;
  border-radius: 1px;
}

.progress-bar.active::after {
  animation: fillProgress var(--remaining-time, 5s) linear forwards;
  animation-play-state: running;
}

.progress-bar.active.paused::after {
  animation: none;
  width: var(--progress-width, 0%);
}

.progress-bar.completed::after {
  width: 100%;
}

.top-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 10px;
  z-index: 10;
  box-sizing: border-box;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.6), transparent);
  height: 80px;
}

.control-button {
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: auto;
}

.control-button:hover {
  opacity: 0.8;
}

.nav-buttons-container {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(500px + 150px);
  height: 100%;
  pointer-events: none;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-sizing: border-box;
}

.nav-button {
  position: relative;
  background: #fff;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  flex-shrink: 0;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.5);
}

#pages-container {
  position: relative;
  width: 100%;
  flex: 1;
}
