/* Schach – Brett und Bedienung
   Alle Regeln sind auf .sch gescoped, damit kein Theme-CSS kollidiert. */

.sch {
	--sch-light:  #dfe5e9;  /* helles Feld */
	--sch-dark:   #7d8f9e;  /* dunkles Feld */
	--sch-wht:    #fbfcfd;  /* weiße Figur */
	--sch-blk:    #1b2833;  /* schwarze Figur */
	--sch-edge:   rgba(0, 0, 0, 0.55);   /* Kontur der Figuren */
	--sch-sel:    #d9a521;  /* gewähltes Feld */
	--sch-last:   rgba(217, 165, 33, 0.34);
	--sch-check:  #c8453c;

	--sch-sqmax:  62px;     /* Deckel für die Feldgröße */
}

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

/* ---------- Aufteilung ----------
   Grundzustand gestapelt. Die Zugliste kommt erst daneben, wenn der
   Container breit genug ist. */

.sch__main {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
	align-items: start;
}

.sch__left { min-width: 0; }

.sch__boardWrap { position: relative; }

/* ---------- Brett ---------- */

.sch__board {
	display: grid;
	/* minmax(0, 1fr): sonst wachsen die Spuren auf ihren min-content-Wert
	   und das Brett läuft aus einer schmalen Spalte heraus. */
	grid-template-columns: repeat(8, minmax(0, 1fr));
	width: 100%;
	max-width: calc(8 * var(--sch-sqmax));
	border: 1px solid var(--sp-ink, #14293b);
	border-radius: 6px;
	overflow: hidden;
}

/* Spielt der Mensch Schwarz, wird das Brett gedreht. Die Figuren dreht die
   Regel darunter wieder zurück, sonst stünden sie auf dem Kopf. */
.sch__board.is-flipped { transform: rotate(180deg); }
.sch__board.is-flipped .sch__sq { transform: rotate(180deg); }

.sch__sq {
	position: relative;
	aspect-ratio: 1;
	min-width: 0;
	border: 0;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	appearance: none;
	font-size: clamp(17px, 7.4cqi, 42px);
	line-height: 1;
	transition: background-color 110ms ease;
}

.sch__sq.is-light { background: var(--sch-light); }
.sch__sq.is-dark  { background: var(--sch-dark); }

/* Beide Farben nutzen dieselben gefüllten Glyphen. Weiß entsteht durch
   helle Füllung plus dunkle Kontur – das ist über alle Schriftarten
   hinweg verlässlicher als die hohlen Unicode-Figuren. */
.sch__sq.is-white { color: var(--sch-wht); text-shadow: 0 0 1px var(--sch-edge), 0 0 2px var(--sch-edge), 0 1px 0 var(--sch-edge), 0 -1px 0 var(--sch-edge), 1px 0 0 var(--sch-edge), -1px 0 0 var(--sch-edge); }
.sch__sq.is-black { color: var(--sch-blk); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22); }

.sch__sq.is-last { box-shadow: inset 0 0 0 100px var(--sch-last); }
.sch__sq.is-sel  { box-shadow: inset 0 0 0 3px var(--sch-sel); }

/* Freies Zielfeld: Punkt. Schlagbares Feld: Ring. */
.sch__sq.is-target::after {
	content: "";
	position: absolute;
	width: 26%;
	height: 26%;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.3);
}

.sch__sq.is-capture::after {
	content: "";
	position: absolute;
	inset: 6%;
	border-radius: 50%;
	border: 3px solid rgba(200, 69, 60, 0.75);
}

.sch__sq.is-check { background: var(--sch-check); }

.sch__sq:focus-visible { outline: 2px solid var(--sch-sel); outline-offset: -3px; z-index: 2; }
.sch__sq[disabled] { cursor: default; }

/* ---------- Umwandlung ---------- */

.sch__promo {
	display: none;
	position: absolute;
	inset: 0;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: rgba(20, 41, 59, 0.82);
	border-radius: 6px;
	z-index: 5;
}

.sch__promo.is-open { display: flex; }

