/* Rate It web: same look as the iOS app. Dark, minimal, one gold accent used sparingly. */
:root {
  --bg: #09090a;
  --surface: #161617;
  --raised: #212123;
  --link: #8ab8ff;
  --line: rgba(255, 255, 255, 0.08);
  --text: #fff;
  --muted: #9e9ea0;
  --faint: #6b6b6d;
  --accent: #ffc73d;
  --danger: #ff6161;
  --radius-card: 28px;
  --radius: 14px;
  --topbar: 56px;
  --tabbar: 64px;
  /* Filled buttons and selected chips, and the text on them. */
  --inverse: #fff;
  --on-inverse: #000;
  --hover: rgba(255, 255, 255, 0.06);
  --focus-line: rgba(255, 255, 255, 0.28);
  --bar-bg: rgba(9, 9, 10, 0.85);
  --tabbar-bg: rgba(14, 14, 15, 0.92);
  --cell-hover: #2c2c2f;
  --dist: rgba(255, 255, 255, 0.28);
  --comment: #e8e8ea;
  color-scheme: dark;
}

/* Light appearance (Settings → Appearance). Dark is the default; "System" follows the device. Photos keep
   their white overlays in both. */
:root[data-theme="light"] {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --raised: #e9e9ec;
  --link: #1f62c9;
  --line: rgba(0, 0, 0, 0.09);
  --text: #111113;
  --muted: #5f5f63;
  --faint: #8d8d92;
  --accent: #c48d00;
  --danger: #d93636;
  --inverse: #111113;
  --on-inverse: #fff;
  --hover: rgba(0, 0, 0, 0.05);
  --focus-line: rgba(0, 0, 0, 0.3);
  --bar-bg: rgba(244, 244, 246, 0.85);
  --tabbar-bg: rgba(255, 255, 255, 0.92);
  --cell-hover: #dcdce0;
  --dist: rgba(0, 0, 0, 0.18);
  --comment: #2a2a2d;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #f4f4f6;
    --surface: #ffffff;
    --raised: #e9e9ec;
    --link: #1f62c9;
    --line: rgba(0, 0, 0, 0.09);
    --text: #111113;
    --muted: #5f5f63;
    --faint: #8d8d92;
    --accent: #c48d00;
    --danger: #d93636;
    --inverse: #111113;
    --on-inverse: #fff;
    --hover: rgba(0, 0, 0, 0.05);
    --focus-line: rgba(0, 0, 0, 0.3);
    --bar-bg: rgba(244, 244, 246, 0.85);
    --tabbar-bg: rgba(255, 255, 255, 0.92);
    --cell-hover: #dcdce0;
    --dist: rgba(0, 0, 0, 0.18);
    --comment: #2a2a2d;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.gold { color: var(--accent); }
.error { color: var(--danger); font-size: 14px; }
.notice { color: var(--muted); font-size: 14px; background: var(--surface); border-radius: var(--radius); padding: 12px 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.spacer { flex: 1; }

/* ---------- Buttons, fields, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 600;
  transition: transform .12s ease, opacity .15s ease, background .15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn.primary { background: var(--inverse); color: var(--on-inverse); }
.btn.secondary { background: var(--raised); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.warn { color: #ffa94d; }
.danger-text, .link.danger, .link-row.danger { color: var(--danger); }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px;
  color: var(--muted); position: relative;
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.link { color: var(--text); font-size: 15px; }
.link:hover { text-decoration: underline; }
.link.muted { color: var(--muted); }
.link.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 12px; }

.field, textarea {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); outline: none;
}
textarea { padding: 14px 16px; resize: vertical; line-height: 1.4; }
.field:focus-within, .field:focus, textarea:focus { border-color: var(--focus-line); }
label.field { display: flex; align-items: center; gap: 6px; }
label.field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 50px; }
.prefix { color: var(--faint); }
.status { width: 18px; text-align: center; font-weight: 700; }
.status.is-available { color: #4cd964; }
.status.is-taken, .status.is-invalid { color: var(--danger); }
.label { display: block; font-size: 14px; color: var(--muted); margin: 16px 0 6px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--raised);
  font-size: 15px; font-weight: 600; transition: background .15s, color .15s;
}
.chip.selected { background: var(--inverse); color: var(--on-inverse); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px;
  background: var(--raised); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill.gold { background: var(--accent); color: #000; }
.pill.toggle:hover { color: var(--text); }

/* ---------- Avatars, photos, loading ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--line); background: var(--raised); }
.avatar-fallback { display: inline-grid; place-items: center; color: var(--muted); font-weight: 700; }
.photo { position: relative; width: 100%; height: 100%; background: var(--surface); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
.photo.loaded img { opacity: 1; }
.photo.loading::before, .skeleton, .skeleton-card {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--surface) 30%, #1f1f21 50%, var(--surface) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton, .skeleton-card { position: relative; }
@keyframes shimmer { to { background-position: -150% 0; } }
.photo-error { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--faint);
  background: none; border: 0; cursor: pointer; font: inherit; z-index: 1; }
/* Safety net: a photo still marked "loading" after 4s is shown anyway (a half-loaded photo beats an invisible one). */
@keyframes photo-reveal { to { opacity: 1; } }
.photo.loading img { animation: photo-reveal 0s 4s forwards; }
.photo.error img { visibility: hidden; }
.spinner {
  width: 26px; height: 26px; margin: 24px auto; border-radius: 50%;
  border: 3px solid var(--raised); border-top-color: var(--text); animation: spin .8s linear infinite;
}
.spinner.big { width: 36px; height: 36px; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 8px; }
.splash img { width: 72px; border-radius: 18px; }

.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 64px 24px; }
.empty-icon { color: var(--faint); margin-bottom: 4px; }
.empty h2 { font-size: 22px; }
.empty p { color: var(--muted); max-width: 340px; }
.empty .btn { margin-top: 8px; }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: 1.5px; font-size: 17px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--topbar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0; display: flex; align-items: center; justify-content: space-between;
  background: var(--bar-bg); backdrop-filter: blur(16px);
}
.content { padding: 0 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--tabbar-bg); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 11px; font-weight: 600;
}
.tabbar a.on { color: var(--text); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #000;
  font-size: 11px; font-weight: 800; display: inline-grid; place-items: center;
}
.topbar .badge { position: absolute; top: 4px; right: 2px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100dvh;
    padding: 28px 16px; border-right: 1px solid var(--line);
  }
  .sidebar nav { display: grid; gap: 4px; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px;
    color: var(--muted); font-weight: 600;
  }
  .sidebar nav a:hover { background: var(--surface); color: var(--text); }
  .sidebar nav a.on { color: var(--text); background: var(--surface); }
  .sidebar .badge { margin-left: auto; }
  .content { padding: 24px 32px 48px; }
  .mobile-only { display: none !important; }
}

