/* ✨ Everything is driven by CSS variables set by the active theme (see index.php / app.js)
   Sections: base · page shell · buttons & forms · page headers & cards · posts · hearts · comments
             · pager · video player · editor · profiles & members · notifications · settings · phones */

/* ───────────── 🧱 Base ───────────── */
* { box-sizing: border-box; }
body {
	margin: 0; padding: 28px 16px;
	background-color: var(--bg); background-image: var(--bg-tile); background-repeat: repeat;
	color: var(--text); font: 17px/1.65 var(--font-body);
}
/* 🖼️ Photo backgrounds sit on their own fixed layer. (background-attachment: fixed is broken on phones.) */
body::before {
	content: ''; position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none;
	background: var(--bg-cover) center / cover no-repeat;
}
a { color: var(--link); cursor: pointer; }
a:hover { color: var(--link-hover); }
h1, h2, h3 { font-family: var(--font-head); color: var(--heading); }
.err { color: #e0533f; }
.err:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; } /* 🍯 bot trap */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cnote { font-size: .85rem; color: var(--muted); margin: 0 0 10px; }
.file { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }

/* ───────────── 🏠 Page shell ───────────── */
#page {
	max-width: 1000px; margin: 0 auto; padding: 28px 32px;
	/* 🪟 Opacity + frosted blur come from the theme (100% = solid) */
	background: rgba(var(--page-rgb), var(--surf-a)); border: 1px solid var(--border);
	-webkit-backdrop-filter: var(--page-filter); backdrop-filter: var(--page-filter);
	border-radius: calc(var(--radius) * 1.6); box-shadow: 0 10px 40px rgba(0, 0, 0, .10);
}

/* 🏷️ Header: site title on the left, account actions on the right */
header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 20px; }
.brand { min-width: 0; }
#site-title { display: inline-flex; align-items: center; gap: .4em; max-width: 100%; font: 700 2rem/1.1 var(--font-head); color: var(--heading); text-decoration: none; }
#site-title.logo-right { flex-direction: row-reverse; justify-content: flex-end; }
/* 🖼️ Header logo: height follows the title's font size, so it scales with it */
#site-logo { height: calc(1.1em * var(--logo-scale, 1)); width: auto; max-width: 100%; object-fit: contain; display: block; flex: none; }
#tagline { color: var(--muted); font-size: .95rem; margin-top: 4px; }
#tagline:empty { display: none; }

#nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#nav a {
	display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 999px;
	font-size: .88rem; font-weight: 600; line-height: 1.2; text-decoration: none;
	color: var(--text); background: rgb(var(--side-rgb)); border: 1px solid var(--border);
}
#nav a:hover, #nav a.on { color: var(--text); border-color: var(--accent); }
#nav a.cta { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
#nav a.cta:hover { color: var(--accent-text); filter: brightness(1.1); }
#nav a.icon { position: relative; padding: 7px 10px; }
#nav a.icon .nbadge { position: absolute; top: -6px; right: -8px; margin: 0; }
#nav a.quiet { background: none; border-color: transparent; color: var(--muted); }
#nav a.quiet:hover { color: var(--text); }
#nav .pmenu-wrap { display: none; } /* 📱 the ⋯ menu: phones only (wide screens have these links in #sections) */
.pmenu-wrap { position: relative; }
.pmenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 170px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--page-rgb)); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.pmenu[hidden] { display: none; }
#nav .pmenu a { display: flex; padding: 10px 12px; border: 0; border-radius: 8px; background: none; font-size: .95rem; cursor: pointer; }
#nav .pmenu a:hover { background: rgb(var(--side-rgb)); }

/* 🧭 Site sections (Home / Community) as tabs under the header */
#sections { display: flex; gap: 4px; flex-wrap: wrap; margin: 20px 0 28px; border-bottom: 1px solid var(--border); }
#sections a {
	padding: 10px 14px; margin-bottom: -1px; font-weight: 600; font-size: .95rem; text-decoration: none;
	color: var(--muted); border-bottom: 2px solid transparent;
}
#sections a:hover { color: var(--text); }
#sections a.on { color: var(--heading); border-bottom-color: var(--accent); }
#sections a.far { margin-left: auto; } /* 🏭 the Blog/Factory switch sits at the far end */

/* 🧱 Content + sidebar */
#layout { display: flex; flex-direction: var(--layout-dir); gap: 24px; align-items: flex-start; }
main { flex: 1; min-width: 0; transition: opacity .15s; }
main.loading { opacity: .4; }
aside { width: var(--side-w, 190px); flex-shrink: 0; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; font-size: .92rem; }
.sblock { background: rgb(var(--side-rgb)); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px; }
aside h3 { margin: 0 0 8px; font: 700 .75rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
aside ul { list-style: none; margin: 0; padding: 0; }
aside li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--border); line-height: 1.35; }
aside li:last-child { border-bottom: 0; }
aside a { text-decoration: none; font-weight: 600; }
aside .small { color: var(--muted); font-size: .78rem; margin: 10px 0 0; }
aside li .small { margin: 2px 0 0; font-weight: 400; }

footer { text-align: center; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: 32px; padding-top: 14px; }
footer a { color: var(--muted); }

/* ───────────── 🖱️ Buttons & forms ───────────── */
input[type=text], input[type=password], input[type=number], textarea, select {
	width: 100%; padding: 10px 12px; font: 16px var(--font-body); background: var(--page); color: var(--text);
	border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); margin-bottom: 12px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 220px; resize: vertical; }
