/* Profile layouts, box styles and the style editor. Colors come from the per-person theme sheet (/theme/<name>.css). */

/* ---- layouts ---- */
.pp-side { display: flex; flex-direction: column; gap: 14px; }
.pp-body { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.pp-main > * + * { margin-top: 14px; }
.pp-side:empty { display: none; }

.song-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.song-play { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.song-play .icon { width: 22px; height: 22px; }
.playing .song-play { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 18px var(--accent-glow); }
.song-text { min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.song-text small { color: var(--muted); }
.song-frame { margin-top: 12px; }
.song-frame[hidden] { display: none; }
.song-frame iframe { display: block; width: 100%; border: 0; border-radius: 12px; }
.song-frame iframe.youtube { aspect-ratio: 16 / 9; }
.song-frame iframe.spotify { height: 152px; }

/* Showcase: a side panel and a wide feed */
.page:has(.layout-showcase), .page:has(.layout-gallery), .page:has(.layout-retro) { max-width: 1000px; }
.page:has(.layout-spotlight) { max-width: 600px; }
@media (min-width: 820px) {
  .layout-showcase .pp-body { display: grid; grid-template-columns: 310px minmax(0, 1fr); align-items: start; }
  .layout-showcase .pp-side { position: sticky; top: 76px; }
  .layout-gallery .pp-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .layout-gallery .pp-side .person-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-gallery .pp-main { column-count: 2; column-gap: 14px; }
  .layout-gallery .pp-main > * { break-inside: avoid; margin: 0 0 14px; }
  .layout-gallery .pp-main > .posts-title { column-span: all; }
  .layout-retro .pp-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .layout-retro .pp-side { order: 2; }
  .layout-retro .pp-main { order: 1; }
}

/* Spotlight: one centered column */
.layout-spotlight .profile-intro { flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.layout-spotlight .profile-name { padding-bottom: 4px; }
.layout-spotlight .picture-frame { width: 136px; height: 136px; }
.layout-spotlight .profile-name h1 { font-size: calc(30px * var(--ts, 1)); }
.layout-spotlight .description { text-align: center; }
.layout-spotlight .profile-buttons { justify-content: center; }
.layout-spotlight .profile-buttons > * { flex: 0 1 220px; }
.layout-spotlight .pp-side { text-align: center; }
.layout-spotlight .details > div { justify-content: center; flex-wrap: wrap; }
.layout-spotlight .song-row { justify-content: center; flex-direction: column; text-align: center; }
.layout-spotlight .song-play { width: 58px; height: 58px; }
.layout-spotlight .section-head { justify-content: center; }

/* Retro: boxes with heading bars and a big grid of friends */
.layout-retro .card, .layout-retro .profile-card { border-radius: 3px; border: 2px solid var(--accent-line); }
.layout-retro .card > .section-head { margin: -14px -16px 12px; padding: 7px 14px; background: var(--accent); color: var(--on-accent); }
.layout-retro .card > .section-head h2, .layout-retro .card > .section-head a { color: var(--on-accent); font-size: calc(15px * var(--ts, 1)); text-transform: uppercase; letter-spacing: .06em; }
.layout-retro .details-head { margin: -14px -16px 8px; }
.layout-retro .cover { height: 150px; }
.layout-retro .pp-family .person-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.layout-retro .pp-family .person img { border-radius: 3px; }
.layout-retro .posts-title { padding: 7px 14px; background: var(--accent); color: var(--on-accent); font-size: calc(15px * var(--ts, 1)); text-transform: uppercase; letter-spacing: .06em; }

/* ---- box styles (applied to the body of a themed profile) ---- */
body.card-sharp .card, body.card-sharp .box, body.card-sharp .profile-card { border-radius: 0; }
body.card-sharp .layout-retro .card { border-radius: 0; }
body.card-glass .card, body.card-glass .box, body.card-glass .profile-card { border-color: rgba(255, 255, 255, .18); background: rgba(var(--card-rgb), .55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
body.card-outline .card, body.card-outline .box, body.card-outline .profile-card { border: 2px solid var(--accent-line); background: transparent; }

/* ---- preview inside the editor ---- */
body.preview-mode .topbar, body.preview-mode .footer, body.preview-mode .back-link, body.preview-mode .profile-buttons, body.preview-mode .notice { display: none; }
body.preview-mode .page { padding-top: 0; }
body.preview-mode { overflow-x: hidden; }

/* ---- the editor ---- */
.style-editor > * + * { margin-top: 14px; }
.layout-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.layout-pick { position: relative; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 10px; border: 2px solid var(--line); border-radius: 12px; font-weight: 400; cursor: pointer; }
.layout-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.layout-pick input { position: absolute; opacity: 0; pointer-events: none; }
.layout-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout-pick b { font-size: calc(15px * var(--ts, 1)); }
.layout-pick small { color: var(--muted); font-size: calc(12.5px * var(--ts, 1)); line-height: 1.3; }
.layout-thumb { display: grid; gap: 3px; height: 64px; margin-bottom: 4px; }
.layout-thumb i { display: block; border-radius: 3px; background: var(--raised-hover); }
.layout-thumb i:first-child { background: var(--accent); }
.thumb-classic { grid-template-rows: 22px 1fr 1fr; }
.thumb-classic i:nth-child(n+3) { grid-row: auto; }
.thumb-showcase { grid-template-columns: 1fr 2fr; grid-template-rows: 18px 1fr 1fr; }
.thumb-showcase i:first-child { grid-column: 1 / 3; }
.thumb-showcase i:nth-child(3) { grid-column: 1; grid-row: 2 / 4; }
.thumb-showcase i:nth-child(2) { grid-column: 2; grid-row: 2 / 4; }
.thumb-showcase i:nth-child(4) { display: none; }
.thumb-gallery { grid-template-columns: repeat(3, 1fr); grid-template-rows: 14px 1fr 1fr; }
.thumb-gallery i:first-child { grid-column: 1 / 4; }
.thumb-gallery i:nth-child(4) { grid-column: 3; }
.thumb-spotlight { grid-template-columns: 1fr; justify-items: center; grid-template-rows: 28px 12px 1fr; }
.thumb-spotlight i:first-child { width: 28px; border-radius: 50%; }
.thumb-spotlight i:nth-child(2) { width: 60%; }
.thumb-spotlight i:nth-child(3) { width: 85%; }
.thumb-spotlight i:nth-child(4) { display: none; }
.thumb-retro { grid-template-columns: 2fr 1fr; grid-template-rows: 14px 1fr 1fr; }
.thumb-retro i:first-child { grid-column: 1 / 3; }
.thumb-retro i:nth-child(3) { grid-column: 2; grid-row: 2 / 4; }
.thumb-retro i:nth-child(2) { grid-column: 1; grid-row: 2 / 4; }
.thumb-retro i:nth-child(4) { display: none; }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--text); font: inherit; font-size: calc(13.5px * var(--ts, 1)); cursor: pointer; }
.preset:hover { background: var(--raised-hover); }
.preset-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--dot, #888); box-shadow: 0 0 0 4px var(--dot-bg, #222) inset; border: 1px solid var(--line); }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.color-inputs { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.color-inputs input[type=color] { flex: none; width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); cursor: pointer; }
.color-inputs input[type=text] { margin-top: 0; font-family: ui-monospace, Consolas, monospace; }
.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 14px; }
.look-grid.two { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.style-preview { display: block; width: 100%; height: 560px; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.style-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.style-actions .button { flex: 1 1 160px; margin-top: 0; }

body.profile-themed .cover { background: linear-gradient(135deg, var(--raised-hover), var(--raised)); }

/* ---- move and zoom a picture ---- */
.crop-dialog { width: min(420px, calc(100vw - 24px)); max-width: none; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card-top); color: var(--text); }
.crop-dialog::backdrop { background: rgba(0, 0, 0, .75); }
.crop-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; }
.crop-title { font-size: calc(18px * var(--ts, 1)); }
.crop-help { margin: 0; color: var(--muted); font-size: calc(14px * var(--ts, 1)); text-align: center; }
.crop-view { position: relative; overflow: hidden; border-radius: 10px; background: #000; cursor: grab; touch-action: none; outline: 2px solid var(--accent); }
.crop-view:active { cursor: grabbing; }
.crop-view img { position: absolute; top: 0; left: 0; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }

.crop-buttons { display: flex; gap: 10px; width: 100%; }
.crop-buttons .button { flex: 1; margin-top: 0; }

/* ---- picture chooser ---- */
.pick-input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; min-width: 0; margin: 0; padding: 0; border: 0; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.pick { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.pick-thumb { position: relative; flex: none; display: grid; place-items: center; width: 84px; height: 84px; overflow: hidden; border: 1px dashed var(--line); border-radius: 50%; background: var(--raised); }
.pick-thumb.wide { width: 150px; height: 56px; border-radius: 10px; }
.pick-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pick-thumb img:not([hidden]) ~ .pick-empty { display: none; }
.pick-empty { padding: 4px; color: var(--muted); font-size: calc(12px * var(--ts, 1)); text-align: center; }
.pick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-actions .button { margin-top: 0; }
.pick-actions [hidden] { display: none; }

/* ---- featured family: a row of circles under the profile, and the picker for it ---- */
.pp-family { padding-bottom: 12px; }
.pp-family .person-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 12px; }
.pp-family .person { flex: 0 0 72px; width: 72px; font-size: calc(12px * var(--ts, 1)); }
.layout-retro .pp-family .person-grid { display: flex; }
.layout-retro .pp-family .person { flex-basis: 84px; width: 84px; }
.fam-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 10px; }
.fam-pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; margin: 0; padding: 8px 4px; border: 2px solid transparent; border-radius: 12px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; text-align: center; cursor: pointer; overflow-wrap: anywhere; }
.fam-pick img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.fam-pick input { position: absolute; opacity: 0; pointer-events: none; }
.fam-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fam-pick:has(input:focus-visible) { outline: 2px solid var(--accent); }
.fam-pick.off { opacity: .4; }

/* ---- app update banner ---- */
.update-banner { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--accent-line); background: var(--card-top); color: var(--text); font-size: calc(14px * var(--ts, 1)); }
.update-banner .update-text { flex: 1; min-width: 0; }
.update-banner .button { flex: none; margin: 0; padding: 7px 14px; }
.update-later { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: calc(22px * var(--ts, 1)); line-height: 1; cursor: pointer; }

/* ---- invite welcome page ---- */
.welcome { max-width: 440px; margin: 8px auto 0; text-align: center; }
.welcome > * + * { margin-top: 14px; }
.welcome-icon { display: block; width: 132px; height: 132px; margin: 12px auto 0; border-radius: 30px; box-shadow: 0 8px 30px rgba(242, 80, 15, .3); }
.welcome h1 { font-size: calc(26px * var(--ts, 1)); }
.button.big { display: block; width: 100%; padding: 16px; font-size: calc(18px * var(--ts, 1)); }
.welcome-steps { text-align: left; }
.welcome-steps ol { padding-left: 20px; }
.welcome-steps li { margin-bottom: 8px; }
.welcome-small { font-size: calc(14px * var(--ts, 1)); }

/* ---- crew order: hold and drag ---- */
.crew-strip { display: flex; flex-wrap: wrap; gap: 14px 12px; min-height: 92px; margin-top: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; background: var(--raised); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.crew-strip.empty::before { content: "Nobody picked yet"; align-self: center; color: var(--muted); font-size: calc(14px * var(--ts, 1)); }
.crew-item { flex: 0 0 68px; width: 68px; text-align: center; font-size: calc(12px * var(--ts, 1)); font-weight: 600; overflow-wrap: anywhere; cursor: grab; touch-action: none; outline: none; }
.crew-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.crew-item img { display: block; width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; object-fit: cover; pointer-events: none; }
.crew-item.lifted { opacity: .25; }
.crew-ghost { position: fixed; z-index: 1000; margin: 0; pointer-events: none; opacity: .95; transform: scale(1.15); filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .5)); font-size: calc(12px * var(--ts, 1)); font-weight: 600; text-align: center; color: var(--text); }
.crew-ghost img { display: block; width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.crew-hint { margin: 8px 0 0; font-size: calc(13px * var(--ts, 1)); }

.crew-item { position: relative; }
.crew-remove { position: absolute; top: -6px; right: -2px; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card-top); color: var(--text); font-size: calc(17px * var(--ts, 1)); line-height: 1; cursor: pointer; touch-action: manipulation; }
.crew-add-title { margin: 16px 0 0; font-size: calc(14px * var(--ts, 1)); font-weight: 700; }
button.fam-pick { margin: 0; border: 2px solid transparent; background: none; color: inherit; font-family: inherit; }
button.fam-pick[hidden] { display: none; }

