/* ============================================================
   THE CRAPS APP — v6 design system
   Dark, premium, social-first. Black dominant, casino green
   for activity, red strategic, gold punctuation.
   ============================================================ */

:root {
  --bg: #050706;
  --surface: #0B0F0D;
  --surface-2: #121814;
  --deep-green: #062A20;
  --mid-green: #087A51;
  --green: #00B875;
  --green-soft: rgba(0, 184, 117, 0.14);
  --red: #C8101E;
  --red-dark: #720A11;
  --gold: #C79A3B;
  --gold-2: #E4C069;
  --text: #F5F3ED;
  --muted: #A6AAA7;
  --faint: #6C716E;
  --line: rgba(245, 243, 237, 0.09);
  --on-green: #04120C;
  --line-strong: rgba(245, 243, 237, 0.16);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Manrope', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
}

html[data-theme='light'] {
  --bg: #F2F1EC;
  --surface: #FFFFFF;
  --surface-2: #ECEAE3;
  --deep-green: #0A3527;
  --green: #067A52;
  --green-soft: rgba(6, 122, 82, 0.12);
  --text: #101412;
  --muted: #5A615C;
  --faint: #8B928D;
  --line: rgba(16, 20, 18, 0.1);
  --on-green: #F5F3ED;
  --line-strong: rgba(16, 20, 18, 0.18);
  --shadow: 0 1px 2px rgba(16, 20, 18, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100dvh;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font-family: inherit; font-size: 15px; color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.link-btn { color: var(--green); font-weight: 600; font-size: 13px; }
[hidden] { display: none !important; }

::selection { background: var(--mid-green); color: #fff; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

/* ---------------- splash ---------------- */
#splash {
  position: fixed; inset: 0; z-index: 100;
  background: #050706;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  transition: opacity 0.5s ease;
}
#splash.gone { opacity: 0; pointer-events: none; }
.splash-logo { width: 132px; height: 132px; }
.splash-tag { color: #A6AAA7; font-size: 11px; letter-spacing: 0.32em; font-weight: 600; }

/* ---------------- shell ---------------- */
#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 0 84px;
}
.page { display: none; animation: page-in 200ms ease; }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0.4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* topbar — avatar | logo | space | notifs | create */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center;
  gap: 10px;
  padding: 7px 14px;
  max-width: 520px; margin: 0 auto;
}
.top-avatar { width: auto; min-width: 34px; height: 36px; justify-self: start; display: flex; align-items: center; }
.top-avatar .avatar { width: 32px; height: 32px; font-size: 12px; }
.top-avatar .btn-follow { white-space: nowrap; padding: 7px 12px; font-size: 12.5px; }
.top-brand { display: flex; align-items: center; }
.top-logo { width: 34px; height: 34px; }
.top-flex { flex: 1; }
.top-actions { display: flex; gap: 2px; justify-self: end; }
.top-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  color: var(--text);
}
.top-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.top-icon:active { background: var(--surface-2); }
.top-icon.solid { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg);
}

/* bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  max-width: 520px; margin: 0 auto;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 0; color: var(--muted); position: relative;
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
}
.bn-item svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bn-item.active { color: var(--green); }
.bn-post {
  align-self: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--green);
  color: var(--green);
  display: grid; place-items: center;
  margin: -6px 0 -2px;
  transition: transform 0.15s ease;
}
.bn-post:active { transform: scale(0.93); }
.bn-post svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.bn-badge {
  position: absolute; top: 2px; right: 22%;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff;
  border-radius: 8px; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}

/* desktop rail */
#rail { display: none; }
@media (min-width: 1024px) {
  #rail {
    display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 230px; padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    gap: 24px;
  }
  .rail-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
  .rail-logo { width: 40px; height: 40px; }
  .rail-name { font-weight: 800; font-size: 15px; letter-spacing: 0.05em; line-height: 1.2; }
  .rail-nav { display: flex; flex-direction: column; gap: 4px; }
  .rail-item {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 12px; border-radius: 10px;
    color: var(--muted); font-weight: 600; font-size: 15px;
    text-align: left;
  }
  .rail-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .rail-item.active { color: var(--text); background: var(--surface-2); }
  .rail-item.active svg { color: var(--green); }
  .rail-foot { margin-top: auto; font-size: 11px; color: var(--faint); padding: 0 8px; }
  #app, .topbar { max-width: 600px; }
  .top-brand { visibility: hidden; }
  .bottomnav { display: none; }
  #app { padding-bottom: 40px; }
}

