:root {
  color-scheme: light dark;
  --ink: #0D1B2A;
  --ink2: #172b40;
  --mist: #F5F5F7;
  --paper: #fff;
  --cream: #f7f1e8;
  --slate: #667b8b;
  --lav: #D6D6F5;
  --lilac: #9067C6;
  --lilac2: #7447b3;
  --line: #dfe4e8;
  --shadow: 0 14px 40px rgba(13,27,42,.09);
  --danger: #a54848;
  --ok: #1d6b2e;
  --brand-cream: #FEF6EB;
  --brand-slate: #344658;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eaf1f7;
    --ink2: #dce8f2;
    --mist: #0e1721;
    --paper: #162331;
    --cream: #e9e2d9;
    --slate: #a9bac6;
    --lav: #3a355a;
    --lilac: #b38ee5;
    --lilac2: #c5a4ed;
    --line: #2b3c4c;
    --shadow: 0 14px 40px rgba(0,0,0,.28);
    --danger: #f09292;
    --ok: #7bc98a;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; touch-action: manipulation; }
body { margin: 0; background: var(--mist); color: var(--ink); font-family: "Source Sans 3", system-ui, -apple-system, sans-serif; min-height: 100vh; touch-action: manipulation; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--lilac), transparent 35%); outline-offset: 2px; }
h1, h2, h3 { font-family: Nunito, "Source Sans 3", sans-serif; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin: 0 0 14px; }
h2 { font-size: 21px; font-weight: 800; margin: 26px 0 10px; }
a { color: var(--lilac2); }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; min-height: 64px; display: flex; align-items: center; gap: 22px; padding: 8px max(16px, calc((100vw - 1120px) / 2)); background: var(--brand-cream); color: var(--brand-slate); border-bottom: 1px solid #e3ded2; }
.brand { display: flex; align-items: center; padding: 4px 0; }
.brand-logo { height: 27px; width: auto; display: block; }
.topbar nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar nav button { border: 0; background: transparent; color: var(--brand-slate); font-weight: 700; font-size: 15px; padding: 9px 12px; border-radius: 9px; }
.topbar nav button:hover { background: rgba(52, 70, 88, .1); }
.topbar nav button.active { background: rgba(52, 70, 88, .14); }
#signout-btn { border: 1px solid rgba(52, 70, 88, .35); margin-left: 6px; }
.icon-btn { position: relative; width: 40px; height: 40px; flex: none; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: var(--brand-slate); padding: 0; }
.icon-btn:hover { background: rgba(52, 70, 88, .1); border-color: transparent; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { background: var(--lilac2); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 12px; font-weight: 800; vertical-align: 2px; }
.icon-btn .badge { position: absolute; top: 1px; right: 0; padding: 0 5px; font-size: 11px; line-height: 16px; }

/* Mobile icon nav (prototype): exactly four icon-only route buttons.
   Desktop hides it; mobile hides the word nav and shows this bar. */
.mobile-nav { display: none; }
.mobile-nav button { border: 0; background: transparent; border-radius: 11px; color: var(--slate); display: grid; place-items: center; padding: 7px 8px; }
.mobile-nav button svg { width: 25px; height: 25px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mobile-nav button.active { color: var(--lilac2); background: color-mix(in srgb, var(--lav), transparent 42%); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 72px; }
.view { margin-bottom: 48px; }
.footer { text-align: center; color: var(--slate); padding: 24px; font-size: 13px; }

/* ---------- Headings / rows ---------- */
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.heading-row h1 { margin: 0; }
.row { display: flex; gap: 8px; align-items: end; margin: 10px 0; }
.row label { flex: 1; margin: 0; }

/* ---------- Buttons ---------- */
button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 10px; padding: 9px 15px; font-size: 15px; font-weight: 700; }
button:hover { border-color: var(--lilac); }
button:disabled { opacity: .5; cursor: default; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; background: var(--ink2); color: var(--mist); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { filter: brightness(1.08); border-color: transparent; }
.btn.primary { background: var(--lilac); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { filter: none; border-color: var(--lilac); }
.btn.small { padding: 7px 11px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger), transparent 45%); }
.btn.danger:hover { filter: none; border-color: var(--danger); }
.primary-btn { background: var(--lilac); color: #fff; border: 1px solid var(--lilac); border-radius: 10px; padding: 12px 18px; font-size: 15px; font-weight: 800; cursor: pointer; }
.primary-btn:hover { filter: brightness(1.07); border-color: var(--lilac); }
.linklike { background: none; border: 0; padding: 0; color: var(--lilac2); font-weight: 700; text-decoration: none; cursor: pointer; }
.linklike:hover { text-decoration: underline; border-color: transparent; }
#delete-version-btn, #delete-carousel-btn { color: var(--danger); border-color: color-mix(in srgb, var(--danger), transparent 45%); }
#delete-version-btn:hover, #delete-carousel-btn:hover { border-color: var(--danger); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 700; margin: 12px 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select { display: block; width: 100%; margin-top: 5px; padding: 11px 12px; font-size: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--mist); }
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, textarea:focus, select:focus { border-color: var(--lilac); }
textarea { resize: vertical; }
input[type="checkbox"] { accent-color: var(--lilac); width: 16px; height: 16px; vertical-align: -2px; }
input[type="file"] { margin-top: 6px; font-size: 14px; }
form .primary-btn { margin-top: 4px; }

/* ---------- Status / hints ---------- */
.status { color: var(--danger); min-height: 1.2em; font-weight: 600; }
.status.ok { color: var(--ok); }
.status:empty { min-height: 0; }
#global-status:empty { display: none; }
#global-status:not(:empty) { display: block; background: color-mix(in srgb, var(--lav), transparent 55%); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; color: var(--ink); }
.hint { color: var(--slate); }

/* ---------- Panels / cards ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 20px; margin: 18px 0; }
.panel h2 { margin-top: 0; }
.panel form { max-width: 640px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; margin: 16px 0; }
.card h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.card .hint { margin: 4px 0; }

/* ---------- Avatars / creator rows ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink2); color: var(--mist); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; overflow: hidden; position: relative; }
.avatar.me { background: var(--lilac); color: #fff; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
/* Profile picture over the initial: resolved through the worker and
   painted once its URL lands; until then the initial shows. */
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.creator-meta { min-width: 0; line-height: 1.15; }
.creator-meta strong { display: block; }
.creator-meta span { font-size: 13px; color: var(--slate); }

/* ---------- Feed ---------- */
#feed-list { display: grid; gap: 26px; max-width: 660px; margin: 0 auto; }
#feed-list > .hint { text-align: center; padding: 50px 20px; }
#view-feed .heading-row { max-width: 660px; margin-left: auto; margin-right: auto; }
/* Prototype treatment: borderless posts, media edge-to-edge in the shell. */
.feed-post { background: transparent; border: 0; border-radius: 0; overflow: visible; box-shadow: none; padding: 0; margin: 0; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.post-head .follow { margin-left: auto; }
.creator-link { border: 0; background: transparent; padding: 0; display: flex; align-items: center; gap: 10px; text-align: left; border-radius: 9px; color: inherit; min-width: 0; }
.creator-link:hover .creator-meta strong, .creator-link:hover .creator-meta span { color: var(--lilac2); }
.post-media { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(150deg, #172b40 0%, #2c2350 58%, #7447b3 130%); display: grid; place-items: center; overflow: hidden; }
.post-media video.feed-video, .post-media img.feed-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.post-media img.feed-photo { background: #07111a; }
.play-glyph { width: 68px; height: 68px; border-radius: 50%; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(6px); color: #fff; display: grid; place-items: center; font-size: 24px; padding-left: 4px; }
.play-glyph.glyph-photos { padding-left: 0; font-size: 28px; }
.feed-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 4; width: 64px; height: 64px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(3,10,16,.74); color: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.35); padding: 0; }
.feed-play svg { width: 27px; height: 27px; fill: currentColor; margin-left: 3px; }
.feed-mute { position: absolute; z-index: 5; right: 12px; top: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(3,10,16,.76); color: #fff; padding: 0; }
.feed-mute svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feed-mute .slash { display: none; }
.feed-mute.muted .waves { display: none; }
.feed-mute.muted .slash { display: block; }
.media-badge { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; align-items: center; gap: 6px; background: rgba(13,27,42,.78); color: #fff; padding: 5px 8px; border-radius: 6px; font-size: 12px; font-weight: 800; backdrop-filter: blur(8px); }
.media-badge.video::before { content: "▶"; font-size: 9px; }
.post-copy { padding: 14px 16px 17px; display: flex; align-items: flex-start; gap: 10px; }
.post-copy h3 { font-size: 19px; line-height: 1.25; flex: 1; min-width: 0; }
/* Version selector: ONE component everywhere — a compact dropdown
   button showing the current version, opening a menu of versions
   with dates. In the feed it sits in a slim row at the top of the
   post, directly above the media; in the project view the same row
   sits above the stage. Never a row of per-version chips. */
.version-select { position: relative; flex: none; }
.version-chip { border: 1px solid var(--line); background: color-mix(in srgb, var(--lav) 45%, var(--paper)); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 800; line-height: 1.5; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.version-chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.version-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px; }
.version-option { border: 0; background: transparent; color: var(--ink); text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.version-option:hover { background: color-mix(in srgb, var(--lav) 45%, transparent); }
.version-option.active { color: var(--lilac2); background: color-mix(in srgb, var(--lav) 55%, transparent); }
.version-option .version-date { font-weight: 600; opacity: .65; margin-left: 4px; }
.version-row { display: flex; align-items: center; padding: 0 16px 10px; }
.version-select-row { margin: 0 0 12px; }

/* Native aspect: JS sets aspect-ratio and --media-ar inline from the
   stored or probed dimensions. Tall media (height over width) is
   height-capped and centered so a vertical video does not swallow the
   column: 620px on desktop, 78vh on small screens. */
.media-tall { margin-inline: auto; max-width: calc(620px * var(--media-ar, 0.5625)); }
@media (max-width: 760px) { .media-tall { max-width: calc(78vh * var(--media-ar, 0.5625)); } }
/* Feed action bar: directly under the media, left-aligned, above the
   caption. Notes opens the in-feed sheet; Like toggles the project. */
.post-bar { display: flex; align-items: center; gap: 20px; padding: 12px 16px 0; }
.bar-btn { border: 0; background: transparent; padding: 4px 2px; display: inline-flex; align-items: center; gap: 7px; color: var(--slate); font-weight: 800; font-size: 15px; border-radius: 8px; }
.bar-btn:hover { color: var(--lilac2); border-color: transparent; }
.bar-btn:disabled { opacity: .55; }
.bar-btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar-like.active { color: var(--lilac2); }
.bar-like.active svg { fill: var(--lilac); stroke: var(--lilac2); }
.post-title { border: 0; background: transparent; padding: 0; text-align: left; color: inherit; font-weight: 800; border-radius: 7px; }
.post-title:hover { color: var(--lilac2); border-color: transparent; }

/* ---------- Explore ---------- */
.explore-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.search-wrap { width: min(420px, 100%); position: relative; display: block; margin: 0; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: none; stroke: var(--slate); stroke-width: 2; }
.search-wrap input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 12px 14px 12px 44px; margin: 0; }
.medium-filter { display: flex; align-items: center; gap: 5px; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; }
.medium-filter button { border: 0; background: transparent; color: var(--slate); border-radius: 7px; padding: 7px 12px; font-weight: 800; font-size: 14px; }
.medium-filter button.active { background: var(--ink2); color: var(--mist); }
.explore-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.explore-tile { position: relative; aspect-ratio: 1; overflow: hidden; border: 0; background: linear-gradient(150deg, #172b40 0%, #2c2350 58%, #7447b3 130%); padding: 0; color: #fff; text-align: left; border-radius: 0; }
.explore-tile img.feed-photo, .explore-tile video.feed-video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.explore-tile video.feed-video { background: var(--mist); }
.explore-tile video { pointer-events: none; }
.explore-tile .play-glyph { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.explore-tile .media-badge { top: 8px; bottom: auto; left: 8px; }
.explore-overlay { position: absolute; inset: auto 0 0; padding: 34px 11px 10px; background: linear-gradient(transparent, rgba(3,10,16,.82)); display: flex; align-items: end; justify-content: space-between; gap: 8px; }
.explore-text { display: grid; gap: 1px; min-width: 0; }
.explore-title { font: 800 14px/1.15 Nunito, sans-serif; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.explore-creator { font-size: 12px; font-weight: 700; color: rgba(255,255,255,.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explore-meta { display: flex; align-items: center; gap: 4px; flex: none; font-size: 12px; font-weight: 800; }
.explore-meta svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.explore-empty { grid-column: 1 / -1; text-align: center; color: var(--slate); padding: 56px 20px; }

/* ---------- Review (version / carousel detail) ---------- */
.review-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .review-grid { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); align-items: start; } }
.stage-card { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); overflow: hidden; }
.video-wrap { position: relative; background: #000; }
.video-wrap video { width: 100%; display: block; }
.pin-layer { position: absolute; inset: 0; pointer-events: none; }
.pin-dot { position: absolute; width: 29px; height: 29px; margin: -15px 0 0 -15px; border-radius: 50%; background: var(--lilac); border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.35); cursor: pointer; pointer-events: auto; color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; line-height: 1; }
.pin-dot.draft { background: transparent; border-style: dashed; font-size: 18px; pointer-events: none; }
.pin-capture { position: absolute; inset: 0; cursor: crosshair; background: rgba(144,103,198,.08); }
.slidebox img { width: 100%; display: block; background: #07111a; }
.slide-nav { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px; margin: 0; }
#slide-counter { font-weight: 700; color: var(--slate); min-width: 110px; text-align: center; }
#detail-meta, #carousel-meta { margin-top: -6px; }
.owner-controls { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); padding: 12px 14px; margin: 14px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.owner-controls label { margin: 0; font-weight: 700; }
#share-box { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 14px; margin: 12px 0; }
#share-box label { margin-top: 0; }

/* ---------- Notes ---------- */
.notes-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); overflow: hidden; }
.notes-title { padding: 17px 17px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.notes-title h2 { font-size: 20px; margin: 0; }
.notes-list > .hint { padding: 15px 17px; margin: 0; }
.note { padding: 15px 17px; border-bottom: 1px solid var(--line); }
.notes-list .note:last-child { border-bottom: 0; }
.note.reply { margin-left: 22px; border-left: 3px solid var(--lav); padding-left: 14px; }
.note.resolved { opacity: .62; }
.note-top { display: flex; align-items: center; gap: 9px; }
.note .meta { color: var(--slate); font-size: 13px; margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.note-body { margin: 9px 0 11px; line-height: 1.45; }
.note-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.note-actions label { margin: 0; font-size: 14px; }
.note-like { border: 0; background: transparent; color: var(--slate); border-radius: 7px; padding: 6px 8px; font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.note-like:hover { color: var(--lilac2); background: color-mix(in srgb, var(--lav), transparent 55%); border-color: transparent; }
.note-chip { border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; background: var(--lav); color: var(--ink); padding: 4px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.note-chip:hover { color: var(--lilac2); border-color: transparent; }
.notes-panel > .status { padding: 0 17px; }
.notes-panel .panel-hint { padding: 12px 17px 0; margin: 0; }
.notes-panel form { border-top: 1px solid var(--line); padding: 6px 17px 17px; }
.notes-panel form label:first-child { margin-top: 12px; }
form[data-reply-submit] { border-top: 0; padding: 10px 0 2px; }
form[data-reply-submit] textarea { background: var(--mist); }

/* ---------- Notes sheet (feed overlay) ---------- */
.sheet { position: fixed; inset: 0; z-index: 80; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(13,27,42,.52); }
.sheet-panel { position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: min(660px, 100%); max-height: 86vh; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: var(--shadow); overflow: hidden; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 20px; }
.sheet-head .icon-btn { color: var(--ink); }
.sheet-head .icon-btn:hover { background: color-mix(in srgb, var(--lav), transparent 45%); }
.sheet-notes { overflow-y: auto; }
.sheet-panel form { border-top: 1px solid var(--line); padding: 6px 17px 17px; }
.sheet-panel form label:first-child { margin-top: 12px; }
.sheet-panel > .status { padding: 0 17px 12px; margin: 0; }
@media (min-width: 761px) { .sheet-panel { bottom: 26px; border-bottom: 1px solid var(--line); border-radius: 18px; } }

/* ---------- Profile ---------- */
.profile-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.profile-cover { height: 130px; background: linear-gradient(120deg, var(--ink2), var(--lilac2)); }
.profile-body { padding: 0 22px 22px; }
.big-avatar { width: 92px; height: 92px; border: 5px solid var(--paper); border-radius: 50%; background: var(--lilac); color: #fff; display: grid; place-items: center; font: 800 30px Nunito, sans-serif; margin-top: -46px; position: relative; overflow: hidden; }
/* Own profile: the avatar is the photo control — pointer cursor plus
   a small camera badge in the design system's ink/paper pairing. */
.big-avatar.editable { cursor: pointer; }
.avatar-badge { position: absolute; right: 4px; bottom: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; border: 2px solid var(--paper); z-index: 2; }
.avatar-badge svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile-body h1 { margin: 12px 0 6px; font-size: 27px; }
.profile-handle { display: block; color: var(--lilac2); font-weight: 700; margin: -2px 0 4px; }
.profile-handle:empty { display: none; }
.profile-body .hint { margin: 0 0 14px; line-height: 1.5; }
.socials { display: flex; gap: 9px; flex-wrap: wrap; margin: 0 0 14px; }
.socials a { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-weight: 700; font-size: 13px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; background: var(--paper); }
.socials a:hover { border-color: var(--lilac); color: var(--lilac2); }
.socials svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.stats.other { grid-template-columns: 1fr; }
.stat { text-align: center; padding: 20px 10px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat strong { font: 800 24px Nunito, sans-serif; display: block; }
.stat span { color: var(--slate); font-size: 13px; }
.profile-content { margin-top: 28px; }
.profile-content-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.profile-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); flex: 1; }
.profile-tab { position: relative; border: 0; background: transparent; padding: 9px 5px 12px; color: var(--slate); display: inline-flex; align-items: center; gap: 6px; }
.profile-tab:hover { border-color: transparent; color: var(--ink); }
.profile-tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile-tab.active { color: var(--ink); }
.profile-tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--lilac2); border-radius: 3px 3px 0 0; }
.profile-tab .tab-count { font: 700 12px "Source Sans 3", sans-serif; color: var(--slate); }
.profile-panel > h2:first-of-type { margin-top: 26px; }
.profile-notes { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.profile-notes .empty { padding: 22px 18px; color: var(--slate); line-height: 1.5; }
.profile-note { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 11px; padding: 17px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.profile-note:last-child { border-bottom: 0; }
.profile-note-copy { min-width: 0; }
.profile-note-context { color: var(--slate); font-size: 13px; line-height: 1.35; }
.profile-note-context strong { color: var(--ink); font-weight: 700; }
.profile-note p { margin: 7px 0 9px; line-height: 1.48; }
.profile-note-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--slate); font-size: 12px; font-weight: 700; }
.note-location { display: inline-flex; align-items: center; gap: 5px; background: var(--lav); color: var(--ink); padding: 4px 7px; border-radius: 6px; }
.open-note { border: 0; background: transparent; color: var(--lilac2); font-weight: 800; padding: 7px 4px; border-radius: 7px; white-space: nowrap; }
.open-note:hover { background: color-mix(in srgb, var(--lav), transparent 55%); border-color: transparent; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.profile-project { min-width: 0; border: 0; background: transparent; color: inherit; padding: 0; text-align: left; border-radius: 0; }
.profile-project:hover { border-color: transparent; }
.profile-project-media { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(150deg, #172b40 0%, #2c2350 58%, #7447b3 130%); border-radius: 10px; display: block; }
.profile-project-media video.feed-video, .profile-project-media img.feed-photo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.profile-project-media .play-glyph { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.profile-project-media .media-badge { left: 8px; bottom: 8px; }
.profile-project-title { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 10px 2px 0; }
.profile-project-title strong { font: 800 16px/1.25 Nunito, sans-serif; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.profile-project-version { flex: none; color: var(--slate); font-size: 12px; font-weight: 800; padding-top: 2px; }

/* ---------- Create ---------- */
.dropzone { border: 1.5px dashed color-mix(in srgb, var(--slate), transparent 35%); border-radius: 12px; padding: 14px 16px; margin: 12px 0 4px; background: color-mix(in srgb, var(--mist), transparent 40%); }
.dropzone.dragging { border-color: var(--lilac); background: color-mix(in srgb, var(--lav), transparent 62%); }
.dropzone p { margin: 4px 0; }
.dropzone label { margin: 0; }
.dropzone-hint { color: var(--slate); font-size: 13px; }
.picker-zone { padding: 26px 20px; text-align: center; margin-top: 4px; }
.picker-zone .picker-label { font: 800 17px/1.3 Nunito, sans-serif; margin: 0 0 10px; }
.picker-zone input[type="file"] { max-width: 100%; }
.create-video-preview { display: block; width: 100%; max-height: 320px; border-radius: 12px; background: var(--ink); margin: 10px 0 4px; }
.create-photo-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.create-thumb { position: relative; display: inline-block; width: 72px; height: 72px; }
.create-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.create-thumb-remove { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--paper); background: var(--ink); color: #fff; font-size: 14px; line-height: 1; padding: 0; cursor: pointer; }
.form-shell { max-width: 620px; margin: 0 auto 34px; }
.form-card { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); padding: 26px; }
.form-card h1 { margin-top: 0; }
.field { margin: 0 0 16px; }
.field label { margin: 0 0 2px; }

/* ---------- Notifications ---------- */
.notif.unread { border-color: color-mix(in srgb, var(--lilac), transparent 40%); background: color-mix(in srgb, var(--lav), transparent 62%); }
.notif p { margin: 4px 0; }

/* ---------- Auth / redeem ---------- */
.auth-card { max-width: 400px; margin: 40px auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { text-align: center; margin-top: 0; font-size: 26px; }
.auth-card .hint { text-align: center; }
.auth-logo { display: block; width: 190px; height: auto; margin: 0 auto 18px; }
@media (prefers-color-scheme: dark) { .auth-logo { filter: brightness(0) invert(1); } }
.oauth-stack { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 0; }
.oauth-btn { width: 100%; border-radius: 10px; padding: 11px; font-size: 15px; font-weight: 700; cursor: pointer; }
.oauth-google { background: #fff; color: #1c1c1c; border: 1px solid #dadce0; }
.oauth-facebook { background: #1877F2; color: #fff; border: 1px solid #1877F2; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--slate); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth-card input[type="email"], .auth-card input[type="password"], .auth-card input[type="text"] { border-radius: 10px; padding: 11px 12px; }
.auth-card .primary-btn { width: 100%; margin-top: 6px; }
.auth-links { display: flex; justify-content: center; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.waitlist-line { text-align: center; color: var(--slate); }

/* ---------- Desktop: deliberate wide-screen treatment (≥761px) ----------
   Same design language as mobile: the top bar becomes the word nav, the
   feed keeps its readable 660px column, Explore goes multi-column, the
   profile header becomes the prototype's avatar + copy row, Create and
   the items lists use multi-column grids, and the review screen's notes
   panel sticks beside the stage. */
@media (min-width: 761px) {
  .profile-body { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
  .profile-copy { flex: 1; min-width: 0; padding-top: 52px; }
  .profile-copy h1 { margin-top: 0; }
  .profile-actions { margin: 0 0 8px; }
  #profile-view-status { flex-basis: 100%; margin: 6px 0 0; }
  .explore-grid { gap: 6px; }
  #create-projects-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; align-items: start; }
  #create-projects-list > .card, #create-projects-list > .hint { margin: 0; }
  #my-items-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; align-items: start; }
  #my-items-list > .card, #my-items-list > .hint { margin: 0; }
  .form-shell { max-width: 680px; }
}
@media (min-width: 980px) {
  .notes-panel { position: sticky; top: 84px; }
}

/* ---------- Mobile: prototype icon bottom bar ---------- */
@media (max-width: 760px) {
  body { padding-bottom: 86px; }
  .topbar { min-height: 58px; }
  #main-nav { display: none; }
  .mobile-nav { position: fixed; z-index: 60; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); min-height: 66px; padding: 6px 14px calc(6px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); background: color-mix(in srgb, var(--paper), transparent 3%); border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -10px 30px rgba(13,27,42,.11); border-radius: 18px 18px 0 0; }
  .mobile-nav.hidden { display: none; }
  main { padding-top: 20px; }
  h1 { font-size: 26px; }
  .explore-head { align-items: stretch; flex-direction: column; }
  .search-wrap { width: 100%; }
  .medium-filter { align-self: flex-start; }
  .explore-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .profile-content-head { align-items: stretch; }
  .profile-note { padding: 15px 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats.other { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .explore-title { display: none; }
  .explore-overlay { justify-content: flex-end; padding: 24px 7px 7px; }
  .medium-filter { align-self: stretch; }
  .medium-filter button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
