/* Signal Exchange V2 — upgraded UX */
:root{
  color-scheme: light;
  --bg:#fafafa;
  --card:#ffffff;
  --text:#111111;
  --muted:#666666;
  --muted2:#777777;
  --border:#e7e7e7;
  --border2:#ededed;
  --border3:#e2e2e2;
  --topbg:rgba(250,250,250,.92);
  --shadow:0 12px 40px rgba(0,0,0,.08);
  --focus:0 0 0 4px rgba(0,0,0,.08);
}
body.dark{
  color-scheme: dark;
  --bg:#0b0c10;
  --card:#12131a;
  --text:#f3f4f6;
  --muted:#a1a1aa;
  --muted2:#9ca3af;
  --border:rgba(255,255,255,.10);
  --border2:rgba(255,255,255,.08);
  --border3:rgba(255,255,255,.10);
  --topbg:rgba(11,12,16,.76);
  --shadow:0 18px 70px rgba(0,0,0,.55);
  --focus:0 0 0 4px rgba(255,255,255,.12);
}

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

/* --- Mobile smoothness + touch UX (20260109M1) --- */
body{ -webkit-text-size-adjust: 100%; }

a, button, input, textarea, select{
  -webkit-tap-highlight-color: transparent;
}

.btn, .iconbtn, .ig-ico, .ig-btn, .socialbtn, .sheet-act, .seg button{
  touch-action: manipulation;
}

/* Disable hover-jank on touch devices */
@media (hover: none){
  .btn:hover, .socialbtn:hover, .iconbtn:hover{ transform:none; }
  .tile:hover{ box-shadow: none; }
  .tile-actions{ opacity:1; transform:none; }
}

/* Better iOS typing experience (avoid zoom) */
@media (max-width: 620px){
  input, textarea, select{ font-size: 16px; min-height: 44px; }
  .ig-search input{ min-height: 44px; }
}

/* Responsive embeds (detail view) */
.media{
  border:1px solid var(--border2);
  border-radius:16px;
  overflow:hidden;
  background: rgba(0,0,0,.03);
}
body.dark .media{ background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); }
.media iframe{ width:100%; border:0; display:block; }
.media.media-yt{ aspect-ratio: 16 / 9; }
.media.media-yt iframe{ width:100%; height:100%; }

/* Mobile bottom nav (one-hand friendly) */
.foot-desktop{ display:block; }
.foot-mobile{ display:none; }

@media (max-width: 620px){
  main{ padding-bottom: calc(92px + var(--safe-bot, 0px)); margin: 12px auto; }
  .ig-foot{ padding:0; }
  .foot-desktop{ display:none; }
  .foot-mobile{
    display:flex;
    position:fixed;
    left:0; right:0; bottom:0;
    z-index: 80;
    gap:6px;
    padding: 10px 10px calc(10px + var(--safe-bot, 0px));
    background: var(--topbg);
    border-top:1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .mnav{
    flex:1;
    min-width:0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:2px;
    padding:8px 6px;
    border-radius:14px;
    text-decoration:none;
    color:inherit;
    border:1px solid transparent;
  }
  .mnav:active{ transform: scale(.98); }
  .mnav:hover{ border-color: var(--border); background: rgba(127,127,127,.08); }
  .micon{ font-size: 18px; line-height: 1; }
  .mlabel{ font-size: 11px; line-height: 1.1; opacity: .85; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
}

/* Tighter list tiles on very small screens */
@media (max-width: 420px){
  .tile.list{ grid-template-columns: 116px 1fr; }
}
@media (max-width: 360px){
  .tile.list{ grid-template-columns: 104px 1fr; }
  .badge{ font-size: 11px; padding: 3px 7px; }
}


a{ color:inherit; text-decoration:none; }

@media (prefers-reduced-motion: no-preference){
  body, .card, .item, .btn, .ig-top, input, textarea, select{ transition: background .22s ease, border-color .22s ease, color .22s ease, transform .22s ease; }
}
@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior:auto !important; }
}