button, .btnlike {
	display: inline-block; font: 600 .9rem var(--font-body); padding: 8px 16px; text-decoration: none;
	background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent);
	border-radius: calc(var(--radius) * .7); cursor: pointer;
}
button:hover, .btnlike:hover { color: var(--accent-text); filter: brightness(1.1); }
button.ghost, .btnlike.ghostlike { background: rgb(var(--side-rgb)); color: var(--text); border-color: var(--border); }
button.ghost:hover, .btnlike.ghostlike:hover { color: var(--text); border-color: var(--accent); filter: none; }
button.ghost.warn { color: #e0533f; }
button.ghost.warn:hover { border-color: #e0533f; }
button.danger { background: #c0392b; color: #fff; border-color: #c0392b; }
button.sm, .btnlike.sm { padding: 5px 12px; font-size: .8rem; }
button:disabled { opacity: .5; cursor: default; filter: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 4px 0 10px; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
/* 📎 File pickers styled as a dashed button (the real input is hidden inside the label) */
.filebtn {
	display: inline-block; padding: 8px 16px; cursor: pointer; font: 600 .9rem var(--font-body); color: var(--text);
	background: rgb(var(--side-rgb)); border: 1px dashed var(--muted); border-radius: calc(var(--radius) * .7);
}
.filebtn:hover { border-color: var(--accent); color: var(--accent); }
.pf-check { display: flex; gap: 8px; align-items: center; margin: 6px 0; }

/* ───────────── 🪧 Page headers & cards ───────────── */
main > h2:first-child { margin-top: 0; }
.page-head {
	display: flex; align-items: center; justify-content: space-between; gap: 14px 16px; flex-wrap: wrap;
	padding: 18px 22px; margin-bottom: 22px; border: 1px solid var(--border); border-radius: var(--radius);
	background: rgb(var(--side-rgb));
}
.page-head h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.ph-text { min-width: 0; }
.ph-btn { flex: none; }
.form-card, .panel { padding: 22px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--page-rgb)); }
.form-card h3:first-child, .panel h3:first-child { margin-top: 0; }
.field { margin-bottom: 20px; }
.field > label { display: block; margin-bottom: 6px; font: 700 .75rem var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field > label.filebtn { display: inline-block; margin-bottom: 10px; font: 600 .9rem var(--font-body); letter-spacing: 0; text-transform: none; color: var(--text); }
.field > label.filebtn:hover { color: var(--accent); }
.field input[type=text], .field select { margin-bottom: 0; }
.field .file { margin-bottom: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--border); }
.form-actions .err { margin: 0; }
.auth { max-width: 420px; }
.auth .form-actions { padding-top: 6px; border-top: 0; }
.auth a { font-size: .9rem; }
.back { display: inline-block; margin: 0 0 16px; font-size: .9rem; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }
.notice-all { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--accent); background: rgb(var(--side-rgb)); font-size: .9rem; }
/* 🗂️ Pill tabs (Settings tabs, Community Posts / Members) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.tabs .tab { background: rgb(var(--side-rgb)); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 7px 18px; }
.tabs .tab:hover { color: var(--text); border-color: var(--accent); filter: none; }
.tabs .tab.cur { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
/* 🔖 Section titles inside a page (Friends, Posts, Wall, Comments) */
.comments > h3, .pf-friends > h3, .pf-posts > h3 { margin: 32px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 1.2rem; }

/* ───────────── 📝 Posts ───────────── */
.post { padding: 24px; margin-bottom: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--page-rgb)); }
.post h2 { margin: 0 0 2px; font-size: 1.6rem; line-height: 1.25; overflow-wrap: anywhere; }
.post h2 a { color: var(--heading); text-decoration: none; }
.post h2 a:hover { color: var(--link); }
.body { white-space: pre-wrap; word-wrap: break-word; }
.body.rich, .editor { white-space: normal; overflow-wrap: anywhere; }
.post img, .post video { max-width: 100%; margin-top: 14px; display: block; border-radius: calc(var(--radius) * .7); }
/* Post footer: heart, comments, copy link, tag, and Edit/Delete pushed to the right */
.pmeta { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-size: .9rem; }
.pmeta a { text-decoration: none; font-weight: 600; }
.pmanage { margin-left: auto; display: flex; gap: 8px; }
.ctag {
	font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 3px 10px; border-radius: 999px;
	background: rgb(var(--side-rgb)); border: 1px solid var(--border); color: var(--muted) !important;
}
.ctag:hover { color: var(--link) !important; }

/* ✍️ Byline: round picture/initial + name, date underneath */
.byline { display: flex; align-items: center; gap: 10px; margin: 10px 0 16px; }
.byline-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
	background: var(--accent); color: var(--accent-text); font: 700 .95rem var(--font-body); }
.byline-text { min-width: 0; line-height: 1.25; }
.byline-name { font-weight: 700; color: var(--text); overflow-wrap: anywhere; text-decoration: none; }
a.byline-name:hover { text-decoration: underline; }
.byline-when { color: var(--muted); font-size: .8rem; display: flex; flex-wrap: wrap; gap: 0 8px; }
.byline-edited { font-style: italic; }
.byline-edited::before { content: "\00b7"; margin-right: 8px; font-style: normal; }

/* 🖼️ Round profile pictures (any avatar circle that has a photo). See-through pictures show the page behind them. */
.has-img { overflow: hidden; padding: 0; background: transparent; }
.byline-av.has-img, .c-av.has-img, .pf-av.has-img { display: block; background: transparent; }
.has-img img { width: 100%; height: 100%; margin: 0; max-width: none; object-fit: cover; display: block; border-radius: 50%; }
/* 🙂 Factory: the circle shows the dressed avatar's head (the top 300×300 of the 534×1450 body, centered) */
.has-head { display: block !important; position: relative; overflow: hidden; padding: 0; background: rgb(var(--side-rgb)); border: 1px solid var(--border); }
.has-head .avfig-head { position: absolute; top: 0; left: -39%; width: 178%; height: auto; margin: 0; }

/* ✍️ Formatted post content (used on posts and inside the editor) */
.rich p { margin: 0 0 .9em; }
.rich h2 { font-size: 1.4rem; margin: 1.1em 0 .4em; }
.rich h3 { font-size: 1.15rem; margin: 1em 0 .4em; }
.rich blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--accent); background: rgb(var(--side-rgb)); border-radius: 0 var(--radius) var(--radius) 0; color: var(--muted); }
.rich ul, .rich ol { margin: 0 0 .9em; padding-left: 1.6em; }
.rich code { font-family: "Courier New", Consolas, monospace; background: rgb(var(--side-rgb)); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; font-size: .92em; }
.rich pre { background: rgb(var(--side-rgb)); border: 1px solid var(--border); padding: 12px; border-radius: var(--radius); overflow-x: auto; white-space: pre-wrap; }
.rich hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }
.rich > :last-child { margin-bottom: 0; }

/* ───────────── 🗂️ Forum: sections, subsections (Community index and a section's page) ───────────── */
.fcat { margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--page-rgb)); overflow: hidden; }
.frow { display: grid; grid-template-columns: minmax(0, 1fr) 150px 190px auto; gap: 6px 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); }
.frow:first-child { border-top: 0; }
.fcat > .frow:first-child:not(:only-child) { background: rgb(var(--side-rgb)); } /* 📁 a section's own row, above its subsections */
.fcat > .frow + .frow { padding-left: 38px; }
.frow .cnote { margin: 2px 0 0; overflow-wrap: anywhere; }
.frow-name { font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--heading); }
.frow-name:hover { color: var(--link); }
.frow-last a { font-weight: 600; text-decoration: none; }
.frow-tools { display: flex; gap: 4px; }
.fcrumbs a { text-decoration: none; }
.fcrumbs a:hover { text-decoration: underline; }
.page-head .row.ph-btn { margin: 0; }

