/* JumPHP playground: a night-blue arcade cabinet, yellow buttons, pixels where it helps. */
:root {
	--bg: #0b0e1f;
	--bg-2: #11162e;
	--panel: #161c3a;
	--panel-2: #1d2550;
	--line: #2b3670;
	--ink: #eef0fa;
	--muted: #a6afd6;
	--faint: #6f79a8;
	--yellow: #ffd23f;
	--pink: #ff4d8d;
	--cyan: #3fd0ff;
	--green: #4be08a;
	--red: #ff6b6b;
	--radius: 6px;
	--mono: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
	--rainbow: linear-gradient(90deg, #ff4d4d, #ff9f1c, #ffd23f, #4be08a, #3fd0ff, #7c5cff, #ff4d8d);
	color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
code, pre, kbd { font-family: var(--mono); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(26px, 4vw, 40px); }
h2 { font-size: clamp(20px, 2.6vw, 26px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.pixel { font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.stripe { height: 4px; background: var(--rainbow); }

/* --- header ----------------------------------------------------------------------------------------- */
.top { background: var(--bg-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: baseline; gap: 8px; color: var(--ink); font: 800 22px var(--mono); letter-spacing: .08em; }
.logo:hover { text-decoration: none; }
.logo b { color: var(--yellow); text-shadow: 2px 2px 0 var(--pink); }
.logo small { font: 600 11px var(--mono); color: var(--muted); letter-spacing: .15em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius); font-weight: 600; white-space: nowrap; }
.nav a:hover, .nav a.on { color: var(--ink); background: var(--panel); text-decoration: none; }
.search { flex: 1; min-width: 160px; max-width: 360px; margin-left: auto; }
.me { display: flex; align-items: center; gap: 8px; }
.me img { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); }
.me form { margin: 0; }
@media (max-width: 720px) {
	.top .wrap { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
	.search { order: 5; max-width: none; flex-basis: 100%; }
	.nav { order: 4; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
	.nav a { padding: 6px 7px; }
	.logo small { display: none; }
}

/* --- forms and buttons ------------------------------------------------------------------------------ */
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; width: 100%; }
input[type=checkbox] { width: auto; }
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
label { display: block; font-weight: 600; margin: 0 0 6px; }
label.inline { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.field { margin-bottom: 18px; }
.field .hint { font-size: 14px; color: var(--muted); margin-top: 4px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: 700 15px var(--sans); padding: 10px 18px; border-radius: var(--radius); border: 2px solid var(--line);
	background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--yellow); color: #17130a; border-color: #17130a; box-shadow: 4px 4px 0 var(--pink); }
.btn.primary:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--pink); }
.btn.big { font-size: 19px; padding: 14px 28px; }
.btn.small { font-size: 13px; padding: 6px 11px; }
.btn.danger { border-color: var(--red); color: var(--red); background: transparent; }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions form { margin: 0; }

/* --- flashes, panels, badges ------------------------------------------------------------------------ */
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; white-space: pre-line; border: 1px solid; }
.flash.success { background: #10301f; border-color: var(--green); }
.flash.error { background: #3a1420; border-color: var(--red); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel h2 { font-size: 20px; }
.badge { display: inline-block; font: 700 12px var(--mono); letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }
.badge.ready { background: #123d27; color: var(--green); }
.badge.error { background: #45121f; color: var(--red); }
.badge.creating, .badge.empty { background: #403710; color: var(--yellow); }
.chip { display: inline-block; padding: 5px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px; }
.chip:hover, .chip.on { color: var(--ink); border-color: var(--yellow); text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
pre.code { background: #070914; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; font-size: 14px; white-space: pre-wrap; }
.cmd { display: flex; gap: 10px; align-items: flex-start; background: #070914; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.cmd code { flex: 1; white-space: pre-wrap; word-break: break-all; font-size: 14px; }
.cmd .btn { flex: none; }

/* --- page layout ------------------------------------------------------------------------------------ */
main { flex: 1; }
.section { padding: 36px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.hero { padding: 48px 0 30px; }
.hero h1 { font-family: var(--mono); letter-spacing: .02em; max-width: 860px; }
.hero h1 em { font-style: normal; color: var(--yellow); text-shadow: 3px 3px 0 var(--pink); }
.hero p.lead { font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 720px; }
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); counter-reset: step; }
.steps .panel { padding: 18px; margin: 0; }
.steps .panel::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 30px; height: 30px; margin-bottom: 8px;
	border-radius: 50%; background: var(--yellow); color: #17130a; font: 800 15px var(--mono); }
.two { display: grid; gap: 24px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
footer.bottom { border-top: 1px solid var(--line); background: var(--bg-2); padding: 26px 0 32px; color: var(--muted); font-size: 14px; margin-top: 40px; }
footer.bottom .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
body.full footer.bottom { display: none; }

/* --- game cards ------------------------------------------------------------------------------------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; color: var(--ink); transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-3px); border-color: var(--yellow); text-decoration: none; }
.thumb { aspect-ratio: 16 / 9; background: #070914; position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.thumb .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font: 800 clamp(18px, 2.4vw, 26px) var(--mono); letter-spacing: .05em; padding: 12px; text-align: center;
	color: #fff; text-shadow: 3px 3px 0 rgba(0, 0, 0, .45); background: linear-gradient(135deg, hsl(var(--h) 70% 38%), hsl(calc(var(--h) + 60) 70% 22%)); }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: auto; padding-top: 4px; }
.card .meta img { width: 20px; height: 20px; border-radius: 50%; }
.card .cat { font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--yellow); }
.cats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.cats a { display: block; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.cats a:hover { border-color: var(--yellow); text-decoration: none; }
.cats strong { display: block; font-size: 19px; }
.cats span { color: var(--muted); font-size: 14px; }
.cats em { float: right; font: 700 13px var(--mono); font-style: normal; color: var(--yellow); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 28px; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }

/* --- a game ----------------------------------------------------------------------------------------- */
.gamebar { background: var(--bg-2); border-bottom: 1px solid var(--line); }
.gamebar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-top: 8px; padding-bottom: 8px; max-width: none; }
.gamebar h1 { font-size: 18px; margin: 0; }
.gamebar .by { color: var(--muted); font-size: 14px; }
.gamebar .actions { margin-left: auto; gap: 6px; }
.frame { width: 100%; border: 0; display: block; background: #000; height: calc(100vh - 116px); min-height: 360px; }
.game-hero { display: grid; gap: 28px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: center; padding: 36px 0; }
.game-hero .thumb { border-radius: 10px; border: 1px solid var(--line); }
@media (max-width: 860px) { .game-hero { grid-template-columns: 1fr; } .frame { height: calc(100vh - 150px); } }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }

/* --- sources ---------------------------------------------------------------------------------------- */
.crumbs { font-family: var(--mono); font-size: 15px; margin: 18px 0; word-break: break-all; }
.crumbs a { color: var(--yellow); }
table.files { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.files td { padding: 8px 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 14px; }
table.files tr:first-child td { border-top: 0; }
table.files td.size { text-align: right; color: var(--faint); white-space: nowrap; }
pre.source { counter-reset: line; background: #070914; border: 1px solid var(--line); border-radius: 10px; padding: 12px 0; overflow-x: auto; font-size: 13.5px; line-height: 1.55; margin: 0; }
pre.source span { display: block; padding: 0 16px 0 0; white-space: pre; }
pre.source span::before { counter-increment: line; content: counter(line); display: inline-block; width: 52px; padding-right: 14px; margin-right: 12px; text-align: right; color: var(--faint); border-right: 1px solid var(--line); user-select: none; }
.preview-img { background: repeating-conic-gradient(#1a1f3c 0 25%, #12162c 0 50%) 0 0 / 16px 16px; padding: 18px; border-radius: 10px; border: 1px solid var(--line); }
.preview-img img { image-rendering: pixelated; margin: 0 auto; max-height: 70vh; }

/* --- editor ----------------------------------------------------------------------------------------- */
/* the editor fills what the header and the bar leave of the window, whatever their height */
@media (min-width: 961px) {
	body.full:has(#editor) { height: 100vh; height: 100dvh; }
	body.full:has(#editor) main { display: flex; flex-direction: column; min-height: 0; }
}
.editor { display: grid; grid-template-columns: 250px minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); flex: 1; min-height: 480px; }
.editor.no-preview { grid-template-columns: 250px minmax(0, 1fr); }
.editor.no-preview .ed-preview { display: none; }
.ed-tree { overflow: auto; border-right: 1px solid var(--line); background: var(--bg-2); font: 13px/1.4 var(--mono); padding: 6px 0; }
.ed-tree details > summary { cursor: pointer; padding: 3px 10px; color: var(--muted); list-style: none; white-space: nowrap; }
.ed-tree details > summary::-webkit-details-marker { display: none; }
.ed-tree details > summary::before { content: '▸ '; }
.ed-tree details[open] > summary::before { content: '▾ '; }
.ed-tree .children { padding-left: 12px; }
.ed-tree a { display: block; padding: 3px 10px 3px 22px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-tree a:hover { background: var(--panel); text-decoration: none; }
.ed-tree a.on { background: var(--panel-2); color: var(--yellow); }
.ed-tree a.modified::after, .ed-tree a.added::after { content: ' ●'; color: var(--yellow); }
.ed-tree a.added { color: var(--green); }
.ed-tree a.deleted { color: var(--faint); text-decoration: line-through; }
.ed-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ed-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--bg-2); font: 13px var(--mono); min-height: 44px; flex-wrap: wrap; }
.ed-head .path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-code { flex: 1; overflow: hidden; min-height: 0; }
.ed-code .cm-editor { height: 100%; }
.ed-empty { display: grid; place-items: center; height: 100%; color: var(--muted); padding: 24px; text-align: center; }
.ed-preview { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ed-preview iframe { flex: 1; width: 100%; border: 0; background: #000; }
.ed-status { font: 12px var(--mono); color: var(--muted); }
@media (max-width: 960px) {
	.editor, .editor.no-preview { grid-template-columns: 1fr; height: auto; }
	.ed-tree { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
	.ed-code { height: 60vh; flex: none; }
	.ed-preview { border-left: 0; height: 60vh; }
}
dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 22px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 6, 15, .7); }

/* --- the wall of games (/games) ------------------------------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wall-top { width: 100%; box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 18px 16px; max-width: 1600px; margin: 0 auto; }
.sorts { display: flex; flex-wrap: wrap; gap: 6px; }
.sorts a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 14px; }
.sorts a:hover { color: var(--ink); text-decoration: none; border-color: var(--yellow); }
.sorts a.on { background: var(--yellow); border-color: var(--yellow); color: #111; font-weight: 700; }
.wall { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); padding: 0 16px 40px; max-width: 1600px; margin: 0 auto; }
.tile { position: relative; display: block; border-radius: 8px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); color: var(--ink); transition: transform .12s, border-color .12s; }
.tile:hover, .tile:focus-visible { transform: scale(1.03); border-color: var(--yellow); text-decoration: none; z-index: 1; }
.tile .name { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.tile .name span { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .name small { color: var(--muted); font-size: 12px; white-space: nowrap; display: flex; gap: 6px; }
.stars-mini { color: var(--yellow); font-weight: 700; }

/* --- marks: the stars of a game --------------------------------------------------------------------- */
.rate { display: flex; align-items: center; gap: 8px; }
.rate .stars { display: inline-flex; }
.rate .stars button { background: none; border: 0; padding: 0 1px; font-size: 20px; line-height: 1; color: #4a4f6b; cursor: pointer; }
.rate .stars:hover button { color: var(--yellow); }
.rate .stars button:hover ~ button { color: #4a4f6b; }
.rate .stars button.on { color: var(--yellow); }
.rate .avg { color: var(--ink); font-weight: 700; font-size: 14px; }
.rate .avg small { color: var(--muted); font-weight: 400; }

/* --- sharing a game --------------------------------------------------------------------------------- */
.share { position: relative; display: inline-flex; }
.share > button { display: inline-flex; align-items: center; gap: 6px; }
.share-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; min-width: 190px; display: flex; flex-direction: column;
	background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 30px #0009; }
.share-menu[hidden] { display: none; }
.share-menu a, .share-menu button { padding: 8px 12px; border-radius: 6px; color: var(--ink); font: inherit; font-size: 14px; text-align: left; background: none; border: 0; cursor: pointer; }
.share-menu a:hover, .share-menu button:hover { background: var(--bg-2); text-decoration: none; }

/* --- a game installed as an app: only the game --------------------------------------------------------- */
.install { position: relative; display: inline-flex; }
.install[hidden] { display: none; }
.install > button { display: inline-flex; align-items: center; gap: 6px; }
.install-help { width: 260px; }
.install-help p { margin: 6px 8px; font-size: 14px; line-height: 1.5; }
@media (display-mode: standalone), (display-mode: fullscreen) {
	body.full .stripe, body.full header.top, body.full .gamebar { display: none; }
	body.full .frame { height: 100vh; height: 100dvh; }
}

.private-list { list-style: none; margin: 8px 0; padding: 0; max-height: 240px; overflow: auto; font-size: 13px; }
.private-list li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.private-list code { word-break: break-all; }

/* --- the documentation ---------------------------------------------------------------------------------- */
.docs-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; align-items: start; }
.docs-nav { position: sticky; top: 16px; font-size: 14px; }
.docs-nav h2 { font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--yellow); margin: 18px 0 6px; }
.docs-nav h2:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav li a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); }
.docs-nav li a:hover { color: var(--ink); text-decoration: none; background: var(--panel); }
.docs-nav li a.on { color: var(--ink); background: var(--panel); border-left: 3px solid var(--yellow); }
.doc { max-width: 820px; line-height: 1.7; font-size: 16px; }
.doc h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.2; margin: 0 0 18px; }
.doc h2 { font-size: 22px; margin: 36px 0 10px; }
.doc { min-width: 0; }
.doc p, .doc li { color: #cfd3ea; overflow-wrap: anywhere; }
.doc code { font: 14px var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.doc pre { background: #070914; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; }
.doc pre code { background: none; border: 0; padding: 0; font-size: 13.5px; color: #e6e9ff; }
.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; display: block; overflow-x: auto; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { color: var(--yellow); font-weight: 700; }
.doc blockquote { margin: 16px 0; padding: 10px 16px; border-left: 3px solid var(--pink); background: var(--panel); border-radius: 0 8px 8px 0; }
.doc-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
	.docs-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
	.docs-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px 14px; }
	.docs-nav h2 { width: 100%; margin: 10px 0 2px; }
	.docs-nav ul { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 100%; min-width: 0; }
	.docs-nav li a { white-space: nowrap; }
}
