/* A space's page. Everything visual comes from the owner's theme, which arrives as CSS
   variables and data- attributes on <html> (see SpaceTheme.ToCssVars and space.js applyTheme):
     --bg --bg2 --card --text --accent --on-accent --banner1 --banner2 --on-banner --on-bg
     --radius --font-head --font-body
     data-pattern  data-cards  data-layout  data-avatar  data-title                      */

* { box-sizing: border-box; }

html {
    --muted: color-mix(in srgb, var(--text) 62%, var(--card));
    --line: color-mix(in srgb, var(--text) 16%, transparent);
    --tint: color-mix(in srgb, var(--accent) 12%, transparent);
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text);
    line-height: 1.6;
    background: linear-gradient(165deg, var(--bg), var(--bg2)) fixed;
    overflow-wrap: anywhere;
}

a { color: var(--accent); }
button { font: inherit; color: inherit; }

/* ── Background pattern ── */
.pattern { position: fixed; inset: 0; pointer-events: none; z-index: 0; --p: color-mix(in srgb, var(--on-bg) 13%, transparent); }
[data-pattern="dots"] .pattern { background: radial-gradient(circle, var(--p) 1.6px, transparent 1.8px) 0 0 / 22px 22px; }
[data-pattern="grid"] .pattern { background: linear-gradient(var(--p) 1px, transparent 1px) 0 0 / 30px 30px, linear-gradient(90deg, var(--p) 1px, transparent 1px) 0 0 / 30px 30px; }
[data-pattern="stripes"] .pattern { background: repeating-linear-gradient(45deg, var(--p) 0 2px, transparent 2px 18px); }
[data-pattern="checks"] .pattern { background: conic-gradient(var(--p) 25%, transparent 0 50%, var(--p) 0 75%, transparent 0) 0 0 / 44px 44px; }
[data-pattern="stars"] .pattern {
    --s: color-mix(in srgb, var(--on-bg) 55%, transparent);
    background:
        radial-gradient(circle, var(--s) 1px, transparent 1.4px) 12px 20px / 130px 130px,
        radial-gradient(circle, var(--s) 1.4px, transparent 1.9px) 70px 90px / 190px 190px,
        radial-gradient(circle, var(--s) .8px, transparent 1.2px) 40px 140px / 90px 90px,
        radial-gradient(circle, var(--s) 1.8px, transparent 2.3px) 150px 40px / 260px 260px;
}

/* ── Top bar ── */
.topbar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 1080px; margin: 0 auto; padding: 10px 18px; color: var(--on-bg); }
.topbar-brand { color: inherit; text-decoration: none; }
.bs-logo { display: inline-flex; align-items: center; gap: 7px; }
.bs-logo-word { font-family: 'Poppins', system-ui, sans-serif; font-weight: 600; font-size: 1.1rem; }
.bs-logo-word b { font-weight: 800; }
.topbar-right { position: relative; display: flex; align-items: center; gap: 8px; }

/* The menu icon and the panel it drops, in the space's own colors. */
.menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 42px; padding: 0; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.menu-btn:hover { background: color-mix(in srgb, var(--card) 88%, var(--text)); }
.site-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; min-width: 190px; display: flex; flex-direction: column; gap: 2px; padding: 8px; text-align: right; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.site-menu[hidden] { display: none; }
.site-menu a { padding: 8px 10px; border-radius: 6px; font-weight: 700; font-size: .92rem; text-decoration: none; color: var(--text); }
.site-menu a:hover { background: var(--tint); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

.pill { display: inline-block; text-decoration: none; font-weight: 700; font-size: .85rem; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
.pill.pill-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; }

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 18px 30px; }

/* ── Banner ── */
.banner {
    min-height: 210px;
    border-radius: var(--radius);
    background: linear-gradient(120deg, var(--banner1), var(--banner2)) center / cover no-repeat;
    color: var(--on-banner);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    position: relative;
}
.banner.has-image { color: #fff; }
.banner.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0) 65%); }
.banner-text { position: relative; z-index: 1; padding: 22px 26px; width: 100%; }
.space-title { font-family: var(--font-head); font-size: clamp(1.7rem, 5vw, 3rem); line-height: 1.12; margin: 0; font-weight: 700; }
.space-tagline { margin: 6px 0 0; font-size: clamp(.95rem, 2vw, 1.15rem); opacity: .92; }

