:root{
  --bg:#fbfbfb;
  --card:#fff;
  --ink:#111;
  --muted:#777;
  --line:#e8e8e8;
  --soft:#efefef;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
  background:var(--bg);
  color:var(--ink);
}

a{
  color:#000;
  text-decoration:none;
}
a:visited{
  color:#000;
}

.header{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(251,251,251,.92);
  backdrop-filter:saturate(180%) blur(14px);
  border-bottom:1px solid var(--line);
  padding: env(safe-area-inset-top) 0 0;
}

.headerInner{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  padding:12px 12px;
  gap:10px;
}

.navLeft{
  display:flex;
  align-items:center;
  justify-self:start;
  gap:8px;
}

.navRight{
  display:flex;
  align-items:center;
  justify-self:end;
}

.monthTitle{
  font-weight:700;
  letter-spacing:.2px;
  text-align:center;
  justify-self:center;
}

.navBtn{
  border:1px solid var(--line);
  background:#fff;
  color:#111;
  height:34px;
  min-width:38px;
  padding:0 10px;
  cursor:pointer;
  border-radius:8px;
}

.todayBtn{
  border:1px solid var(--line);
  background:#fff;
  color:#111;
  height:34px;
  min-width:38px;
  padding:0 10px;
  cursor:pointer;
  border-radius:8px;
}

.main{
  padding:12px;
  height:calc(100vh - 60px);
  display:flex;
  flex-direction:column;
}

.calendar{
  background:var(--card);
  border:1px solid var(--line);
  flex:1;
  display:flex;
  flex-direction:column;
}

.dow{
  display:grid;
  grid-template-columns:repeat(7, 1fr);
  border-bottom:1px solid var(--line);
  background:#fafafa;
}
.dow div{
  padding:10px 0;
  text-align:center;
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

.grid{
  display:grid;
  grid-template-columns:repeat(7, 1fr);
  grid-auto-rows: 1fr;
  flex:1;
}

.cell{
  position:relative;
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  background:#fff;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  isolation:isolate;
}
.cell:nth-child(7n){ border-right:0; }

.cell.outside{
  background:#fff;
}

.datebar{
  position:absolute;
  top:0; left:0; right:0;
  height:22px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  padding:0 6px 0 0;
  background:var(--soft);
  color:#000;
  font-size:12px;
  border-bottom:1px solid var(--soft);
  z-index:2;
}
.cell.outside .datebar{
  background:#fff;
  color:var(--soft);
  border-bottom:1px solid #f3f3f3;
}

.cell.today .datebar{
  background:var(--soft);
  color:#000;
  border-top:2px solid #555;
  border-left:2px solid #555;
  border-right:2px solid #555;
  border-bottom:1px solid var(--soft);
  font-weight:400;
  position:relative;
}
.cell.today{
  box-shadow: inset 0 0 0 2px #555;
}

.dotsWrap{
  position:absolute;
  top:30px;
  left:12px;
  right:auto;
  bottom:auto;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  gap:6px;
  z-index:7;
  pointer-events:none;
}
.dotsLine{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-start;
  align-items:center;
  gap:4px;
  min-height:10px;
  max-width:66px; /* 5 dots max per row: 5*10 + 4*4 */
}

.dot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
  flex:0 0 auto;
}

.dot-feed{
  background:#1b7141;
}

.dot-story{
  background:#d6e6c5;
}

.dot-probe{
  background:#cccccc;
}

.badges{
  position:absolute;
  left:6px;
  right:6px;
  top:28px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.badges{ display:none; }

.cell.outside .dotsWrap .dot{
  opacity:0.95;
}
.cell.today .dotsWrap{
  z-index:6;
}

/* Modal */
.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.38);
  display:none;
  z-index:50;
  padding:12px;
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.modal.open{ display:flex; align-items:center; justify-content:center; }

.sheet{
  width:min(860px, 100%);
  max-height: 92vh;
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  overflow:auto;
}