/* ---------- Pages ---------- */
.page { max-width: 940px; margin: 0 auto; padding-top: 8px; }
.page.narrow { max-width: 560px; }
.page.center { display: grid; place-items: center; min-height: 60vh; }
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.3px; margin: 8px 0 16px; }
.page h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 24px 0 10px; }
.page > p.muted { margin: -8px 0 20px; }

/* ---------- Feed ---------- */
.feed { max-width: 540px; margin: 0 auto; }
.feed-card {
  display: flex; flex-direction: column; gap: 12px;
  height: calc(100dvh - var(--topbar) - var(--tabbar) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 520px;
}
@media (min-width: 900px) { .feed-card { height: calc(100dvh - 48px); } }
.feed-card.preview { height: auto; min-height: 0; }
.feed-card.preview .feed-photo { flex: none; aspect-ratio: 4 / 5; }
.skeleton-card { border-radius: var(--radius-card); }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head .author { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.post-head .author span { display: grid; line-height: 1.2; }
.post-head small { color: var(--faint); font-size: 12px; }
.feed-photo {
  position: relative; flex: 1; min-height: 0; border-radius: var(--radius-card); overflow: hidden;
  background: var(--surface); user-select: none;
}
.feed-photo .photo, .feed-photo .photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-shade { position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, 0.65)); pointer-events: none; }
.caption {
  position: absolute; left: 18px; right: 80px; bottom: 18px; font-weight: 600; font-size: 17px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.photo-actions { position: absolute; right: 14px; bottom: 16px; display: grid; gap: 14px; }
.action {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); transition: transform .12s;
}
.action:active { transform: scale(0.9); }
.action.liked { color: var(--danger); }
.action.liked .icon { fill: currentColor; }
.action.disliked { color: var(--accent); }
.action.disliked .icon { fill: currentColor; }
.action:disabled { cursor: default; opacity: 1; }
.detail-row .action, .after-rating .action { flex-direction: row; gap: 6px; font-size: 15px; text-shadow: none; }
.heart-burst {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: #fff;
  opacity: 0; transform: scale(0.4); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), opacity .25s;
}
.heart-burst .icon { fill: #fff; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35)); }
.heart-burst.on { opacity: 0.95; transform: scale(1); }
.results-overlay { position: absolute; left: 12px; right: 12px; bottom: 12px; animation: rise .45s cubic-bezier(.2, .9, .3, 1); }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }

