/*
 * medienpatch Voxel-Bauwelt
 * Nur Systemschriften. Keine fremden Dateien, keine Einbindung von aussen.
 */

.mpv-buehne {
	--mpv-dunkel: #14161c;
	--mpv-blatt: rgba(20, 22, 28, 0.88);
	--mpv-hell: #ffffff;
	--mpv-akzent: #f2a33c;
	--mpv-akzent-dunkel: #8a5405;
	--mpv-rand: rgba(255, 255, 255, 0.28);

	position: relative;
	width: 100%;
	height: var(--mpv-hoehe, 480px);
	margin: 0 0 1.5em;
	overflow: hidden;
	background: #8ec0e8;
	border: 2px solid var(--mpv-dunkel);
	border-radius: 6px;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	color: var(--mpv-hell);
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}

.mpv-buehne *,
.mpv-buehne *::before,
.mpv-buehne *::after {
	box-sizing: border-box;
}

.mpv-leinwand {
	display: block;
	width: 100%;
	height: 100%;
	cursor: crosshair;
	outline: none;
}

.mpv-leinwand:focus-visible {
	outline: 4px solid var(--mpv-akzent);
	outline-offset: -4px;
}

/* ---------- Fadenkreuz ---------- */

.mpv-fadenkreuz {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 22px;
	height: 22px;
	margin: -11px 0 0 -11px;
	pointer-events: none;
	opacity: 0;
}

.mpv-buehne--laeuft .mpv-fadenkreuz {
	opacity: 1;
}

.mpv-fadenkreuz::before,
.mpv-fadenkreuz::after {
	content: "";
	position: absolute;
	background: #ffffff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65);
}

.mpv-fadenkreuz::before {
	top: 10px;
	left: 0;
	width: 22px;
	height: 2px;
}

.mpv-fadenkreuz::after {
	top: 0;
	left: 10px;
	width: 2px;
	height: 22px;
}

/* ---------- Kopfzeile ---------- */

.mpv-kopf {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	gap: 10px;
	align-items: center;
}

