/* Elfmeterschießen – Frontend-Styles
   Designrichtung: Flutlicht-Stadion bei Nacht. Tiefes Nachtblau als Bühne,
   Rasengrün als Boden, Signalgelb als einziger Akzent (Ball/Aktion).
   Signature: die Torwand mit sechs Zielfeldern. */

.elfmeter-mount {
	--em-night: #0b1f3a;
	--em-night-2: #112c52;
	--em-grass: #1f7a3d;
	--em-grass-dark: #155e2e;
	--em-line: rgba(255, 255, 255, 0.85);
	--em-accent: #ffe11a;
	--em-accent-ink: #1a1500;
	--em-danger: #ff4d4d;
	--em-text: #f2f6ff;
	--em-muted: #9fb2d0;
	--em-card: #0f2647;
	--em-radius: 14px;
	--em-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);

	box-sizing: border-box;
	max-width: 560px;
	margin: 2rem auto;
	padding: clamp(1rem, 3vw, 1.75rem);
	background: radial-gradient(120% 90% at 50% 0%, var(--em-night-2) 0%, var(--em-night) 70%);
	border-radius: var(--em-radius);
	box-shadow: var(--em-shadow);
	color: var(--em-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.45;
	-webkit-text-size-adjust: 100%;
}

.elfmeter-mount *,
.elfmeter-mount *::before,
.elfmeter-mount *::after {
	box-sizing: border-box;
}

/* Kopfzeile */
.em-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.em-title {
	margin: 0;
	font-size: clamp(1.25rem, 4vw, 1.6rem);
	font-weight: 800;
	letter-spacing: -0.02em;
}

.em-step {
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--em-accent);
	white-space: nowrap;
}

.em-lead {
	margin: 0 0 1.1rem;
	color: var(--em-muted);
	font-size: 0.95rem;
}

.em-lead strong {
	color: var(--em-text);
}

/* Tor + Rasen-Bühne */
.em-pitch {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background: linear-gradient(180deg, var(--em-night-2) 0%, var(--em-night) 38%, var(--em-grass) 38%, var(--em-grass-dark) 100%);
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}

/* Torwand mit sechs Zielfeldern (Signature-Element) */
.em-goal {
	position: relative;
	margin: 1.1rem auto 0;
	width: 100%;
	aspect-ratio: 3 / 2;
	max-width: 460px;
	border: 6px solid var(--em-line);
	border-bottom: none;
	border-radius: 6px 6px 0 0;
	background:
		repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, 0.06) 22px 23px),
		repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, 0.06) 22px 23px);
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: repeat(2, 1fr);
	gap: 4px;
	padding: 6px;
}

.em-zone {
	position: relative;
	border: 2px dashed rgba(255, 255, 255, 0.28);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.03);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 3px;
	padding: 4px;
	font-size: 0.72rem;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.4);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.em-zone:hover {
	background: rgba(255, 225, 26, 0.12);
	border-color: var(--em-accent);
	color: var(--em-accent);
}

.em-zone:focus-visible {
	outline: 3px solid var(--em-accent);
	outline-offset: 2px;
}

.em-zone.is-picked {
	background: rgba(255, 225, 26, 0.22);
	border-color: var(--em-accent);
	border-style: solid;
	color: var(--em-accent);
	transform: scale(0.97);
}

.em-pick-badge {
	position: static;
	width: 20px;
	height: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--em-accent);
	color: var(--em-accent-ink);
	border-radius: 50%;
	font-size: 0.7rem;
	font-weight: 900;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
	animation: em-pop 0.25s ease;
}

@keyframes em-pop {
	from { transform: scale(0.4); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

/* Torwart-Modus: Felder nicht direkt klickbar, es wird gewischt */
.em-goal.is-keeper .em-zone {
	cursor: grab;
	border-style: solid;
	border-color: rgba(255, 255, 255, 0.15);
}

/* Ball */
.em-ball {
	position: absolute;
	left: 50%;
	bottom: 8%;
	width: 30px;
	height: 30px;
	margin-left: -15px;
	border-radius: 50%;
	background:
		radial-gradient(circle at 35% 30%, #ffffff 0%, #e9edf5 55%, #c7cedd 100%);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
	z-index: 5;
	pointer-events: none;
}

.em-ball::before {
	content: "";
	position: absolute;
	inset: 18% 18%;
	border-radius: 50%;
	background:
		radial-gradient(circle at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.12) 41%, transparent 55%);
}

/* Torwart-Handschuh / Reaktionsindikator */
.em-keeper {
	position: absolute;
	width: 52px;
	height: 52px;
	margin: -26px 0 0 -26px;
	border-radius: 50%;
	background: rgba(255, 225, 26, 0.18);
	border: 3px solid var(--em-accent);
	z-index: 6;
	pointer-events: none;
	opacity: 0;
}

/* Statuszeile über dem Tor */
.em-scorebar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 1.6rem;
	margin: 0.2rem 0 0.4rem;
	font-weight: 700;
	font-size: 0.9rem;
}

.em-pips {
	display: flex;
	gap: 5px;
}

.em-pip {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2px solid var(--em-muted);
	background: transparent;
}

.em-pip.goal {
	background: var(--em-accent);
	border-color: var(--em-accent);
}

.em-pip.save {
	background: var(--em-danger);
	border-color: var(--em-danger);
}

/* Buttons */
.em-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-top: 1.1rem;
}