.sheetHeader{
  position:sticky;
  top:0;
  z-index:2;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px;
  border-bottom:1px solid var(--line);
}
.sheetTitle{
  font-weight:400;
}
.closeBtn,
.close{
  border:0;
  background:transparent;
  color:#b8b8b8;
  height:34px;
  min-width:34px;
  padding:0 8px;
  cursor:pointer;
  font-size:24px;
  line-height:1;
  font-weight:400;
  -webkit-appearance:none;
  appearance:none;
}
.closeBtn:hover,
.close:hover{ color:#9f9f9f; }
.closeBtn:active,
.close:active{ color:#8e8e8e; }
.closeBtn:focus,
.close:focus{ outline:none; box-shadow:none; }
.sheetBody{
  padding:12px;
}

/* Sections */
.section{
  border:0;
  background:#fff;
  margin:0 0 20px 0;
}
.sectionHeader{
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  background:#000;
  color:#fff;
  padding:10px;
  font-weight:700;
  text-align:center;
}

.sectionBody{
  padding:12px;
}

.feedPopupLayout{
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(280px, 40%);
  gap:12px;
  align-items:start;
}

.feedPopupCarousel{
  min-width:0;
}

.feedPopupTrack{
  display:flex;
  width:100%;
  overflow:hidden;
  background:#fff;
  border:1px solid var(--line);
  transition:transform .28s ease;
  will-change:transform;
  touch-action:pan-y;
}

.feedPopupSlide{
  flex:0 0 100%;
  width:100%;
  min-width:100%;
  max-width:100%;
}

.feedPopupImage{
  width:100%;
  height:100%;
  display:block;
  aspect-ratio:4 / 5;
  object-fit:cover;
  background:#eee;
}

.feedPopupRight{
  min-width:0;
  display:flex;
  flex-direction:column;
}

.feedPopupRight .label{
  margin-top:0;
}

.feedPopupRight .btnPrimary{
  margin-bottom:20px; /* more space between download button and first textarea block */
}

.feedPopupRight .label + textarea + .label{
  margin-top:14px; /* vertical gap between Post Caption and Hashtags label blocks */
}

.btnPrimary{
  width:100%;
  height:38px;
  border:1px solid #dfdfdf;
  background:#f7f7f7;
  color:#111;
  font-weight:500;
  font-size:13px;
  letter-spacing:0.01em;
  cursor:pointer;
  border-radius:8px;
  transition:background-color .15s ease, border-color .15s ease, transform .04s ease;
  margin-bottom:14px;
}
.btnPrimary:hover{
  background:#f1f1f1;
  border-color:#d2d2d2;
}
.btnPrimary:active{
  background:#ebebeb;
  transform:translateY(1px);
}
.btnPrimary:focus{
  outline:none;
  box-shadow:0 0 0 3px rgba(17,17,17,.08);
}

.label{
  margin:0;
  border:1px solid var(--line);
  padding:5px 6px;
  text-transform:uppercase;
  font-size:10px;
  letter-spacing:0.06em;
  color:#000;
  text-align:center;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
}

.sectionBody > .label + .label,
.sectionBody > textarea + .label,
.sectionBody > .storyItem + .label,
.sectionBody > .label:first-child{
  margin-top:18px;
}

.label + textarea{
  margin:0;
  border-top:0;
}

textarea{
  width:100%;
  border:1px solid var(--line);
  padding:5px 10px;
  font-size:16px; /* mobile default to prevent iOS zoom */
  min-height:54px;
  resize:vertical;
  outline:none;
}

/* Desktop */
@media (min-width: 768px){
  textarea{
    font-size:12px;
  }
}

textarea:focus{
  border-color:#111;
}

.copyRow{
  display:flex;
  gap:8px;
  align-items:center;
}
.copyBtn{
  border:1px solid var(--line);
  background:#fff;
  height:34px;
  padding:0 12px;
  cursor:pointer;
  white-space:nowrap;
}
.copyHint{
  font-size:12px;
  color:var(--muted);
}

/* Stories list */
.storyItem{
  margin:0 0 12px 0;
}
.storyImg{
  width:100%;
  aspect-ratio: 9 / 16;
  background:#eee;
  display:block;
  object-fit:cover;
}

/* Stories section spacing */
.storyItem .btnPrimary,
.storyItem textarea{
  margin-bottom:20px;
}

.storyItem textarea:last-of-type{
  margin-bottom:0;
}

.copyLabel{
  border-color:#d9d9d9;
  transition:border-color .15s ease;
}
.copyLabel.copied{
  border-color:#000;
}

@media (max-width: 900px){
  .modal{
    padding: 0;
  }
  .sheet{
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .feedPopupLayout{
    grid-template-columns:1fr;
    gap:10px;
  }

  .feedPopupRight .btnPrimary{
    width:100%;
  }
}

button,
a,
.closeBtn,
.close{
  color:inherit;
}
