/* ================================================================
   PRIYO STORY — STORIES (rail + full-screen viewer)
   ================================================================ */

/* ---------------- rail ---------------- */
.story-card{ cursor:pointer; }
.st-thumb{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover;
  display:block;
}
.st-textthumb{
  display:flex; align-items:center; justify-content:center;
  padding:14px 10px;
  text-align:center;
  color:#fff;
  font-size:15.5px; font-weight:700;
  line-height:1.45;
  word-break:break-word;
}
.story-card.st-own .story-avatar-ring{ box-shadow:0 0 0 2.5px var(--green, #1a7a4c); }

/* ---------------- upload preview ---------------- */
.st-prev{
  border-radius:12px;
  overflow:hidden;
  background:#0e1512;
  max-height:320px;
  display:flex; align-items:center; justify-content:center;
}
.st-prev img, .st-prev video{
  width:100%;
  max-height:320px;
  object-fit:contain;
  display:block;
}

/* ================================================================
   VIEWER
   ================================================================ */
.st-viewer{
  position:fixed; inset:0;
  z-index:10005;
  background:#0a0d0b;
  display:none;
  align-items:center; justify-content:center;
  opacity:0;
  transition:opacity .2s ease;
  font-family:'Hind Siliguri', sans-serif;
}
.st-viewer.open{ display:flex; }
.st-viewer.shown{ opacity:1; }

.st-stage{
  position:relative;
  width:min(430px, 100%);
  height:min(100%, calc(100vh - 40px));
  background:#000;
  border-radius:16px;
  overflow:hidden;
  display:flex; align-items:center; justify-content:center;
}

.st-media{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:#000;
}
.st-media img, .st-media video{
  width:100%; height:100%;
  object-fit:contain;      /* never crop a story */
  display:block;
}
.st-textslide{
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  padding:40px 26px;
  text-align:center;
  color:#fff;
  font-size:24px; font-weight:700;
  line-height:1.55;
  word-break:break-word;
}

/* progress bars */
.st-bars{
  position:absolute;
  top:0; left:0; right:0;
  display:flex; gap:4px;
  padding:10px 10px 0;
  padding-top:calc(10px + env(safe-area-inset-top, 0px));
  z-index:14;
}
.st-bar{
  flex:1;
  height:3px;
  background:rgba(255,255,255,.32);
  border-radius:3px;
  overflow:hidden;
}
.st-bar > i{ display:block; height:100%; width:0%; background:#fff; }
.st-bar.done > i{ width:100%; }

/* header */
.st-top{
  position:absolute;
  top:0; left:0; right:0;
  padding:22px 12px 0;
  padding-top:calc(22px + env(safe-area-inset-top, 0px));
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  z-index:13;
  background:linear-gradient(180deg, rgba(0,0,0,.62) 0%, rgba(0,0,0,0) 100%);
  pointer-events:none;
}
.st-top > *{ pointer-events:auto; }
.st-who{ display:flex; align-items:center; gap:9px; min-width:0; }
.st-who-pic{
  width:34px; height:34px; border-radius:50%;
  overflow:hidden; flex-shrink:0;
  border:2px solid #fff; background:#333;
}
.st-who-pic img{ width:100%; height:100%; object-fit:cover; display:block; }
.st-who-name{ font-size:16.5px; font-weight:700; color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.6); }
.st-who-time{ font-size:14px; color:rgba(255,255,255,.8); }
.st-tools{ display:flex; gap:6px; flex-shrink:0; }
.st-btn{
  width:34px; height:34px; border-radius:50%;
  border:none; background:rgba(255,255,255,.16);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  transition:background .16s ease;
}
.st-btn:hover{ background:rgba(255,255,255,.32); }
.st-btn svg{ width:17px; height:17px; }

/* caption */
.st-caption{
  position:absolute;
  left:0; right:0; bottom:0;
  padding:34px 16px 20px;
  padding-bottom:calc(20px + env(safe-area-inset-bottom, 0px));
  color:#fff;
  font-size:17px; line-height:1.55;
  background:linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.78) 100%);
  z-index:12;
  word-break:break-word;
  pointer-events:none;
}

/* tap zones */
.st-zone{
  position:absolute;
  top:56px; bottom:0;
  width:34%;
  border:none; background:transparent;
  cursor:pointer;
  z-index:10;
  -webkit-tap-highlight-color:transparent;
}
.st-prevzone{ left:0; }
.st-nextzone{ right:0; width:50%; }

/* side arrows (desktop) */
.st-arrow{
  position:absolute;
  width:44px; height:44px; border-radius:50%;
  border:none; background:rgba(255,255,255,.14);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; z-index:16;
  transition:background .16s ease, opacity .16s ease;
}
.st-arrow:hover{ background:rgba(255,255,255,.3); }
.st-arrow[disabled]{ opacity:.22; cursor:default; }
.st-arrow svg{ width:20px; height:20px; }
.st-prev{ left:max(14px, calc(50% - 300px)); top:50%; transform:translateY(-50%); }
.st-next{ right:max(14px, calc(50% - 300px)); top:50%; transform:translateY(-50%); }