.sch__promoBtn {
	width: 52px;
	height: 52px;
	font-size: 30px;
	line-height: 1;
	color: var(--sch-blk);
	background: var(--sch-light);
	border: 1px solid var(--sp-ink, #14293b);
	border-radius: 6px;
	cursor: pointer;
}

.sch__promoBtn:hover { background: #fff; }

/* ---------- Geschlagene Figuren ---------- */

.sch__taken {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	min-height: 1.5em;
	margin-bottom: 8px;
	font-size: 17px;
	line-height: 1.2;
	word-break: break-all;
}

.sch__takenSide.is-white { color: #8fa3b3; }
.sch__takenSide.is-black { color: var(--sch-blk); opacity: 0.75; }

/* ---------- Zugliste ---------- */

.sch__side { min-width: 0; }

.sch__sideTitle {
	font-family: var(--sp-mono, monospace);
	font-size: 11px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--sp-muted, #5b6f7f);
	font-weight: 400;
	margin: 0 0 8px;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--sp-line, #c2ccd3);
}

.sch__moves {
	list-style: none;
	margin: 0;
	padding: 0;
	font-family: var(--sp-mono, monospace);
	font-size: 11.5px;
	line-height: 1.7;
	color: var(--sp-muted, #5b6f7f);
	max-height: 200px;
	overflow-y: auto;
	counter-reset: halbzug;
}

.sch__move {
	counter-increment: halbzug;
	display: grid;
	grid-template-columns: 28px minmax(0, 1fr);
	gap: 6px;
	border-bottom: 1px solid rgba(194, 204, 211, 0.5);
	padding: 1px 0;
	white-space: nowrap;
}

.sch__move::before {
	content: counter(halbzug) ".";
	color: var(--sp-line, #c2ccd3);
	text-align: right;
}

@media (prefers-reduced-motion: reduce) {
	.sch__sq { transition: none; }
}

/* ---------- Responsiv ----------
   Gemessen wird die Breite von .sch, nicht die des Fensters. */

@container (min-width: 640px) {
	.sch__main { grid-template-columns: minmax(0, 1fr) minmax(150px, 210px); }
	.sch__moves { max-height: 420px; }
}

@container (max-width: 420px) {
	.sch__inner { padding: 13px; }
	.sch__taken { font-size: 15px; }
	.sch__promoBtn { width: 44px; height: 44px; font-size: 25px; }
	.sch__actions .sch__btn { flex: 1 1 auto; }
}

/* ===== Gemeinsame Gestaltung der Spiele =====================================
   Dieser Block ist in allen Spiele-Plugins identisch:
   schiffe-versenken, sudoku, vier-gewinnt, superhirn, schnick-schnack,
   mahjong, solitaer, schach. Wird hier etwas geaendert, muss es dort
   mitgeaendert werden. Einzige Ausnahme ist --sp-accent: der ist je Spiel
   eigen und entspricht der Kachelfarbe in der Spiele-Icon-Navigation.
   ========================================================================== */

.sch {
	--sp-paper:  #eef1f3;
	--sp-ink:    #14293b;
	--sp-muted:  #5b6f7f;
	--sp-line:   #c2ccd3;
	--sp-win:    #1f7a4d;
	--sp-lose:   #b3382c;
	--sp-radius: 12px;
	--sp-sans:   system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--sp-mono:   ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	--sp-accent: #39424a;

	container-type: inline-size;

	background: var(--sp-paper);
	color: var(--sp-ink);
	font-family: var(--sp-sans);
	border: 1px solid var(--sp-line);
	border-radius: var(--sp-radius);
	max-width: 780px;
	margin: 0 auto;
	box-sizing: border-box;
}

.sch__inner { padding: clamp(14px, 4cqi, 26px); }

.sch__head {
	padding-bottom: 12px;
	margin-bottom: 16px;
	border-bottom: 1px solid var(--sp-line);
}

.sch__eyebrow {
	font-family: var(--sp-mono);
	font-size: 11px;
	font-weight: 400;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--sp-accent);
	opacity: 1;
	margin: 0 0 4px;
}

.sch__title {
	font-family: var(--sp-sans);
	font-size: clamp(21px, 6cqi, 30px);
	font-weight: 800;
	letter-spacing: 0.01em;
	line-height: 1.05;
	text-transform: none;
	margin: 0;
	color: var(--sp-ink);
}

.sch__status {
	font-family: var(--sp-mono);
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--sp-muted);
	opacity: 1;
	margin: 12px 0 0;
	min-height: 1.5em;
}

.sch__status--win  { color: var(--sp-win);  font-weight: 700; opacity: 1; }
.sch__status--lose { color: var(--sp-lose); font-weight: 700; opacity: 1; }

.sch__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 12px;
}

.sch__actionsLabel {
	font-family: var(--sp-mono);
	font-size: 10px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--sp-muted);
	margin-right: 2px;
}

.sch__btn {
	font-family: var(--sp-mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	padding: 10px 16px;
	border-radius: 6px;
	background: var(--sp-accent);
	color: #fff;
	border: 1px solid var(--sp-accent);
	cursor: pointer;
}

.sch__btn--ghost,
.sch__btn--chip {
	background: transparent;
	color: var(--sp-ink);
	border-color: var(--sp-line);
	font-weight: 400;
}

.sch__btn--chip { padding: 7px 12px; letter-spacing: 0.1em; }

.sch__btn--chip.is-on {
	background: var(--sp-accent);
	color: #fff;
	border-color: var(--sp-accent);
	font-weight: 700;
}

.sch__btn:hover:not([disabled]) { filter: brightness(1.08); }
.sch__btn[disabled] { opacity: 0.38; cursor: not-allowed; }
.sch__btn:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }

.sch__hint {
	font-family: var(--sp-sans);
	font-size: 12px;
	line-height: 1.6;
	color: var(--sp-muted);
	margin: 12px 0 0;
}

.sch__hint kbd {
	font-family: var(--sp-mono);
	font-size: 11px;
	background: rgba(0, 0, 0, 0.06);
	border: 1px solid var(--sp-line);
	border-radius: 3px;
	padding: 1px 5px;
	color: var(--sp-ink);
}

/* ---------- Online-Mehrspieler ----------
   Moduswahl (Computer / Online) und das Lobby-Panel. Das Panel ist nur
   im Online-Modus sichtbar; Bedienelemente des Einzelspiels, die online
   stören (Neue Partie, Zug zurück, Seite wechseln, Stärke), werden dann
   ausgeblendet – Revanche und Raumsteuerung liegen im Panel. */

.sch__modes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px;
}

.sch__mp { display: none; }

.sch--online .sch__mp { display: block; }

.sch--online .sch__actions { display: none; }