.rate-area { display: grid; gap: 10px; }
.rate-head, .rate-foot { display: flex; align-items: center; justify-content: space-between; }
.rate-head strong { font-size: 17px; }
.after-rating { display: flex; align-items: center; gap: 18px; min-height: 104px; }
.gave { color: var(--muted); font-size: 15px; font-weight: 500; }
.gave strong { font-size: 30px; font-weight: 900; margin-left: 6px; vertical-align: -3px; }
.btn.next { min-height: 50px; }
@media (hover: none) { .hint { visibility: hidden; } }

/* Rating bar */
.rating-bar { position: relative; display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; touch-action: none; }
.cell {
  height: 58px; border-radius: 12px; background: var(--raised); color: var(--muted);
  font: 600 16px/1 ui-rounded, -apple-system, system-ui, sans-serif; transform-origin: bottom;
  transition: transform .2s cubic-bezier(.3, 1.5, .5, 1), background .12s;
}
.cell.lit { color: #000; }
.cell.peak { transform: scale(1.12); font-weight: 900; font-size: 19px; z-index: 1; }
.rating-bar:not(.locked) .cell:hover { background: var(--cell-hover); }
.rating-bar.locked .cell { cursor: default; }
.rating-bubble {
  position: absolute; bottom: 74px; transform: translateX(-50%); width: 64px; height: 72px; border-radius: 20px;
  display: grid; place-items: center; color: #000; font: 900 38px/1 ui-rounded, -apple-system, system-ui, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); pointer-events: none;
}

/* Results */
.results {
  display: grid; gap: 14px; padding: 18px; border-radius: 20px;
  background: rgba(30, 30, 32, 0.72); backdrop-filter: blur(24px) saturate(1.4); border: 1px solid var(--line);
}
.results.loading { min-height: 180px; place-items: center; }
.results-top { display: flex; justify-content: space-between; align-items: flex-start; }
.results .label { margin: 0; font-size: 13px; }
.average { font: 900 46px/1 ui-rounded, -apple-system, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.results-meta { display: grid; justify-items: end; gap: 6px; }
.distribution { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; height: 72px; }
.dist-col { display: grid; grid-template-rows: 1fr auto; gap: 4px; text-align: center; font: 500 11px ui-rounded, system-ui; color: var(--faint); }
.dist-track { display: flex; align-items: flex-end; }
.dist-bar { width: 100%; border-radius: 4px; background: var(--dist); transition: height .7s cubic-bezier(.2, .9, .3, 1); }
.dist-col.mine .dist-bar { background: var(--accent); }
.dist-col.mine { color: var(--accent); font-weight: 900; }

/* Post page */
.post-page { max-width: 560px; margin: 0 auto; display: grid; gap: 14px; }
.detail-photo { aspect-ratio: 4 / 5; border-radius: var(--radius-card); overflow: hidden; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.detail-caption { font-weight: 600; font-size: 17px; }
.post-page .feed-card.skeleton-card { height: 70vh; }

/* Menus & modals */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 44px; z-index: 30; min-width: 200px; padding: 6px; border-radius: 14px;
  background: var(--raised); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.menu button { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 9px; }
.menu button:hover { background: var(--hover); }
.menu .danger { color: var(--danger); }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(460px, 100%); max-height: min(720px, 90dvh); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: pop .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { width: min(640px, 100%); }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 6px 20px 20px; overflow-y: auto; display: grid; gap: 12px; }
@media (max-width: 600px) {
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: 22px 22px 0 0; max-height: 88dvh; padding-bottom: env(safe-area-inset-bottom); }
}
.choice-list { display: grid; gap: 4px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--raised); cursor: pointer; }
.choice.on { outline: 1px solid var(--accent); }
.choice input { accent-color: var(--accent); }