/* ───────────── ❤️ Hearts: one pill = heart button + clickable count, with a "who hearted" popover ───────────── */
.hwrap { position: relative; display: inline-flex; align-items: center; background: var(--page); border: 1px solid var(--border); border-radius: 999px; }
.hwrap.on { border-color: #e0405a; }
.hwrap button { background: none; color: var(--text); border: 0; margin: 0; font: 600 .95rem var(--font-body); line-height: 1.2; }
.hwrap button:hover { filter: none; color: var(--text); }
.hwrap button.heart { padding: 5px 12px; }
.hwrap button.heart:hover, .hwrap.on button.heart { color: #e0405a; }
.hwrap button.hcount { padding: 5px 12px 5px 0; margin-left: -6px; }
.hwrap button.hcount:hover { text-decoration: underline dotted; }
button.heart.pop { animation: heartpop .4s ease; }
@keyframes heartpop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.hpop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 150px; max-width: min(260px, 78vw); max-height: 220px; overflow: auto;
	background: var(--page); color: var(--text); border: 1px solid var(--border); border-radius: calc(var(--radius) * .7);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .25); padding: 8px 12px; font: 500 .85rem/1.6 var(--font-body); text-align: left; }
.hpop .hhead { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

/* ───────────── 💬 Comments (threaded: blocks inside blocks, alternating shades) ───────────── */
.comment { padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--side-rgb)); }
.comment.d1 { background: rgb(var(--page-rgb)); }
.comment.reply { margin: 12px 0 0; border-left: 4px solid var(--accent); }
.comment.gone { opacity: .65; font-style: italic; }
.comment.gone .ctext { color: var(--muted); }
.chead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .85rem; margin-bottom: 6px; }
.chead strong { color: var(--heading); font-size: .98rem; }
.chead .when { color: var(--muted); }
.cname { font-weight: 700; color: var(--heading); text-decoration: none; }
.cname:hover { text-decoration: underline; }
.c-av { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
	background: var(--accent); color: var(--accent-text); font: 700 .75rem var(--font-body); text-decoration: none; }
.badge { font-size: .7rem; font-weight: 700; background: var(--accent); color: var(--accent-text); padding: 1px 8px; border-radius: 999px; }
.ctext { white-space: pre-wrap; overflow-wrap: anywhere; }
.cactions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.cactions button.ghost { padding: 4px 10px; font-size: .8rem; }
.cactions .hwrap button { padding-top: 3px; padding-bottom: 3px; font-size: .85rem; }
.cform { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--page-rgb)); }
.cform textarea { min-height: 100px; }
.comment .cform { margin: 12px 0 0; padding: 0; border: 0; background: none; }
.reply-form textarea { min-height: 80px; }

/* ───────────── 🔢 Pagination ───────────── */
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 22px 0 6px; }
.pager a { min-width: 38px; text-align: center; padding: 6px 12px; font: 600 .9rem var(--font-body); text-decoration: none; color: var(--text);
	background: rgb(var(--side-rgb)); border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); user-select: none; }
