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

:root {
  --primary: #E91E63;
  --primary-dark: #C2185B;
  --secondary: #9C27B0;
  --accent: #FF4081;
  --bg: #000;
  --text: #fff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --sheet-bg: #1C1C1E;
  --input-bg: #2C2C2E;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

/* ── Stories Wrapper ── */
.stories-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  overflow: hidden;
}

/* ── Progress Bars (Instagram style) ── */
.story-progress-bars {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
}

.progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.progress-segment-fill {
  width: 0;
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.progress-segment.active .progress-segment-fill {
  animation: progressFill 5s linear forwards;
}

.progress-segment.completed .progress-segment-fill {
  width: 100%;
}

@keyframes progressFill {
  to { width: 100%; }
}

/* ── Story Header ── */
.story-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.story-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-ring {
  position: relative;
  width: 38px;
  height: 38px;
  background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
  border-radius: 50%;
  padding: 2px;
  animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.profile-avatar {
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.profile-time {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.story-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.story-close:active {
  transform: scale(0.9);
  background: rgba(0, 0, 0, 0.5);
}

/* ── Video Container ── */
.story-video-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.story-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

/* DejaCast player injects video.js tree (not native <video>); force cover-fill */
.story-video-container .dejacast-embed,
.story-video-container .dejacast-embed .video-js,
.story-video-container .dejacast-embed .video-js .vjs-tech,
.story-video-container .dejacast-embed .video-js video,
.story-video-container .dejacast-embed .video-js .vjs-poster {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  padding-top: 0 !important;
}

.story-video-container .dejacast-embed .video-js .vjs-tech,
.story-video-container .dejacast-embed .video-js video {
  object-fit: cover;
}

.story-video-container .dejacast-embed .video-js .vjs-poster {
  background-size: cover !important;
}

.gradient-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
  pointer-events: none;
  z-index: 10;
}

/* ── Story Content ── */
.story-content {
  position: absolute;
  bottom: 120px;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 20px;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease-out 0.5s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.story-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.story-title {
  font-size: 42px;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
  letter-spacing: -0.5px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.heart-icon {
  font-size: 36px;
  color: var(--accent);
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1); }
  50% { transform: scale(1); }
}

.story-subtitle {
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

/* ── Tap Zones ── */
.tap-zone {
  position: absolute;
  top: 60px;
  bottom: 160px;
  width: 30%;
  z-index: 50;
  cursor: pointer;
}

.tap-left {
  left: 0;
}

.tap-right {
  right: 0;
}

/* ── Start Overlay ── */
.story-start {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s, visibility 0.4s;
}

.story-start.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-content {
  text-align: center;
  padding: 40px;
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.start-avatar-large {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.start-names {
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.start-date {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 32px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.2);
}

.start-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: white;
  color: #764ba2;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: all 0.2s;
}

.start-play-btn:active {
  transform: scale(0.95);
}

/* ── Sound Prompt ── */
.sound-prompt {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.sound-prompt.visible {
  opacity: 1;
  visibility: visible;
  animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.sound-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.2s;
}

.sound-btn:active {
  transform: scale(0.95);
}

/* ── Reaction Bubbles ── */
.reaction-bubbles {
  position: absolute;
  bottom: 160px;
  left: 0;
  right: 0;
  height: 300px;
  z-index: 30;
  pointer-events: none;
}

.reaction {
  position: absolute;
  font-size: 32px;
  animation: floatUp 3s ease-out forwards;
  opacity: 0;
}

@keyframes floatUp {
  0% {
    bottom: 0;
    opacity: 1;
    transform: translateX(0) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translateX(var(--drift, 20px)) scale(1);
  }
  100% {
    bottom: 300px;
    opacity: 0;
    transform: translateX(var(--drift, 20px)) scale(0.8);
  }
}

/* ── Story Actions ── */
.story-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  gap: 8px;
  padding: 16px 12px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
}

.story-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.story-action-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.25);
}

.story-action-btn--primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.story-action-btn--primary:active {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

/* ── Backdrop ── */
.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 300;
}

.backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* ── Sheet ── */
.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--sheet-bg);
  border-radius: 24px 24px 0 0;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 400;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet.active {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  margin: 12px auto 20px;
}

.sheet-content {
  padding: 0 20px 24px;
}

.sheet-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.sheet-title {
  font-size: 24px;
  font-weight: 700;
  color: white;
  text-align: center;
  flex: 1;
}

.sheet-close-x {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.sheet-close-x:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.15);
}

/* ── Event Card ── */
.event-card {
  background: var(--input-bg);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.event-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.event-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.event-icon--ceremony {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.event-icon--party {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.event-name {
  font-size: 17px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.event-time {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
}

.event-location {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-left: 56px;
}

.event-maps-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 56px;
  transition: all 0.2s;
}

.event-maps-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.98);
}

.sheet-note {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin: 20px 0;
}

.sheet-close-btn {
  width: 100%;
  padding: 16px;
  background: var(--input-bg);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.sheet-close-btn:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.15);
}

/* ── Form ── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-bottom: 10px;
}

.optional-label {
  font-weight: 400;
  color: var(--text-secondary);
}

.toggle-buttons {
  display: flex;
  gap: 12px;
}

.toggle-btn {
  flex: 1;
}

.toggle-btn input {
  display: none;
}

.toggle-btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--input-bg);
  border: 2px solid transparent;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.toggle-btn input:checked + .toggle-btn-inner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.guest-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--input-bg);
  border-radius: 16px;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s;
}

.stepper-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.15);
}

.stepper-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stepper-number {
  font-size: 32px;
  font-weight: 700;
  color: white;
}

.stepper-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 16px 18px;
  background: var(--input-bg);
  border: 2px solid transparent;
  border-radius: 16px;
  color: white;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(233, 30, 99, 0.4);
  transition: all 0.2s;
  margin-top: 28px;
}

.submit-btn:active {
  transform: scale(0.98);
  box-shadow: 0 4px 16px rgba(233, 30, 99, 0.4);
}

/* ── Success Modal ── */
.success-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.success-modal.visible {
  opacity: 1;
  visibility: visible;
}

.success-content {
  width: 90%;
  max-width: 340px;
  padding: 40px 32px;
  background: var(--sheet-bg);
  border-radius: 24px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-modal.visible .success-content {
  transform: scale(1);
}

.success-check {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  animation: successPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.success-title {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
}

.success-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 28px;
}

.success-close-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.success-close-btn:active {
  transform: scale(0.98);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  max-width: 320px;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  color: white;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  z-index: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Animations & Effects ── */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

/* ── Responsive ── */
@media (max-width: 380px) {
  .story-title {
    font-size: 36px;
  }
  
  .story-subtitle {
    font-size: 16px;
  }
  
  .story-action-btn {
    font-size: 10px;
    padding: 10px 6px;
  }
}