/* Top bar */
.ig-top{
  position:sticky; top:0; z-index:50;
  display:grid; grid-template-columns:1fr minmax(120px,520px) 1fr;
  align-items:center; gap:12px;
  padding:10px 14px;
  background:var(--topbg);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
.ig-left{ display:flex; align-items:center; gap:10px; }
.ig-logo{ font-weight:900; letter-spacing:.01em; }
.ig-pill{ font-size:12px; padding:3px 9px; border:1px solid var(--border); border-radius:999px; color:var(--muted); }

.ig-search input{
  width:100%;
  padding:9px 12px;
  border-radius:999px;
  border:1px solid var(--border3);
  background:var(--card);
  outline:none;
  color:inherit;
}
.ig-search input:focus{ box-shadow:var(--focus); }

.ig-nav{ display:flex; justify-content:flex-end; align-items:center; gap:10px; }
.ig-ico{
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px;
  border-radius:999px;
  border:1px solid transparent;
  cursor:pointer;
  user-select:none;
  background: transparent;
  color: inherit;
}
.ig-ico:hover{ border-color:var(--border); background:rgba(127,127,127,.08); }
.ig-btn{ border: 1px solid transparent; }

main{ max-width: 980px; margin: 16px auto; padding: 0 14px 36px; }
.view{ display:grid; gap:14px; }
.view.enter{ animation: viewIn .22s ease both; }
@keyframes viewIn{ from{ opacity:.0; transform: translateY(6px);} to{ opacity:1; transform: translateY(0);} }

.animate-in{ animation: popIn .28s ease both; }
@keyframes popIn{ from{ opacity:0; transform: translateY(6px);} to{ opacity:1; transform: translateY(0);} }

/* Alerts / toasts */
.alerts{ position: fixed; top: 64px; right: 14px; z-index: 200; display:grid; gap:10px; max-width: 340px; }
.alert{
  padding:10px 12px;
  border:1px solid var(--border);
  background:var(--card);
  border-radius:14px;
  box-shadow:var(--shadow);
  font-size:13px;
}
.alert.bad{ border-color: rgba(255, 70, 70, .35); }

/* Cards + basics */
.card{
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--card);
  overflow:hidden;
}
.cardpad{ padding:12px; }
.row{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.h{ margin:0; font-size:18px; font-weight:900; }
.muted{ color:var(--muted); }
.tiny{ font-size:12px; color:var(--muted2); }

.btn{
  border:1px solid var(--border);
  background:var(--card);
  color:inherit;
  padding:8px 12px;
  border-radius:999px;
  cursor:pointer;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0px) scale(.98); }
.btn.primary{
  background:var(--text);
  color:var(--bg);
  border-color:transparent;
}
body.dark .btn.primary{ background:#ffffff; color:#0b0c10; }
.btn.on{ border-color: rgba(240, 60, 120, .55); }
.btn.busy{ opacity:.65; cursor:progress; }


.field label{ display:block; font-size:12px; color:var(--muted); margin-top:10px; margin-bottom:6px; }
input, textarea, select{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border3);
  background:var(--card);
  outline:none;
  color:inherit;
}
input:focus, textarea:focus, select:focus{ box-shadow:var(--focus); }
textarea{ min-height:110px; resize:vertical; }

/* Feed layouts */
.grid{ display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:10px; }
@media (max-width: 860px){ .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px){ .grid{ grid-template-columns: repeat(1, minmax(0, 1fr)); } }
.grid.listmode{ grid-template-columns: 1fr; }