/* ---------------- avatars ---------------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* neutral charcoal fallback when no profile photo */
.avatar-fb { background: #202721; color: var(--off-white, #F5F3ED); }
html[data-theme='light'] .avatar-fb { background: #DEDCD2; color: #101412; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 92px; height: 92px; font-size: 28px; }
.avatar-story { width: 54px; height: 54px; font-size: 18px; }

/* ---------------- home: tabs + stories ---------------- */
.feed-tabs {
  display: flex; gap: 18px;
  padding: 10px 18px 0;
}
.feed-tab {
  color: var(--faint); font-weight: 600; font-size: 14px;
  padding: 6px 2px 10px; position: relative;
}
.feed-tab.active { color: var(--text); }
.feed-tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; border-radius: 2px; background: var(--green);
}

.stories {
  display: flex; gap: 14px;
  overflow-x: auto; padding: 12px 18px 14px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }
.story {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 62px; flex-shrink: 0;
}
.story-ring { padding: 2px; border-radius: 50%; }
.story.crew .story-ring { background: linear-gradient(135deg, var(--gold), var(--gold-2)); }
.story.live .story-ring { background: var(--green); }
.story.muted .story-ring { background: var(--line-strong); }
.story .avatar { border: 2px solid var(--bg); }
.story-name { font-size: 11px; color: var(--muted); font-weight: 600; max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- post card ---------------- */
#feed { display: flex; flex-direction: column; }
.post {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 14px;
  animation: page-in 240ms ease;
}
.post-head { display: flex; align-items: center; gap: 10px; }
.post-avatar-btn { flex-shrink: 0; }
.post-user { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.post-name { font-weight: 700; font-size: 14px; }
.post-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--faint); flex-wrap: wrap; }
.post-place { color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.post-place svg { width: 11px; height: 11px; fill: none; stroke: var(--red); stroke-width: 2.2; }
.post-time { color: var(--faint); font-size: 12px; }
.post-head .top-icon { margin-left: auto; width: 30px; height: 30px; }
.post-head .top-icon svg { width: 17px; height: 17px; color: var(--muted); }

.post-copy { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.post-copy .hashtag { color: var(--gold-2); font-weight: 600; }
.post-checkin {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--deep-green); color: var(--text);
  border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; margin: 10px 0 0;
}
.post-checkin svg { width: 14px; height: 14px; fill: none; stroke: var(--green); stroke-width: 2; }

.post-photo { margin: 12px -16px 0; position: relative; }
.post-photo img, .post-photo video { width: 100%; max-height: 520px; object-fit: cover; }
.post-photo.is-video img { cursor: pointer; }
.vplay {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none;
}
.vplay span {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(5, 7, 6, 0.55);
  display: grid; place-items: center;
}
.vplay svg { width: 22px; height: 22px; fill: #fff; stroke: none; margin-left: 3px; }
.vdur {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(5, 7, 6, 0.75); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}

/* embedded meetup + group chips in feed */
.post-event {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; margin-top: 12px;
}
.post-event img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.post-event .pe-label { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; color: var(--gold-2); }
.post-event .pe-title { font-weight: 700; font-size: 13.5px; margin-top: 2px; }
.post-event .pe-when { color: var(--muted); font-size: 12px; margin-top: 2px; }
.post-event .pe-going { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 3px; }
.post-event .pe-going span { color: var(--green); }
.post-group {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 5px 12px 5px 5px;
  border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--text);
}
.post-group img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.post-group svg { width: 13px; height: 13px; fill: none; stroke: var(--gold-2); stroke-width: 2; }

/* engagement counts + actions */
.post-counts { margin-top: 12px; font-size: 13.5px; font-weight: 600; display: flex; gap: 4px; align-items: baseline; }
.post-counts b { font-weight: 800; }
.post-counts .pc-likes { display: inline-flex; align-items: center; gap: 4px; }
.post-counts .pc-likes svg { width: 14px; height: 14px; fill: var(--text); stroke: none; }
.post-counts .csep { color: var(--faint); margin: 0 3px; }
.post-counts .pc-cmts { color: var(--muted); font-weight: 600; }
.post-actions { display: flex; align-items: center; gap: 18px; margin-top: 10px; }
.pa {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 2px 0;
}
.pa svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pa.liked { color: var(--red); }
.pa.liked svg { fill: var(--red); stroke: var(--red); }
.pa.saved svg { fill: var(--gold); stroke: var(--gold); }
.pa:active { transform: scale(0.94); }
.pa-spacer { margin-left: auto; }

.post-comments { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.pc-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.pc-row .avatar { width: 24px; height: 24px; font-size: 10px; }
.pc-text b { font-weight: 700; margin-right: 5px; }
.pc-view { color: var(--faint); font-size: 13px; font-weight: 600; }

/* empty state */
.empty {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-emoji { font-size: 34px; margin-bottom: 10px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 300px; margin: 0 auto; }

/* ---------------- explore ---------------- */
.page-title-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 4px;
}
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.search-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 12px 18px 0; padding: 0 12px;
}
.search-ic { width: 17px; height: 17px; fill: none; stroke: var(--faint); stroke-width: 2; flex-shrink: 0; }
.search-row input {
  flex: 1; background: none; border: none; outline: none;
  padding: 10px 0;
}

.pills { display: flex; gap: 8px; padding: 14px 18px; overflow-x: auto; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.active { background: var(--green); border-color: var(--green); color: var(--on-green); }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 20px 18px 10px;
}
.section-title { font-size: 16px; font-weight: 800; }

/* explore: trending tags */
.tag-row { display: flex; gap: 8px; overflow-x: auto; padding: 0 18px 4px; scrollbar-width: none; }
.tag-chip {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; text-align: left; flex-shrink: 0;
}
.tag-chip b { display: block; color: var(--gold-2); font-size: 13px; }
.tag-chip span { font-size: 11px; color: var(--muted); }

/* explore: suggested players — horizontal carousel */
.player-strip {
  display: flex; gap: 14px;
  overflow-x: auto; padding: 2px 18px 6px; scrollbar-width: none;
}
.player-strip::-webkit-scrollbar { display: none; }
.pcard {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 76px; flex-shrink: 0;
}
.pcard-av { position: relative; }
.pcard-av .avatar { width: 60px; height: 60px; font-size: 19px; }
.pcard-name { font-size: 12px; font-weight: 700; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-sub { font-size: 10.5px; color: var(--faint); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .btn-follow { padding: 5px 12px; font-size: 12px; }

/* explore: people list */
.people-list { display: flex; flex-direction: column; padding: 0 18px; }
.person {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.person-info { flex: 1; min-width: 0; text-align: left; }
.person-name { font-weight: 700; font-size: 14px; }
.person-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-follow {
  background: var(--green); color: var(--on-green);
  font-weight: 700; font-size: 13px;
  padding: 7px 16px; border-radius: 8px;
}
.btn-follow.following {
  background: none; color: var(--muted);
  border: 1px solid var(--line-strong);
}

/* explore: trending editorial grid — mixed tile sizes, photography first */
.grid-ed {
  display: grid; grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 132px; gap: 3px; padding: 0 3px;
}
.grid-ed .gtile { position: relative; overflow: hidden; background: var(--surface-2); }
.grid-ed .gtile.tall { grid-row: span 2; }
.grid-ed .gtile.wide { grid-column: span 2; }
.grid-ed .gtile img { width: 100%; height: 100%; object-fit: cover; }
.grid-ed .glikes {
  position: absolute; bottom: 7px; left: 7px;
  display: flex; align-items: center; gap: 4px;
  color: #fff; font-size: 11.5px; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.grid-ed .glikes svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.grid-ed .glabel {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: var(--deep-green); padding: 8px;
  font-size: 11px; font-weight: 700; line-height: 1.35; color: var(--gold-2);
}

/* uniform 3-col grid (profile grid, video grid) */
.grid3 {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 3px; padding: 0 3px;
}
.grid3 .gtile { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); }
.grid3 .gtile img { width: 100%; height: 100%; object-fit: cover; }
.grid3 .gtile .glabel {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: var(--deep-green); padding: 8px;
  font-size: 11px; font-weight: 700; line-height: 1.35; color: var(--gold-2);
}
.grid3 .gtile .glikes {
  position: absolute; bottom: 6px; left: 6px;
  display: flex; align-items: center; gap: 4px;
  color: #fff; font-size: 11px; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.grid3 .gtile .glikes svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }
/* play badge on video tiles */
.gtile .gvplay {
  position: absolute; top: 7px; right: 7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(5, 7, 6, 0.55);
  display: grid; place-items: center;
}
.gtile .gvplay svg { width: 11px; height: 11px; fill: #fff; stroke: none; margin-left: 2px; }

/* explore: casino cards — photography dominates, text overlaid */
.casino-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px; }
.casino-card {
  position: relative; border-radius: var(--radius); overflow: hidden; text-align: left;
  aspect-ratio: 3/4; background: var(--surface-2);
}
.casino-photo { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.casino-shade { position: absolute; inset: 0; background: linear-gradient(rgba(5,7,6,0) 42%, rgba(5,7,6,0.88)); }
.casino-body { position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 12px; }
.casino-name { font-weight: 800; font-size: 14.5px; color: #fff; }
.casino-city { color: rgba(245,243,237,0.72); font-size: 12px; margin-top: 1px; }
.casino-activity { color: var(--green); font-size: 11.5px; font-weight: 600; margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.casino-activity::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* events */
.event-card {
  background: var(--surface); border: none;
  border-radius: var(--radius); overflow: hidden; margin: 0 18px 12px;
  box-shadow: 0 0 0 1px var(--line);
}
.event-photo { aspect-ratio: 16/8; width: 100%; object-fit: cover; }
.event-body { padding: 12px 14px; }
.event-title { font-weight: 800; font-size: 15px; letter-spacing: 0.01em; }
.event-when { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.event-when .dot { color: var(--faint); }
.event-going { color: var(--text); font-size: 13px; font-weight: 700; margin-top: 6px; }
.event-going span { color: var(--green); }
.event-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-going {
  background: var(--green); color: var(--on-green);
  font-weight: 700; font-size: 13px;
  padding: 8px 16px; border-radius: 8px;
}
.btn-going.going { background: none; color: var(--green); border: 1px solid var(--green); }
.btn-ghost {
  background: none; color: var(--muted);
  border: 1px solid var(--line-strong);
  font-weight: 600; font-size: 13px;
  padding: 8px 16px; border-radius: 8px;
}

/* groups */
.group-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; margin: 0 18px 10px;
}
.group-photo { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.group-info { flex: 1; min-width: 0; text-align: left; }
.group-name { font-weight: 800; font-size: 14px; }
.group-members { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------------- messages ---------------- */
#convo-list { padding: 4px 0; }
.convo-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 11px 18px; border-bottom: 1px solid var(--line);
}
.convo-info { flex: 1; min-width: 0; }
.convo-name { font-weight: 700; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.convo-preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.convo-preview.unread { color: var(--text); font-weight: 600; }
.convo-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.convo-time { color: var(--faint); font-size: 12px; }
.unread-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--green); color: var(--on-green);
  border-radius: 9px; font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}

.convo-head {
  position: sticky; top: 55px; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}
.convo-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.convo-spacer { width: 36px; }
.convo-msgs { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 10px; min-height: 46vh; }
.msg { max-width: 76%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4; word-break: break-word; }
.msg.them { background: var(--surface-2); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.me { background: var(--deep-green); border: 1px solid var(--line-strong); border-bottom-right-radius: 4px; align-self: flex-end; color: #F5F3ED; }
.msg.me .msg-time { color: rgba(245, 243, 237, 0.62); }
.msg-time { font-size: 10.5px; color: var(--faint); margin-top: 3px; }
.convo-form {
  position: sticky; bottom: 0;
  display: flex; gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.convo-form input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 10px 14px; outline: none;
}
.send-btn {
  background: var(--green); color: var(--on-green);
  font-weight: 800; font-size: 13px;
  padding: 0 16px; border-radius: 20px;
}

/* ---------------- profile ---------------- */
.profile-cover {
  position: relative; height: 160px;
  background-image:
    linear-gradient(rgba(5,7,6,0.82), rgba(5,7,6,0.94)),
    url('assets/img/craps-felt.jpg');
  background-size: cover; background-position: center;
}
html[data-theme='light'] .profile-cover {
  background-image:
    linear-gradient(rgba(16,20,18,0.72), rgba(16,20,18,0.88)),
    url('assets/img/craps-felt.jpg');
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { padding: 0 18px; position: relative; }
.profile-avatar-row { display: flex; align-items: flex-end; justify-content: space-between; margin-top: -46px; }
.profile-avatar-row .avatar-lg { border: 4px solid var(--bg); }
.profile-btns { display: flex; gap: 8px; padding-bottom: 6px; }
.btn-primary {
  background: var(--green); color: var(--on-green);
  font-weight: 800; font-size: 14px;
  padding: 9px 18px; border-radius: 9px;
  width: 100%;
}
.btn-primary:disabled { opacity: 0.5; }
.btn-secondary {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-strong);
  font-weight: 700; font-size: 14px;
  padding: 8px 16px; border-radius: 9px;
}
.profile-id { margin-top: 10px; }
.profile-name { font-size: 19px; font-weight: 800; }
.profile-handle { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.profile-meta { display: flex; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.profile-meta span { display: inline-flex; gap: 5px; align-items: center; }
.profile-meta svg { width: 13px; height: 13px; fill: none; stroke: var(--gold-2); stroke-width: 1.8; flex-shrink: 0; }
.profile-meta .pm-pin svg { stroke: var(--red); }
.profile-bio { margin-top: 8px; font-size: 14px; line-height: 1.5; }
.profile-stats {
  display: flex; gap: 26px; margin-top: 14px;
  padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stat b { font-size: 16px; font-weight: 800; }
.stat span { color: var(--muted); font-size: 12.5px; margin-left: 5px; }
.profile-tabs { display: flex; }
.ptab {
  flex: 1; text-align: center; padding: 11px 0;
  color: var(--faint); font-weight: 700; font-size: 12.5px; letter-spacing: 0.04em;
  border-bottom: 2px solid transparent;
}
.ptab.active { color: var(--text); border-bottom-color: var(--green); }
#profile-feed .post { animation: none; }

/* subhead (push pages) */
.subhead-row {
  position: sticky; top: 55px; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}
.subhead-row.overlay { background: linear-gradient(rgba(5,7,6,0.85), rgba(5,7,6,0)); border-bottom: none; position: sticky; top: 55px; backdrop-filter: blur(6px); color: #F5F3ED; }
.subhead-row.overlay .top-icon { color: #F5F3ED; }
.subhead-title { font-weight: 800; font-size: 15px; }

/* casino page */
.casino-hero { position: relative; }
.casino-hero img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.casino-hero-fade { position: absolute; inset: 0; background: linear-gradient(rgba(5,7,6,0.25), transparent 30%, var(--bg)); }
.casino-panel { padding: 14px 18px 0; }
.casino-h1 { font-size: 24px; font-weight: 800; }
.casino-city { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.casino-actions { display: flex; gap: 8px; margin-top: 12px; }
.casino-actions .btn-secondary { flex: 1; }
.btn-checkin {
  flex: 1.4; background: var(--green); color: var(--on-green);
  font-weight: 800; font-size: 13.5px;
  padding: 9px 12px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-checkin svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.casino-blurb { color: var(--muted); font-size: 13.5px; margin-top: 12px; line-height: 1.5; }
.here-row { display: flex; gap: 10px; padding: 12px 18px 0; align-items: center; }
.here-avatars { display: flex; }
.here-avatars .avatar { width: 30px; height: 30px; font-size: 11px; border: 2px solid var(--bg); margin-left: -7px; }
.here-avatars .avatar:first-child { margin-left: 0; }
.here-count { color: var(--muted); font-size: 12.5px; }
.here-recent { display: flex; align-items: center; gap: 7px; padding: 8px 18px 0; color: var(--muted); font-size: 12.5px; }
.here-recent::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.here-recent b { color: var(--text); font-weight: 700; }

/* group page */
.group-hero { position: relative; }
.group-hero img { width: 100%; aspect-ratio: 16/7; object-fit: cover; }
.group-panel { padding: 14px 18px 0; }
.group-h1 { font-size: 21px; font-weight: 800; }
.member-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 10px; padding: 10px 18px; }

/* post detail */
#post-body .post { border: none; }
.comment-form {
  position: sticky; bottom: 0;
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.comment-form input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 10px 14px; outline: none;
}
.all-comments { padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.ac-row { display: flex; gap: 10px; }
.ac-row .avatar { width: 30px; height: 30px; font-size: 11px; }
.ac-body { flex: 1; background: var(--surface-2); border-radius: 12px; border-top-left-radius: 4px; padding: 8px 12px; }
.ac-who { font-weight: 700; font-size: 13px; }
.ac-text { font-size: 13.5px; margin-top: 1px; word-break: break-word; }
.ac-time { color: var(--faint); font-size: 11px; margin-top: 3px; }

/* ---------------- modals ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: end center; }
@media (min-width: 640px) { .modal { place-items: center; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 4, 0.72); }
.modal-card {
  position: relative; width: 100%; max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px 14px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto;
}
@media (min-width: 640px) { .modal-card { border-radius: 14px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-title { font-weight: 800; font-size: 17px; }
.sheet-card { padding-bottom: 16px; }

/* composer */
.composer-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 700; font-size: 14px; }
#composer-text {
  width: 100%; background: none; border: none; outline: none; resize: none;
  font-size: 15px; line-height: 1.5; padding: 4px 0 8px;
}
.composer-photo-preview { position: relative; margin-bottom: 10px; }
.composer-photo-preview img { width: 100%; max-height: 300px; object-fit: cover; border-radius: 10px; }
.composer-photo-preview button {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(5, 7, 6, 0.75); color: #fff;
  display: grid; place-items: center;
}
.composer-row { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; flex-wrap: wrap; }
.composer-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 13px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.composer-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.composer-chip.on { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.composer-hint { color: var(--faint); font-size: 11.5px; margin-left: auto; }
.casino-picker {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin-bottom: 12px;
}
.casino-opt {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; text-align: left;
  font-size: 13px; font-weight: 600;
}
.casino-opt.on { border-color: var(--green); color: var(--green); background: var(--green-soft); }

/* auth */
.auth-card { text-align: center; padding-top: 22px; }
.auth-logo { width: 84px; height: 84px; margin: 0 auto 14px; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 3px;
  margin-bottom: 16px;
}
.auth-tab { padding: 8px; border-radius: 7px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.auth-tab.active { background: var(--green); color: var(--on-green); }
.field { text-align: left; margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.06em; }
.field input {
  width: 100%; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 11px 12px; outline: none;
}
.field input:focus { border-color: var(--green); }
.field textarea, .modal textarea {
  width: 100%; min-height: 84px; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 11px 12px; outline: none; resize: vertical;
}
.field textarea:focus, .modal textarea:focus { border-color: var(--green); }
.auth-note { color: var(--faint); font-size: 11.5px; margin-top: 12px; }
.auth-link-row { margin-top: 10px; text-align: center; }
.auth-link-row a { color: var(--green); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.auth-link-row a:hover { text-decoration: underline; }

/* notifications */
.notif-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.notif-row:last-child { border-bottom: none; }
.notif-ic {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
}
.notif-ic.like { background: var(--red-dark); color: #fff; }
.notif-ic.comment { background: var(--mid-green); color: #fff; }
.notif-ic.follow { background: var(--deep-green); color: var(--green); border: 1px solid var(--line-strong); }
.notif-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.notif-text { font-size: 13.5px; flex: 1; }
.notif-text b { font-weight: 700; }
.notif-text .q { color: var(--muted); }
.notif-time { color: var(--faint); font-size: 11.5px; margin-top: 2px; }

/* settings */
.settings-me { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.settings-me .avatar { width: 52px; height: 52px; font-size: 17px; }
.settings-me-name { font-weight: 800; }
.settings-me-sub { color: var(--muted); font-size: 12.5px; }
.settings-upload {
  display: flex; gap: 8px; margin: 10px 0;
}
.settings-upload label, .settings-upload button {
  flex: 1; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 9px; font-size: 12.5px; font-weight: 700;
}
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.settings-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.toggle {
  width: 44px; height: 26px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  position: relative; flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 2.5px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--muted); transition: all 0.18s ease;
}
.toggle.on { background: var(--green); border-color: var(--green); }
.toggle.on::after { left: 20px; background: var(--on-green); }

/* toast */
#toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  z-index: 70;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  max-width: 86vw; text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}

/* welcome screen */
.welcome {
  position: fixed; inset: 0; z-index: 55;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px;
  text-align: center;
}
.welcome-logo { width: 118px; height: 118px; }
.welcome-name { font-weight: 800; font-size: 21px; letter-spacing: 0.08em; }
.welcome-tag { color: var(--muted); font-size: 11.5px; letter-spacing: 0.3em; font-weight: 600; margin-bottom: 14px; }
.welcome-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 300px; }
.welcome-actions .btn-primary { padding: 12px 18px; font-size: 15px; }
.welcome-actions .welcome-login { padding: 11px 16px; }
.welcome-browse { color: var(--green); font-weight: 700; font-size: 13.5px; margin-top: 6px; }
.welcome-note { color: var(--faint); font-size: 11.5px; margin-top: 18px; }

@media (min-width: 1024px) { #toast { bottom: 32px; } }

/* misc */
.mt8 { margin-top: 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* keep scrolled-to posts clear of sticky headers */
.post { scroll-margin-top: 110px; }

/* ================= VISUAL PASS v7 — rolling rail, dice loader, create sheet ================= */

/* ROLLING NOW rail title */
.rail-title-row {
  font-size: 11px; font-weight: 800; letter-spacing: 0.18em; color: var(--muted);
  padding: 14px 16px 4px;
}
.rail-title-row + .stories { padding-top: 6px; }
.story { display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; }
.story-dot {
  position: absolute; top: 44px; right: 6px; width: 11px; height: 11px;
  background: var(--green); border: 2.5px solid var(--bg); border-radius: 50%;
}
.story-place {
  font-size: 9.5px; font-weight: 700; color: var(--green);
  max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: -3px;
}

/* dice-branded create button (bottom nav center + topbar) */
.bn-post {
  align-self: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; color: var(--muted);
  margin: -6px 0 -2px;
  transition: transform 0.15s ease;
}
.bn-post:active { transform: scale(0.93); }
.bn-post svg.die-icon {
  width: 46px; height: 46px; box-sizing: border-box; padding: 11px;
  border-radius: 50%; background: var(--surface-2);
  border: 1.5px solid var(--green); stroke: none;
}
.bn-post-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.02em; }
.bn-post svg.die-icon rect { fill: var(--red); stroke: rgba(255,255,255,0.35); stroke-width: 0.8; }
.bn-post svg.die-icon .pip { fill: #fff; }
#btn-create svg { stroke: none; fill: none; }
#btn-create svg rect { fill: var(--red); stroke: none; }
#btn-create svg circle { fill: #fff; stroke: none; }
.rail-item svg rect { fill: none; stroke: currentColor; }

/* DICE LOADER — branded progress, reduced-motion safe */
.dice-loader {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 44px 24px;
}
.dice-pair { display: flex; gap: 8px; }
.dice-loader .die { width: 30px; height: 30px; display: block; }
.dice-loader .die svg { width: 100%; height: 100%; }
.dice-loader .die rect { fill: var(--red); }
.dice-loader .die .pip { fill: #fff; }
.dice-loader .d1 { animation: die-tumble 1.15s ease-in-out infinite; }
.dice-loader .d2 { animation: die-tumble 1.15s ease-in-out 0.28s infinite; }
@keyframes die-tumble {
  0%   { transform: rotate(0deg) translateY(0); }
  35%  { transform: rotate(160deg) translateY(-7px); }
  70%  { transform: rotate(320deg) translateY(0); }
  100% { transform: rotate(360deg) translateY(0); }
}
.dice-label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
@media (prefers-reduced-motion: reduce) {
  .dice-loader .d1, .dice-loader .d2 { animation: none; }
}

/* CREATE SHEET */
.create-list { display: flex; flex-direction: column; gap: 4px; }
.create-opt {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 10px; border: none; background: transparent; border-radius: 12px;
  color: var(--text); text-align: left; cursor: pointer;
}
.create-opt:active { background: var(--surface-2); }
.create-ic {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
}
.create-ic svg { width: 21px; height: 21px; stroke: var(--gold); stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.create-ic.live svg rect { stroke: var(--green); }
.create-ic.live svg circle { stroke: var(--green); }
.create-opt b { display: block; font-size: 14.5px; font-weight: 700; }
.create-opt small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ROLLING NOW modal */
.rolling-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 2px 0 6px; }
.casino-picker.static { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.casino-opt.sel { border-color: var(--green); color: var(--green); background: var(--green-soft); }

/* form rows in modals */
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* profile: saved link + back */
.pf-saved-link {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 10px; padding: 5px 10px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line-strong);
  color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer;
}
.pf-saved-link svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }
.pf-saved-link:active { border-color: var(--green); color: var(--green); }
.saved-back {
  display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 10px;
  background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer;
}
.saved-back svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* check-in options (visibility + expiry) in composer */
.checkin-opts { background: var(--surface-2); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.ck-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.ck-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.ck-pills .pill { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ck-pills .pill.active { background: var(--green); border-color: var(--green); color: var(--on-green); }