/* ---- home: composer line and story cards ---- */
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-pill { flex: 1; min-width: 0; padding: 11px 18px; border: 1px solid var(--line); border-radius: 26px; color: var(--text); font-size: calc(17px * var(--ts, 1)); }
.composer-pill:hover { text-decoration: none; background: var(--raised); }
.composer-photo { flex: none; display: grid; place-items: center; width: 44px; height: 44px; color: var(--muted); }
.composer-photo .icon { width: 28px; height: 28px; }
.stories-tray { display: flex; gap: 8px; margin: 0 -16px; padding: 4px 16px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 16px; scrollbar-width: none; }
.stories-tray::-webkit-scrollbar { display: none; }
.story-card { position: relative; flex: none; width: 112px; height: 196px; overflow: hidden; border-radius: 14px; background: #000; color: #fff; scroll-snap-align: start; }
.story-card:hover { text-decoration: none; }
.story-card .sc-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .35), transparent 35%, transparent 60%, rgba(0, 0, 0, .7)); pointer-events: none; }
.sc-avatar { position: absolute; top: 8px; left: 8px; z-index: 2; width: 38px; height: 38px; padding: 2px; border-radius: 50%; background: #8a8f98; }
.story-card.unseen .sc-avatar { background: var(--accent); }
.sc-avatar img { display: block; width: 100%; height: 100%; border: 2px solid #000; border-radius: 50%; object-fit: cover; }
.sc-name { position: absolute; left: 10px; right: 8px; bottom: 9px; z-index: 2; font-size: calc(14px * var(--ts, 1)); font-weight: 700; line-height: 1.2; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); overflow-wrap: anywhere; }
.story-card.create { background: var(--raised); color: var(--text); }
.story-card.create::after { display: none; }
.sc-top { position: absolute; inset: 0 0 52px; }
.sc-top img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sc-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; background: var(--card); }
.story-card.create .sc-name { left: 4px; right: 4px; bottom: 7px; text-align: center; text-shadow: none; font-size: calc(13.5px * var(--ts, 1)); }
.sc-plus { position: absolute; left: 50%; top: -17px; transform: translateX(-50%); display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid var(--card); border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: calc(22px * var(--ts, 1)); line-height: 1; }