.pager a:hover { border-color: var(--accent); }
.pager a.cur { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pager a.off { opacity: .35; pointer-events: none; }
.pager span { color: var(--muted); padding: 0 2px; }

/* ───────────── 🎬 Custom video player ───────────── */
.vp { position: relative; margin-top: 14px; background: #000; border-radius: calc(var(--radius) * .7); overflow: hidden; max-width: 100%; outline: none; line-height: 0;
	user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.vp:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.vp video { display: block; width: 100%; max-height: 80vh; background: #000; cursor: pointer; }
.post .vp video { margin: 0; border-radius: 0; }
.vp .vp-big { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; padding: 0; display: flex; align-items: center; justify-content: center;
	color: #fff; background: rgba(0, 0, 0, .55); border: 2px solid rgba(255, 255, 255, .85); border-radius: 50%;
	-webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); cursor: pointer; transition: transform .15s, background .15s, opacity .2s; }
.vp .vp-big:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-text); transform: scale(1.08); filter: none; }
.vp .vp-big svg { margin-left: 3px; }
.vp.playing .vp-big { opacity: 0; pointer-events: none; }
.vp-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 28px 10px 8px; color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, .8), transparent); font: 600 12px/1 var(--font-body); transition: opacity .25s; }
.vp.idle .vp-bar { opacity: 0; pointer-events: none; }
.vp.idle { cursor: none; }
.vp .vp-btn { display: inline-flex; align-items: center; justify-content: center; width: auto; margin: 0; padding: 6px; background: none; color: #fff; border: 0; border-radius: 6px; line-height: 0; cursor: pointer; flex: none; }
.vp .vp-btn:hover { background: rgba(255, 255, 255, .2); filter: none; }
.vp .vp-speed { font: 700 12px/1 var(--font-body); min-width: 44px; line-height: 1; padding: 9px 6px; }
.vp-time { white-space: nowrap; font-variant-numeric: tabular-nums; padding: 0 4px; }
.vp-track { position: relative; flex: 1; min-width: 40px; height: 22px; margin: 0 8px; cursor: pointer; touch-action: none; }
.vp-track::before, .vp-buf, .vp-fill { position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; transition: height .12s, margin-top .12s; }
.vp-track::before { content: ''; right: 0; background: rgba(255, 255, 255, .28); }
.vp-buf { width: 0; background: rgba(255, 255, 255, .4); pointer-events: none; }
.vp-fill { width: 0; background: var(--accent); pointer-events: none; }
.vp-track:hover::before, .vp-track:hover .vp-buf, .vp-track:hover .vp-fill, .vp.scrubbing .vp-fill { height: 6px; margin-top: -3px; }
.vp-knob { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff; transform: scale(0); transition: transform .12s; pointer-events: none; }
.vp-track:hover .vp-knob, .vp.scrubbing .vp-knob { transform: scale(1); }
.vp-tip { position: absolute; bottom: 24px; left: 0; transform: translateX(-50%); display: none; padding: 3px 7px; background: rgba(0, 0, 0, .85); border-radius: 4px; font-size: 11px; pointer-events: none; }
.vp-track:hover .vp-tip { display: block; }
.vp-volwrap { display: inline-flex; align-items: center; }
.vp .vp-vol { width: 70px; margin: 0; padding: 0; background: none; border: 0; accent-color: var(--accent); cursor: pointer; }
@media (hover: none) { .vp-volwrap .vp-vol { display: none; } .vp-knob { transform: scale(1); } }
@media (max-width: 520px) { .vp-bar { gap: 2px; padding: 24px 6px 6px; } .vp .vp-vol { display: none; } .vp .vp-speed { min-width: 36px; } .vp .vp-big { width: 64px; height: 64px; margin: -32px 0 0 -32px; } }
.vp-spin { display: none; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 4px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; animation: vpspin .8s linear infinite; pointer-events: none; }
.vp.loading .vp-spin { display: block; }
@keyframes vpspin { to { transform: rotate(360deg); } }
.vp-flash { position: absolute; top: 50%; left: 50%; margin: -22px 0 0 -40px; width: 80px; padding: 12px 0; text-align: center; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font: 700 15px/1 var(--font-body); opacity: 0; pointer-events: none; transition: opacity .2s; }
.vp-flash.show { opacity: 1; }
.vp-flash.left { left: 20%; } .vp-flash.right { left: 80%; }
.vp-err { display: none; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); padding: 16px; text-align: center; background: rgba(0, 0, 0, .75); color: #fff; font: 14px/1.5 var(--font-body); }
.vp-err a { color: #fff; }
.vp:fullscreen, .vp:-webkit-full-screen { border-radius: 0; margin: 0; display: flex; align-items: center; background: #000; }
.vp:fullscreen video, .vp:-webkit-full-screen video { height: 100%; max-height: none; object-fit: contain; }

/* ───────────── 🎛️ Post editor ───────────── */
.rte { border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); margin-bottom: 12px; background: var(--page); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px; background: rgb(var(--side-rgb)); border-bottom: 1px solid var(--border); border-radius: calc(var(--radius) * .7) calc(var(--radius) * .7) 0 0; position: sticky; top: 0; z-index: 5; }
.toolbar .tb, .toolbar .tbl { font: 600 .85rem var(--font-body); min-width: 34px; height: 34px; padding: 0 9px; margin: 0; width: auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
	background: var(--page); color: var(--text); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.toolbar select.tb { padding: 0 6px; }
.toolbar .tb:hover, .toolbar .tbl:hover { color: var(--text); border-color: var(--accent); filter: none; }
.toolbar .tb.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.toolbar .tbcolor { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.editor { min-height: 300px; padding: 14px; outline: none; border-radius: 0 0 calc(var(--radius) * .7) calc(var(--radius) * .7); }
.editor:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.dest-fixed { padding: 10px 12px; border: 1px dashed var(--border); border-radius: calc(var(--radius) * .7); background: rgb(var(--side-rgb)); font-size: .95rem; }

/* ───────────── 🧑 Profiles, members, friends ───────────── */
.profile-card { display: flex; gap: 20px; align-items: center; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; background: rgb(var(--side-rgb)); }
.profile-card h2 { margin: 0 0 2px; overflow-wrap: anywhere; }
.pf-info { min-width: 0; }
.pf-av { flex: none; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font: 700 2.2rem var(--font-body); }
.pf-av.pf-av-sm { width: 56px; height: 56px; font-size: 1.4rem; }
.pf-bio { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pf-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pf-priv { margin: 10px 0 0; }
/* ⚙️ "Edit my profile" fold-out */
.pf-edit { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; margin-bottom: 18px; background: rgb(var(--page-rgb)); }
.pf-edit summary { cursor: pointer; font-weight: 700; }
.pf-edit[open] summary { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.pf-edit > label:not(.pf-check) { display: block; margin: 14px 0 6px; font: 700 .75rem var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pf-edit textarea { min-height: 80px; height: 90px; margin: 0 0 8px; }
.pf-edit > div:last-child { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.pf-pic { display: flex; gap: 14px; align-items: center; margin: 0 0 6px; }
.pf-pic .cnote { display: inline-block; margin-top: 6px; }
.pf-blocked { margin: 14px 0; }
.pf-b { margin: 6px 0; display: flex; align-items: center; gap: 10px; }
.pf-flist { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-fr { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; border: 1px solid var(--border); background: rgb(var(--side-rgb)); text-decoration: none; font-size: .9rem; font-weight: 600; }
.pf-fr:hover { border-color: var(--accent); }
.pf-fr .byline-av { width: 28px; height: 28px; font-size: .8rem; }
.pf-posts > .ghost { display: block; margin: 0 auto; }
.h3-link { margin-left: 10px; font: 600 .85rem var(--font-body); }

/* 🔎 Member search + directory */
.find-box { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
.find-box input[type=text] { flex: 1 1 160px; width: auto; margin: 0; padding: 7px 12px; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.member-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; text-decoration: none; color: var(--text);
	border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--side-rgb)); }
.member-card:hover { color: var(--text); border-color: var(--accent); }
.mc-text { display: flex; flex-direction: column; min-width: 0; }
.mc-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-text .cnote { margin: 0; }

/* ───────────── 🔔 Notifications ───────────── */
.nbadge { display: inline-block; margin-left: 5px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; vertical-align: middle; }
.nbadge[hidden] { display: none; }
.form-card > h3 { margin: 0 0 12px; font-size: 1.1rem; }
.form-card > h3 ~ h3 { margin-top: 24px; }
.nt-list { display: flex; flex-direction: column; gap: 8px; }
.nt-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px; border-radius: calc(var(--radius) * .7); border: 1px solid var(--border); text-decoration: none; color: inherit; }
.nt-list .nt-row { margin-bottom: 0; }
.nt-link:hover { color: inherit; border-color: var(--accent); }
.nt-new { border-color: var(--accent); background: rgb(var(--side-rgb)); }
.nt-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nt-body .cnote { margin: 2px 0 0; }
.nt-act { flex: none; display: flex; gap: 6px; }
.nt-list + p { margin: 16px 0 0; }

/* ✉️ Messages: inbox rows reuse .nt-row; a conversation reuses the comment cards (.comment, .cform) */
.msg-last { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-tools { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 1 auto; min-width: 0; }
.msg-list .comment:last-child { margin-bottom: 0; }

/* 🍞 Pop-up message (toast) */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px;
	background: var(--accent); color: var(--accent-text); font-weight: 700; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); animation: toast 4s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 8%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ───────────── 🏭 Factory: avatars, J-Dollars, catalog ───────────── */
/* 🧍 A body with clothes stacked on it (every layer is the same 534×1450 picture) */
.avfig { position: relative; flex: none; aspect-ratio: 534 / 1450; height: 300px; margin: 0 auto; }
.avfig img, .avfig canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; margin: 0; border-radius: 0; object-fit: contain; pointer-events: none; } /* 🧍 reset .post img so heads in post bylines line up */
.avfig-xs { height: 90px; }
.avfig-sm { height: 170px; }
.avfig-md { height: 360px; }
.avfig-lg { height: 480px; }
.avfig-duo { height: 320px; }
.avfig-pf { height: 220px; margin: 0; }
.jd-pill { font-weight: 700; white-space: nowrap; }
/* 🗂️ Catalog slot tabs: smaller pills on one row (a 3×3 grid on phones) */
.tabs.slot-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 5px; }
.tabs.slot-tabs::-webkit-scrollbar { display: none; }
.slot-tabs .tab { flex: none; padding: 6px 12px; font-size: .85rem; }
/* 📚 Factory sidebar: my avatar and J-Dollars (the page-header balance is phones only) */
.fside { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.fside h3 { align-self: stretch; text-align: left; }
.fside .jd-pill { font-size: 1.1rem; }
.fside .btnlike { align-self: stretch; text-align: center; padding: 8px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 📏 one line, even in a narrow sidebar */
.jd-pill.ponly { display: none; }
/* 👗 Avatar page / item editor: big figure on one side, controls on the other */
.av-layout { display: flex; gap: 20px; align-items: flex-start; }
.av-stage { flex: none; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--side-rgb)); position: sticky; top: 16px; }
.av-side { flex: 1; min-width: 0; }
.av-pair { display: flex; gap: 12px; }
.av-pair figure { margin: 0; text-align: center; }
.fit-tools .row { margin-bottom: 6px; }
.fit-tools input[type=range] { flex: 1; min-width: 120px; }
.fit-tools select { width: auto; margin: 0; }
.av-side h3 { margin: 18px 0 10px; }
.ph-row { display: flex; align-items: center; gap: 14px; }
.av-side .slot-tabs { margin-bottom: 12px; flex-wrap: wrap; overflow: visible; } /* 🗂️ closet column is narrow: wrap instead of hiding tabs */
/* 👩👨 Body picker */
.body-pick { display: flex; gap: 10px; }
.body-pick button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 18px; }
.body-pick button.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.signup-body { margin: 4px 0 12px; }
.signup-body .cnote { margin: 0 0 8px; }
/* 🛍️ Catalog + closet cards */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.item-card { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 12px 10px; text-align: center;
	border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--side-rgb)); }
button.item-card { font-weight: 400; }
.item-card strong { max-width: 100%; overflow-wrap: anywhere; }
.item-card .cnote { margin: 0; font-size: .78rem; }
.item-card button { margin-top: 4px; }
.item-card.worn { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.item-card.nofit { opacity: .5; }
.item-card.offsale { border-style: dashed; }
.item-link { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; color: inherit; text-decoration: none; }
.item-link:hover strong { text-decoration: underline; }
/* 🔎 One item's own page */
.item-price { margin: 0 0 10px; font-size: 1.6rem; font-weight: 700; }
.item-desc { margin: 0 0 12px; overflow-wrap: anywhere; }
.item-about { margin: 2px 0; font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }

/* ───────────── 🎮 Games and the Game Studio ───────────── */
/* 🕹️ The game runs in a sandboxed frame; its aspect ratio follows the room (set by gameFrame) */
.game-wrap { margin-bottom: 14px; background: #000; border-radius: var(--radius); overflow: hidden; }
.game-frame { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 78vh; border: 0; margin: 0 auto; background: #000; }
.game-frame:fullscreen { max-height: none; aspect-ratio: auto; }
.game-wrap { position: relative; }
.game-exit { display: none; position: absolute; top: calc(6px + env(safe-area-inset-top)); left: 50%; z-index: 1; transform: translateX(-50%); padding: 2px 14px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font-size: .85rem; line-height: 1.5; }
/* 📱 the game fills the screen (phones do this when the game starts; ⛶ Full screen everywhere) */
body.game-immersive { overflow: hidden; }
body.game-immersive .game-wrap { position: fixed; inset: 0; z-index: 2000; margin: 0; border-radius: 0; }
body.game-immersive .game-frame { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
body.game-immersive .game-exit { display: block; }
.game-wrap:fullscreen { width: 100%; height: 100%; }
/* 📱 Studio test run on a phone-sized screen */
.game-wrap.gs-phone { width: fit-content; max-width: 100%; margin: 0 auto 14px; padding: 10px; border-radius: 26px; background: #0b0d12; box-shadow: inset 0 0 0 2px #333a48; }
.gs-phone .game-frame { width: 740px; height: 350px; max-width: 100%; max-height: none; aspect-ratio: auto !important; border-radius: 14px; }
.gs-phone.tall .game-frame { width: 350px; height: 740px; max-height: 80vh; }
.gs-touch { margin-top: 14px; }
.gs-tdir { display: inline-flex; align-items: center; gap: 2px; margin: 0 6px; }
.gs-tbtn { margin-bottom: 6px; }
.gs-tbtn select, .gs-tbtn input[type=text] { width: auto; margin: 0; }
.game-scores { margin: 0; padding-left: 26px; }
.game-scores li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.game-scores li:last-child { border-bottom: 0; }
.game-scores li b { float: right; }
.game-scores li.me { font-weight: 700; }
/* 📋 Games list */
.game-list { display: grid; gap: 10px; }
.game-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--page-rgb)); color: var(--text); text-decoration: none; }
.game-card:hover { border-color: var(--accent); color: var(--text); }
.gc-icon { font-size: 2rem; }
.gc-text { flex: 1; min-width: 0; }
.gc-text .cnote { margin: 2px 0 0; }
.gc-draft { margin-left: 8px; font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: var(--muted); color: rgb(var(--page-rgb)); }
/* 🛠️ Studio + docs: no sidebar and a wider page. ⛶ Full page (.studio-full) hides the site's header and footer too. */
.wide-page #side { display: none; }
.wide-page #page { max-width: 1440px; }
/* 🎮 Playing a game: nearly the whole window, the game on top and its info underneath */
.play-page #page { max-width: none; padding: 12px 16px; width: min(100%, calc((100vh - 180px) * var(--ar, 1.333) + 34px)); min-width: min(100%, 420px); } /* the page is only as wide as the game needs (never wider than the window) */
.play-bar { margin-bottom: 6px; }
.play-page .game-wrap { margin-bottom: 10px; background: none; }
.play-stage { width: 100%; } /* the button bar and the game share the game's width */
.play-page .game-frame { width: 100%; max-height: none; } /* as big as fits, in the game's own shape (no bars) */
.play-page .game-wrap:fullscreen { background: #000; }
body.game-immersive.play-page .game-frame, .play-page .game-wrap:fullscreen .game-frame { width: 100%; }
body.game-immersive.play-page .game-wrap { background: #000; }
body.studio-full { padding: 0; }
body.studio-full header, body.studio-full #sections, body.studio-full footer, body.studio-full #tabbar, body.studio-full .studio > .page-head { display: none; }
body.studio-full #page { max-width: none; min-height: 100vh; padding: 10px 14px; border: 0; border-radius: 0; }
body.studio-full .gs-bar { padding: 10px 14px; margin-bottom: 10px; }
body.studio-full .gs-code.tall { height: calc(100vh - 290px); }
body.studio-full .gs-tree { max-height: calc(100vh - 180px); }
.gs-bar .row { margin-bottom: 8px; }
.gs-bar .row:last-child { margin-bottom: 0; }
.gs-pick { max-width: 220px; margin: 0; }
.gs-gname { flex: 1; min-width: 160px; margin: 0; font-weight: 600; }
.gs-status { margin: 0 0 0 auto; }
.gs-splitbtn.on { border-color: var(--accent); color: var(--accent); }
/* 🌲 list on the left, tabs + panes on the right */
.gs-ide { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px; align-items: start; }
.gs-tree { position: sticky; top: 10px; max-height: calc(100vh - 40px); overflow: auto; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--side-rgb)); font-size: .85rem; }
.gs-tsec { margin-bottom: 8px; }
.gs-thead { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; font: 700 .7rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gs-tadd { padding: 0 8px; font-size: .9rem; line-height: 1.4; background: transparent; color: var(--muted); border: 1px solid var(--border); }
.gs-tadd:hover { color: var(--accent); border-color: var(--accent); filter: none; }
.gs-titem { display: block; width: 100%; text-align: left; padding: 3px 8px; margin: 1px 0; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: 500 .82rem ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.gs-titem:hover { background: rgba(128, 128, 128, .15); color: var(--text); filter: none; }
.gs-titem.open { color: var(--link); }
.gs-titem.cur { background: var(--accent); color: var(--accent-text); }
.gs-titem.cur2 { outline: 1px solid var(--accent); }
.gs-work { min-width: 0; }
.gs-strip { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.gs-tab { display: flex; align-items: center; gap: 4px; flex-shrink: 0; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgb(var(--side-rgb)); font-size: .8rem; cursor: pointer; white-space: nowrap; }
.gs-tab:hover { border-color: var(--accent); }
.gs-tab.cur { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.gs-tab.cur2 { border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.gs-x { padding: 0 6px; background: transparent; color: inherit; border: 0; font-size: 1rem; line-height: 1.2; opacity: .6; }
.gs-x:hover { opacity: 1; color: inherit; filter: none; }
.gs-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.gs-panes.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gs-pane { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: rgb(var(--page-rgb)); }
.gs-pane.focus { border-color: var(--accent); }
.gs-empty { margin: 0; }
.gs-head { margin-bottom: 10px; }
.gs-head .gs-name { flex: 1; min-width: 120px; margin: 0; font: 600 1rem ui-monospace, Consolas, monospace; }
.gs-kind { font-size: 1.2rem; }
.gs-props { margin-bottom: 8px; font-size: .9rem; }
.gs-props summary { cursor: pointer; color: var(--muted); font-size: .82rem; margin-bottom: 8px; }
.gs-field { display: block; font-size: .85rem; color: var(--muted); }
.gs-field > span:first-child { display: block; margin-bottom: 3px; }
.gs-field input, .gs-field select, .gs-field textarea { margin: 0; }
.gs-field .cnote { display: block; margin: 2px 0 0; font-size: .75rem; }
.gs-evtabs { margin: 6px 0 10px; }
.gs-evtabs .tab { padding: 5px 12px; font-size: .8rem; white-space: nowrap; }
.gs-add { width: auto; margin: 0; padding: 4px 8px; font-size: .8rem; }
/* ⌨️ code boxes: a colored copy of the text (.gs-hl) sits under a see-through textarea, so typing stays a normal textarea */
.gs-codewrap { margin-bottom: 8px; }
.gs-code { display: flex; height: 340px; border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); background: #14171f; overflow: hidden; resize: vertical; }
.gs-code.tall { height: 460px; }
.gs-code.short { height: 160px; }
.gs-ln, .gs-ta, .gs-hl { font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace; tab-size: 4; margin: 0; padding: 8px; letter-spacing: 0; }
.gs-ln { color: #5d6577; text-align: right; user-select: none; overflow: hidden; min-width: 2.6em; background: #10131a; border-right: 1px solid #262b38; white-space: pre; }
.gs-ln .e { display: inline-block; width: 100%; color: #fff; background: #c0392b; border-radius: 3px; cursor: help; }
.gs-edit { position: relative; flex: 1; min-width: 0; }
.gs-hl { position: absolute; inset: 0; overflow: hidden; white-space: pre; color: #e6e9f0; pointer-events: none; }
.gs-ta { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; resize: none; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: #fff; white-space: pre; overflow: auto; }
.gs-ta::selection { background: rgba(110, 150, 255, .35); }
.gs-ta:focus { outline: none; box-shadow: none; }
.h-kw { color: #c792ea; } .h-lit { color: #ff9cac; } .h-fn { color: #82aaff; } .h-fn2 { color: #89ddff; font-weight: 600; }
.h-const { color: #f78c6c; } .h-num { color: #f78c6c; } .h-str { color: #c3e88d; } .h-com { color: #697098; font-style: italic; }
.h-var { color: #ffcb6b; } .h-res { color: #4fd6be; } .h-dir { color: #ff5370; } .h-tag { color: #f07178; } .h-attr { color: #ffcb6b; } .h-data { color: #4fd6be; font-weight: 600; }
/* 💡 suggestions and 🧾 argument hints float over everything (position: fixed, placed at the caret) */
.gs-pop, .gs-tip { position: fixed; z-index: 50; border: 1px solid #353c4f; border-radius: 8px; background: #1b1f2a; color: #e6e9f0; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); font: 12.5px/1.45 ui-monospace, Consolas, monospace; }
.gs-pop { width: 370px; max-width: calc(100vw - 8px); overflow: hidden; }
.gs-pop-list { max-height: 216px; overflow-y: auto; }
.gs-pop-item { display: flex; justify-content: space-between; gap: 10px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.gs-pop-item.cur { background: #2b5fd9; }
.gs-pop-item.cur span { color: #fff; }
.gs-pop-name { overflow: hidden; text-overflow: ellipsis; }
.gs-pop-kind { color: #7f88a0; overflow: hidden; text-overflow: ellipsis; }
.gs-pop-desc { padding: 6px 10px; border-top: 1px solid #353c4f; font-family: system-ui, sans-serif; color: #b7bfd1; white-space: normal; }
.gs-pop-desc code { display: block; margin-bottom: 2px; color: #82aaff; font-family: ui-monospace, Consolas, monospace; }
.gs-tip { max-width: min(520px, calc(100vw - 8px)); padding: 6px 10px; pointer-events: none; }
.gs-tip code { color: #e6e9f0; white-space: pre-wrap; }
.gs-tip b { color: #ffcb6b; text-decoration: underline; }
.gs-tip div { margin-top: 3px; font-family: system-ui, sans-serif; color: #b7bfd1; }
.gs-lint div { margin-top: 4px; padding: 4px 10px; border-radius: 6px; background: rgba(224, 83, 63, .15); color: #ff8a7a; font: 12px ui-monospace, Consolas, monospace; cursor: pointer; }
/* 🖼️ sprites, 🚪 rooms, 🪟 UI preview, 🔤 fonts */
.gs-spr { display: grid; grid-template-columns: 1fr auto; gap: 16px; }
.gs-sprbox { text-align: center; }
.gs-sprpv { display: block; background: repeating-conic-gradient(#8884 0 25%, transparent 0 50%) 0 0 / 16px 16px; border: 1px solid var(--border); border-radius: 6px; }
.gs-roomtools { align-items: end; }
.gs-roomtools .gs-field input { width: 80px; }
.gs-roomwrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px; }
.gs-room { display: block; max-width: 100%; cursor: crosshair; touch-action: none; }
.gs-tspv, .gs-pal { display: block; max-width: 100%; image-rendering: pixelated; background: repeating-conic-gradient(#8884 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.gs-pal { cursor: pointer; border: 1px solid var(--border); border-radius: 4px; }
.gs-palwrap { margin-bottom: 8px; overflow-x: auto; }
.gs-tl { margin: 8px 0; }
.gs-uipvwrap { background: #000; border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.gs-uipv { display: block; width: 100%; max-height: 50vh; aspect-ratio: 4 / 3; border: 0; }
.gs-sub { margin: 14px 0 6px; font: 700 .75rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gs-fontpv { padding: 10px; border: 1px dashed var(--border); border-radius: 6px; overflow-wrap: anywhere; }
/* ▶ test run: game and output side by side on wide screens */
.gs-runbody { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 2fr); gap: 12px; align-items: start; }
.gs-runbody .game-wrap { margin: 0; }
.gs-out .gs-sub { margin-top: 0; }
.gs-console { max-height: 360px; overflow: auto; padding: 8px 10px; border-radius: 6px; background: #10131a; color: #cfd5e2; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.gs-console:empty::before { content: 'Nothing yet.'; color: #5d6577; }
.gs-console .bad { color: #ff8a7a; }
.gs-console .go { cursor: pointer; text-decoration: underline dotted; }
/* 📖 docs: contents on the left (page) or a dropdown (Studio pane), search on top */
.gd-top { display: flex; gap: 8px; margin-bottom: 12px; }
.gd-top input { flex: 1; margin: 0; }
.gd-top select { width: auto; margin: 0; }
.gd-main { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.gd.compact .gd-main { display: block; }
.gd.compact .gd-body { max-height: 75vh; overflow: auto; padding-right: 6px; }
body.studio-full .gd.compact .gd-body { max-height: calc(100vh - 230px); }
.gd-toc { position: sticky; top: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 30px); overflow: auto; font-size: .85rem; }
.gd-toc a { padding: 3px 8px; border-radius: 6px; text-decoration: none; }
.gd-toc a:hover { background: rgba(128, 128, 128, .15); }
.gd-sec { padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--border); font-size: .95rem; }
.gd-sec h3 { margin: 0 0 10px; }
.gd-sec h4 { margin: 18px 0 6px; font-size: 1rem; }
.gd-sec p { margin: 0 0 10px; }
.gd-sec code { font: .85em ui-monospace, Consolas, monospace; padding: 1px 5px; border-radius: 4px; background: rgba(128, 128, 128, .15); }
.gd-code { margin: 0 0 12px; padding: 10px 12px; border-radius: 6px; background: #10131a; color: #e6e9f0; font: 12.5px/1.5 ui-monospace, Consolas, monospace; overflow-x: auto; tab-size: 4; }
.gd-tablewrap { overflow-x: auto; margin-bottom: 12px; }
.gd-fns { border-collapse: collapse; width: 100%; font-size: .88rem; }
.gd-fns td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.gd-fns td:first-child { white-space: nowrap; }
.gd-fns td:first-child code { background: none; padding: 0; color: var(--link); }

/* 🎚️ On/off slider for a game's creator settings */
.gswitch { display: flex; align-items: center; gap: 10px; margin: 8px 0; cursor: pointer; }
.gswitch input { position: absolute; opacity: 0; pointer-events: none; }
.gswitch .track { flex: none; width: 46px; height: 26px; border-radius: 13px; background: #888; position: relative; transition: background .15s; }
.gswitch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.gswitch input:checked + .track { background: #2e9e55; }
.gswitch input:checked + .track::after { left: 23px; }
.gswitch input:focus-visible + .track { outline: 2px solid currentColor; outline-offset: 2px; }
.gswitch .state { font-weight: bold; min-width: 2.5em; }

/* ───────────── 🤖 JaydenAI ───────────── */
.ai-chat { display: flex; flex-direction: column; height: min(72vh, 720px); min-height: 380px; }
.ai-log { flex: 1; overflow-y: auto; padding: 4px 2px 12px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; overscroll-behavior: contain; }
.ai-row { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; }
.ai-row.user { flex-direction: row-reverse; }
.ai-ava { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; background: rgb(var(--side-rgb)); border: 1px solid var(--border); }
.ai-bub { min-width: 0; max-width: min(82%, 640px); padding: 10px 14px; border-radius: 18px; border: 1px solid var(--border); background: rgb(var(--side-rgb)); border-bottom-left-radius: 5px; overflow-wrap: anywhere; line-height: 1.5; }
.ai-row.user .ai-bub { background: var(--accent); color: var(--accent-text); border-color: var(--accent); border-bottom-left-radius: 18px; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.ai-bub > :first-child { margin-top: 0; }
.ai-bub > :last-child { margin-bottom: 0; }
.ai-bub p, .ai-bub ul, .ai-bub h4 { margin: 8px 0 0; }
.ai-bub .gd-code { margin: 8px 0 0; max-width: 100%; }
.ai-bub .gd-tablewrap { overflow-x: auto; }
.ai-tag { display: block; margin-top: 6px; font-size: .7rem; color: var(--muted); }
.ai-empty { margin: auto; text-align: center; max-width: 420px; color: var(--muted); padding: 20px; }
.ai-empty .big { font-size: 2.6rem; display: block; margin-bottom: 6px; }
.ai-dots span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: ai-dot 1.2s infinite ease-in-out; }
.ai-dots span:nth-child(2) { animation-delay: .15s; }
.ai-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-err { margin: 0 0 8px; }
.ai-err:empty { display: none; }
.ai-compose { display: flex; gap: 8px; align-items: flex-end; padding: 8px; border: 1px solid var(--border); border-radius: 22px; background: rgb(var(--side-rgb)); }
.ai-compose textarea { flex: 1; min-height: 0; height: 40px; max-height: 160px; resize: none; border: 0; background: transparent; padding: 9px 8px; font-size: 1rem; outline: none; box-shadow: none; }
.ai-send { flex: none; width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.ai-hint { margin: 6px 0 0 12px; }

/* ───────────── ⚙️ Settings ───────────── */
.grp { padding: 16px 0; border-top: 1px solid var(--border); }
.grp:first-of-type { border-top: 0; padding-top: 4px; }
.grp h4 { margin: 0 0 10px; font: 700 .75rem var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.grp > label { display: block; margin-bottom: 10px; font-size: .85rem; color: var(--muted); }
.grp > label.pf-check { display: flex; color: var(--text); }
.grp .file { margin: 0 0 10px; }
.grp .row { margin-bottom: 4px; }
.grp .row .file { margin: 0; }
.grp textarea { min-height: 64px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 14px; margin-bottom: 14px; }
.grid label { font-size: .85rem; color: var(--muted); display: block; }
.grid input[type=color] { display: block; width: 100%; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--page); cursor: pointer; }
.grid select, .grid input[type=range] { margin: 0; width: 100%; }
.grid input[type=range] { accent-color: var(--accent); }
/* 🎚️ Limits tab: long labels, number box, range hint */
.grid.lims { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid.lims input { margin: 4px 0 2px; }
.grid.lims .file { display: block; margin: 0; font-size: .75rem; }
.savebar { margin: 4px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
/* 🗂️ Saved themes / members lists */
.theme-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
.theme-row:last-child { border-bottom: 0; }
.theme-row .name { flex: 1; min-width: 120px; font-weight: 600; }
.theme-row .tag { font-size: .7rem; background: var(--accent); color: var(--accent-text); padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.sw { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .4); margin-right: -6px; vertical-align: middle; }

/* ───────────── 📱 Phones: stacked layout, bottom tab bar replaces most of the header links ───────────── */
#tabbar { display: none; }
@media (max-width: 720px) {
	/* 🛠️ Game Studio + docs: everything in one column, the list becomes a short scrolling box */
	.gs-ide, .gs-panes.two, .gs-spr, .gs-runbody, .gd-main { grid-template-columns: minmax(0, 1fr); }
	.gs-tree { position: static; max-height: 200px; }
	.game-wrap { margin-left: -16px; margin-right: -16px; border-radius: 0; }
	.game-frame { max-height: 70vh; }
	.game-card { flex-wrap: wrap; padding: 12px; }
	.game-card .btnlike { margin-left: auto; }
	.gd-toc { display: none; }
	.gs-pane { padding: 10px; }
	.gs-code, .gs-code.tall { height: 300px; }
	body.studio-full .gs-code.tall { height: 60vh; }
	body { padding: 10px 10px 84px; font-size: 16px; }
	#page { padding: 18px 16px; }
	#site-title { font-size: clamp(1.15rem, 6vw, 1.45rem); } /* shrinks a little on narrow phones so it clears the header buttons */
	header { flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
	#nav { flex-wrap: nowrap; flex: none; gap: 4px; }
	#nav a { padding: 6px 9px; }
	#nav .dup, #nav .donly, #sections { display: none; }
	#nav .pmenu-wrap { display: block; }
	.pmore .nbadge { position: absolute; top: -6px; right: -6px; margin: 0; }
	.pmenu .nbadge { margin-left: auto; }
	.pmore { position: relative; font-size: 1.1rem; line-height: 1; padding: 6px 12px; }
	#nav:not(:has(a:not(.dup))) { display: none; }
	#layout { flex-direction: column; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
	aside { width: 100%; position: static; }
	.post, .form-card, .panel, .page-head, .profile-card { padding: 16px; }
	.frow { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
	.fcat > .frow + .frow { padding-left: 26px; }
	.frow-n, .frow-last { grid-column: 1; }
	.pmanage { margin-left: 0; flex-basis: 100%; }
	.pmanage button { flex: 1; }
	.pmeta { margin-top: 12px; padding-top: 10px; gap: 6px 14px; font-size: .85rem; }
	.page-head { padding: 14px 16px; margin-bottom: 14px; gap: 10px; }
	.page-head p { font-size: .85rem; }
	.ph-btn { width: 100%; text-align: center; }
	.frow-tools { flex-direction: row; grid-column: 1; grid-row: auto; }
	.comment { padding: 10px 12px; }
	.toolbar .sep { display: none; }
	.editor { min-height: 240px; }
	.profile-card { flex-direction: column; text-align: center; }
	.pf-av { width: 72px; height: 72px; font-size: 1.9rem; }
	.byline-av { width: 30px; height: 30px; font-size: .85rem; }
	/* on phones, put "Edited" on its own line instead of wrapping awkwardly */
	.byline-edited::before { content: none; }
	.byline-edited { flex-basis: 100%; }
	.grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
	.nt-row { flex-wrap: wrap; }
	.nt-act { width: 100%; }
	.pf-actions { justify-content: center; }
	main { width: 100%; }
	body[data-site="factory"] aside { display: none; } /* 🏭 phones have Avatar in the tab bar, and the balance in the page headers */
	.jd-pill.ponly { display: revert; }
	.tabs.slot-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; overflow: visible; }
	.slot-tabs .tab { padding: 7px 4px; text-align: center; }
	.av-layout { flex-direction: column; align-items: stretch; }
	.av-stage { position: static; }
	.avfig-lg, .avfig-md { height: 340px; }
	.av-pair { justify-content: center; }
	.avfig-duo { height: 260px; }
	.item-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
	.toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

	.ai-chat { height: calc(100dvh - 330px); min-height: 320px; }
	.ai-bub { max-width: 88%; padding: 9px 12px; }
	.ai-ava { width: 28px; height: 28px; font-size: .95rem; }
	.ai-hint { display: none; }

	#tabbar {
		display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; gap: 2px;
		background: rgb(var(--side-rgb)); border-top: 1px solid var(--border);
		padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(0, 0, 0, .12);
	}
	#tabbar a {
		flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
		padding: 6px 0; border-radius: 10px; text-decoration: none; color: var(--text);
	}
	#tabbar .ti { position: relative; font-size: 1.25rem; line-height: 1.2; }
	#tabbar .tl { font-size: .68rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
	#tabbar a.on { background: var(--accent); color: var(--accent-text); }
	#tabbar .nbadge { position: absolute; top: -4px; right: -14px; margin: 0; min-width: 16px; line-height: 16px; font-size: .62rem; padding: 0 4px; }
}
@media (max-width: 600px) {
	.page-head h2 { font-size: 1.3rem; }
	.post h2 { font-size: 1.4rem; }
}
