/* ==========================================================================
   DEMUREGRAM FULLSCREEN STORY VIEWER & PRECISION ENGINE
   ========================================================================== */

/* Darkroom Viewport Overlay */
.story-viewport-overlay {
  position: fixed;
  inset: 0;
  background-color: #0e0e10;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
}

.story-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
}

.story-brand-title {
  font-family: 'Grand Hotel', cursive, -apple-system, sans-serif;
  font-size: 26px;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-decoration: none;
}

.btn-close-overlay {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 26px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-close-overlay:hover { opacity: 1; }

/* Center Display Stage */
.story-viewer-stage {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  position: relative;
  padding-bottom: 24px;
}

/* 9:16 Center Story Card */
.story-frame-active {
  position: relative !important;
  height: min(92vh, 860px) !important;
  aspect-ratio: 9 / 16 !important;
  width: calc(min(92vh, 860px) * 9 / 16) !important;
  max-width: 100vw !important;
  background-color: #000000 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9) !important;
  border: 1px solid #262626 !important;
}

@media (max-width: 768px) {
  .story-frame-active {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }
}

/* Header Progress Bars */
.story-progress-header {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 20;
}

.progress-track {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 2px;
}

/* Author Header & Action Icons */
.story-author-bar {
  position: absolute;
  top: 20px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
}

.author-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-username {
  font-weight: 600;
  font-size: 13px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  color: #ffffff;
}

.story-timestamp {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.story-action-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-ctrl {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.85;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
  padding: 4px;
}

.btn-ctrl:hover { opacity: 1; }

/* Media Stack & Slide Switching */
.story-media-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
}

/* Tap Zone Overlay Layer */
.story-tap-layer {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 10;
  pointer-events: auto;
}

.tap-zone {
  height: 100%;
  cursor: pointer;
}

.tap-left {
  width: 35%;
}

.tap-right {
  width: 65%;
}

.story-slide-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-slide-item.active {
  opacity: 1;
  visibility: visible;
}

.media-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Ensure interactive stickers sit above tap zones */
.story-sticker-card {
  z-index: 15 !important;
}

/* Question Sticker Component */
.question-sticker {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78%;
  background: #ffffff;
  border-radius: 16px;
  padding: 22px 16px 16px 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.sticker-avatar {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #ffffff;
}

.sticker-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sticker-prompt {
  color: #111111;
  font-weight: 700;
  font-size: 16px;
  margin: 6px 0 14px 0;
  line-height: 1.3;
}

.sticker-input-container input {
  width: 100%;
  background: #eef1f5;
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: #111111;
  outline: none;
  text-align: center;
}

.sticker-input-container input::placeholder {
  color: #8e8e93;
}

/* Footer Controls */
.story-footer-bar {
  position: absolute;
  bottom: 16px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 20;
}

.story-reply-input-wrapper {
  flex-grow: 1;
}

.story-reply-input-wrapper input {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  padding: 10px 18px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  backdrop-filter: blur(8px);
}

.story-reply-input-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.85);
}

.btn-footer-action {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  padding: 4px;
}

/* Bottom Progress Scrubber */
.story-scrubber-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.scrubber-head {
  width: 25%;
  height: 100%;
  background: #ffffff;
  border-radius: 2px;
}

/* Right Side Previews */
.story-preview-sidebar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
}

@media (max-width: 900px) {
  .story-preview-sidebar {
    display: none;
  }
}

.btn-next-user {
  position: absolute;
  left: -22px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform 0.2s, background 0.2s;
}

.btn-next-user:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.4);
}

.preview-story-card {
  position: relative;
  width: 145px;
  height: 250px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s, transform 0.2s;
  text-decoration: none;
  display: block;
}

.preview-story-card:hover {
  opacity: 0.95;
  transform: scale(1.02);
}

.preview-backdrop {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: blur(6px) brightness(0.55);
}

.preview-card-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  text-align: center;
  padding: 12px;
}

.preview-avatar-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  margin-bottom: 8px;
}

.preview-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #000;
}

.preview-username {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.preview-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
}


@media (max-width: 768px) {
  .story-viewport-overlay {
    background-color: #000000 !important;
  }
  .story-viewer-stage {
    padding: 0 !important;
  }
  .story-frame-active {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    border: none !important;
    aspect-ratio: unset !important;
  }
  .media-element,
  .story-media-viewport video,
  .story-media-viewport img {
    width: 100vw !important;
    height: 100% !important;
    object-fit: cover !important;
  }
}