[data-title="glow"] .space-title { text-shadow: 0 0 10px var(--accent), 0 0 26px var(--accent), 0 0 48px var(--accent); }
[data-title="shadow"] .space-title { text-shadow: 3px 3px 0 rgba(0, 0, 0, .5); }
[data-title="gradient"] .space-title { background: linear-gradient(90deg, currentColor, var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ── Layout ── */
.cols { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
[data-layout="right"] .cols { grid-template-columns: minmax(0, 1fr) 310px; }
[data-layout="right"] .profile { order: 2; }
[data-layout="stacked"] .cols { grid-template-columns: minmax(0, 720px); justify-content: center; }

/* ── Cards ── */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; }
[data-cards="shadow"] .card { box-shadow: 0 8px 26px rgba(0, 0, 0, .14); }
[data-cards="outline"] .card { border: 2px solid color-mix(in srgb, var(--text) 45%, transparent); }
[data-cards="glass"] .card { background: color-mix(in srgb, var(--card) 68%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); }

/* ── Profile ── */
.profile { text-align: center; }
.avatar-wrap { margin-top: -64px; position: relative; z-index: 2; }
[data-layout="stacked"] .avatar-wrap { margin-top: 0; }
.avatar { width: 124px; height: 124px; object-fit: cover; border: 4px solid var(--card); border-radius: 50%; background: var(--card); display: inline-block; }
[data-avatar="rounded"] .avatar { border-radius: 24%; }
[data-avatar="square"] .avatar { border-radius: 0; }
.avatar-blank { background: var(--accent); color: var(--on-accent); font-family: var(--font-head); font-weight: 700; font-size: 3.2rem; line-height: 116px; }

.owner-name { font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; margin-top: 8px; }
.owner-addr { color: var(--muted); font-size: .8rem; }

.facts { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; font-size: .93rem; }
.facts li { padding: 7px 0; border-top: 1px solid var(--line); }
.facts span { display: inline-block; min-width: 76px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

.side-h { font-family: var(--font-head); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 20px 0 6px; text-align: left; }
.about { text-align: left; font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--tint); color: var(--text); border-radius: 999px; padding: 3px 11px; font-size: .82rem; font-weight: 600; }

.video { display: block; width: 100%; aspect-ratio: 16 / 9; position: relative; padding: 0; border: 0; cursor: pointer; overflow: hidden; background: #000; border-radius: calc(var(--radius) * .6); }
.video img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: var(--accent); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.video-play::before { content: ""; position: absolute; left: 21px; top: 16px; border-style: solid; border-width: 10px 0 10px 16px; border-color: transparent transparent transparent var(--on-accent); }
.video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; border-radius: calc(var(--radius) * .6); }


.side-foot { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; font-size: .82rem; }
.link-btn .share-ico { display: block; }

/* ── Feed ── */
.feed { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.empty { text-align: center; color: var(--muted); padding: 34px 20px; }

a.composer-open { display: block; box-sizing: border-box; text-decoration: none; }
.composer-open { width: 100%; text-align: left; background: var(--tint); border: 1.5px dashed var(--accent); border-radius: calc(var(--radius) * .6); padding: 12px 16px; font-weight: 700; cursor: pointer; color: var(--text); }
.composer-open { display: flex; align-items: center; gap: 10px; }
.composer-icon { flex: none; color: var(--accent); }
.composer-form, .edit-form { display: flex; flex-direction: column; gap: 10px; }
.composer-form[hidden] { display: none; }

input[type=text], textarea {
    width: 100%; font: inherit; color: var(--text);
    background: var(--card);   /* the card colour itself: a darker fill read as disabled */
    border: 1.5px solid color-mix(in srgb, var(--text) 32%, transparent); border-radius: calc(var(--radius) * .5); padding: 10px 12px;
}
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
::placeholder { color: var(--muted); opacity: .8; }

.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-msg { margin-right: auto; font-size: .85rem; font-weight: 600; color: #d43c4f; }
.btn-accent { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px; padding: 9px 20px; font-weight: 700; cursor: pointer; }
/* Grayed out: nothing to send or save yet. */
.btn-accent:disabled { background: color-mix(in srgb, var(--text) 16%, var(--card)); color: color-mix(in srgb, var(--text) 42%, var(--card)); cursor: not-allowed; }
.btn-plain { background: none; border: 0; padding: 9px 8px; font-weight: 700; color: var(--muted); cursor: pointer; }

.post-head { margin-bottom: 10px; }
.post-title { font-family: var(--font-head); font-size: 1.1rem; line-height: 1.25; margin: 0 0 3px; font-weight: 700; }
.post-author, .post-date, .post-edited { color: var(--muted); font-size: .8rem; }
.post-author { font-weight: 700; }
.post-date::before, .post-edited::before { content: "· "; }
.post-body { font-size: .875rem; line-height: 1.5; }
/* The feed shows the start of a long post; "Read more" opens the post's own page. */
.post-more { display: inline-block; margin-top: 8px; font-size: .86rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.post-more:hover { text-decoration: underline; }

.post-actions { display: flex; align-items: center; gap: 4px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.act { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; border-radius: 999px; padding: 6px 11px; font-size: .86rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.act:hover { background: var(--tint); color: var(--text); }
.act svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.act[data-act="share"] svg, .act[data-act="repost"] svg,.act[data-act="delete"] svg, .act[data-act="edit"] svg, .act[data-act="block"] svg { stroke-linecap: round; }
.act.like.on { color: var(--accent); }
.act.like.on svg { fill: currentColor; }
.act.danger:hover { color: #d43c4f; }
.act-gap { flex: 1; }

/* ── Comments ── */
.comments { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.comments[hidden] { display: none; }
.comment { padding: 10px 0 6px; margin-bottom: 2px; font-size: .93rem; }
.comments > .comment { border-top: 1px solid var(--line); }
.comment-head { display: flex; align-items: baseline; gap: 8px; font-size: .8rem; color: var(--muted); }
.comment-head b { color: var(--text); font-size: .88rem; }
.comment-head .badge { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 7px; font-size: .68rem; font-weight: 700; }
.comment-head .del { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .78rem; font-weight: 700; padding: 0; }
.comment-head .del + .del { margin-left: 4px; }
.comment-head .del:hover { color: #d43c4f; }
.comment-head .del.reply:hover { color: var(--accent); }
.comment-head .del.share, .comment-head .del.trash, .comment-head .del.edit, .comment-head .del.reply, .comment-head .del.block, .comment-head .del.approve { display: inline-flex; align-self: center; }
.comment-head .del.edit:hover { color: var(--accent); }
.comment-head .del.share svg, .comment-head .del.trash svg, .comment-head .del.edit svg, .comment-head .del.reply svg, .comment-head .del.block svg, .comment-head .del.approve svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.comment-head .del.share:hover { color: var(--accent); }
.comment.clickable { cursor: pointer; }
.comment.linked { outline: 2px solid var(--accent); outline-offset: 2px; }
.replies { margin-left: 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.replies.flat { margin-left: 0; padding-left: 0; border-left: 0; }
.reply-slot .comment-form { margin: 0 0 8px; }
.comment-text { white-space: pre-wrap; margin-top: 2px; }
.comment-none { color: var(--muted); font-size: .88rem; margin-bottom: 8px; }
.comment-media { display: block; max-width: 100%; max-height: 420px; margin-top: 6px; border-radius: calc(var(--radius) * .4); }
video.comment-media { width: 100%; max-width: 480px; background: #000; }

/* The original post inside a repost with a note. */
.quote { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: calc(var(--radius) * .5); color: var(--text); text-decoration: none; }
.quote { position: relative; }
.quote:hover { background: var(--tint); }
.quote-by { font-size: .78rem; font-weight: 700; color: var(--muted); }
.quote-title { font-weight: 700; color: inherit; text-decoration: none; }
.quote-title::after { content: ""; position: absolute; inset: 0; }
.quote-body { margin-top: 4px; }
.quote-body a { position: relative; z-index: 1; }
.quote-img { max-width: 100%; max-height: 220px; margin-top: 6px; border-radius: calc(var(--radius) * .4); align-self: flex-start; }
.quote-gone { color: var(--muted); font-size: .9rem; font-style: italic; }

/* The "Repost with a note" box. */
.repost-back { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.repost-box { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: var(--card); color: var(--text); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.repost-box h3 { margin: 0; font-size: 1.05rem; }
.repost-box textarea { min-height: 96px; resize: vertical; }
.repost-box .quote { margin-top: 0; pointer-events: none; }

/* A picture or video on a post. */
.post-media { display: block; max-width: 100%; max-height: 520px; margin-top: 12px; border-radius: calc(var(--radius) * .5); }
video.post-media { width: 100%; max-width: 560px; background: #000; }

/* The tools under the post composer's text box: attachment preview, then the bar. */
.cf-wrap { position: relative; display: flex; flex-direction: column; gap: 6px; }

/* The comment box: text on top, then the attached picture or video, then a bar with the
   picture / video / emoji buttons on the left and Post on the right. */
.comment-form { position: relative; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.comment-form textarea { min-height: 42px; }
.cf-bar { display: flex; align-items: center; gap: 2px; }
.cf-gap { flex: 1; }
.cf-bar .btn-accent { flex: 0 0 auto; white-space: nowrap; }
.cf-tool { display: inline-flex; background: none; border: 0; border-radius: 999px; padding: 7px; color: var(--muted); cursor: pointer; }
.cf-tool:hover { background: var(--tint); color: var(--text); }
.cf-tool svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cf-preview { position: relative; align-self: flex-start; max-width: 100%; }
.cf-preview[hidden] { display: none; }
.cf-preview img, .cf-preview video { display: block; max-width: 100%; max-height: 180px; border-radius: calc(var(--radius) * .4); }
.cf-remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.emoji-pop { position: absolute; left: 0; top: 100%; z-index: 5; margin-top: 4px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: calc(var(--radius) * .5); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.emoji-pop[hidden] { display: none; }
.emoji-pop button { background: none; border: 0; border-radius: 6px; padding: 4px; font-size: 1.25rem; line-height: 1.2; cursor: pointer; }
.emoji-pop button:hover { background: var(--tint); }
.comment-register { display: block; font-size: .9rem; font-weight: 700; margin-bottom: 10px; }
.comments > .comment-form { margin: 0 0 12px; }

/* ── Help and About ── */
.info { max-width: 760px; margin: 0 auto; }
.info h1 { font-family: var(--font-head); font-size: 1.5rem; margin: 10px 0 12px; }
.info h2 { font-family: var(--font-head); font-size: 1.05rem; margin: 22px 0 6px; color: var(--accent); }
.info p, .info li { font-size: .95rem; }
.info-back { font-size: .85rem; font-weight: 700; text-decoration: none; }
.info-lead { font-size: 1.05rem; color: var(--muted); }
.info-facts { list-style: none; margin: 14px 0 0; padding: 0; }
.info-facts li { padding: 7px 0; border-top: 1px solid var(--line); }
.info-facts span { display: inline-block; min-width: 96px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

.space-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; text-align: center; font-size: .85rem; margin-top: 30px; padding-top: 18px; border-top: 1px solid color-mix(in srgb, var(--on-bg) 20%, transparent); }
.space-foot-logo { display: block; height: 32px; width: auto; }

/* The same format as AIChatPort's footer: gray line, blue ClarkApps link with no underline
   until you hover it. The gray and the blue are mixed with the page's text color so they
   stay readable on a dark theme as well as a light one. */
.space-foot-line { display: block; font-size: inherit; line-height: 1.5; color: color-mix(in srgb, var(--on-bg) 62%, var(--bg)); }
.space-foot-line a { color: color-mix(in srgb, #0066cc 62%, var(--on-bg)); text-decoration: none; }
.space-foot-line a:hover { text-decoration: underline; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 20; background: var(--text); color: var(--card); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.toast[hidden] { display: none; }

/* Inside the Studio's live preview: look, don't touch. */
.is-preview .topbar, .is-preview .composer { display: none; }
.is-preview .wrap { padding-top: 16px; }

@media (max-width: 800px) {
    .cols, [data-layout="right"] .cols { grid-template-columns: minmax(0, 1fr); }
    [data-layout="right"] .profile { order: 0; }
    .banner { min-height: 150px; }
    .banner-text { padding: 16px 18px; }
    .avatar { width: 104px; height: 104px; }
    .avatar-blank { line-height: 96px; font-size: 2.6rem; }
    .avatar-wrap { margin-top: -56px; }
}

@media (max-width: 520px) {
    .wrap { padding: 0 10px 24px; }
    .topbar { padding: 8px 12px; }
    .card { padding: 15px; }
    .post-title { font-size: 1rem; }
    .pill { font-size: .78rem; padding: 6px 11px; }
}
.media-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.vid-title { margin-top: 4px; font-size: .86rem; line-height: 1.3; color: var(--muted); }
.song { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; cursor: pointer; font: inherit; text-align: left; color: var(--text); background: color-mix(in srgb, var(--text) 8%, var(--card)); border-radius: calc(var(--radius) * .6); }
.song:hover { background: color-mix(in srgb, var(--text) 14%, var(--card)); }
.song.on { box-shadow: inset 0 0 0 2px var(--accent); }
.blog-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-decoration: none; color: var(--text); background: color-mix(in srgb, var(--text) 8%, var(--card)); border-radius: calc(var(--radius) * .6); }
.blog-link:hover { background: color-mix(in srgb, var(--text) 14%, var(--card)); }
.blog-go { flex: none; color: var(--muted); }
.song-player[hidden] { display: none; }
.song-art { flex: none; width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.song-art-blank { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--accent); color: var(--on-accent); }
.song-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.song-title { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-art { width: 85px; height: 48px; }
.song-artist { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-play { flex: none; position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); }
.song-play::before { content: ""; position: absolute; left: 12px; top: 8px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent var(--on-accent); }
.song-frame { width: 100%; height: 175px; border: 0; display: block; border-radius: calc(var(--radius) * .6); }
.song-player { margin-bottom: 12px; }
.song-player:not([hidden]) { display: block; }
.ppane { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ppane[hidden], .mpane[hidden] { display: none; }
.ptabs { display: flex; gap: 8px; }
.ptab { border: 0; cursor: pointer; font: inherit; font-weight: 700; padding: 9px 20px; border-radius: 999px; color: var(--text); background: var(--card); }
.ptab:hover { background: color-mix(in srgb, var(--text) 10%, var(--card)); }
.ptab.on { background: var(--accent); color: var(--on-accent); }
.ptab-n { opacity: .7; font-weight: 600; font-size: .85em; margin-left: 2px; }
.mtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.mtab { border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .92rem; padding: 7px 14px; border-radius: 999px; color: var(--muted); background: transparent; }
.mtab:hover { color: var(--text); }
.mtab.on { background: var(--tint); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.media-empty { margin: 0; padding: 28px 10px; text-align: center; color: var(--muted); }

.install-app-btn { flex-basis: 100%; margin: 4px auto 0; padding: 7px 16px; width: fit-content; border: 1px solid color-mix(in srgb, var(--on-bg) 25%, transparent); border-radius: 999px; background: transparent; color: color-mix(in srgb, #0066cc 62%, var(--on-bg)); font: inherit; font-weight: 700; cursor: pointer; }
.install-app-btn:hover { text-decoration: underline; }

/* ── Post text (the small Markdown subset: PostHtml on the server) ── */
.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { text-decoration: underline; }
.post-read { color: var(--muted); font-size: .8rem; }
.post-read::before { content: "· "; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; }
.md h3, .md h4 { font-family: var(--font-head); line-height: 1.25; margin: 1.1em 0 .4em; }
.md h3 { font-size: 1.2em; }
.md h4 { font-size: 1.05em; }
.md ul, .md ol { margin: .4em 0 .8em; padding-left: 1.4em; }
.md li { margin: .15em 0; }
.md blockquote { margin: .7em 0; padding: .2em 1em; border-left: 3px solid var(--accent); color: var(--muted); }
.md code { background: var(--tint); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.1em 0; }
.md-embed { position: relative; aspect-ratio: 16 / 9; margin: .8em 0; }
.md-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: calc(var(--radius) * .5); }

/* A post on its own page. */
.post-page { max-width: 760px; margin: 20px auto 0; display: flex; flex-direction: column; gap: 14px; }
.post.is-full .post-title { font-size: 1.7rem; margin-bottom: 6px; }
.post.is-full .post-body { font-size: 1rem; line-height: 1.7; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.post-nav-link { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; text-decoration: none; color: var(--text); background: var(--card); border-radius: calc(var(--radius) * .6); font-weight: 700; }
.post-nav-link small { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.post-nav-link:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.post-nav-link.next { text-align: right; grid-column: 2; }

/* Drafts, labels and the pager. */
.flag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); vertical-align: 1px; }
.flag-draft { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.flag-held { color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.post.is-draft { outline: 2px dashed var(--accent); outline-offset: -2px; }
.act.publish { color: var(--accent); }
.feed-h { font-family: var(--font-head); font-size: 1.05rem; margin: 4px 0 -6px; color: var(--on-bg); }
.feed-h small { font-weight: 400; font-size: .78rem; opacity: .75; margin-left: 6px; }
.held-note { background: var(--tint); font-size: .92rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pager-link { font-weight: 700; text-decoration: none; padding: 8px 18px; border-radius: 999px; background: var(--card); color: var(--text); }
.pager-link:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.pager-n { font-size: .85rem; color: var(--on-bg); opacity: .8; }
.side-links { display: inline-flex; align-items: center; gap: 12px; }
.side-links .link-btn { display: inline-flex; text-decoration: none; }

/* Writing tools: formatting buttons, preview, the unsent-draft reminder. */
.fmt-slot:empty { display: none; }
.fmt-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.fmt-btn { min-width: 34px; height: 32px; padding: 0 9px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 700; cursor: pointer; }
.fmt-btn:hover:not(:disabled) { background: var(--tint); color: var(--text); }
.fmt-btn:disabled { opacity: .4; cursor: default; }
.fmt-btn.i { font-style: italic; }
.fmt-btn svg { display: block; margin: 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fmt-btn.pv { font-size: .82rem; box-shadow: inset 0 0 0 1px var(--line); }
.md-preview { border: 1.5px dashed var(--line); border-radius: calc(var(--radius) * .5); padding: 12px 14px; min-height: 120px; }
.md-preview[hidden] { display: none; }
.opt { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); cursor: pointer; }
.opt input { width: auto; margin: 0; }
.restored { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 12px; font-size: .85rem; background: var(--tint); border-radius: calc(var(--radius) * .5); }
.restored[hidden] { display: none; }
.composer-left { margin-left: auto; padding: 1px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--accent); color: var(--on-accent); }
.post.editing > :is(.post-head, .post-body, .post-more, .post-actions, .comments, a, video, iframe) { display: none; }
.edit-media { display: flex; flex-direction: column; gap: 6px; }
.edit-media-note { font-size: .82rem; color: var(--muted); }

/* Comment notes, held comments, editing a comment. */
.comment-note { margin-bottom: 10px; padding: 8px 12px; font-size: .88rem; color: var(--muted); background: var(--tint); border-radius: calc(var(--radius) * .5); }
.comment.is-held { padding-left: 10px; border-left: 3px solid var(--accent); }
.comment-head .badge-held { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.comment-head .del.approve { color: var(--accent); }
.comment-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

@media (max-width: 520px) {
    .post.is-full .post-title { font-size: 1.35rem; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-link.next { grid-column: auto; }
}

/* ── The owner's media editor (Edit media on the Media tab) ── */
.mtab-edit { margin-left: auto; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .88rem; padding: 7px 14px; border-radius: 999px; color: var(--text); background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.mtab-edit:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.mtab-edit[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.media-item { position: relative; min-width: 0; }
.item-remove, .manage { display: none; }
.editing .item-remove { display: flex; }
.editing .manage { display: block; }
.editing .media-empty { padding-bottom: 8px; }
.item-remove { position: absolute; top: -7px; right: -7px; width: 26px; height: 26px; align-items: center; justify-content: center; border: 0; border-radius: 50%; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 700; line-height: 1; color: #fff; background: #d43c4f; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.item-remove:hover { background: #b32d3f; }
.item-remove:disabled { opacity: .5; cursor: default; }
.manage { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.manage-count { margin: 0 0 8px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.manage-full { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: #fff3e0; color: #8a5300; font-size: .85rem; font-weight: 600; }
.manage-block { margin-top: 14px; }
.manage-title { font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
.manage-add { display: flex; gap: 8px; }
.manage-add input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); background: var(--card); }
.manage-add input:disabled { opacity: .55; cursor: not-allowed; }
.m-btn { flex: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .9rem; padding: 8px 16px; border-radius: 8px; color: var(--on-accent); background: var(--accent); }
.m-btn:hover { filter: brightness(1.08); }
.m-btn:disabled { opacity: .5; cursor: not-allowed; }
.manage-msg { display: block; min-height: 1.2em; margin-top: 6px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.manage-msg.ok { color: var(--muted); }
.manage-msg.bad { color: #d43c4f; }
.manage-hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.manage-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.manage-or::before, .manage-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.manage-results { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.result-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: calc(var(--radius) * .6); background: color-mix(in srgb, var(--text) 8%, var(--card)); }
.result-art { flex: none; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.result-art-blank { display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); }
.result-text { flex: 1; min-width: 0; }
.result-title { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Follow button and the follower count under a space's name */
.follow-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; flex-wrap: wrap; }
.follow-count { font-size: .86rem; color: var(--muted); }
.follow-btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 999px; padding: 6px 16px; font-size: .86rem; font-weight: 700; cursor: pointer; }
.follow-btn.on { background: transparent; color: var(--accent); }
.follow-btn:disabled { opacity: .6; cursor: default; }

/* The list of people who liked a post */
.likers-btn { font-weight: 600; }
.likers-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.likers-box { background: var(--card, #fff); color: var(--text); border-radius: 16px; width: 100%; max-width: 420px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.likers-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line, rgba(128,128,128,.25)); }
.likers-title { margin: 0; font-size: 1.15rem; }
.likers-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.likers-list { overflow-y: auto; padding: 6px 12px 12px; }
.likers-empty { color: var(--muted); text-align: center; padding: 18px 0; margin: 0; }
.liker { display: flex; align-items: center; gap: 12px; padding: 8px 6px; }
.liker-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.liker-blank { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 700; }
.liker-who { display: flex; flex-direction: column; min-width: 0; flex: 1; text-decoration: none; color: inherit; }
.liker-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liker-space { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.count-link b { color: var(--text); }
.count-link:hover { text-decoration: underline; }
.post-in { color: var(--muted); }
.post-in a { color: inherit; font-weight: 600; }
/* The My posts / For you / Following switch under the writing box */
.feed-switch { position: relative; align-self: flex-start; }
.feed-pick { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 2px; font: inherit; font-size: 1rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.feed-pick:hover { color: var(--text); }
.feed-menu { position: absolute; left: 0; top: calc(100% + 4px); min-width: 180px; background: var(--card); color: var(--text); border: 1px solid var(--line, rgba(128,128,128,.3)); border-radius: 14px; box-shadow: 0 14px 34px rgba(20, 24, 50, .2); padding: 6px; z-index: 20; }
.feed-opt { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; border-radius: 10px; padding: 10px 12px; font: inherit; font-weight: 600; color: inherit; cursor: pointer; text-align: left; }
.feed-opt:hover { background: color-mix(in srgb, var(--text) 8%, var(--card)); }
.feed-check { visibility: hidden; color: var(--accent); }
.feed-opt.on .feed-check { visibility: visible; }