.mpv-position {
	margin: 0;
	padding: 6px 10px;
	background: var(--mpv-blatt);
	border-radius: 4px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

/* ---------- Knöpfe ---------- */

.mpv-knopf {
	display: inline-block;
	margin: 0;
	padding: 9px 14px;
	background: var(--mpv-blatt);
	color: var(--mpv-hell);
	border: 2px solid var(--mpv-rand);
	border-radius: 4px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.2;
	cursor: pointer;
}

.mpv-knopf:hover {
	border-color: var(--mpv-akzent);
}

.mpv-knopf:focus-visible {
	outline: 3px solid var(--mpv-akzent);
	outline-offset: 2px;
}

.mpv-knopf--gross {
	padding: 14px 24px;
	font-size: 18px;
	background: var(--mpv-akzent);
	color: #241704;
	border-color: #241704;
	font-weight: bold;
}

.mpv-knopf--klein {
	padding: 7px 10px;
	font-size: 14px;
}

.mpv-knopf--weg {
	border-color: rgba(255, 160, 160, 0.6);
}

.mpv-knopf--datei {
	position: relative;
	overflow: hidden;
}

.mpv-knopf--datei input[type="file"] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.mpv-knopfreihe {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 12px;
}

/* ---------- Leiste mit Baustoffen ---------- */

.mpv-hotbar {
	position: absolute;
	right: 10px;
	bottom: 10px;
	left: 10px;
	display: flex;
	gap: 6px;
	justify-content: center;
	overflow-x: auto;
	padding: 6px;
	background: var(--mpv-blatt);
	border-radius: 6px;
}

.mpv-stoff {
	position: relative;
	flex: 0 0 auto;
	width: 64px;
	padding: 5px 4px 4px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--mpv-hell);
	border: 2px solid transparent;
	border-radius: 4px;
	font-family: inherit;
	font-size: 11px;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

.mpv-stoff--aktiv {
	border-color: var(--mpv-akzent);
	background: rgba(242, 163, 60, 0.22);
}

.mpv-stoff:focus-visible {
	outline: 3px solid var(--mpv-akzent);
	outline-offset: 2px;
}

.mpv-stoff__bild {
	display: block;
	width: 34px;
	height: 34px;
	margin: 0 auto 4px;
	background-size: cover;
	background-repeat: no-repeat;
	border: 1px solid rgba(0, 0, 0, 0.4);
	image-rendering: pixelated;
}

.mpv-stoff__name {
	display: block;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.mpv-stoff__taste {
	position: absolute;
	top: 2px;
	right: 4px;
	font-size: 10px;
	opacity: 0.75;
}

/* ---------- Startbild ---------- */

.mpv-start {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: linear-gradient(180deg, #2b3a4d 0%, #16202c 100%);
	text-align: center;
}

.mpv-start[hidden] {
	display: none;
}

.mpv-start__inhalt {
	max-width: 30em;
}

.mpv-start__titel {
	margin: 0 0 12px;
	font-family: inherit;
	font-size: 30px;
	color: var(--mpv-hell);
}

.mpv-start__text {
	margin: 0 0 20px;
	font-size: 16px;
}

.mpv-start__fein {
	margin: 16px 0 0;
	font-size: 13px;
	opacity: 0.85;
}

/* ---------- Menü ---------- */

.mpv-dialog {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 16px;
	overflow-y: auto;
	background: rgba(8, 10, 14, 0.72);
}

.mpv-dialog[hidden] {
	display: none;
}

.mpv-dialog__blatt {
	width: 100%;
	max-width: 34em;
	padding: 16px 18px 20px;
	background: #1b1f27;
	border: 2px solid var(--mpv-rand);
	border-radius: 6px;
}

.mpv-dialog__kopf {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.mpv-dialog__titel {
	margin: 0;
	font-family: inherit;
	font-size: 20px;
	color: var(--mpv-hell);
}

.mpv-dialog__reiter {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 14px;
	border-bottom: 2px solid var(--mpv-rand);
}

.mpv-reiter {
	padding: 8px 12px;
	background: none;
	color: var(--mpv-hell);
	border: 2px solid transparent;
	border-bottom: none;
	border-radius: 4px 4px 0 0;
	font-family: inherit;
	font-size: 14px;
	cursor: pointer;
}

.mpv-reiter[aria-selected="true"] {
	background: rgba(242, 163, 60, 0.2);
	border-color: var(--mpv-akzent);
	font-weight: bold;
}

.mpv-reiter:focus-visible {
	outline: 3px solid var(--mpv-akzent);
	outline-offset: 2px;
}

.mpv-tafel[hidden] {
	display: none;
}

.mpv-tafel h3 {
	margin: 16px 0 6px;
	font-family: inherit;
	font-size: 16px;
	color: var(--mpv-akzent);
}

.mpv-tafel h3:first-child {
	margin-top: 0;
}

.mpv-tafel h4 {
	margin: 14px 0 6px;
	font-family: inherit;
	font-size: 14px;
	color: var(--mpv-hell);
}

.mpv-hinweis {
	margin: 0 0 10px;
	font-size: 13px;
	color: #d9dde5;
}

.mpv-feld {
	display: block;
	margin: 0 0 12px;
	font-size: 14px;
}

.mpv-feld label,
.mpv-feld__titel {
	display: block;
	margin-bottom: 4px;
}

.mpv-feld--schalter label {
	margin-bottom: 8px;
	cursor: pointer;
}

.mpv-feld input[type="text"],
.mpv-feld input[type="number"] {
	width: 100%;
	padding: 8px;
	background: #10131a;
	color: var(--mpv-hell);
	border: 2px solid var(--mpv-rand);
	border-radius: 4px;
	font-family: inherit;
	font-size: 15px;
}

.mpv-feld input[type="range"] {
	width: 100%;
	accent-color: var(--mpv-akzent);
}

.mpv-feld input[type="checkbox"],
.mpv-feld input[type="radio"] {
	width: 18px;
	height: 18px;
	margin-right: 6px;
	accent-color: var(--mpv-akzent);
	vertical-align: -3px;
}

.mpv-feld input:focus-visible {
	outline: 3px solid var(--mpv-akzent);
	outline-offset: 2px;
}

.mpv-liste {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mpv-liste__zeile {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
}

.mpv-liste__zeile .mpv-knopf:first-child {
	flex: 1 1 auto;
	text-align: left;
}

.mpv-liste__leer {
	font-size: 13px;
	color: #d9dde5;
}

.mpv-tasten {
	display: grid;
	grid-template-columns: minmax(6em, 10em) 1fr;
	gap: 4px 12px;
	margin: 0 0 10px;
	font-size: 14px;
}

.mpv-tasten dt {
	font-weight: bold;
	color: var(--mpv-akzent);
}

.mpv-tasten dd {
	margin: 0;
}

/* ---------- Finger-Steuerung ---------- */

.mpv-touch[hidden] {
	display: none;
}

.mpv-stick {
	position: absolute;
	bottom: 96px;
	left: 16px;
	width: 116px;
	height: 116px;
	background: rgba(20, 22, 28, 0.5);
	border: 2px solid var(--mpv-rand);
	border-radius: 50%;
}

.mpv-stick__knauf {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 46px;
	height: 46px;
	background: rgba(242, 163, 60, 0.85);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.mpv-touchknoepfe {
	position: absolute;
	right: 16px;
	bottom: 96px;
	display: grid;
	grid-template-columns: repeat(2, auto);
	gap: 8px;
}

.mpv-rundknopf {
	width: 74px;
	height: 56px;
	padding: 4px;
	background: var(--mpv-blatt);
	color: var(--mpv-hell);
	border: 2px solid var(--mpv-rand);
	border-radius: 8px;
	font-family: inherit;
	font-size: 13px;
	cursor: pointer;
}

.mpv-rundknopf:focus-visible {
	outline: 3px solid var(--mpv-akzent);
	outline-offset: 2px;
}

/* ---------- Meldungen ---------- */

.mpv-meldung {
	position: absolute;
	top: 56px;
	left: 50%;
	max-width: 80%;
	margin: 0;
	padding: 0 12px;
	transform: translateX(-50%);
	font-size: 14px;
	text-align: center;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
	pointer-events: none;
}

.mpv-meldung:not(:empty) {
	padding: 8px 12px;
	background: var(--mpv-blatt);
	border-radius: 4px;
}

/* ---------- Kleine Bildschirme ---------- */

@media (max-width: 640px) {
	.mpv-buehne {
		font-size: 14px;
	}

	.mpv-hotbar {
		justify-content: flex-start;
	}

	.mpv-stoff {
		width: 56px;
	}

	.mpv-stick {
		bottom: 108px;
		width: 96px;
		height: 96px;
	}

	.mpv-touchknoepfe {
		bottom: 108px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mpv-buehne * {
		transition: none !important;
		animation: none !important;
	}
}


/* ---------- Version 2: Modi, Inventar, Wesen ---------- */

.mpv-knopf--versteckt {
	display: none;
}

/* Modus-Auswahl im Startbild */
.mpv-modus-wahl {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
	margin: 8px 0 14px;
}

.mpv-modus {
	flex: 1 1 220px;
	max-width: 300px;
	padding: 16px 18px;
	text-align: left;
	background: var(--mpv-blatt);
	color: var(--mpv-hell);
	border: 2px solid var(--mpv-rand);
	border-radius: 10px;
	font-family: inherit;
	cursor: pointer;
}

.mpv-modus:hover,
.mpv-modus:focus-visible {
	border-color: var(--mpv-akzent);
	outline: none;
}

.mpv-modus__titel {
	display: block;
	margin-bottom: 6px;
	font-size: 20px;
	font-weight: bold;
	color: var(--mpv-akzent);
}

.mpv-modus__text {
	display: block;
	font-size: 13px;
	line-height: 1.4;
	color: var(--mpv-hell);
}

/* Uhr und Gesundheit im Kopf */
.mpv-uhr {
	margin: 0;
	padding: 4px 10px;
	background: var(--mpv-blatt);
	border-radius: 6px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.mpv-gesundheit {
	margin: 0;
	padding: 4px 10px;
	background: var(--mpv-blatt);
	border-radius: 6px;
	font-size: 18px;
	line-height: 1;
	letter-spacing: 2px;
	color: #ff6b6b;
}

.mpv-gesundheit[hidden] {
	display: none;
}

/* Felder im Inventar (eigene Klasse, damit das Menue unberuehrt bleibt) */
.mpv-slot {
	position: relative;
	width: 46px;
	height: 46px;
	padding: 0;
	background: rgba(0, 0, 0, 0.35);
	border: 2px solid var(--mpv-rand);
	border-radius: 6px;
	cursor: pointer;
}

.mpv-slot:hover,
.mpv-slot:focus-visible {
	border-color: var(--mpv-akzent);
	outline: none;
}

.mpv-slot__bild {
	position: absolute;
	inset: 4px;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	image-rendering: pixelated;
}

.mpv-slot__zahl {
	position: absolute;
	right: 3px;
	bottom: 1px;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #fff;
	text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
}

.mpv-slot__taste {
	position: absolute;
	left: 3px;
	top: 1px;
	font-size: 10px;
	color: var(--mpv-akzent);
}

.mpv-slot__name {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -14px;
	font-size: 9px;
	line-height: 1;
	text-align: center;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--mpv-hell);
}

/* Leiste unten (Hotbar) nutzt dieselben Felder */
.mpv-hotbar .mpv-slot {
	width: 48px;
	height: 48px;
	flex: 0 0 auto;
}

.mpv-slot--aktiv {
	border-color: var(--mpv-akzent);
	box-shadow: 0 0 0 2px var(--mpv-akzent);
}

/* Inventar-Ueberlagerung */
.mpv-inventar {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(8, 9, 12, 0.72);
	z-index: 20;
}

.mpv-inventar[hidden] {
	display: none;
}

.mpv-inventar__blatt {
	width: 100%;
	max-width: 470px;
	max-height: 100%;
	overflow-y: auto;
	padding: 16px 18px 18px;
	background: var(--mpv-dunkel);
	border: 2px solid var(--mpv-rand);
	border-radius: 12px;
}

.mpv-inventar__kopf {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.mpv-inventar__titel {
	margin: 0;
	font-family: inherit;
	font-size: 20px;
	color: var(--mpv-hell);
}

.mpv-inventar__untertitel {
	margin: 14px 0 8px;
	font-family: inherit;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: rgba(255, 255, 255, 0.66);
}

.mpv-bereich[hidden] {
	display: none;
}

.mpv-gitter {
	display: grid;
	gap: 5px;
	justify-content: center;
}

.mpv-gitter--haupt {
	grid-template-columns: repeat(9, auto);
}

.mpv-gitter--leiste {
	grid-template-columns: repeat(9, auto);
	margin-top: 8px;
	padding-top: 10px;
	border-top: 1px solid var(--mpv-rand);
}

.mpv-gitter--handwerk {
	grid-template-columns: repeat(var(--mpv-kante, 2), auto);
}

/* Palette im Kreativ-Modus */
.mpv-palette {
	display: grid;
	grid-template-columns: repeat(auto-fill, 46px);
	gap: 6px;
	justify-content: center;
}

/* Herstellen */
.mpv-handwerk__reihe,
.mpv-ofen__reihe {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
}

.mpv-handwerk__pfeil,
.mpv-ofen__marke {
	font-size: 20px;
	color: rgba(255, 255, 255, 0.7);
}

.mpv-slot--ergebnis {
	width: 56px;
	height: 56px;
	border-color: var(--mpv-akzent);
}

/* Ofen */
.mpv-ofen[hidden] {
	display: none;
}

.mpv-ofen__spalte {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.mpv-ofen__marke {
	font-size: 11px;
}

.mpv-ofen__balkenrahmen {
	width: 60px;
	height: 10px;
	background: rgba(0, 0, 0, 0.5);
	border: 1px solid var(--mpv-rand);
	border-radius: 5px;
	overflow: hidden;
}

.mpv-ofen__balken {
	display: block;
	width: 0;
	height: 100%;
	background: var(--mpv-akzent);
}

/* Aufgenommener Stapel am Zeiger */
.mpv-griff {
	position: absolute;
	width: 40px;
	height: 40px;
	margin-left: -20px;
	margin-top: -20px;
	background: transparent;
	border: none;
	pointer-events: none;
	z-index: 30;
}

.mpv-griff[hidden] {
	display: none;
}

@media (max-width: 520px) {
	.mpv-slot {
		width: 40px;
		height: 40px;
	}
	.mpv-hotbar .mpv-slot {
		width: 42px;
		height: 42px;
	}
	.mpv-palette {
		grid-template-columns: repeat(auto-fill, 40px);
	}
	.mpv-inventar__blatt {
		max-width: 100%;
	}
}

/* Leiste: neun Fächer, bei wenig Platz umbrechen statt wegscrollen. */
.mpv-hotbar {
	overflow: visible;
	flex-wrap: wrap;
	padding-bottom: 18px;
}