.tile{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  border:1px solid var(--border2);
  background:var(--card);
  min-height: 180px;
  display:block;
  transform: translateZ(0);
}
.tile:hover{ box-shadow: var(--shadow); }
.tile img{ width:100%; height:100%; object-fit:cover; display:block; filter:saturate(1.02); }
.tile .overlay{
  position:absolute; inset:0;
  display:flex; flex-direction:column; justify-content:flex-end;
  padding:12px;
  background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,.15) 55%, rgba(0,0,0,0));
  color:#fff;
}
.tile .ov-title{ font-weight:900; text-shadow: 0 1px 12px rgba(0,0,0,.45); }
.tile .ov-sub{ font-size:12px; opacity:.92; margin-top:2px; }
.tile .ov-badges{ display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.badge{
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(6px);
}
.chip{
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.14);
}

.tile-actions{
  position:absolute; top:10px; right:10px;
  display:flex; gap:6px; align-items:center;
  opacity:.0;
  transform: translateY(-4px);
}
.tile:hover .tile-actions{ opacity:1; transform: translateY(0); }
@media (max-width: 640px){
  .tile-actions{ opacity:1; transform:none; }
}
.iconbtn{
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.35);
  color:#fff;
  cursor:pointer;
}
.iconbtn:active{ transform: scale(.97); }

.iconbtn.on{ border-color: rgba(240, 60, 120, .55); }
.iconbtn.busy{ opacity:.65; cursor:progress; }

/* List tile variant */
.tile.list{
  min-height:auto;
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:10px;
}
.tile.list img{ height: 100%; min-height: 110px; }
.tile.list .overlay{
  position:relative; inset:auto;
  background:none;
  color:inherit;
  padding:12px;
}
.tile.list .ov-title{ text-shadow:none; }
.tile.list .ov-sub{ opacity:1; color:var(--muted); }
.tile.list .ov-badges .badge{ background: transparent; border-color: var(--border); color: inherit; }
.tile.list .tile-actions{
  position:absolute; top:10px; right:10px;
  opacity:1; transform:none;
}
.tile.list .iconbtn{
  border-color: var(--border);
  background: rgba(127,127,127,.10);
  color: inherit;
}

/* Items (statuses/comments) */
.list{ display:grid; gap:10px; }
.item{
  border:1px solid var(--border2);
  border-radius:14px;
  padding:10px;
  background:var(--card);
}
.item.highlight{ border-color: rgba(240, 60, 120, .45); }

/* Skeleton */
.skel{
  background: linear-gradient(90deg, rgba(127,127,127,.10), rgba(127,127,127,.18), rgba(127,127,127,.10));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius:14px;
}
@keyframes shimmer{ 0%{ background-position:200% 0; } 100%{ background-position:-200% 0; } }