.em-btn {
	flex: 1 1 auto;
	min-width: 140px;
	appearance: none;
	border: none;
	border-radius: 10px;
	padding: 0.85rem 1.1rem;
	font-size: 0.98rem;
	font-weight: 800;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
	font-family: inherit;
}

.em-btn:active {
	transform: translateY(1px);
}

.em-btn--primary {
	background: var(--em-accent);
	color: var(--em-accent-ink);
}

.em-btn--primary:hover {
	filter: brightness(1.06);
}

.em-btn--primary:disabled {
	background: #4a5878;
	color: #aebbd4;
	cursor: not-allowed;
}

.em-btn--ghost {
	background: rgba(255, 255, 255, 0.08);
	color: var(--em-text);
}

.em-btn--ghost:hover {
	background: rgba(255, 255, 255, 0.14);
}

.em-btn:focus-visible {
	outline: 3px solid var(--em-accent);
	outline-offset: 2px;
}

/* Eingabe-Feld für Name + Link */
.em-field {
	margin-top: 1rem;
}

.em-field label {
	display: block;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--em-muted);
	margin-bottom: 0.35rem;
}

.em-input {
	width: 100%;
	padding: 0.75rem 0.85rem;
	border-radius: 9px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	background: var(--em-card);
	color: var(--em-text);
	font-size: 0.95rem;
	font-family: inherit;
}

.em-input:focus {
	outline: none;
	border-color: var(--em-accent);
}

.em-linkbox {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.em-linkbox .em-input {
	font-size: 0.82rem;
	color: var(--em-muted);
}

/* Ergebnis-Ansicht */
.em-result {
	text-align: center;
	padding: 0.5rem 0;
}

.em-result-headline {
	font-size: clamp(1.4rem, 6vw, 2rem);
	font-weight: 900;
	margin: 0.2rem 0;
	letter-spacing: -0.02em;
}

.em-result-headline.win { color: var(--em-accent); }
.em-result-headline.lose { color: var(--em-danger); }
.em-result-headline.draw { color: var(--em-text); }

.em-tally {
	display: flex;
	justify-content: center;
	gap: 1.4rem;
	margin: 1rem 0;
}

.em-tally-col { text-align: center; }

.em-tally-name {
	font-size: 0.85rem;
	color: var(--em-muted);
	font-weight: 700;
	margin-bottom: 0.2rem;
}

.em-tally-score {
	font-size: 2.4rem;
	font-weight: 900;
	line-height: 1;
}

/* Replay-Liste */
.em-replay {
	margin: 1rem 0;
	display: grid;
	gap: 0.4rem;
}

.em-replay-row {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.5rem 0.7rem;
	background: var(--em-card);
	border-radius: 9px;
	font-size: 0.88rem;
}

.em-replay-num {
	font-weight: 800;
	color: var(--em-muted);
	min-width: 1.5rem;
}

.em-replay-out {
	margin-left: auto;
	font-weight: 800;
}

.em-replay-out.goal { color: var(--em-accent); }
.em-replay-out.save { color: var(--em-danger); }

.em-hint {
	font-size: 0.8rem;
	color: var(--em-muted);
	text-align: center;
	margin-top: 0.6rem;
}

.em-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	background: var(--em-accent);
	color: var(--em-accent-ink);
	font-weight: 800;
	padding: 0.7rem 1.2rem;
	border-radius: 10px;
	box-shadow: var(--em-shadow);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 9999;
}

.em-toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
	.em-ball,
	.em-keeper,
	.em-zone,
	.em-btn,
	.em-toast {
		transition: none !important;
	}
}

@media (max-width: 420px) {
	.em-zone { font-size: 0.62rem; }
	.em-btn { min-width: 100%; }
}

/* ---------- Pixelart-Bühne (Halten-Phase) ---------- */
.em-pixelstage {
	background: #0b1f3a;
	padding: 0;
}

.em-scene {
	display: block;
	width: 100%;
	height: auto;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

#em-ball,
#em-keeper {
	will-change: transform;
}

#em-shooter {
	transform-box: fill-box;
	transform-origin: center bottom;
}

@keyframes em-runup {
	0%   { transform: translateY(0); }
	50%  { transform: translateY(-2px); }
	100% { transform: translateY(0); }
}

#em-shooter.em-runup {
	animation: em-runup 0.3s steps(2) infinite;
}

#em-shooter.em-kick {
	animation: none;
	transform: translateX(-5px) rotate(-8deg);
}

@media (prefers-reduced-motion: reduce) {
	#em-shooter.em-runup { animation: none; }
	#em-ball, #em-keeper { transition: none !important; }
}