.st-viewer.paused .st-bars,
.st-viewer.paused .st-top,
.st-viewer.paused .st-caption{ opacity:0; transition:opacity .2s ease; }

/* ---------------- responsive ---------------- */
@media (max-width:700px){
  .st-stage{
    width:100%; height:100%;
    border-radius:0;
  }
  .st-arrow{ display:none; }
  .st-textslide{ font-size:22px; padding:34px 20px; }
}
@media (max-width:380px){
  .st-who-name{ font-size:15.5px; }
  .st-btn{ width:31px; height:31px; }
  .st-btn svg{ width:15px; height:15px; }
  .st-textslide{ font-size:21px; }
}
@media (max-height:520px) and (orientation:landscape){
  .st-stage{ width:min(320px, 100%); }
  .st-caption{ padding-bottom:12px; }
}
@media (prefers-reduced-motion:reduce){
  .st-viewer{ transition:none; }
}

/* ================================================================
   MUSIC — picker in the composer, badge on the tile, label in the viewer
   ================================================================ */
.mu-bar{ display:flex; gap:8px; align-items:center; }
.mu-bar .mu-search{ flex:1; min-width:0; }
.mu-upload{
  width:44px; height:44px;
  border:1.5px solid var(--border, #e2e8e4);
  background:#fff;
  border-radius:10px;
  color:var(--green-dark, #0f5132);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
}
.mu-upload:hover{ background:var(--green-light, #e8f5ee); }
.mu-upload svg{ width:19px; height:19px; }

.mu-list{
  margin-top:9px;
  max-height:210px;
  overflow-y:auto;
  border:1px solid var(--border, #e2e8e4);
  border-radius:11px;
  background:#fbfdfc;
}
.mu-item{
  display:flex; align-items:center; gap:10px;
  padding:9px 11px;
  border-bottom:1px solid var(--border, #e2e8e4);
}
.mu-item:last-child{ border-bottom:none; }
.mu-play{
  width:34px; height:34px; border-radius:50%;
  border:none;
  background:var(--green-light, #e8f5ee);
  color:var(--green-dark, #0f5132);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
}
.mu-item.playing .mu-play{ background:var(--green-dark, #0f5132); color:#fff; }
.mu-play svg{ width:15px; height:15px; }
.mu-main{ flex:1; min-width:0; }
.mu-title{
  font-size:16.5px; font-weight:700;
  color:var(--text, #1f2a24);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.mu-sub{ font-size:14.5px; color:var(--muted, #6b7a72); }
.mu-pick{
  border:none;
  background:var(--green-dark, #0f5132);
  color:#fff;
  border-radius:8px;
  padding:7px 14px;
  font-family:inherit; font-size:15.5px; font-weight:700;
  cursor:pointer; flex-shrink:0;
}
.mu-pick:hover{ opacity:.92; }
.mu-none{ padding:18px 14px; font-size:16px; color:var(--muted, #6b7a72); text-align:center; line-height:1.6; }

.mu-chosen{
  display:flex; align-items:center; gap:10px;
  margin-top:9px;
  padding:10px 12px;
  border-radius:11px;
  background:var(--green-light, #e8f5ee);
  border:1px solid #bfe3ce;
}
.mu-note{
  width:34px; height:34px; border-radius:50%;
  background:#fff;
  color:var(--green-dark, #0f5132);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.mu-note svg{ width:16px; height:16px; }
.mu-clear{
  border:none; background:transparent;
  color:var(--muted, #6b7a72);
  width:30px; height:30px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
}
.mu-clear svg{ width:16px; height:16px; }

/* badge on the story tile */
.story-music{
  position:absolute;
  right:8px; top:8px;
  width:26px; height:26px;
  border-radius:50%;
  background:rgba(0,0,0,.55);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  z-index:4;
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
}
.story-music svg{ width:14px; height:14px; }

/* now-playing strip inside the viewer */
.st-music{
  position:absolute;
  left:12px; bottom:78px;
  display:flex; align-items:center; gap:7px;
  max-width:calc(100% - 24px);
  background:rgba(0,0,0,.5);
  color:#fff;
  font-size:15.5px; font-weight:600;
  padding:6px 12px;
  border-radius:20px;
  z-index:13;
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  pointer-events:none;
}
.st-music svg{ width:14px; height:14px; flex-shrink:0; }
.st-music span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

@media (max-width:700px){
  .mu-list{ max-height:180px; }
  .st-music{ bottom:88px; font-size:15px; }
}
@media (max-width:380px){
  .mu-pick{ padding:6px 10px; font-size:14.5px; }
  .mu-upload{ width:40px; height:40px; }
}