/* ---- the full-screen story viewer ---- */
body.story-page { overflow: hidden; overscroll-behavior: none; background: #000; }
body.story-page .topbar, body.story-page .nav, body.story-page .footer, body.story-page .create-sheet { display: none !important; }
body.story-page .page { max-width: none; padding: 0; }
.sv { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; background: #000; color: #fff; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .18s ease, opacity .18s ease; }
.sv-media { position: absolute; inset: 0; display: grid; place-items: center; }
.sv-media img, .sv-media video { display: block; width: 100%; height: 100%; object-fit: contain; }
.sv-zone { position: absolute; inset: 0; z-index: 2; touch-action: none; }
.sv-top { position: absolute; top: 0; left: 0; right: 0; z-index: 4; padding: max(10px, env(safe-area-inset-top)) 10px 18px; background: linear-gradient(180deg, rgba(0, 0, 0, .6), transparent); pointer-events: none; transition: opacity .15s; }
.sv-top button, .sv-top a { pointer-events: auto; }
.sv.holding .sv-top, .sv.holding .sv-bottom, .sv.holding .sv-caption { opacity: 0; }
.sv-bars { display: flex; gap: 4px; }
.sv-bars span { flex: 1; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.sv-bars i { display: block; width: 100%; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }
.sv-head { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.sv-who { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; color: #fff; }
.sv-who:hover { text-decoration: none; }
.sv-avatar { width: 42px; height: 42px; flex: none; border-radius: 50%; object-fit: cover; }
.sv-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sv-names b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(16px * var(--ts, 1)); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.sv-time { color: rgba(255, 255, 255, .8); font-size: calc(13px * var(--ts, 1)); }
.sv-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; background: none; color: #fff; cursor: pointer; }
.sv-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sv-icon svg circle { fill: currentColor; stroke: none; }
.sv-caption { position: absolute; left: 0; right: 0; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 3; margin: 0; padding: 0 20px; text-align: center; font-size: calc(18px * var(--ts, 1)); line-height: 1.3; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); pointer-events: none; transition: opacity .15s; }
.sv-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 14px 12px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(0, 0, 0, .65), transparent); transition: opacity .15s; }
.sv-reply { flex: 1; margin: 0; }
.sv-reply button { width: 100%; padding: 14px 20px; border: 0; border-radius: 28px; background: rgba(90, 94, 102, .85); color: #fff; font: inherit; font-size: calc(17px * var(--ts, 1)); text-align: left; cursor: pointer; }
.sv-views { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 26px; background: rgba(90, 94, 102, .85); color: #fff; font: inherit; font-size: calc(16px * var(--ts, 1)); font-weight: 600; cursor: pointer; }
.sv-views svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sv-add { display: grid; place-items: center; width: 46px; height: 46px; margin-left: auto; border-radius: 50%; background: rgba(90, 94, 102, .85); color: #fff; }
.sv-add svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.sv-menu { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 62px); right: 10px; z-index: 6; min-width: 170px; padding: 6px; border-radius: 12px; background: #1c1f26; box-shadow: 0 8px 24px rgba(0, 0, 0, .6); }
.sv-menu[hidden], .sv-sheet[hidden] { display: none; }
.sv-delete { display: block; width: 100%; padding: 12px 14px; border: 0; border-radius: 8px; background: none; color: #ff6b6b; font: inherit; font-size: calc(16px * var(--ts, 1)); text-align: left; cursor: pointer; }
.sv-sheet { position: absolute; inset: 0; z-index: 7; display: flex; align-items: flex-end; background: rgba(0, 0, 0, .55); touch-action: pan-y; }
.sv-panel { width: 100%; max-height: 70%; display: flex; flex-direction: column; border-radius: 18px 18px 0 0; background: #15171c; }
.sv-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 8px 18px; font-size: calc(18px * var(--ts, 1)); }
.sv-viewers { overflow-y: auto; padding: 0 12px max(16px, env(safe-area-inset-bottom)); }
.sv-viewer { display: flex; align-items: center; gap: 12px; padding: 9px 6px; color: #fff; }
.sv-viewer:hover { text-decoration: none; background: rgba(255, 255, 255, .06); border-radius: 10px; }
.sv-viewer img { width: 46px; height: 46px; flex: none; border-radius: 50%; object-fit: cover; }
.sv-viewer span { display: flex; flex-direction: column; min-width: 0; }
.sv-viewer small { color: #9aa0aa; font-size: calc(13px * var(--ts, 1)); }
.sv-empty { margin: 14px 6px; color: #9aa0aa; }
.sv-icon[hidden] { display: none; }

.im-typing { padding: 2px 14px 6px; font-size: calc(13px * var(--ts, 1)); font-style: italic; color: var(--muted); }
.im-typing.hidden { display: none; }

/* Cover photo: fill (default), fit the whole picture, or center it at its own size. */
.cover-fit .cover-photo { object-fit: contain; }
.cover-center .cover-photo { object-fit: scale-down; }
.cover .cover-photo { position: relative; }
.cover .cover-backdrop { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(18px) brightness(.55); }
.cover-fits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 6px; }
.cover-fit-pick { padding: 8px; }
.pick-thumb.fit-fit img { object-fit: contain; }
.pick-thumb.fit-center img { object-fit: scale-down; }
.crop-fits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; }
.crop-fit { padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.crop-fit.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.crop-view.still { cursor: default; }
.crop-view.plain { background: linear-gradient(135deg, #1c2029, #0f1115); }
.crop-view .crop-backdrop { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(14px) brightness(.55); }
.crop-dialog { margin: auto; }
.crop-fit:focus:not(:focus-visible) { outline: none; }
.cover-stretch .cover-photo { object-fit: fill; }
.pick-thumb.fit-stretch img { object-fit: fill; }
.crop-dialog:focus { outline: none; }

/* ---- the profile box: About me, details, song, crew and links as tap-to-open bars ---- */
.pp-box { padding: 4px 0; overflow: hidden; }
.pp-sec + .pp-sec, .pp-sec + .pp-song, .pp-song + .pp-sec, .pp-song + .pp-song { border-top: 1px solid var(--line); }
.pp-sec > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 16px; list-style: none; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.pp-sec > summary::-webkit-details-marker { display: none; }
.pp-sec > summary::after { content: ''; flex: none; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.pp-sec[open] > summary::after { transform: rotate(225deg) translate(-2px, 0); }
.pp-sec > summary > .icon { flex: none; width: 20px; height: 20px; color: var(--accent-text); }
.pp-sec-name { font-weight: 600; font-size: calc(15px * var(--ts, 1)); }
.pp-sec-body { padding: 0 16px 14px; }
.pp-sec-bio .description { margin: 0; }
.pp-box .pp-details-art { position: static; opacity: 1; -webkit-mask-image: none; mask-image: none; display: block; width: 100%; height: 72px; margin-bottom: 8px; border-radius: 10px; object-fit: cover; }
.pp-sec-details .details { margin: 0; }
.pp-faces { display: flex; margin-left: 4px; }
.pp-faces img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid var(--card); background: var(--raised); }
.pp-faces img + img { margin-left: -8px; }
.pp-sec-crew[open] .pp-faces { display: none; }
.pp-box .pp-family { padding-bottom: 12px; }
.pp-see-all { display: block; margin-top: 10px; text-align: center; font-size: calc(13px * var(--ts, 1)); }
.pp-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pp-link { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 14px; border-radius: 999px; background: var(--raised); color: var(--text); font-size: calc(14px * var(--ts, 1)); text-decoration: none; overflow-wrap: anywhere; }
.pp-link:hover { background: var(--raised-hover); }
.pp-song { position: relative; }
.pp-sec-song > summary { min-height: 60px; }
.pp-sec-song .song-play { width: 40px; height: 40px; }
.pp-sec-song .song-play .icon { width: 18px; height: 18px; }
.pp-song .song-frame { margin: 0; padding: 0 16px 14px; }
.pp-song .song-frame:empty { display: none; }
/* Closed bar, song playing: the player keeps going but is shrunk out of sight. */
.pp-song:not(.open) .song-frame { position: absolute; left: 0; bottom: 0; width: 2px; height: 2px; padding: 0; overflow: hidden; opacity: 0; pointer-events: none; }
.pp-song:not(.open) .song-frame iframe { width: 200px; height: 120px; }
.layout-gallery .pp-side { display: flex !important; }
.layout-spotlight .pp-sec > summary { justify-content: center; }
.layout-spotlight .pp-sec > summary::after { margin-left: 0; }
.layout-spotlight .pp-links { justify-content: center; }
.layout-retro .pp-box { border-radius: 3px; border: 2px solid var(--accent-line); }

/* ---- the profile box editor ---- */
.sec-list { margin: 8px 0 0; padding: 0; list-style: none; }
.sec-row { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.sec-row.dragging { opacity: .85; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); border-color: var(--accent); position: relative; z-index: 2; }
.sec-row.off .sec-label { opacity: .45; text-decoration: line-through; }
.sec-grip { flex: none; display: grid; place-items: center; width: 34px; height: 40px; border-radius: 8px; color: var(--muted); font-size: 20px; line-height: 1; cursor: grab; touch-action: none; user-select: none; }
.sec-grip:active { cursor: grabbing; background: var(--raised-hover); }
.sec-label { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.sec-opts { flex: none; display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
.sec-chip { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: calc(13px * var(--ts, 1)); font-weight: 400; cursor: pointer; }
.sec-chip input { margin: 0; accent-color: var(--accent); }
.sec-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sec-move { display: none; }
.link-rows { display: grid; gap: 8px; }
.link-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; }
.link-row input { margin: 0; }

/* ---- picture left, middle or right ---- */
.pic-center .profile-intro { flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.pic-center .profile-name { padding: 0 0 4px; align-items: center; }
.pic-center .picture-frame { width: 136px; height: 136px; }
.pic-center .profile-name h1 { font-size: calc(30px * var(--ts, 1)); }
.pic-center .profile-buttons { justify-content: center; }
.pic-right .profile-intro { flex-direction: row-reverse; text-align: right; }
.pic-right .profile-name { align-items: flex-end; }
.pic-right .profile-buttons { justify-content: flex-end; }

/* ---- edit mode on your own page ---- */
.pe-open { margin-top: 4px; }
.pe-bar { position: sticky; z-index: 9; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: 16px; background: var(--card); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.pe-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pe-bar-top .button { margin: 0; }
.pe-tools { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.pe-tool { flex: none; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--text); font: inherit; font-size: calc(13.5px * var(--ts, 1)); cursor: pointer; }
.pe-tool.on { border-color: var(--accent); background: var(--accent-soft); }
.pe-hint { margin: -4px 4px 12px; color: var(--muted); font-size: calc(12.5px * var(--ts, 1)); line-height: 1.35; }
.pe-error { margin: 8px 2px 0; color: #ff8a8a; font-size: calc(13.5px * var(--ts, 1)); }
.pe-error[hidden] { display: none; }
body.editing .pp-main, body.editing .notice { display: none; }
.pe-editable { outline: 1px dashed var(--accent-line); outline-offset: 3px; border-radius: 6px; cursor: text; min-width: 3ch; }
.pe-editable:focus { outline: 2px solid var(--accent); }
.pe-editable:empty::before { content: attr(data-placeholder); color: var(--muted); }
.cover { position: relative; }
.pe-photo-btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 12px; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff; font-size: calc(13px * var(--ts, 1)); font-weight: 600; cursor: pointer; }
.pe-photo-btn .icon { width: 18px; height: 18px; }
.pe-cover-btn { position: absolute; top: 10px; right: 10px; z-index: 2; }
.pe-busy { opacity: .5; pointer-events: none; }
.pe-picture { position: relative; cursor: grab; touch-action: pan-y; transition: transform .15s; }
.pe-picture.pe-dragging { transition: none; cursor: grabbing; box-shadow: 0 0 0 4px var(--accent); }
.pe-picture img { pointer-events: none; }
.pe-picture-badge { position: absolute; right: 4px; bottom: 4px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.pe-picture-badge .icon { width: 18px; height: 18px; }
.pe-pics { display: flex; justify-content: center; gap: 8px; margin: 10px 16px 14px; }
.pe-pics button { width: 52px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); color: var(--text); font-size: 20px; cursor: pointer; }
.pe-pics button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.pe-box .pe-grip { flex: none; display: grid; place-items: center; width: 28px; height: 36px; margin-left: -8px; border-radius: 8px; color: var(--muted); font-size: 18px; letter-spacing: -3px; cursor: grab; touch-action: none; user-select: none; }
.pe-box .pe-grip:active { background: var(--raised-hover); cursor: grabbing; }
.pe-eye { position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.pe-eye .icon { width: 20px; height: 20px; }
.pe-eye + * { margin-left: 0; }
.pe-box .pp-sec > summary:has(.pe-eye)::after { margin-left: 4px; }
.pe-eye[aria-pressed="false"]::after { content: ''; position: absolute; left: 8px; right: 8px; top: 50%; height: 2px; background: currentColor; transform: rotate(-40deg); }
.pp-part.pe-off > details > summary > :not(.pe-eye):not(.pe-grip) { opacity: .4; }
.pp-part.pe-off > details > .pp-sec-body { opacity: .4; }
.pp-part.pe-moving { position: relative; z-index: 2; background: var(--raised); box-shadow: 0 6px 20px rgba(0, 0, 0, .45); }
.pp-part + .pp-part { border-top: 1px solid var(--line); }
.pe-fields { display: grid; gap: 10px; }
.pe-fields label { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.pe-fields label span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.pe-fields input { margin: 0; }
.pe-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-height: 52vh; display: flex; flex-direction: column; border-top: 1px solid var(--accent-line); border-radius: 18px 18px 0 0; background: var(--card); color: var(--text); box-shadow: 0 -8px 30px rgba(0, 0, 0, .5); padding-bottom: env(safe-area-inset-bottom); }
.pe-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pe-panel-head .button { margin: 0; }
.pe-panel-body { display: grid; gap: 10px; padding: 12px 16px 18px; overflow-y: auto; }
.pe-field { display: grid; gap: 4px; margin: 0; font-weight: 400; }
.pe-field span { color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.pe-colors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pe-colors input[type="color"] { width: 100%; height: 40px; padding: 2px; }
@media (max-width: 420px) { .pe-fields label { grid-template-columns: 1fr; gap: 4px; } }
.pe-photo-btn input[type="file"], .pe-picture input[type="file"] { display: none !important; }
.pe-cover-btn { left: auto; width: auto; max-width: max-content; white-space: nowrap; }

/* About me and Crew sit in the box as they are, without a bar */
.pp-plain { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.pp-plain .description { flex: 1; min-width: 0; margin: 0; }
.pp-crew-row { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pp-crew-row::-webkit-scrollbar { display: none; }
.pp-crew-person { flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; width: calc((100% - 32px) / 5); max-width: 64px; color: var(--text); font-size: calc(11px * var(--ts, 1)); text-align: center; text-decoration: none; }
.pp-crew-person img { width: 100%; max-width: 52px; height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover; background: var(--raised); }
.pp-crew-person span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-crew-plus { display: grid; place-items: center; width: 100%; max-width: 52px; aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 50%; color: var(--muted); font-size: 26px; }
.pp-part.pe-off.pp-plain > :not(.pe-eye):not(.pe-grip) { opacity: .4; }
.pp-plain .pe-eye { margin-left: 0; }
.pp-main > .page-tabs, .pp-main > .tabs { margin-top: 14px; }
.pp-plain .description { padding: 0; }

/* Hobbies & projects */
.pp-hobbies { flex: 1; min-width: 0; display: grid; gap: 8px; }
.pp-project { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; overflow-wrap: anywhere; }
.pp-project-label { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-text); font-size: calc(12.5px * var(--ts, 1)); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pp-project-label .icon { width: 16px; height: 16px; }
.pp-hobby-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-hobby { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); font-size: calc(13px * var(--ts, 1)); }
.pe-panel textarea { width: 100%; resize: vertical; }

/* The friends page: a picture beside each name. */
.friend-cards { list-style: none; margin: 6px 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.friend-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); }
.friend-card img { flex: none; width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.friend-card-name { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.friends-note { margin: 4px 0 12px; }

.friends-count { font-weight: 400; margin-left: 4px; }
.friend-card-open { color: var(--text); text-decoration: none; cursor: pointer; }
.friend-card-open:hover { border-color: var(--accent); text-decoration: none; }
.friend-card-go { margin-left: auto; opacity: .6; display: grid; }

/* The profile editor's Pictures and Crew panels. */
.pe-sub { margin: 8px 0 0; font-weight: 600; }
.pe-panel .preset[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.pe-crew-strip, .pe-crew-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pe-crew-strip:empty { display: none; }
.pe-crew-chip, .pe-crew-pick { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--text); font: inherit; font-size: calc(14px * var(--ts, 1)); }
.pe-crew-chip { border-color: var(--accent); background: var(--accent-soft); padding-right: 5px; }
.pe-crew-pick { cursor: pointer; }
.pe-crew-pick:disabled { opacity: .45; cursor: default; }
.pe-crew-chip img, .pe-crew-pick img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.pe-crew-btn { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card-top); color: var(--text); font-size: 16px; line-height: 1; cursor: pointer; }
.pe-crew-btn:disabled { opacity: .35; cursor: default; }
button.pp-crew-add { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.pe-field[hidden], .pe-panel .button[hidden] { display: none; }