.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.people li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.people li .btn { margin-left: auto; }
.people .score { margin-left: auto; font: 900 20px ui-rounded, system-ui; }

.comments { display: grid; gap: 14px; min-height: 120px; }
.comment { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.comment-body p { color: var(--comment); overflow-wrap: anywhere; }
.comment-form { display: flex; gap: 8px; position: sticky; bottom: -20px; background: var(--surface); padding: 8px 0; }
.comment-form input { flex: 1; min-width: 0; min-height: 46px; padding: 0 16px; border-radius: 23px; background: var(--raised); border: 0; outline: none; }

.toast {
  position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 100;
  background: var(--inverse); color: var(--on-inverse); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); animation: drop .3s cubic-bezier(.2, .9, .3, 1.2); max-width: calc(100% - 32px);
}
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }

/* ---------- Grid, discover, profile ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid-cell { position: relative; aspect-ratio: 4 / 5; border-radius: 8px; overflow: hidden; background: var(--surface); }
.grid-cell .photo { position: absolute; inset: 0; transition: transform .25s; }
.grid-cell:hover .photo { transform: scale(1.03); }
.grid-badge {
  position: absolute; left: 7px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.search {
  display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); color: var(--muted); margin-bottom: 14px;
}
.search input { flex: 1; background: none; border: 0; outline: none; color: var(--text); }
.tabs { display: flex; gap: 18px; margin-bottom: 12px; }
.tabs button { font-size: 22px; font-weight: 800; color: var(--faint); }
.tabs button.on { color: var(--text); }
.page .chips { margin-bottom: 16px; }
.people-row { display: flex; gap: 18px; overflow-x: auto; margin-bottom: 18px; }
.person { display: grid; justify-items: center; gap: 6px; font-size: 12px; font-weight: 600; width: 76px; flex: none; }
.person span { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.profile-head { display: grid; justify-items: center; text-align: center; gap: 12px; margin: 16px 0 28px; }
.profile-head h1 { font-size: 24px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); width: min(420px, 100%); }
.stats div { display: grid; }
.stats strong { font: 900 24px ui-rounded, system-ui; }
.stats span { color: var(--muted); font-size: 13px; }
.follow-counts { display: flex; gap: 22px; }
.follow-counts .link { color: var(--muted); }
.follow-counts strong { color: var(--text); }
.avatar-pick { display: grid; justify-items: center; gap: 8px; cursor: pointer; }

/* ---------- Create ---------- */
.source-tile {
  display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: transform .12s;
}
.source-tile:active { transform: scale(0.98); }
.source-tile span:last-of-type { display: grid; }
.source-tile small { color: var(--muted); }
.tile-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; background: var(--raised); }
.step-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; margin-bottom: 16px; }
.step-head h1 { text-align: center; font-size: 17px; }
.crop-frame {
  position: relative; overflow: hidden; border-radius: var(--radius-card); background: #000; touch-action: none; cursor: grab;
  outline: 1px solid rgba(255, 255, 255, 0.4); outline-offset: -1px;
}
.crop-frame:active { cursor: grabbing; }
.crop-image { position: absolute; left: 50%; top: 50%; max-width: none; pointer-events: none; }
.zoom { display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; }
.zoom input { flex: 1; accent-color: var(--inverse); }
.page.narrow > .btn.block { margin-top: 20px; }
.details-thumb { height: 150px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; cursor: pointer; }
.switch {
  appearance: none; flex: none; width: 51px; height: 31px; border-radius: 16px; background: var(--raised);
  position: relative; cursor: pointer; transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Settings, notifications, moderation ---------- */
.group { background: var(--surface); border-radius: 18px; padding: 4px 16px; margin-bottom: 16px; }
.group h3 { margin: 12px 0 2px !important; font-size: 13px !important; text-transform: uppercase; letter-spacing: .5px; color: var(--faint) !important; }
.group .switch-row + .switch-row, .group .link-row + .link-row, .group .kv + .kv { border-top: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; }
.kv span:last-child { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.link-row { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 15px 0; text-align: left; }
.link-row span { display: inline-flex; align-items: center; gap: 8px; }
.link-row span:last-child { color: var(--faint); }
.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.notes a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; }
.notes a:hover { background: var(--surface); }
.notes li.unread a { background: var(--surface); font-weight: 600; }
.milestone { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #000; }
.report-card { display: flex; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); margin-bottom: 12px; }
.report-thumb { width: 72px !important; height: 90px !important; border-radius: 10px; flex: none; }
.report-info { display: grid; gap: 4px; min-width: 0; }
.report-info p { overflow-wrap: anywhere; }
.report-info .row { margin-top: 8px; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; align-items: center; justify-content: center; gap: 48px; padding: 32px 20px; }
@media (min-width: 900px) { .auth:not(.single) { grid-template-columns: minmax(0, 440px) 420px; } }
.auth-hero h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.05; letter-spacing: -1px; margin: 28px 0 14px; }
.auth-hero .brand { color: var(--accent); }
.auth-card { width: min(420px, 100vw - 40px); display: grid; gap: 12px; }
.auth-card h2 { font-size: 26px; margin-bottom: 6px; }
.auth-card .link { justify-self: center; }
.agree { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); cursor: pointer; }
.agree input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.agree a { color: var(--text); font-weight: 600; }
.rules { padding: 0; margin: 8px 0; list-style: none; display: grid; gap: 12px; }
.rules li { padding-left: 26px; position: relative; }
.rules li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 900; }
.interest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin: 12px 0; }
.interest { height: 52px; border-radius: 14px; background: var(--raised); font-weight: 600; transition: background .15s, color .15s; }
.interest.on { background: var(--inverse); color: var(--on-inverse); }
.legal-links { margin-top: 28px; font-size: 14px; color: var(--faint); }
.legal-links a { color: var(--muted); }
.legal-links a:hover { color: var(--text); }

