/* Schach (spiele/schach/schach.js) – vorerst flaches Holzbrett mit runden Bildmarken */
.schach-seite { max-width: 1180px; margin: 0 auto; padding: 18px var(--rand, 20px) 40px; }
.schach-titel { margin: 0 0 14px; }
.schach { display: grid; grid-template-columns: minmax(0, min(78vh, 720px)) minmax(220px, 1fr); gap: 26px; align-items: start; }
@media (max-width: 820px) { .schach { grid-template-columns: 1fr; } }

.sc-brett-rahmen { padding: 14px; border-radius: 10px; background: linear-gradient(135deg, #5b3a22, #3b2414);
  box-shadow: 0 18px 40px rgb(0 0 0 / .45), inset 0 0 0 2px rgb(255 255 255 / .06); }
.sc-brett { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 3px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; }
.sc-feld { position: relative; border: 0; padding: 0; margin: 0; aspect-ratio: 1; cursor: pointer; display: grid; place-items: center; }
.sc-feld.hell { background: #e9d6b4; }
.sc-feld.dunkel { background: #a87a4f; }
.sc-feld:focus-visible { outline: 3px solid #2f7de1; outline-offset: -3px; z-index: 2; }
.sc-feld.letzter::before { content: ''; position: absolute; inset: 0; background: rgb(240 200 60 / .38); }
.sc-feld.gewaehlt::before { content: ''; position: absolute; inset: 0; background: rgb(90 170 90 / .5); }
.sc-feld.ziel::after { content: ''; position: absolute; width: 26%; height: 26%; border-radius: 50%; background: rgb(30 60 30 / .45); z-index: 3; pointer-events: none; }
.sc-feld.ziel-schlag::after { content: ''; position: absolute; inset: 5%; border-radius: 50%; border: 5px solid rgb(30 60 30 / .5); z-index: 3; pointer-events: none; }
.sc-feld.im-schach::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgb(220 40 30 / .75), rgb(220 40 30 / 0) 70%); }

.sc-figur { position: relative; z-index: 2; width: 92%; height: 92%; display: block;
  filter: drop-shadow(0 2px 2px rgb(0 0 0 / .4)); transition: filter .15s; will-change: transform; }
.sc-figur img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sc-figur.schwebt { z-index: 20; filter: drop-shadow(0 12px 12px rgb(0 0 0 / .5)); transition: none; }
.sc-zeichen { position: absolute; right: -2%; bottom: -2%; width: 36%; height: 36%; border-radius: 50%; display: grid; place-items: center;
  font-size: clamp(9px, 2.1vmin, 17px); line-height: 1; pointer-events: none; }
.weiss .sc-zeichen { background: #f7eedb; color: #8a6418; box-shadow: 0 0 0 2px #c9a24b; }
.schwarz .sc-zeichen { background: #231c18; color: #d8d2c6; box-shadow: 0 0 0 2px #8f8a80; }
.sc-rang, .sc-linie { position: absolute; font: 600 clamp(8px, 1.4vmin, 12px)/1 system-ui, sans-serif; opacity: .7; pointer-events: none; z-index: 1; }
.sc-rang { left: 4%; top: 4%; }
.sc-linie { right: 5%; bottom: 3%; }
.hell .sc-rang, .hell .sc-linie { color: #8a5f38; }
.dunkel .sc-rang, .dunkel .sc-linie { color: #f2e2c4; }

.sc-leiste { display: flex; flex-direction: column; gap: 14px; }
.sc-stand { margin: 0; font-size: 1.05rem; min-height: 2.6em; }
.sc-wahl { display: grid; gap: 10px; }
.sc-wahl label { display: grid; gap: 4px; font-size: .9rem; }
.sc-wahl select, .sc-knoepfe button { font: inherit; padding: 7px 10px; border-radius: 6px; }
.sc-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-knoepfe button { cursor: pointer; border: 1px solid rgb(128 128 128 / .5); background: rgb(128 128 128 / .12); color: inherit; }
.sc-knoepfe button:hover, .sc-knoepfe button:focus-visible { background: rgb(128 128 128 / .25); }
.sc-zuege { margin: 0; padding: 8px 8px 8px 2.6em; max-height: 260px; overflow: auto; font: .92rem/1.6 ui-monospace, Menlo, Consolas, monospace;
  border-radius: 6px; background: rgb(128 128 128 / .1); white-space: pre; }
.sc-zuege:empty { display: none; }
.sc-nachweis { margin: 0; font-size: .75rem; opacity: .75; }

.sc-umwandlung { border: 0; border-radius: 12px; padding: 18px 20px; background: #2a201a; color: #f3ead8; box-shadow: 0 20px 50px rgb(0 0 0 / .6); }
.sc-umwandlung::backdrop { background: rgb(0 0 0 / .5); }
.sc-umwandlung p { margin: 0 0 10px; text-align: center; }
.sc-umw-wahl { display: flex; gap: 10px; }
.sc-umw { width: 76px; height: 76px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.sc-umw img { width: 100%; height: 100%; display: block; }
.sc-umw:focus-visible { outline: 3px solid #f1c27d; outline-offset: 3px; }
.sc-reihe { display: contents; }

/* 3D-Ansicht (schach3d.js) */
.sc-brett-rahmen { position: relative; }
/* 3D-Ansicht: großes Bild links, rechts oben das flache Brett zum Ziehen, darunter die Leiste (am Handy untereinander) */
.schach.mit-3d { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  grid-template-areas: "drei brett" "drei leiste"; grid-template-rows: auto 1fr; }
.schach.mit-3d .sc-brett-rahmen { display: contents; }
.schach.mit-3d .sc-3d-huelle { grid-area: drei; align-self: start; border-radius: 10px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #4a3a2c, #1c1612 75%); }
.schach.mit-3d .sc-3d-hinweis { grid-area: drei; align-self: center; }
.schach.mit-3d .sc-brett { grid-area: brett; box-shadow: 0 0 0 8px #4a2e1a, 0 8px 22px rgb(0 0 0 / .4); margin: 8px; }
.schach.mit-3d .sc-leiste { grid-area: leiste; }
@media (max-width: 820px) {
  .schach.mit-3d { grid-template-columns: 1fr; grid-template-areas: "drei" "brett" "leiste"; grid-template-rows: auto; }
  .schach.mit-3d .sc-brett { width: min(100% - 16px, 420px); justify-self: center; }
}

.sc-3d-huelle { aspect-ratio: 1 / 0.86; width: 100%; }
.sc-3d-leinwand { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.sc-3d-hinweis { position: absolute; left: 0; right: 0; top: 45%; margin: 0; text-align: center; color: #f2e2c4; pointer-events: none; }
.sc-3d-hinweis:empty { display: none; }
.sc-knoepfe button[aria-pressed="true"] { outline: 2px solid #c9a24b; }
.sc-3d-huelle { position: relative; }
.sc-3d-knoepfe { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.sc-3d-knoepfe button { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid rgb(255 255 255 / .25);
  background: rgb(20 16 12 / .7); color: #f2e2c4; font-size: 20px; line-height: 1; cursor: pointer; }
.sc-3d-knoepfe button:hover { background: rgb(60 45 30 / .85); }
.sc-3d-tipp { position: absolute; left: 14px; top: 10px; right: 14px; margin: 0; font-size: .78rem; color: rgb(242 226 196 / .75); pointer-events: none; }
@media (max-width: 600px) { .sc-3d-tipp { display: none; } }
.sc-stand.blinkt { animation: sc-blinkt .9s ease; }
@keyframes sc-blinkt { 0%, 60% { color: #ffcf6a; transform: translateX(0); } 15% { transform: translateX(-4px); } 30% { transform: translateX(4px); } 45% { transform: translateX(-2px); } 100% { transform: none; } }
/* Mit Himmel (Tagesstimmung der Seite): die 3D-Bühne lässt ihn durchscheinen, nur ein leichter Schatten unterm Brett */
html[data-himmel="an"] .schach.mit-3d .sc-3d-huelle { background: radial-gradient(ellipse at 50% 62%, rgb(30 20 12 / .38), rgb(30 20 12 / 0) 68%); }

/* ---------- Bühnenmodus: Menü und 2D-Brett schweben neben der Szene (Startseite, „Aktion Schach“) ---------- */
.aktion-ui { position: absolute; inset: 0; z-index: 30; pointer-events: none; perspective: 1600px; }
.aktion-ui .schach.sc-buehne { display: block; margin: 0; max-width: none; }
.sc-buehne .sc-3d-huelle, .sc-buehne #sc-3d, .sc-buehne .sc-leiste > p:not(.sc-stand):not(.sc-nachweis) { display: none !important; }
.sc-buehne .sc-brett-rahmen, .sc-buehne .sc-leiste {
  position: absolute; top: 50%; pointer-events: auto; box-sizing: border-box; padding: 12px; border-radius: 16px;
  background: rgba(24, 20, 16, .58); -webkit-backdrop-filter: blur(9px) saturate(1.2); backdrop-filter: blur(9px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 34px 70px rgba(0, 0, 0, .45), 0 2px 0 rgba(255, 255, 255, .06) inset;
  color: #f1ece2; opacity: 0; transition: transform 1.1s cubic-bezier(.2, .8, .2, 1), opacity .9s;
}
.sc-buehne .sc-brett-rahmen { display: block; left: 2.5%; width: min(34vh, 26vw, 330px); transform: translateY(-50%) translateX(-90px) rotateY(42deg) scale(.86); }
.sc-buehne .sc-leiste { right: 2.5%; width: min(300px, 25vw); max-height: 84%; overflow: auto; transform: translateY(-50%) translateX(90px) rotateY(-42deg) scale(.86); }
.aktion-ui.da .sc-buehne .sc-brett-rahmen { opacity: 1; transform: translateY(-50%) rotateY(14deg); animation: sc-schweben 6s ease-in-out .9s infinite; }
.aktion-ui.da .sc-buehne .sc-leiste { opacity: 1; transform: translateY(-50%) rotateY(-12deg); animation: sc-schweben 6.6s ease-in-out 1.1s infinite; }
@keyframes sc-schweben { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.sc-buehne .sc-leiste select, .sc-buehne .sc-leiste button { font-size: .9rem; }
.sc-buehne .sc-zuege { max-height: 9em; overflow: auto; }
.sc-buehne .sc-nachweis { font-size: .7rem; opacity: .7; }
.sc-buehne a { color: inherit; }
@media (max-width: 760px) {
  .sc-buehne .sc-brett-rahmen { top: 62px; left: 8px; width: min(44vw, 230px); padding: 8px; transform: translateX(-60px) rotateY(36deg) scale(.86); }
  .sc-buehne .sc-leiste { top: auto; bottom: 10px; right: 8px; width: min(52vw, 260px); max-height: 46%; transform: translateX(60px) rotateY(-36deg) scale(.86); }
  .aktion-ui.da .sc-buehne .sc-brett-rahmen { transform: rotateY(10deg); }
  .aktion-ui.da .sc-buehne .sc-leiste { transform: rotateY(-10deg); }
}
@media (prefers-reduced-motion: reduce) { .aktion-ui.da .sc-buehne .sc-brett-rahmen, .aktion-ui.da .sc-buehne .sc-leiste { animation: none; } }
.schach.sc-buehne.mit-3d, .schach.sc-buehne { display: block; }
.schach.sc-buehne.mit-3d .sc-brett-rahmen { display: block; }
.schach.sc-buehne.mit-3d .sc-brett { margin: 0; box-shadow: 0 0 0 6px #4a2e1a; width: 100%; }
.schach.sc-buehne .sc-3d-hinweis { margin: 8px 0 0; font-size: .85rem; text-align: center; }
.schach.sc-buehne .sc-3d-hinweis:empty { display: none; }
/* schmale Schirme: das Menü liegt unter der Bühne und schwebt von unten herein */
.aktion-unten { padding: 0 12px; margin: -14px 0 24px; perspective: 1200px; }
.aktion-unten .sc-leiste { box-sizing: border-box; padding: 14px; border-radius: 16px; color: #f1ece2;
  background: rgba(24, 20, 16, .82); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 24px 50px rgba(0, 0, 0, .4);
  opacity: 0; transform: translateY(40px) rotateX(18deg); transition: transform 1s cubic-bezier(.2, .8, .2, 1), opacity .8s; }
.aktion-unten.da .sc-leiste { opacity: 1; transform: none; }
.aktion-unten .sc-leiste > p:not(.sc-stand):not(.sc-nachweis), .aktion-unten #sc-3d { display: none; }
.aktion-unten .sc-zuege { max-height: 8em; overflow: auto; }
.aktion-unten .sc-nachweis { font-size: .7rem; opacity: .7; }
/* Leistung (v105): kein Weichzeichner hinter den schwebenden Tafeln – er müsste über der laufenden 3D-Szene jedes Bild
   neu rechnen; stattdessen etwas dichteres Glas */
.sc-buehne .sc-brett-rahmen, .sc-buehne .sc-leiste { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(24, 20, 16, .8); }
