/* ==========================================================================
   Binomio Fantastico - Frontend Styles
   Kindgerechtes, farbenfrohes Slot-Machine-Design.
   ========================================================================== */

.wsm-container {
	position: relative;
	max-width: 960px;
	margin: 2rem auto;
	padding: 1.5rem;
	font-family: "Comic Sans MS", "Baloo 2", "Trebuchet MS", sans-serif;
	background: linear-gradient(180deg, #fef6e4 0%, #f3e8ff 100%);
	border-radius: 24px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
	box-sizing: border-box;
}
.wsm-container * {
	box-sizing: border-box;
}

/* --- Layoutsprache-Umschalter (3 Flaggen oben rechts) ---
   Getrennt von der "Sprache"-Auswahl (Funktionssprache) weiter unten: diese
   Flaggen steuern nur Anzeigetexte/Labels und die Sprache des KI-Kommentars. */
.wsm-layout-lang-switch {
	position: absolute;
	top: 14px;
	right: 16px;
	display: flex;
	gap: 4px;
	z-index: 2;
}
.wsm-flag-btn {
	background: none;
	border: 2px solid transparent;
	border-radius: 8px;
	padding: 2px 5px;
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.wsm-flag-btn:hover {
	opacity: 0.8;
	transform: translateY(-1px);
}
.wsm-flag-btn.wsm-flag-active {
	opacity: 1;
	border-color: #5b3a8e;
	background: rgba(255, 255, 255, 0.6);
}
.wsm-flag-btn:focus-visible {
	outline: 3px solid #219ebc;
}

/* --- Titel ("Binomio Fantastico") --- */
.wsm-title-block {
	text-align: center;
	margin-bottom: 1.5rem;
	padding-right: 2.5rem; /* Platz fuer die Flaggen oben rechts, damit der Titel nicht ueberlappt */
}
.wsm-title {
	margin: 0;
	font-size: 2rem;
	color: #5b3a8e;
	text-shadow: 2px 2px 0 #ffd166;
}
.wsm-subtitle {
	margin: 0.25rem 0 0;
	font-size: 1rem;
	color: #7a6a9a;
	font-style: italic;
}

/* --- Setup row (name, language / mode, album) --- */
.wsm-setup-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: center;
	margin-bottom: 1rem;
}
.wsm-setup-row-modes {
	margin-bottom: 1.5rem;
}
.wsm-field {
	display: flex;
	flex-direction: column;
	min-width: 140px;
}
.wsm-field label {
	font-weight: 700;
	margin-bottom: 0.25rem;
	color: #5b3a8e;
}
.wsm-field input,
.wsm-field select {
	padding: 0.5rem 0.75rem;
	border-radius: 12px;
	border: 3px solid #ffb703;
	font-size: 1rem;
	background: #fff;
}
.wsm-field input:focus,
.wsm-field select:focus {
	outline: 3px solid #219ebc;
}

/* --- Game area layout --- */
.wsm-game-area {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	align-items: flex-start;
	justify-content: center;
}

/* --- Slot machine --- */
.wsm-machine {
	position: relative;
	background: linear-gradient(180deg, #ff6b6b 0%, #c1121f 100%);
	border-radius: 28px;
	padding: 2rem 2rem 2.25rem;
	box-shadow: inset 0 0 0 6px #ffd166, 0 8px 20px rgba(0, 0, 0, 0.25);
	flex: 2 1 480px;
	max-width: 540px;
}

.wsm-machine-lights {
	display: flex;
	justify-content: space-around;
	margin-bottom: 0.75rem;
}
.wsm-machine-lights span {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff3b0;
	box-shadow: 0 0 6px #fff3b0;
	transition: background 0.2s, box-shadow 0.2s;
}
.wsm-machine-lights.wsm-lit span {
	background: #ffd60a;
	box-shadow: 0 0 16px 4px #ffd60a;
	animation: wsm-blink 0.6s ease-in-out infinite alternate;
}
@keyframes wsm-blink {
	from { opacity: 1; }
	to { opacity: 0.4; }
}

.wsm-reels {
	display: flex;
	gap: 1.25rem;
	background: #22223b;
	border-radius: 18px;
	padding: 1.25rem;
	justify-content: center;
}
.wsm-reel {
	width: 150px;
	height: 150px;
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: inset 0 0 0 4px #4a4e69;
}
.wsm-reel-inner {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.1rem;
	font-weight: 700;
	text-align: center;
	padding: 6px;
	color: #22223b;
}
.wsm-reel-inner img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* --- Bild + sichtbare Beschriftung (Alt-Text aus der Alben-Verwaltung) ---
   Bilder sind Teil des "Woerterbuchs" des Spiels, genau wie die Wortlisten -
   deshalb wird ihr Name (Alt-Text) beim Ziehen mit angezeigt, nicht nur als
   unsichtbares alt-Attribut. */
.wsm-image-with-label {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
}
.wsm-image-with-label img {
	max-width: 100%;
	max-height: 78%;
	object-fit: contain;
}
.wsm-image-label {
	font-size: 0.8rem;
	font-weight: 800;
	color: #22223b;
	text-align: center;
	line-height: 1.1;
}
.wsm-reel.wsm-spinning .wsm-reel-inner {
	animation: wsm-spin 0.15s linear infinite;
}
@keyframes wsm-spin {
	from { transform: translateY(-6px); opacity: 0.6; }
	to   { transform: translateY(6px); opacity: 1; }
}
.wsm-reel.wsm-stopped {
	box-shadow: inset 0 0 0 4px #4a4e69, 0 0 12px 4px #ffd60a;
}

/* --- Lever --- */
.wsm-lever {
	position: absolute;
	right: -18px;
	top: 40%;
	width: 40px;
	height: 140px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
}
.wsm-lever-stick {
	position: absolute;
	left: 50%;
	top: 20px;
	transform: translateX(-50%);
	width: 10px;
	height: 100px;
	background: #adb5bd;
	border-radius: 6px;
}
.wsm-lever-knob {
	position: absolute;
	left: 50%;
	top: 0;
	transform: translateX(-50%);
	width: 34px;
	height: 34px;
	background: radial-gradient(circle at 35% 30%, #ff4d4d, #b30000);
	border-radius: 50%;
	box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
	transition: top 0.2s ease;
}
.wsm-lever.wsm-pulled .wsm-lever-knob {
	top: 90px;
}

.wsm-pull-button {
	display: block;
	margin: 1.25rem auto 0;
	padding: 0.75rem 2rem;
	font-size: 1.1rem;
	font-weight: 800;
	color: #22223b;
	background: #ffd60a;
	border: 4px solid #fff;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 4px 0 #c9910a;
	transition: transform 0.1s ease;
}
.wsm-pull-button:hover:not(:disabled) {
	transform: translateY(-2px);
}
.wsm-pull-button:active:not(:disabled) {
	transform: translateY(2px);
	box-shadow: 0 2px 0 #c9910a;
}
.wsm-pull-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* --- Story row (Geschichte statt nur ein Satz) --- */
.wsm-sentence-row {
	display: flex;
	gap: 0.5rem;
	margin-top: 1.25rem;
	align-items: flex-end;
}
.wsm-sentence-row textarea {
	flex: 1;
	padding: 0.6rem 0.9rem;
	border-radius: 14px;
	border: 3px solid #fff;
	font-size: 1rem;
	font-family: inherit;
	resize: vertical;
	min-height: 4.5rem;
}
.wsm-arrow-button {
	width: 46px;
	height: 46px;
	flex-shrink: 0;
	border-radius: 50%;
	border: none;
	background: #06d6a0;
	color: #fff;
	font-size: 1.2rem;
	cursor: pointer;
	box-shadow: 0 3px 0 #049c74;
}
.wsm-arrow-button:disabled,
.wsm-sentence-row textarea:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* --- Results panel --- */
.wsm-results-panel {
	flex: 1 1 300px;
	max-width: 340px;
	background: #fff;
	border-radius: 20px;
	padding: 1rem 1.25rem 1.25rem;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
	max-height: 560px;
	display: flex;
	flex-direction: column;
}
.wsm-results-header h3 {
	margin: 0 0 0.75rem;
	color: #5b3a8e;
	text-align: center;
}
.wsm-results-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	flex: 1;
}
.wsm-results-list li {
	background: #f3e8ff;
	border-radius: 14px;
	padding: 0.75rem;
	margin-bottom: 0.75rem;
	font-size: 0.9rem;
	line-height: 1.4;
	animation: wsm-pop-in 0.3s ease;
}
@keyframes wsm-pop-in {
	from { transform: scale(0.85); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}
.wsm-result-combo {
	font-weight: 800;
	color: #c1121f;
	margin-bottom: 0.35rem;
}
.wsm-result-combo img {
	height: 28px;
	width: 28px;
	object-fit: contain;
	vertical-align: middle;
	margin: 0 2px;
	border-radius: 6px;
}
.wsm-result-sentence {
	font-style: italic;
	color: #22223b;
	margin-bottom: 0.35rem;
}
.wsm-result-comment {
	color: #219ebc;
	font-weight: 700;
}
.wsm-result-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
}
.wsm-result-action-btn {
	flex: 1;
	padding: 0.35rem 0.5rem;
	border-radius: 999px;
	border: none;
	background: #5b3a8e;
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
}
.wsm-result-action-btn:hover {
	background: #472d70;
}
.wsm-results-empty {
	text-align: center;
	color: #999;
	padding: 1rem 0;
	font-size: 0.9rem;
}

.wsm-clean-button {
	margin-top: 0.75rem;
	padding: 0.55rem 1rem;
	border-radius: 999px;
	border: none;
	background: #ef476f;
	color: #fff;
	font-weight: 700;
	cursor: pointer;
	align-self: center;
}
.wsm-clean-button:hover {
	background: #d63e60;
}

/* ==========================================================================
   Responsive: WordPress Desktop, Tablet und Smartphone
   Laienerklaerung: Diese Regeln sorgen dafuer, dass die Slot-Machine auf
   grossen Bildschirmen (Desktop), mittelgrossen (Tablet) und kleinen
   (Smartphone) gut aussieht und bedienbar bleibt (groessere Tippflaechen,
   gestapeltes statt nebeneinander liegendes Layout).
   ========================================================================== */

/* Tablet (z.B. iPad im Hoch- oder Querformat) */
@media (max-width: 900px) {
	.wsm-container {
		padding: 1rem;
		margin: 1rem auto;
	}
	.wsm-game-area {
		gap: 1rem;
	}
	.wsm-machine,
	.wsm-results-panel {
		max-width: 100%;
	}
}

/* Smartphone (Hochformat und kleine Tablets) */
@media (max-width: 600px) {
	.wsm-setup-row {
		flex-direction: column;
		align-items: stretch;
		gap: 0.75rem;
	}
	.wsm-field {
		min-width: 0;
		width: 100%;
	}
	.wsm-field input,
	.wsm-field select {
		font-size: 16px; /* verhindert automatisches Zoomen auf iOS */
		min-height: 44px; /* ausreichend grosse Tippflaeche */
	}

	.wsm-machine {
		padding: 1rem;
		border-radius: 20px;
	}
	.wsm-reels {
		gap: 0.5rem;
		padding: 0.75rem;
	}
	.wsm-reel {
		width: 42%;
		min-width: 0;
		height: auto;
		aspect-ratio: 1 / 1;
	}
	.wsm-reel-inner {
		font-size: 0.85rem;
	}
	.wsm-image-label {
		font-size: 0.7rem;
	}

	.wsm-title {
		font-size: 1.5rem;
	}
	.wsm-layout-lang-switch {
		top: 8px;
		right: 8px;
	}
	.wsm-flag-btn {
		font-size: 1.1rem;
	}
	.wsm-title-block {
		padding-right: 2rem;
	}

	.wsm-lever {
		display: none; /* Auf kleinen Screens reicht der grosse Button */
	}
	.wsm-pull-button {
		width: 100%;
		min-height: 48px;
		font-size: 1rem;
	}

	.wsm-sentence-row {
		flex-direction: column;
		align-items: stretch;
	}
	.wsm-sentence-row textarea {
		min-height: 88px;
		font-size: 16px;
	}
	.wsm-arrow-button {
		align-self: flex-end;
		width: 52px;
		height: 52px;
	}

	.wsm-results-panel {
		max-height: 320px;
	}
	.wsm-clean-button {
		width: 100%;
		min-height: 44px;
	}
}

/* Sehr kleine Smartphones */
@media (max-width: 360px) {
	.wsm-reel-inner {
		font-size: 0.65rem;
	}
	.wsm-image-label {
		font-size: 0.6rem;
	}
}
