/* === AlbaLove Instagram-Style Stories Rail === */
#chat .chat-view .albalove-story-rail:not([hidden]),
.albalove-kiwiirc .kiwi-workspace .albalove-story-rail:not([hidden]) {
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 5.25rem;
  box-sizing: border-box;
  padding: 0.6rem 0.85rem;
  background: #14100f;
  border-bottom: 1px solid #2a2422;
  scrollbar-width: none;
}
.albalove-story-rail::-webkit-scrollbar { display: none; }

.albalove-story-circles {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.albalove-story-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  width: 4.35rem;
  gap: 0.28rem;
  padding: 0.05rem;
  border: 0;
  background: transparent;
  color: #ede3d3;
  font: 500 0.72rem/1.25 "Geist", system-ui, sans-serif;
  cursor: pointer;
  transition: transform 0.16s ease;
}
.albalove-story-circle:hover { transform: translateY(-1px); }
.albalove-story-circle:active { transform: scale(0.96); }

.albalove-story-circle > span:last-child {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* Instagram gradient ring */
.albalove-story-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.55rem;
  height: 3.55rem;
  padding: 2.5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f58529 0%, #dd2a7b 48%, #dc1e2e 100%);
  box-sizing: border-box;
  flex: none;
}
.albalove-story-ring-inner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #14100f;
  background: radial-gradient(circle at 30% 25%, #5b1821, #211416);
  color: #f6efe4;
  font: 600 1.15rem/1 "Geist", system-ui, sans-serif;
  overflow: hidden;
  box-sizing: border-box;
}
.albalove-story-ring-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.albalove-story-plus {
  background: #2a2422;
}
.albalove-story-plus .albalove-story-ring-inner {
  background: #1c1817;
  color: #ff7a83;
  font-size: 1.55rem;
  font-weight: 400;
  border: 1.5px dashed #74343a;
}

/* === Fullscreen Instagram Story Modal === */
.albalove-stories {
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0.75rem;
  border: 0;
  background: transparent;
  color: #f6efe4;
  font-family: "Geist", system-ui, sans-serif;
  color-scheme: dark;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.albalove-stories:not([open]) { display: none; }
.albalove-stories::backdrop {
  background: rgba(7, 5, 5, 0.92);
  backdrop-filter: blur(10px);
}
.albalove-stories [hidden] { display: none !important; }

/* 9:16 Story Viewer Card */
.albalove-story-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 410px);
  height: min(90dvh, 730px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0b0707;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Top Progress + Author Overlay */
.albalove-story-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 0.65rem 0.75rem 2.25rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%);
  pointer-events: none;
}
.albalove-story-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 0.6rem;
}
.albalove-story-seg {
  flex: 1 1 0;
  height: 2.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.albalove-story-seg-fill {
  width: 0%;
  height: 100%;
  background: #ffffff;
  border-radius: 999px;
  will-change: width;
}
.albalove-story-seg.done .albalove-story-seg-fill { width: 100%; }

.albalove-story-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: auto;
}
.albalove-story-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.albalove-story-avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #dc1e2e, #651620);
  color: #fff7f5;
  font: 600 0.85rem/1 "Geist", system-ui, sans-serif;
  flex: none;
}
.albalove-story-author {
  color: #ffffff;
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.albalove-story-time {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  flex: none;
}
.albalove-story-paused-badge {
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 600;
}
.albalove-story-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
}
.albalove-story-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(20, 16, 15, 0.65);
  color: #f6efe4;
  font: 600 0.8rem/1 "Geist", system-ui, sans-serif;
  cursor: pointer;
}
.albalove-story-icon-btn:hover { background: rgba(220, 30, 46, 0.75); border-color: #ff5260; }
.albalove-story-close { font-size: 1.15rem; width: 2rem; padding: 0; }

/* Story Media & Text Canvas */
.albalove-story-canvas {
  position: relative;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 25%, #3d1118 0%, #170e10 55%, #0b0707 100%);
  overflow: hidden;
}
.albalove-story-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0b0707;
}
.albalove-story-text-only {
  padding: 4.5rem 1.75rem 3rem;
  text-align: center;
  color: #f6efe4;
  font: 500 clamp(1.2rem, 3.2vw, 1.55rem)/1.45 "Geist", system-ui, sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}
.albalove-story-caption-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 3rem 1.1rem 1.15rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.45) 60%, transparent 100%);
  color: #f6efe4;
  font-size: 0.96rem;
  line-height: 1.45;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}

/* Tap zones + desktop hover arrows */
.albalove-story-tap {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 32% 68%;
}
.albalove-story-tap > div { cursor: pointer; }
.albalove-story-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(11, 7, 7, 0.58);
  color: #ffffff;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.albalove-story-nav:hover { opacity: 1; background: rgba(220, 30, 46, 0.8); }
.albalove-story-nav.prev { left: 0.55rem; }
.albalove-story-nav.next { right: 0.55rem; }
.albalove-story-nav:disabled { opacity: 0.2; cursor: default; }

/* === Composer Card === */
.albalove-story-composer-card {
  box-sizing: border-box;
  width: min(100%, 410px);
  padding: 1.25rem;
  border-radius: 18px;
  border: 1px solid #2a2422;
  background: #14100f;
  color: #f6efe4;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.85);
}
.albalove-stories-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.albalove-stories-heading h2 {
  margin: 0;
  color: #f6efe4;
  font: 400 1.85rem/1.1 "Instrument Serif", Georgia, serif;
}
.albalove-stories-status {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(220, 30, 46, 0.14);
  border: 1px solid rgba(220, 30, 46, 0.35);
  color: #ffd5d8;
  font-size: 0.88rem;
}
.albalove-stories-status:empty { display: none; }

.albalove-story-form {
  display: grid;
  gap: 0.75rem;
}
.albalove-story-form-note {
  margin: 0;
  color: #c8b9ad;
  font-size: 0.84rem;
}
.albalove-story-form label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #ede3d3;
}
.albalove-story-form textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 0.65rem 0.75rem;
  resize: vertical;
  border: 1px solid #3c2f2c;
  border-radius: 10px;
  background: #0b0707;
  color: #f6efe4;
  font: inherit;
}
.albalove-story-form textarea:focus {
  outline: none;
  border-color: #dc1e2e;
}
.albalove-story-preview-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2422;
  background: #0b0707;
}
.albalove-story-preview-wrap img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}
.albalove-story-preview-clear {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(11, 7, 7, 0.78);
  color: #f6efe4;
  font-size: 0.75rem;
  cursor: pointer;
}
.albalove-story-submit {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 10px;
  background: #dc1e2e;
  color: #fff7f5;
  font: 600 0.95rem/1.2 "Geist", system-ui, sans-serif;
  cursor: pointer;
}
.albalove-story-submit:hover { background: #a01421; }
.albalove-story-submit:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 500px) {
  .albalove-stories { padding: 0; }
  .albalove-story-stage {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .albalove-story-nav { display: none; }
}