/* Sheet / modal */
.backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  z-index: 250;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding: 14px;
}
.sheet{
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.sheet .sheet-hd{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
}
.sheet .sheet-title{ font-weight:900; }
.sheet .sheet-bd{ padding: 10px 10px 12px; display:grid; gap:8px; }
.sheet .sheet-act{
  width:100%;
  text-align:left;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  cursor:pointer;
}
.sheet .sheet-act:hover{ background: rgba(127,127,127,.10); }
.sheet .sheet-act.danger{ border-color: rgba(255, 70, 70, .35); }
.sheet .sheet-act .sub{ display:block; font-size:12px; color: var(--muted); margin-top:2px; }

/* Footer */
.ig-foot{ padding:14px; text-align:center; color:var(--muted2); }
.footlink{ text-decoration: underline; text-underline-offset: 3px; }
.dot{ opacity:.55; margin:0 8px; }


.iconbtn.danger{ border-color: rgba(255, 96, 96, .35); }

/* --- PATCH: V2 mobile header + safe areas (20251223K4) --- */
:root{
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

/* header safe top */
.ig-top{
  padding-top: calc(10px + var(--safe-top));
}

/* mobile: stack header and make icon row scroll instead of spilling off-screen */
@media (max-width: 620px){
  .ig-top{
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 8px;
  }
  .ig-left{ justify-content: space-between; }
  .ig-search{ width: 100%; }
  .ig-nav{
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    gap: 8px;
  }
  .ig-nav::-webkit-scrollbar{ display:none; }
  .ig-ico, .ig-btn{ width: 32px; height: 32px; font-size: 15px; }
}

/* extra small phones */
@media (max-width: 380px){
  .ig-logo{ font-size: 15px; }
  .ig-pill{ display:none; }
  .ig-ico, .ig-btn{ width: 30px; height: 30px; font-size: 14px; }
}

/* main/footer safe bottom */
main{ padding-bottom: calc(36px + var(--safe-bot)); }

/* Bottom sheet stays inside viewport + safe areas */
.backdrop{ padding-bottom: calc(14px + var(--safe-bot)); padding-top: calc(14px + var(--safe-top)); }
.sheet{ max-height: calc(86vh - var(--safe-top)); overflow:auto; }
/* --- /PATCH --- */


/* --- Signal Exchange additions (platform promos) --- */
.previewCard{ border:1px solid var(--border); border-radius:16px; padding:12px; background:var(--card); box-shadow: var(--shadow); }
.prevThumb{ width:92px; height:92px; border-radius:16px; object-fit:cover; border:1px solid var(--border2); flex:0 0 auto; }

.item.preview{ border:1px dashed var(--border3); }

.socials{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.socialbtn{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 10px;
  border:1px solid var(--border2);
  border-radius:999px;
  background:rgba(0,0,0,.03);
  font-size:13px;
}
body.dark .socialbtn{ background:rgba(255,255,255,.04); border-color:rgba(255,255,255,.12); }
.socialbtn:hover{ transform: translateY(-1px); }


/* --- Mobile polish v3 (20260109M2): quick composer + swipe + IO sentinel --- */
html{ scroll-behavior:smooth; }
body{ -webkit-tap-highlight-color: transparent; }
button, a, input, textarea, select{ touch-action: manipulation; }

.sentinel{ width:100%; height:1px; }

.to-top{
  position:fixed;
  right:12px;
  bottom:calc(98px + var(--safe-bot, 0px));
  z-index:85;
  display:none;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:var(--card);
  box-shadow: var(--shadow);
}
.to-top.show{ display:inline-flex; align-items:center; justify-content:center; }
@media (min-width: 621px){
  .to-top{ bottom:16px; }
}

.ig-nav .ig-ico.is-active,
.foot-mobile .mnav.is-active{
  border-color: var(--line);
  background: rgba(255,255,255,.06);
}
body.ig.dark .ig-nav .ig-ico.is-active,
body.ig.dark .foot-mobile .mnav.is-active{
  background: rgba(255,255,255,.04);
}

body.modal-open{ overflow:hidden; }

.qp-overlay{
  position:fixed;
  inset:0;
  z-index:120;
  display:none;
  background: rgba(0,0,0,.40);
  padding: calc(10px + var(--safe-top, 0px)) 10px calc(10px + var(--safe-bot, 0px)) 10px;
}
.qp-overlay.show{ display:flex; align-items:flex-end; justify-content:center; }
.qp-sheet{
  width:min(720px, 100%);
  max-height: 92vh;
  overflow:auto;
  background: var(--bg);
  border:1px solid var(--line);
  border-radius: 22px 22px 18px 18px;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  animation: qpIn .18s ease-out both;
}
@keyframes qpIn{
  from{ transform: translateY(26px); opacity:.0; }
  to{ transform: translateY(0px); opacity:1; }
}
.qp-handle{
  width: 52px;
  height: 5px;
  border-radius: 999px;
  margin: 10px auto 6px auto;
  background: rgba(255,255,255,.18);
}
body.ig.light .qp-handle{ background: rgba(0,0,0,.12); }
.qp-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 8px 14px 12px 14px;
}
.qp-title{ font-weight:700; letter-spacing:.2px; }
.qp-close{ padding:8px 10px; border-radius:12px; }
.qp-body{ padding: 0 14px 14px 14px; }

@media (max-width: 620px){
  input, textarea, select, button{ font-size:16px; } /* prevent iOS zoom */
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  .qp-sheet{ animation:none; transform:none; }
}


/* Clickable tag chips */
.tagchip{
  cursor:pointer;
  color:inherit;
  font:inherit;
  line-height:1;
  appearance:none;
  -webkit-appearance:none;
}
.tagchip:focus-visible{
  outline:2px solid rgba(255,255,255,.35);
  outline-offset:2px;
}


/* --- Artist Spotlight layout --- */
.sx-feed-grid{
  display:grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap:16px;
  align-items:start;
}
.sx-main{ min-width:0; }
.sx-side{ min-width:0; }
.sx-sticky{ position:sticky; top:86px; }
@media (max-width: 980px){
  .sx-feed-grid{ grid-template-columns: 1fr; }
  .sx-sticky{ position:static; top:auto; }
}



/* =========================
   Profile 2.0 (X/IG/FB mash)
   ========================= */
.profileCard{ position:relative; }
.profileCover{
  height:150px;
  position:relative;
  border-bottom:1px solid var(--border);
  background:
    radial-gradient(900px 220px at 10% 20%, rgba(255,255,255,.09), rgba(255,255,255,0) 55%),
    radial-gradient(700px 200px at 80% 10%, rgba(255,255,255,.06), rgba(255,255,255,0) 60%),
    linear-gradient(135deg, rgba(0,0,0,.55), rgba(0,0,0,.25));
}
.profileCard[style*="--accent-h"] .profileCover::before{
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(650px 260px at 10% 10%, hsla(var(--accent-h), 85%, 60%, .40), transparent 60%),
    radial-gradient(520px 240px at 85% 15%, hsla(calc(var(--accent-h) + 40), 85%, 60%, .24), transparent 62%);
  pointer-events:none;
}
.profileCover::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(to top, var(--card), rgba(0,0,0,0) 60%);
  pointer-events:none;
}
.profileTopBar{
  position:absolute;
  top:12px; left:12px; right:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  z-index:2;
}
.profileBody{
  position:relative;
  z-index:2;
  padding:0 14px 14px;
}
.profileAvatarRow{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-top:-44px;
  flex-wrap:wrap;
}
.profileAvatarRing{
  width:92px; height:92px;
  border-radius:50%;
  padding:3px;
  background:
    conic-gradient(
      from 180deg,
      hsla(var(--accent-h), 85%, 60%, .95),
      hsla(calc(var(--accent-h) + 60), 85%, 60%, .55),
      hsla(var(--accent-h), 85%, 60%, .95)
    );
}
.profileAvatar{
  width:100%; height:100%;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg);
  border:1px solid var(--border);
  font-weight:800;
  font-size:28px;
  letter-spacing:-1px;
  box-shadow:0 10px 25px rgba(0,0,0,.45);
}
.profileMeta{ margin-top:10px; }
.profileDisplay{
  font-size:22px;
  font-weight:800;
  line-height:1.1;
}
.profileHandle{
  margin-top:4px;
  color:var(--muted);
}
.profileBio{
  margin-top:10px;
  line-height:1.35;
}
.profileLinksWrap{ margin-top:10px; }
.profileSecondaryActions{
  margin-top:12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.profileStats{
  margin-top:12px;
  display:flex;
  gap:16px;
  flex-wrap:wrap;
}
.profileStat strong{ font-size:14px; }
.profileStat span{
  font-size:12px;
  color:var(--muted);
  margin-left:6px;
}
.profileTabs{
  display:flex;
  gap:10px;
  padding:12px 14px 0;
  border-bottom:1px solid var(--border);
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}
.profileTab{
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--text);
  text-decoration:none;
  white-space:nowrap;
  background:rgba(255,255,255,0);
}
.profileTab.active{
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.14);
}
.profilePostsCard .cardpad{ padding-top:14px; }
