/* Font: Inter (from Google Fonts). */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* Colours and sizes used across the app. Change them here. */
:root {
  color-scheme: dark;
  --ink: #F9F9F9;         /* main text (off-white) */
  --ink-soft: #A7A3BD;    /* quieter text (soft lavender grey) */
  --paper: #080808;       /* page background (near black) */
  --card: #111016;        /* cards and panels */
  --line: #25223A;        /* hairlines */
  --outline: #4A4566;     /* edges of buttons and form fields */
  --accent: #6438FF;      /* violet: logo, main buttons, highlights */
  --accent-2: #5A32FA;    /* second violet, for button gradients */
  --accent-text: #9D88FF; /* lighter violet for links and small text, easier to read on black */
  --accent-ink: #FFFFFF;  /* text on violet */
  --glow: rgba(100, 56, 255, 0.28); /* purple glow behind the top of the page */
  --tint: #1B1928;        /* soft fills */
  --raised: #2A2640;      /* the selected tab */
  --field: #0D0C12;       /* inside of form fields */
  --danger: #B3261E;      /* red fills */
  --danger-ink: #F08B80;  /* red text on dark */
  --ok: #1F6F4A;
  --radius: 16px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: var(--sans);   /* headings use Inter too */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 60% at 50% -10%, var(--glow), transparent 70%) no-repeat, var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
a { color: var(--accent-text); }
h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 1.2rem; margin: 8px 0 0; }
p { margin: 0; }
img { max-width: 100%; display: block; }

#top {
  position: sticky; top: 0; z-index: 5;
  background: rgba(8, 8, 8, 0.72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 1.15rem; letter-spacing: 0; text-decoration: none; }
.brand::before {
  content: "CN"; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 18px rgba(100, 56, 255, 0.45);
  color: var(--accent-ink); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em;
}

/* Top bar: logo on the left, notification bell on the right */
.top-row { display: flex; align-items: center; justify-content: space-between; max-width: 760px; margin: 0 auto; }
.bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: -6px -8px -6px 0; border-radius: 999px;
  color: var(--ink); text-decoration: none;
}
.bell:hover { background: var(--tint); }
.bell.active { color: var(--accent-text); }
.bell-icon { display: inline-flex; width: 24px; height: 24px; }
.bell-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell.active .bell-icon svg { fill: currentColor; }
/* Something new: the chair spins round like a salon chair, then rests, then spins again. */
.bell { perspective: 120px; }
.bell.has-new { color: var(--accent-text); }
.bell.has-new .bell-icon { animation: chair-spin 3s ease-in-out infinite; transform-style: preserve-3d; }
@keyframes chair-spin {
  0% { transform: rotateY(0deg); }
  35% { transform: rotateY(360deg); }
  100% { transform: rotateY(360deg); }
}
@media (prefers-reduced-motion: reduce) { .bell.has-new .bell-icon { animation: none; } }
.bell-count {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #FF3B5C; color: #fff; box-shadow: 0 0 0 2px var(--paper);
  font-size: 0.7rem; font-weight: 700; line-height: 18px; text-align: center;
}

#app { max-width: 760px; margin: 0 auto; padding: 16px 16px 110px; }

#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around;
  background: rgba(17, 16, 22, 0.88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#nav a {
  flex: 1; text-align: center; padding: 14px 4px;
  color: var(--ink-soft); text-decoration: none; font-size: 0.9rem; font-weight: 600;
}
#nav a.active { color: var(--accent-text); box-shadow: inset 0 3px 0 var(--accent); }

/* Layout helpers */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 4px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.narrow { max-width: 520px; margin: 0 auto; width: 100%; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 8px; }
.clamp1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title { min-height: 44px; }

/* Cards */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)), var(--card);
  border: 1px solid rgba(255, 255, 255, 0.10); border-radius: var(--radius);
}
.card.pad { padding: 16px; }
a.card { display: block; color: inherit; text-decoration: none; }
.notice { background: var(--tint); border-color: var(--tint); font-weight: 600; }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 14px; align-items: center; grid-column: 1 / -1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--outline); border-radius: 999px;
  background: transparent; color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink);
  box-shadow: 0 6px 24px rgba(100, 56, 255, 0.35);
}
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.big { width: 100%; min-height: 52px; }
.btn.small { min-height: 36px; padding: 4px 14px; font-size: 0.9rem; }
.btn:disabled, .link-btn:disabled { opacity: 0.6; cursor: wait; }
.link-btn { background: none; border: 0; padding: 8px 4px; font: inherit; font-size: 0.9rem; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }
.link-btn.danger { color: var(--danger-ink); }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.label { font-weight: 600; font-size: 0.95rem; }
.hint { color: var(--ink-soft); font-size: 0.85rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%; padding: 12px; min-height: 46px;
  border: 1px solid var(--outline); border-radius: 10px;
  background: var(--field); color: var(--ink); font: inherit;
}
input[type="file"] { font: inherit; max-width: 100%; }
textarea { resize: vertical; }
.choice { display: flex; align-items: flex-start; gap: 10px; }
.choice input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(100, 56, 255, 0.25); }
.preview { border-radius: var(--radius); max-height: 360px; object-fit: contain; background: var(--tint); }