/* ===================================================================
   Desktop design (matches the Rate It Mac/iPad app). Phones unchanged.
   =================================================================== */
@media (min-width: 900px) {
  .sidebar {
    gap: 0; padding: 22px 12px 14px; width: 240px;
    background: color-mix(in srgb, var(--surface) 60%, transparent); border-right: 1px solid var(--line);
  }
  .sidebar .brand { padding: 0 10px 22px; font-size: 17px; }
  .sidebar .brand img { width: 30px; height: 30px; border-radius: 8px; }
  .sidebar nav { gap: 2px; }
  .sidebar nav a {
    gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
    color: var(--muted); font-size: 15px; font-weight: 500;
  }
  .sidebar nav a .icon { width: 20px; height: 20px; }
  .sidebar nav a.on { color: var(--text); background: var(--raised); font-weight: 600; }
  .sidebar nav a:hover:not(.on) { background: var(--hover); color: var(--text); }
  .sidebar nav a span:not(.badge) { flex: 1; }
  .sidebar .badge { background: var(--accent); color: #000; min-width: 22px; height: 20px; border-radius: 10px; margin-left: 0; }
  .nav-section {
    margin: 22px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: var(--faint);
  }
  .account-card {
    margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px;
    border-radius: 12px; background: color-mix(in srgb, var(--raised) 60%, transparent); transition: background .15s;
  }
  .account-card:hover { background: var(--raised); }
  .account-card span { display: grid; min-width: 0; }
  .account-card strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-card small { font-size: 12px; color: var(--faint); }
  .shell { grid-template-columns: 240px 1fr; }
  .wide-page { max-width: 1240px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
  .grid-cell { border-radius: 12px; }
}
@media (max-width: 899px) { .account-card, .nav-section { display: none; } }

/* Hover polish */
.btn:hover:not(:disabled), .chip:hover, .pill.toggle:hover { filter: brightness(1.12); }
.action:hover { filter: brightness(1.2); }
.grid-cell:hover { transform: translateY(-2px); transition: transform .2s; }

/* ---------- Side-by-side feed and post (wide windows) ---------- */
.feed-wide, .post-split { height: calc(100dvh - 48px); }
/* The photo's height: the window height, or less on narrower windows so the 400px panel still fits. */
.feed-wide, .post-split { --split-h: min(calc(100dvh - 48px), calc((100vw - 760px) * 1.25)); }
/* Photo and panel share one height so their edges line up (4:5 photo + 400px panel + gaps beside a 240px sidebar). */
.feed-wide { display: grid; align-items: center; }
.feed-split, .post-split {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 36px; align-items: center;
  height: 100%; max-width: 1240px; margin: 0 auto;
}
.feed-wide .skeleton-card, .post-split > .skeleton-card { height: 100%; border-radius: var(--radius-card); }
/* Explicit width (4:5 of the height): Safari doesn't derive a centered grid item's width from aspect-ratio
   when everything inside is absolutely positioned, and the photo collapsed to 0px wide. */
.split-photo {
  position: relative; justify-self: center; height: var(--split-h); width: calc(var(--split-h) * 0.8);
  max-width: 100%;
  border-radius: var(--radius-card); overflow: hidden; background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); border: 1px solid var(--line); user-select: none;
}
.split-photo .photo { position: absolute; inset: 0; }
.split-panel { display: flex; flex-direction: column; gap: 16px; height: min(100%, 860px); min-height: 0; padding: 4px 0; }
.feed-split { height: var(--split-h); }
.feed-split .split-photo, .feed-split .split-panel { height: var(--split-h); }
.split-caption { font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -0.3px; overflow-wrap: anywhere; }
.split-actions { display: flex; align-items: center; gap: 18px; }
.split-actions .action { flex-direction: row; gap: 6px; font-size: 15px; text-shadow: none; }
.split-panel .gave strong { font-size: 32px; }
.split-panel .rate-area { gap: 12px; }

/* Post page: details on top, comments fill the rest of the column */
.post-split { grid-template-columns: minmax(0, 1fr) 420px; align-items: stretch; }
.post-split .split-photo { align-self: center; }
.link.back.overlay-back {
  position: absolute; top: 14px; left: 14px; z-index: 2; margin: 0; padding: 6px 12px 6px 8px;
  border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; backdrop-filter: blur(10px);
}
.link.back.overlay-back:hover { text-decoration: none; background: rgba(0, 0, 0, 0.75); }
.split-panel.detail {
  height: 100%; gap: 0; padding: 0; background: color-mix(in srgb, var(--surface) 55%, transparent);
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
}
.detail-top { display: grid; gap: 14px; padding: 20px; border-bottom: 1px solid var(--line); }
.comments-title { font-size: 15px !important; margin: 16px 20px 6px !important; color: var(--text) !important; }
.comments-panel.inline { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 20px 16px; }
.comments-panel.inline .comments { flex: 1; overflow-y: auto; min-height: 0; padding: 8px 0; align-content: start; }
.comments-panel.inline .comment-form { position: static; padding: 10px 0 0; background: transparent; }
.comments-panel:not(.inline) { display: grid; gap: 12px; }

/* ---------- Wide profile header ---------- */
.profile-head.wide {
  grid-template-columns: auto 1fr; justify-items: start; text-align: left;
  column-gap: 36px; row-gap: 10px; align-items: center; margin: 28px 0 32px;
}
.profile-head.wide > .avatar { grid-row: span 5; }
.profile-head.wide h1 { font-size: 30px; }
.profile-head.wide .stats { display: flex; gap: 28px; width: auto; }
.profile-head.wide .stats div { display: flex; align-items: baseline; gap: 6px; }
.profile-head.wide .stats strong { font-size: 20px; }
.profile-head.wide > p { max-width: 560px; }

/* ---------- Insights (admin) ---------- */
.insights-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #5fd38a; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.faint { color: var(--faint); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.stat-tile { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 18px; background: var(--surface); }
.stat-tile strong { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.insights-row { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 900px) { .insights-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.panel { background: var(--surface); border-radius: 18px; padding: 18px; min-width: 0; overflow: hidden; }
.insights > .panel { margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; margin: 0; }
.seg { display: inline-flex; background: var(--raised); border-radius: 10px; padding: 3px; }
.seg button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--bg); color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.bars-plot { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 160px;
  border-bottom: 1px solid var(--line); }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; background: none; border: 0; padding: 0 1px; cursor: default; }
.bar-col:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.bar { width: 100%; max-width: 28px; margin: 0 auto; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; transition: opacity .15s; }
.bar-col.on .bar { opacity: 1; }
.bars-plot:hover .bar-col:not(.on) .bar { opacity: .45; }
.bars-axis { display: flex; gap: 2px; margin-top: 6px; }
.bars-axis span { flex: 1; text-align: center; font-size: 11px; color: var(--faint); white-space: nowrap; overflow: visible; }
.bar-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); pointer-events: none; z-index: 2;
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px;
  display: flex; flex-direction: column; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.bar-tip span { color: var(--muted); }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 0 10px 8px; white-space: nowrap; }
