/* Minecraft area bundle (FRAMEWORK.md 9): what the Minecraft pages need beyond
   the vocabulary, loaded as their area bundle (ui/areas.py AREA_CSS). One
   section per round 6 lane; a lane edits only inside its own. */

/* -- Minecraft admin (pages/minecraft_admin.py, minecraft_admin_load.py; admin_minecraft.js; lane M) -- */
/* Round 6 lane M writes its mc- rules between this header and the end comment. */

/* A player's name with its 16 px head (PlayerName; minecraft_status.js draws
   the same for the players online), sized before the image loads. */
.mc-name {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
}

.mc-name__head {
	inline-size: 16px;
	block-size: 16px;
	flex: none;
	image-rendering: pixelated;
}


/* The AMP facts in the Server panel: one line from the first paint, empty
   or not, clipped (the full text is its title); a whitelist that is off
   reads in the danger colour. */
.c-note[data-mc-facts] {
	min-block-size: 1lh;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mc-fact[data-bad] {
	color: var(--danger);
	font-weight: 600;
}

/* Map render's status: held at its usual fill (the status line and three
   two-line map rows, the Skeleton's six rows) from the first paint, so the
   fill moves nothing below it (criticism round 2 G105). */
[data-mc-bluemap-status] {
	min-block-size: calc(6 * var(--row-h));
}

/* A map row's size and its written age each stay on one line; the tile
   counts before them take the wrap (criticism round 2 G109). */
[data-mc-bluemap-status] .c-list__meta ~ .c-list__meta {
	white-space: nowrap;
}

/* A failed settings read keeps the space its Reserve(rows=8) held, so the
   failure line never lifts the panels below (criticism round 2 G105). */
[data-mc-settings][data-mc-settings-failed] {
	min-block-size: calc(9 * var(--row-h));
}

/* Settings: label and control per cell, two to a line on desk. */
.mc-settings {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--sp-1) var(--sp-3);
}

.mc-setting {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-2);
	min-block-size: var(--row-h);
	font-size: var(--fs-sm);
}

/* An unsaved edit, here and on the setups page's server.properties grid:
   its label in warn. */
.mc-setting[data-dirty] .mc-setting__label,
.ms-prop[data-dirty] > code {
	color: var(--warn);
}

.mc-setting__label {
	min-inline-size: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mc-setting .fld {
	inline-size: 9rem;
	flex: none;
}

.mc-setting__na {
	color: var(--text-muted);
}

/* The half-width tables' clipped columns (the whitelist's Contact and
   Reason, the sync runs' Trigger and Error, the recent jobs' Job and Error)
   take the width the others leave and are cut to it on one line, so a row
   stays one line and its action in the panel (criticism round 2 G102,
   G109). */
:is(#mc-wl, #mc-sync-runs, [data-mc-job-history]) td.t-clamp {
	max-inline-size: 0;
	inline-size: 100%;
}

/* The world job estimate takes the line under Start and keeps two lines
   from the first paint, so the whole of it shows at every width and its
   text never moves the panel (criticism round 2 G115). */
.c-text[data-mc-job-estimate] {
	flex-basis: 100%;
	min-block-size: 2lh;
	white-space: normal;
	color: var(--text-muted);
}

/* The world job form: the three numbers take one width, each beside its
   label. */
[data-mc-job-form] .l-row > .l-field--inline {
	flex: 0 1 auto;
}

[data-mc-job-form] .l-field--inline > .fld {
	inline-size: 7rem;
	flex: none;
}

/* The active world job. */
.mc-job {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
}

.mc-job__head,
.mc-job__phases,
.mc-job__stats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-1) var(--sp-3);
}

.mc-job__head .c-acts {
	margin-inline-start: auto;
}

.mc-job__stats {
	font-size: var(--fs-xs);
	color: var(--text-muted);
}

.mc-job__bar .c-bar {
	inline-size: 100%;
}

/* Quick commands: the command picker, then the picked command's fields on
   the same row, held two control lines high from the fill so a long
   command's fields wrap into space already there. */