/* Welcome screen */
.hero { text-align: center; padding-top: 32px; max-width: 520px; margin: 0 auto; }
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: 2.4rem; letter-spacing: -0.025em; }
.lead { font-size: 1.2rem; color: var(--ink-soft); }
.points { text-align: left; margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }

/* Tabs */
.tabs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tab { flex: 1; min-height: 40px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.tab.active { background: var(--raised); color: var(--ink); }

/* Photo grid */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } }
.post { overflow: hidden; }
.post-img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--tint); }
.post-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

/* Feed of posts: one column, like LinkedIn */
.feed-list { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 620px; margin: 0 auto; }
.feed-page > .tabs, .feed-page > .distance-box, .feed-page > .start-post { width: 100%; max-width: 620px; margin-left: auto; margin-right: auto; }
.post-head { padding: 12px 14px 0; }
.post-text { padding: 0 14px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-text.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.post.text-only .post-text { font-size: 1.05rem; }
.see-more { margin-left: 14px; padding: 0; color: var(--accent-text); text-decoration: none; font-weight: 600; }
.post-foot { padding: 2px 14px 6px; }

/* Photos and video inside a post */
.media { position: relative; background: #000; }
.media-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.media-strip::-webkit-scrollbar { display: none; }
.media-strip img { flex: 0 0 100%; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; scroll-snap-align: start; background: var(--tint); }
.media-count { position: absolute; top: 10px; right: 10px; padding: 2px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.75rem; font-weight: 600; }
.media-dots { display: flex; justify-content: center; gap: 5px; padding: 8px 0 0; background: var(--card); }
.media-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--raised); }
.media-dots .dot.on { background: var(--accent-text); }
.post-video { display: block; width: 100%; max-height: 75vh; background: #000; object-fit: contain; }

/* "Start a post" bar */
.card.start-post { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
.start-post-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 10px 16px; border: 1px solid var(--outline); border-radius: 999px; color: var(--ink-soft); }
.start-post:hover .start-post-text { border-color: var(--accent-text); }

/* Create-a-post screen */
.compose-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.compose-media:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--tint); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.video-thumb { grid-column: 1 / -1; aspect-ratio: auto; }
.thumb.video-thumb video { max-height: 320px; object-fit: contain; background: #000; }
.thumb-remove { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.thumb-label { position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 0.75rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.premium-locked { gap: 8px; }
.premium-tag {
  padding: 1px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
}

/* Likes and comments */
.actions { gap: 2px; margin-left: -10px; }
.act-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 6px 10px;
  border: 0; border-radius: 999px; background: transparent;
  color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.act-btn:hover { background: var(--tint); }
.act-icon { display: inline-flex; width: 24px; height: 24px; }
.act-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.act-btn.on { color: var(--accent-text); }
.act-btn.on svg { fill: currentColor; }
.act-btn.pop svg { animation: pop 0.3s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .act-btn.pop svg { animation: none; } }
.act-num { min-width: 1ch; font-variant-numeric: tabular-nums; }
.comments { display: flex; flex-direction: column; gap: 14px; max-height: 50vh; overflow-y: auto; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.comment-name { color: var(--ink); font-weight: 700; text-decoration: none; }
.comment-box { align-items: flex-end; gap: 8px; }
.comment-box textarea { flex: 1; }
.link-btn.tiny { padding: 2px 0; font-size: 0.8rem; align-self: flex-start; }

/* Distance slider */
.distance-box { display: flex; flex-direction: column; gap: 8px; }
.distance {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer;
}
.distance::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--raised) var(--fill, 50%));
}
.distance::-moz-range-track { height: 6px; border-radius: 999px; background: var(--raised); }
.distance::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
.distance::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 4px solid var(--accent); box-shadow: 0 0 12px rgba(100, 56, 255, 0.6);
}
.distance::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); }
.distance:focus-visible { outline: none; }
.distance:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.loc-line .link-btn { padding: 4px 0; font-size: inherit; color: var(--accent-text); }

/* Notifications */
.notes { display: flex; flex-direction: column; gap: 8px; }
.card.note { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; position: relative; }
.card.note.unread { background: linear-gradient(90deg, rgba(100, 56, 255, 0.16), rgba(100, 56, 255, 0.04)), var(--card); border-color: rgba(157, 136, 255, 0.35); }
.note-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.note-quote { color: var(--ink-soft); }
.note-thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--tint); }
.note-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-text); flex: none; }

/* People */
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--tint); }
.avatar.letter { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 700; }
.person { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.person-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: var(--tint); color: var(--ink); }
.badge.salon { background: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
.badge.off { background: var(--raised); color: var(--ink-soft); align-self: flex-start; }
.job { display: flex !important; flex-direction: column; gap: 4px; padding: 16px; }

/* Messages */
.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); align-self: flex-start; }
.bubble.me { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink); }
.bubble .small { opacity: 0.8; }
.composer { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 62px; background: var(--paper); padding: 8px 0; }
.composer textarea { flex: 1; }

/* Pop-up panel and messages */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.72); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); border: 1px solid var(--line); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 620px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } }
#toasts { position: fixed; left: 0; right: 0; bottom: 76px; z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; max-width: 520px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--ok); color: #fff; }