.data-table td { padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .cap { text-transform: capitalize; }
.data-table .who { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.meter { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: var(--raised); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.top-posts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.top-posts a { position: relative; aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; display: block; }
.top-posts .photo { width: 100%; height: 100%; }
.top-posts .score { position: absolute; left: 6px; bottom: 4px; font-weight: 700; font-size: 14px; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.bar-tip.from-left { transform: translate(-12px, -100%); }
.bar-tip.from-right { transform: translate(calc(-100% + 12px), -100%); }
.show-all { margin: 12px 0 4px; }
.starters { padding: 0; }
.starters summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 14px 18px; cursor: pointer; list-style: none; }
.starters summary::-webkit-details-marker { display: none; }
.starters summary::before { content: '›'; color: var(--muted); display: inline-block; transition: transform .15s; }
.starters[open] summary::before { transform: rotate(90deg); }
.starters[open] summary { border-bottom: 1px solid var(--line); }
.starters .table-scroll, .starters .show-all { margin: 8px 18px 16px; }
.starters .data-table { font-size: 13px; }
.data-table .email { margin-left: 10px; font-size: 12px; color: var(--muted); }
.data-table .email:hover { color: var(--text); }

/* Team badges next to a username */
.role-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; vertical-align: 2px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 16px; white-space: nowrap; }
.role-tag.founder { color: #1a1300; background: linear-gradient(135deg, #ffe08a, var(--accent)); }
.role-tag.admin { color: #1c1f24; background: linear-gradient(135deg, #f4f6f8, #a9b0b8); }
.role-tag.friend { color: #2a1405; background: linear-gradient(135deg, #f0b98a, #b06a32); }
h1 .role-tag { font-size: 12px; padding: 2px 9px; vertical-align: 5px; margin-left: 8px; }

/* ---------- Share links ---------- */
.share-page { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; min-height: 100vh; }
.share-page.center { display: grid; place-items: center; }
.share-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--text); font-weight: 800; letter-spacing: .12em; }
.share-brand img { width: 30px; height: 30px; border-radius: 8px; }
.share-card { background: var(--surface); border-radius: var(--radius-card); padding: 16px; margin-bottom: 16px; }
.share-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.share-head > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.share-head small { color: var(--muted); font-size: 12px; }
.share-photo { border-radius: 20px; overflow: hidden; max-height: min(52vh, 560px); margin: 0 auto; }
.share-caption { font-size: 18px; font-weight: 600; margin: 14px 2px 4px; }
.share-card .rate-area { margin-top: 14px; }
.share-join { text-align: center; padding: 14px 4px 4px; display: grid; gap: 10px; }
.share-join p { margin: 0; }
.share-join .gave { font-size: 18px; }
.share-cta { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: var(--surface);
  border: 1px solid rgba(255, 199, 61, .25); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.share-cta > span { display: flex; flex-direction: column; gap: 2px; }
.share-cta small { color: var(--muted); font-size: 13px; }
.btn.small .icon { width: 18px; height: 18px; }
.appearance-seg { display: flex; margin: 4px 0 8px; }
.appearance-seg button { flex: 1; padding: 8px 10px; font-size: 14px; }
.role-tag.admin { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

/* Feed: each new post slides in from the direction you scrolled. */
@keyframes feed-in-next { from { opacity: 0; transform: translateY(28px); } }
@keyframes feed-in-back { from { opacity: 0; transform: translateY(-28px); } }
.enter-next > * { animation: feed-in-next .28s cubic-bezier(.2, .9, .3, 1); }
.enter-back > * { animation: feed-in-back .28s cubic-bezier(.2, .9, .3, 1); }
@media (prefers-reduced-motion: reduce) { .enter-next > *, .enter-back > * { animation: none; } }

/* Bans (owner) */
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.ban-status { color: var(--danger); font-weight: 600; font-size: 14px; }
.ban-notice { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--text); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px; font-size: 14px; }
.banned-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.banned-list li:first-child { border-top: 0; }
.banned-list .who { flex: 1; min-width: 0; display: grid; gap: 2px; }
/* Profile ⋯ menu, top-right of the profile header */
.profile-head { position: relative; }
.profile-menu { position: absolute; top: 0; right: 0; }

/* Founders: role picker */
.role-options { display: grid; gap: 8px; margin-bottom: 12px; }
.role-option { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; }
.role-option .role-tag { margin-left: 0; }
.role-option.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* ---------- Hashtags and @mentions ---------- */
.hashtag, .mention { color: var(--link); font-weight: 600; }
.hashtag:hover, .mention:hover { text-decoration: underline; }
.caption .hashtag, .caption .mention, .split-caption .hashtag, .split-caption .mention { color: inherit; text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .45); text-underline-offset: 3px; }
.split-caption .hashtag, .split-caption .mention { text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }

.mention-field { position: relative; display: block; width: 100%; }
.mention-field textarea, .mention-field input { width: 100%; }
.comment-form .mention-field { flex: 1; min-width: 0; }
.suggestions { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; margin: 0; padding: 6px; list-style: none;
  background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  max-height: 264px; overflow-y: auto; }
.comment-input .suggestions { top: auto; bottom: calc(100% + 6px); }
.suggestions li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.suggestions li.active, .suggestions li:hover { background: var(--surface); }
.suggestions small { margin-left: auto; }
.tag-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface);
  font-weight: 800; color: var(--muted); }

.tag-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 14px; }
.tag-chip small { color: var(--muted); font-weight: 600; }
.tag-chip:hover { border-color: var(--accent); }

.hashtag-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 18px; }
.hashtag-head h1 { margin: 0; font-size: 28px; overflow-wrap: anywhere; }
.hashtag-head p { margin: 2px 0 0; }
.hashtag-icon { display: grid; place-items: center; flex: none; width: 72px; height: 72px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); font-size: 34px; font-weight: 800; color: var(--accent); }