.mc-qc {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	align-content: flex-start;
	gap: var(--sp-2);
	min-block-size: calc(2 * var(--ctl-h-field) + var(--sp-2));
}

.mc-qc > [data-mc-qc-row]:not([hidden]) {
	display: contents;
}

.mc-qc__player {
	display: inline-flex;
	gap: var(--sp-1);
}

.mc-qc [data-mc-qc-wide] {
	flex: 1 1 12rem;
}

@media (max-width: 600px) {
	/* The state word has its own line on a phone, so its fill never rewraps
	   the last sync after it. */
	#mc-state > [data-amp-state] {
		flex-basis: 100%;
	}

	.mc-settings {
		grid-template-columns: minmax(0, 1fr);
	}

	/* A phone holds the tallest command's lines (Give: the picker, then its
	   fields on three more), so a pick never moves the panels below
	   (criticism round 2 G111). */
	.mc-qc {
		min-block-size: calc(4 * var(--ctl-h-field) + 3 * var(--sp-2));
	}

	/* One setting to a line: a long label wraps whole words rather than
	   being cut mid-word. */
	.mc-setting__label {
		white-space: normal;
	}
}
/* -- end Minecraft admin -- */

/* -- Minecraft public and setups (pages/minecraft.py, minecraft_load.py, minecraft_setups.py, minecraft_setups_load.py; minecraft_status.js, admin_minecraft_setups.js; lane P) -- */
/* Round 6 lane P writes its mp- and ms- rules between this header and the end comment. */

/* /minecraft: the whitelist request as /register lays its form out: half
   the reading column, the two names sharing a line on desk and stacked on
   phones. */
[data-mp-request] .c-form { max-inline-size: calc(var(--w-page) / 2); }
[data-mp-request] .l-row > .l-field { flex-basis: 10rem; }
/* The player count ("2 / 20", rewritten live) is a figure. */
[data-mp-players] { font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
	[data-mp-tps] { --plot-ratio: 2; }
	[data-mp-request] .l-row:has(> .l-field) { row-gap: var(--sp-3); }
	[data-mp-request] .l-row > .l-field { flex-basis: 100%; }
}
/* /admin/minecraft/setups: each live mount holds its Reserve floor
   ((rows + 1) x --row-h, minecraft_setups.RESERVE_ROWS) after reserve.js
   lets go, so a short fill (AMP not configured) takes the same space. */
[data-async="ms-identity"],
[data-async="ms-loadouts"] { min-block-size: calc(4 * var(--row-h)); }
[data-async="ms-mods"],
[data-async="ms-job"] { min-block-size: calc(5 * var(--row-h)); }
[data-async="ms-version"] { min-block-size: calc(2 * var(--row-h)); }

/* While a loadout is edited the left column takes the page width and the
   right column's sections step aside; the editor replaces the list. */
[data-ms-grid][data-ms-editing] { --l-cols: minmax(0, 1fr); }
[data-ms-grid][data-ms-editing] > [data-ms-side] { display: none; }

.ms-identity { display: flex; align-items: flex-start; gap: var(--sp-3); }
.ms-icon { display: inline-flex; flex: none; }
.ms-icon img {
	inline-size: 64px;
	block-size: 64px;
	border-radius: var(--radius-sm);
	image-rendering: pixelated;
}
.ms-icon--small img { inline-size: 18px; block-size: 18px; }
.ms-loadout { display: inline-flex; align-items: center; gap: var(--sp-2); }
.ms-loadout[data-ms-fresh] { color: var(--accent); }


/* server.properties: key and value per line, two or more lines across. */
.ms-props {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(21rem, 100%), 1fr));
	gap: var(--sp-1) var(--sp-4);
}
.ms-prop {
	grid-template-columns: minmax(0, 1fr) 9rem;
	align-items: center;
	gap: var(--sp-2);
	padding: 0 var(--sp-1);
	border-radius: var(--radius-sm);
	font-size: var(--fs-sm);
}
.ms-prop:not([hidden]) { display: grid; }
.ms-prop code,
.ms-prop[data-managed] span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-prop[data-managed] { color: var(--text-muted); }
/* -- end Minecraft public and setups -- */
