/* The theme colours are registered so they can animate: switching day/night turns every colour on the page over the
   same 1.6 s ease-in-out as the sky's half turn (web/world.js). */
@property --sheet { syntax: '<color>'; inherits: true; initial-value: rgba(17, 18, 23, .86); }
@property --raised { syntax: '<color>'; inherits: true; initial-value: #1c1e25; }
@property --raised-2 { syntax: '<color>'; inherits: true; initial-value: #262932; }
@property --raised-3 { syntax: '<color>'; inherits: true; initial-value: #30343f; }
@property --line { syntax: '<color>'; inherits: true; initial-value: rgba(255, 255, 255, .07); }
@property --text { syntax: '<color>'; inherits: true; initial-value: #eceef2; }
@property --text-2 { syntax: '<color>'; inherits: true; initial-value: #c3c6cd; }
@property --muted { syntax: '<color>'; inherits: true; initial-value: #8f949f; }
@property --brand-soft { syntax: '<color>'; inherits: true; initial-value: rgba(255, 152, 0, .14); }
@property --link { syntax: '<color>'; inherits: true; initial-value: #ffab3d; }
@property --danger { syntax: '<color>'; inherits: true; initial-value: #ff6b5e; }
@property --danger-text { syntax: '<color>'; inherits: true; initial-value: #ffc2bb; }
@property --code-bg { syntax: '<color>'; inherits: true; initial-value: #121318; }
@property --bar-bg { syntax: '<color>'; inherits: true; initial-value: rgba(12, 13, 17, .78); }
@property --sky-top { syntax: '<color>'; inherits: true; initial-value: #03050f; }
@property --sky-horizon { syntax: '<color>'; inherits: true; initial-value: #141a33; }
@property --shadow-color { syntax: '<color>'; inherits: true; initial-value: rgba(0, 0, 0, .35); }
@property --glow { syntax: '<color>'; inherits: true; initial-value: rgba(255, 152, 0, .5); }
@property --title { syntax: '<color>'; inherits: true; initial-value: #ff9800; }

:root {
	--sheet: rgba(17, 18, 23, .86);
	--raised: #1c1e25;
	--raised-2: #262932;
	--raised-3: #30343f;
	--line: rgba(255, 255, 255, .07);
	--text: #eceef2;
	--text-2: #c3c6cd;
	--muted: #8f949f;
	--brand: #ff9800;
	--brand-2: #ffb547;
	--brand-ink: #1c0f00;
	--brand-soft: rgba(255, 152, 0, .14);
	--link: #ffab3d;
	--danger: #ff6b5e;
	--danger-text: #ffc2bb;
	--code-bg: #121318;
	--bar-bg: rgba(12, 13, 17, .78);
	--sky-top: #03050f;
	--sky-horizon: #141a33;
	--shadow-color: rgba(0, 0, 0, .35);
	--glow: rgba(255, 152, 0, .5);
	--title: #ff9800;
	--shadow: 0 10px 40px var(--shadow-color);
	color-scheme: dark;
	transition: --sheet 1.6s cubic-bezier(.65, 0, .35, 1), --raised 1.6s cubic-bezier(.65, 0, .35, 1), --raised-2 1.6s cubic-bezier(.65, 0, .35, 1), --raised-3 1.6s cubic-bezier(.65, 0, .35, 1), --line 1.6s cubic-bezier(.65, 0, .35, 1), --text 1.6s cubic-bezier(.65, 0, .35, 1), --text-2 1.6s cubic-bezier(.65, 0, .35, 1), --muted 1.6s cubic-bezier(.65, 0, .35, 1), --brand-soft 1.6s cubic-bezier(.65, 0, .35, 1), --link 1.6s cubic-bezier(.65, 0, .35, 1), --danger 1.6s cubic-bezier(.65, 0, .35, 1), --danger-text 1.6s cubic-bezier(.65, 0, .35, 1), --code-bg 1.6s cubic-bezier(.65, 0, .35, 1), --bar-bg 1.6s cubic-bezier(.65, 0, .35, 1), --sky-top 1.6s cubic-bezier(.65, 0, .35, 1), --sky-horizon 1.6s cubic-bezier(.65, 0, .35, 1), --shadow-color 1.6s cubic-bezier(.65, 0, .35, 1), --glow 1.6s cubic-bezier(.65, 0, .35, 1), --title 1.6s cubic-bezier(.65, 0, .35, 1);
}
:root[data-theme=light] {
	--sheet: rgba(248, 249, 252, .9);
	--raised: #ffffff;
	--raised-2: #eef0f5;
	--raised-3: #e2e5ec;
	--line: rgba(15, 20, 35, .09);
	--text: #16181d;
	--text-2: #3a3e46;
	--muted: #6a707c;
	--brand-soft: rgba(255, 152, 0, .16);
	--link: #b25c00;
	--danger: #c8372b;
	--danger-text: #8a1d14;
	--code-bg: #f3f4f7;
	--bar-bg: rgba(255, 255, 255, .82);
	--sky-top: #78a6ff;
	--sky-horizon: #bfd9ff;
	--shadow-color: rgba(20, 30, 60, .12);
	--glow: rgba(255, 152, 0, 0);
	--title: #ff9800;
	color-scheme: light;
}
@media (prefers-reduced-motion: reduce) { :root { transition: none; } }

* { box-sizing: border-box; }
html { scroll-padding-top: 80px; background: var(--sky-top); }
body {
	position: relative;
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	color: var(--text);
	font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
}
main { flex: 1; padding-bottom: 32px; animation: arrive .2s ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } }
[data-swap] { animation: arrive .18s ease-out; }
.tabs[data-swap] { animation: none; } /* the tab bar just switches; only what's under it slides in */
@media (prefers-reduced-motion: reduce) { main, [data-swap] { animation: none; } .filters { transition: none !important; } }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.center { text-align: center; }
.right { text-align: right; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.push { margin-left: auto; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ------------------------------------------------ the world behind the page (web/world.js + static/img/world) */

.world {
	position: absolute;
	inset: 0 0 auto;
	height: 100%;
	overflow: hidden;
	z-index: -1;
	background: linear-gradient(rgba(0, 0, 0, .45), rgba(0, 0, 0, .45)), url(img/blocks/stone.png) 0 0 / 56px;
	image-rendering: pixelated;
}
.above { position: relative; height: var(--surface); background: linear-gradient(var(--sky-top), var(--sky-horizon)); }
.above .sky { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: auto; }
.below { position: absolute; top: var(--surface); left: 0; right: 0; }
.below .placeholder { position: absolute; top: 0; }
:root:not([data-theme=light]) .below .placeholder { filter: brightness(.5) saturate(.8); }
.world img { height: auto; }
.chunk { position: relative; height: var(--chunk); }
/* rendered world images: native pixels, world x = 0 (the cat) at --ax (62% until world.js places it) */
.world img { position: absolute; left: calc(var(--ax, 62%) - var(--cat)); max-width: none; }
.above img { bottom: 0; }
.chunk img { top: 0; }
.world picture, .world .cat { display: none; }
:root[data-theme=light] .world .t-day, :root:not([data-theme=light]) .world .t-night, .world.turning picture, .home .world.live .cat { display: inline; }
.world .cat { position: absolute; }
@media (max-width: 700px) {
	.world img { left: calc(var(--ax, 62%) - (var(--cat) - var(--mx)) / 2); }
	.chunk { height: calc(var(--chunk) / 2); }
}
/* on the home page the ground line sits a little above the fold, so a couple of blocks of underground peek in */
body.home { --peek: 180px; --surface: calc(100svh - var(--peek)); }
.home .hero + .page { margin-top: calc(var(--peek) + 24px); }
@media (max-width: 700px) { body.home { --peek: 90px; } }
body:not(.home) { --surface: 70svh; }

/* ------------------------------------------------ top bar */

.top {
	position: sticky;
	top: 0;
	z-index: 10;
	background: var(--bar-bg);
	backdrop-filter: blur(14px) saturate(1.2);
	-webkit-backdrop-filter: blur(14px) saturate(1.2);
	border-bottom: 1px solid var(--line);
}
.bar { max-width: 1280px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 900; font-size: 1.25rem; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 10px; }
.links { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.links a, .tabs a { padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.links a:hover, .tabs a:hover { color: var(--text); background: var(--raised-2); text-decoration: none; }
.links a.on, .tabs a.on { color: var(--link); background: var(--brand-soft); }
.search input { width: 240px; padding: 8px 14px; border-radius: 999px; }
.theme { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--raised-2); color: var(--brand); cursor: pointer; }
.theme .sun, :root[data-theme=light] .theme .moon { display: none; }
:root[data-theme=light] .theme .sun { display: block; }

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.drop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; padding: 6px; display: flex; flex-direction: column; z-index: 20; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); text-align: left; }
.drop a, .drop button { display: block; width: 100%; padding: 9px 12px; border-radius: 9px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.drop a:hover, .drop button:hover { background: var(--raised-2); text-decoration: none; }
.drop .pw { display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.danger-text { color: var(--danger) !important; }

.avatar {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand-2), var(--brand));
	color: var(--brand-ink);
	font-weight: 900;
	flex: none;
}
img.avatar { object-fit: cover; background: var(--raised-2); }
.profile .avatar { width: 88px; height: 88px; font-size: 2.4rem; }

/* ------------------------------------------------ controls */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 9px 16px;
	border-radius: 12px;
	border: 1px solid transparent;
	background: var(--raised-2);
	color: var(--text);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: filter .15s, transform .15s;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 4px 18px -6px rgba(255, 152, 0, .7); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.big { padding: 12px 20px; font-size: 1rem; border-radius: 14px; }
.btn.small { padding: 5px 11px; font-size: .86rem; }
.btn.wide { width: 100%; margin-top: 20px; }
.btn.square { padding: 0; width: 40px; height: 40px; }
.btn.big.square { width: 48px; height: 48px; }

input, textarea, select {
	width: 100%;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--raised-2);
	color: var(--text);
	font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%238f949f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; cursor: pointer; }
input[type=radio], input[type=checkbox] { width: auto; accent-color: var(--brand); }
input[type=file] { padding: 8px; }
input[readonly] { opacity: .7; }
textarea { resize: vertical; line-height: 1.5; }
::file-selector-button { margin-right: 12px; padding: 6px 12px; border-radius: 8px; border: 0; background: var(--raised-3); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }

/* pills: toggles for versions, loaders, channels; checked ones light up orange */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills + .pills { margin-top: 6px; }
.pill {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border-radius: 999px;
	border: 1px solid transparent;
	background: var(--raised-2);
	color: var(--text-2);
	font: inherit;
	font-size: .9rem;
	font-weight: 700;
	cursor: pointer;
	user-select: none;
}
.pill:hover { background: var(--raised-3); }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill:has(:checked), .pill.on { background: var(--brand-soft); color: var(--link); border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
.pill:has(:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.pill.off { opacity: .45; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--raised-2); color: var(--muted); white-space: nowrap; }
.tag.type { color: var(--link); background: var(--brand-soft); }
/* loader badges and pills in Modrinth's platform colours; each fades its own colour with the theme,
   and a picked pill's tint follows it through currentColor. Unknown loaders stay plain. */
.l-fabric { --lc: #dbb69b; } .l-forge { --lc: #959eef; } .l-neoforge { --lc: #f99e6b; }
:root[data-theme=light] .l-fabric { --lc: #8a7b71; } :root[data-theme=light] .l-forge { --lc: #5b6197; } :root[data-theme=light] .l-neoforge { --lc: #dc895c; }
@media (prefers-reduced-motion: no-preference) { .l-fabric, .l-forge, .l-neoforge { transition: color 1.6s cubic-bezier(.65, 0, .35, 1); } }
.tag.loader { border: 1px solid var(--line); font-weight: 600; color: var(--lc, var(--muted)); }
.pill.loader { color: var(--lc, var(--text-2)); }
.pill.loader:has(:checked), .pill.loader.on { color: var(--lc, var(--link)); background: color-mix(in srgb, currentColor 16%, transparent); border-color: color-mix(in srgb, currentColor 55%, transparent); }
.stat { display: inline-flex; align-items: center; gap: 6px; }
.icon { border-radius: 18px; background: var(--raised-2); object-fit: cover; flex: none; }
.icon.px { image-rendering: pixelated; } /* a small pixel-art icon shown much bigger (app.js decides) */
.icon.big { width: 96px; height: 96px; border-radius: 22px; }

/* ------------------------------------------------ the page sheet: one container for everything in the middle */

.page {
	width: min(1280px, calc(100% - 48px));
	margin: 24px auto 0;
	padding: 28px;
	border-radius: 24px;
	background: var(--sheet);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
	backdrop-filter: blur(18px) saturate(1.15);
	-webkit-backdrop-filter: blur(18px) saturate(1.15);
}
.page.narrow { width: min(880px, calc(100% - 48px)); }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card + .card, .form + .card, .two + .card { margin-top: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-title { margin: 32px 0 14px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty img { filter: drop-shadow(0 0 30px rgba(255, 152, 0, .25)); }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }
.alert p { margin: 0 0 8px; }
.alert.error { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger-text); }
.alert.ok { background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); }

/* project cards, Modrinth style: title level with the icon's top, tags with its bottom */
.list { display: flex; flex-direction: column; gap: 12px; }
.pcard {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr) auto;
	gap: 18px;
	padding: 16px;
	border-radius: 18px;
	background: var(--raised);
	border: 1px solid var(--line);
	color: var(--text);
	transition: transform .15s, border-color .15s;
}
.pcard:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 45%, transparent); transform: translateY(-1px); }
.pc-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pcard h3 { font-size: 1.2rem; line-height: 1.25; }
.pcard h3 small { font-size: .88rem; font-weight: 500; color: var(--muted); }
.pcard p { margin: 0; color: var(--text-2); }
.pcard .tags { margin-top: auto; }
.pc-stats { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; font-size: .9rem; white-space: nowrap; color: var(--text-2); }
.pc-stats b { color: var(--text); }

/* home */
.hero { min-height: calc(var(--surface) - 61px); max-width: 1280px; margin: 0 auto; padding: 7vh 24px 34vh; display: flex; align-items: flex-start; pointer-events: none; }
.hero-text { max-width: 520px; pointer-events: auto; padding: 28px 32px; border-radius: 24px; background: color-mix(in srgb, var(--raised) 58%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hero h1 { font-size: clamp(2.4rem, 4.6vw, 4rem); line-height: 1.02; margin-bottom: 20px; letter-spacing: -.02em; }
.hero p { font-size: 1.12rem; color: var(--text-2); }
.glow { color: var(--title); text-shadow: 0 0 34px var(--glow); }
.hero-stats { margin: 18px 0 0; font-size: .95rem !important; }

/* browse: one grid; the filters are the left column on wide screens and a panel under the search row on narrow ones */
.browse { display: grid; grid-template-columns: 272px minmax(0, 1fr); grid-template-areas: "side head" "side search" "side list"; grid-template-rows: auto auto 1fr; gap: 0 24px; align-items: start; }
.browse-head { grid-area: head; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.browse > .searchbar { grid-area: search; }
.browse > .list { grid-area: list; }
.filters { grid-area: side; position: sticky; top: 88px; }
.filter-body { display: flex; flex-direction: column; gap: 12px; }
.filters .card { padding: 16px; }
.filters .card + .card { margin: 0; }
.filters h3 { margin-bottom: 12px; }
.filter-toggle { display: none; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid transparent; border-radius: 999px; background: var(--raised-2); color: var(--text-2); font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.filter-toggle:hover { background: var(--raised-3); }
.filter-toggle[aria-expanded=true] { color: var(--link); background: var(--brand-soft); }
.dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.filter-toggle.active .dot { display: block; }
.clear { font-weight: 700; font-size: .9rem; padding-left: 4px; }
.filters:not(:has(:checked)) .clear { display: none; }
.searchbar { display: flex; gap: 10px; margin-bottom: 16px; }
.searchbar input { flex: 1; }
.searchbar select { width: auto; }

/* project page */
.phead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; padding-bottom: 24px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.phead h1 { font-size: 2rem; margin-bottom: 6px; }
.summary { margin: 0 0 12px; color: var(--text-2); font-size: 1.05rem; }
.ph-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: .92rem; color: var(--text-2); }
.ph-actions { display: flex; gap: 8px; align-items: center; }
.pgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.count { font-size: .8rem; opacity: .8; }
.side { display: flex; flex-direction: column; gap: 12px; }
.side .card { padding: 16px 18px; }
.side .card + .card { margin: 0; }
.side h3 { margin-bottom: 10px; }
.side h4 { margin: 12px 0 6px; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.links-card a { display: block; padding: 4px 0; font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text); }
.who-text { display: flex; flex-direction: column; line-height: 1.25; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* markdown */
.md { line-height: 1.7; overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 1.4em 0 .5em; }
.md img { max-width: 100%; height: auto; border-radius: 10px; }
.md > img, .md > video, .md > iframe, .md table { margin: 1em 0; }
.md > img { display: block; }
.md video, .md iframe { display: block; max-width: 100%; border: 0; border-radius: 10px; }
.md video { height: auto; }
.md iframe { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.md summary { cursor: pointer; font-weight: 700; }
.md code { background: var(--raised-2); padding: 2px 6px; border-radius: 6px; }
.md pre { background: var(--code-bg); border: 1px solid var(--line); padding: 14px; border-radius: 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 1em 0; padding: 6px 16px; border-left: 3px solid var(--brand); color: var(--text-2); background: var(--raised-2); border-radius: 0 10px 10px 0; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; }
.md hr { border: 0; border-top: 1px solid var(--line); }

/* versions */
/* one set of column tracks for every row (no auto columns), so the table lines up; each row opens its version */
.vlist { padding: 6px; }
.vrow { position: relative; display: grid; grid-template-columns: 40px minmax(0, 2fr) minmax(0, 1.1fr) minmax(0, 1.3fr) 108px 72px 36px; gap: 16px; align-items: center; padding: 11px 10px; border-radius: 12px; }
.vrow + .vrow { box-shadow: 0 -1px 0 var(--line); }
.vrow:not(.vtitles):hover { background: var(--raised-2); }
.vrow:not(.vtitles):hover + .vrow, .vrow:not(.vtitles):hover { box-shadow: none; }
.vtitles { padding: 8px 10px; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.vtitles span:nth-child(6), .vcount { text-align: right; }
.vname a::after { content: ""; position: absolute; inset: 0; border-radius: 12px; } /* the whole row is the link */
.dlbtn, .vmenu, .vrow .tags { position: relative; z-index: 1; }
.dlbtn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); }
.dlbtn:hover { filter: brightness(1.12); }
.vname { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vname a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vname a:hover { text-decoration: none; }
.vsub { display: flex; align-items: center; gap: 8px; font-size: .85rem; min-width: 0; }
.vsub .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vgames { color: var(--text-2); font-size: .92rem; }
.vdate { font-size: .9rem; white-space: nowrap; color: var(--text-2); }
.vcount { font-weight: 700; }
.chan { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--link); flex: none; }
.chan.beta { background: rgba(250, 204, 21, .14); color: #d9a800; }
.chan.alpha { background: rgba(251, 113, 133, .14); color: #e5566f; }
.vhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card h3 { margin-top: 24px; margin-bottom: 10px; }
.card > h3:first-child { margin-top: 0; }
.vhead + h3 { margin-top: 20px; }
.file { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: 12px; background: var(--raised-2); margin-bottom: 8px; }
.file.primary { outline: 1px solid color-mix(in srgb, var(--brand) 45%, transparent); }
.file-main { min-width: 0; }
.hash { display: block; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--muted); font: .78rem ui-monospace, Menlo, monospace; cursor: copy; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* a version's own page */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 12px; font-weight: 700; font-size: .92rem; color: var(--text-2); }
.back:hover { color: var(--text); text-decoration: none; }
.vtop { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.vtop h2 { font-size: 1.55rem; margin-bottom: 8px; }
.vtop .vsub { gap: 10px; font-size: .92rem; flex-wrap: wrap; }
.file-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-name .i { color: var(--muted); }
.meta { margin: 0; }
.meta dt { margin-top: 12px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.meta dt:first-child { margin-top: 0; }
.meta dd { margin: 3px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.meta .hash { font-size: .88rem; color: var(--text); }

/* the download picker (Modrinth style): pick a game version and a platform, get the file */
dialog.dl {
	width: min(560px, calc(100vw - 32px));
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: 22px;
	background: var(--raised);
	color: var(--text);
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
dialog.dl::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.dl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dl-head h2 { font-size: 1.3rem; }
dialog.dl h3 { margin: 18px 0 10px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.dl-result { margin-top: 20px; }
.dl-result .file { margin: 0; }
.dl-result small { display: block; color: var(--muted); }
.dl-none { color: var(--muted); padding: 14px; border-radius: 12px; background: var(--raised-2); margin: 0; }
.dl-all { display: inline-block; margin-top: 14px; font-weight: 700; font-size: .92rem; }

/* owners' editing tools */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; border: 2px dashed var(--line); border-radius: 16px; background: var(--raised-2); color: var(--text-2); text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.over { border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: var(--brand-soft); }
.dropzone .i { color: var(--link); margin-bottom: 4px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.form .dropzone { display: flex; margin: 0; font-weight: 400; }
.picked { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.picked .file { margin: 0; cursor: default; font-weight: 400; }
.picked .file-main { display: flex; align-items: center; gap: 8px; }
.picked label.file { cursor: pointer; }
.picked label.file:has(:checked) { outline: 1px solid color-mix(in srgb, var(--brand) 45%, transparent); }
.add-files { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.add-files .drop { align-self: stretch; }
.md-editor { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--raised-2); }
.md-tabs { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); }
.md-tabs button { padding: 5px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
.md-tabs button.on { background: var(--raised); color: var(--text); }
.md-editor textarea { border: 0; border-radius: 0; }
.md-editor textarea:focus { outline: none; }
.md-preview { padding: 14px 16px; min-height: 160px; background: var(--raised); }
.changelog { padding: 22px 22px 22px 34px; }
.cl-entry { position: relative; padding-bottom: 22px; }
.cl-entry:last-child { padding-bottom: 0; }
.cl-entry::before { content: ""; position: absolute; left: -19px; top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.cl-entry:last-child::before { display: none; }
.cl-entry::after { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--raised); }
.cl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 8px; }
.cl-head .muted { font-size: .9rem; }

/* forms */
.form label { display: block; font-weight: 700; margin: 16px 0 6px; }
.form h3 + p, .form h3 + label { margin-top: 0; }
.form > .btn { margin-top: 22px; }
.form > :first-child, .form > .two:first-child label { margin-top: 0; }
.page > .two { margin-bottom: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.two > .card { margin: 0; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.inv-gen .btn { margin-top: 22px; }
.invites .newtoken { margin-top: 18px; }
.invites h4 { margin: 22px 0 4px; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.invites ul { list-style: none; margin: 0; padding: 0; }
.invites li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.inv-when { flex: 1; display: flex; flex-direction: column; font-size: .9rem; }
.inv-when small { font-size: .78rem; }
.prefixed { display: flex; align-items: center; background: var(--raised-2); border: 1px solid var(--line); border-radius: 10px; }
.prefixed span { padding-left: 12px; color: var(--muted); }
.prefixed input { border: 0; background: none; padding-left: 2px; }
.icon-pick { display: flex; gap: 14px; align-items: center; }
.form .pill { margin: 0; }
.form .check { display: flex; width: fit-content; align-items: center; gap: 8px; margin-top: 16px; font-weight: 600; cursor: pointer; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.danger-zone h3 { color: var(--danger); }
.inline { display: flex; gap: 10px; margin-top: 16px; }
.newtoken { display: flex; gap: 10px; align-items: center; background: var(--code-bg); border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); padding: 10px 12px; border-radius: 10px; }
.newtoken code { flex: 1; overflow-wrap: anywhere; color: var(--link); }
.snippet { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font: .82rem/1.6 ui-monospace, Menlo, monospace; }
.token-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.table td.right { text-align: right; }
.table .drop { width: 240px; }

/* settings: Modrinth-style sidebar + content */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.snav { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.snav h3 { margin: 6px 10px 6px; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.snav h3 ~ h3 { margin-top: 14px; }
.snav a { padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 700; }
.snav a:hover { background: var(--raised-2); color: var(--text); text-decoration: none; }
.snav a.on { background: var(--brand-soft); color: var(--link); }
.settings-main h1 { margin-bottom: 18px; }
.form-actions { margin-top: 22px; }
.avatar-pick { display: flex; align-items: center; gap: 18px; }
.avatar-preview .avatar { width: 72px; height: 72px; font-size: 2rem; }
.avatar-pick input[type=file] { width: auto; }

.sside { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 12px; }
.sside .snav { position: static; }
.docs-btn { justify-content: flex-start; padding: 11px 14px; }

/* docs */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.docs-nav { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 10px; }
.docs-nav .back { margin: 0; }
.docs-nav .snav { position: static; }
.docs-main { max-width: 820px; }
.docs-main h1 { margin-bottom: 12px; }
.docs-main h2 { margin: 36px 0 10px; padding-top: 8px; scroll-margin-top: 80px; }
.docs-main ol { padding-left: 22px; }
.docs-main li { margin: 4px 0; }
.docs-main table { width: 100%; font-size: .92rem; }
.docs-main th { text-align: left; color: var(--muted); }
.code { position: relative; margin: 12px 0 16px; }
.code pre { margin: 0; padding-right: 76px; }
.code [data-copy-code] { position: absolute; top: 8px; right: 8px; }

/* auth, profile, error */
.page.auth { width: min(420px, calc(100% - 32px)); margin-top: 8vh; padding: 32px; }
.auth h1 { margin: 12px 0 20px; }
.auth label { display: block; font-weight: 700; margin: 16px 0 6px; }
.auth-logo { display: block; border-radius: 16px; }
.auth-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.auth-head h1 { margin: 0; }
.auth > form + p { margin-top: 16px; }
/* a form's error under its fields: opens smoothly, and shakes when the same error comes back */
@keyframes open { from { grid-template-rows: 0fr; opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.form-error { display: grid; grid-template-rows: 1fr; animation: open .25s ease-out; }
.form-error > p { min-height: 0; overflow: hidden; margin: 0; color: var(--danger-text); font-weight: 600; font-size: .9rem; }
.form-error > p::before { content: ""; display: block; height: 12px; }
.form-error.again > p { animation: shake .35s ease; }
.auth form:has(.form-error p) #password { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
@media (prefers-reduced-motion: reduce) { .form-error, .form-error.again > p { animation: none; } }
.profile { display: flex; gap: 22px; align-items: center; margin-bottom: 20px; }
.profile h1 { margin: 0 0 6px; }
.profile p { margin: 4px 0; }
.errorpage h1 { font-size: 4rem; margin: 10px 0 6px; color: var(--brand); }

/* a thin footer */
.foot { padding: 9px 20px; font-size: .78rem; text-align: center; color: var(--muted); background: var(--bar-bg); border-top: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ------------------------------------------------ smaller screens */

@media (max-width: 1080px) {
	.pgrid, .settings, .docs { grid-template-columns: minmax(0, 1fr); }
	.sside, .docs-nav { position: static; }
	.snav { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
	.snav h3 { display: none; }
	.browse { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "search" "side" "list"; grid-template-rows: none; }
	.filter-toggle { display: inline-flex; }
	/* above the results the filter cards sit side by side; hidden until the toggle opens them (JS only) */
	/* above the results the filter cards sit side by side; the panel slides open and shut (JS toggles .open) */
	.filters { position: static; display: grid; grid-template-rows: 1fr; margin-bottom: 16px; transition: grid-template-rows .3s ease, margin-bottom .3s ease, opacity .3s ease; }
	.filter-body { flex-direction: row; flex-wrap: wrap; align-items: flex-start; min-height: 0; overflow: hidden; }
	.filters .card { flex: 1 1 240px; }
	.filters .clear { flex-basis: 100%; }
	.js .filters:not(.open) { grid-template-rows: 0fr; margin-bottom: 0; opacity: 0; visibility: hidden; transition: grid-template-rows .3s ease, margin-bottom .3s ease, opacity .3s ease, visibility 0s .3s; }
	.phead { grid-template-columns: auto minmax(0, 1fr); }
	.ph-actions { grid-column: 1 / -1; }
	.vrow { grid-template-columns: 40px minmax(0, 1fr) 36px; row-gap: 6px; }
	.vtitles { display: none; }
	.vrow .vgames, .vrow .tags, .vrow .vdate, .vrow .vcount { grid-column: 2; }
	.vrow .vcount { text-align: left; font-weight: 600; color: var(--text-2); }
	.vrow .vcount::after { content: " downloads"; font-weight: 400; }
	.vrow .vmenu { grid-column: 3; grid-row: 1; }
}
@media (max-width: 860px) {
	.search { display: none; }
	.page { width: calc(100% - 24px); padding: 20px; margin-top: 12px; border-radius: 20px; }
}
@media (max-width: 700px) {
	.bar { gap: 10px; padding: 10px 16px; }
	.links { min-width: 0; } /* stays on the first row; scrolls sideways if it ever runs out of room */
	.page, .page.narrow { width: 100%; margin: 0; border-radius: 0; border-left: 0; border-right: 0; padding: 18px 16px; }
	.pcard { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 14px; }
	.pcard .icon { width: 64px; height: 64px; border-radius: 14px; }
	.pc-stats { grid-column: 1 / -1; flex-direction: row; }
	.icon.big { width: 72px; height: 72px; border-radius: 18px; }
	.phead h1 { font-size: 1.5rem; }
	.two { grid-template-columns: 1fr; }
	.two > .card + .card { margin-top: 16px; }
	.searchbar { flex-wrap: wrap; }
	.searchbar input { flex-basis: 100%; }
	.hero { padding: 16px 16px 300px; align-items: center; } /* the card floats in the sky, above the terrain */
	.hero-text { padding: 20px 22px; }
	.hero h1 { font-size: 2.6rem; }
	.hero p { font-size: 1rem; }
	.hero .btn.big { padding: 11px 16px; font-size: 1rem; }
	.table { font-size: .88rem; }
}

/* ------------------------------------------------ personal access tokens (templates/pats.html, owned by the API work)
   Modrinth-style create/edit dialogs are popovers, so they open without JavaScript. */
.pat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.settings-main .pat-head h1 { margin: 0; }
.token-row.pat { flex-wrap: wrap; padding: 14px 0; }
.token-row.pat:nth-last-child(2) { border-bottom: 0; } /* the last row; its dialog follows it */
.pat-info { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pat-info .newtoken { margin-top: 4px; }
.pat-info .hint { margin: 0; }
.pat-expired { color: var(--danger-text); }
.pat-actions { display: flex; gap: 8px; }
.modal[popover] {
	width: min(560px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: 22px;
	background: var(--raised);
	color: var(--text);
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.modal[popover]::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.modal h2 { margin-bottom: 4px; }
.modal .scopes { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.modal .scopes legend { padding: 0; margin-bottom: 8px; font-weight: 700; }
.scope-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 24px; }
.scope-groups h4 { margin: 0 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: .95rem; }
.modal .scope-groups .check { margin: 6px 0 0; font-weight: 500; }
.modal .form-actions { justify-content: flex-end; }
@media (max-width: 380px) { .brand span { display: none; } }
