/* ============================================================
   Ulmer Meister-Schach – Senioren-Hochkontrast (2D-Draufsicht)
   Alle Regeln sind unter .page-schach-senioren gescoped.
   ============================================================ */

.page-schach-senioren {
  --chess-ui-font: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Bühnen-Hintergrund: Mitte heller, Ränder dunkler */
  background-color: #6e7278 !important;
  background-image:
    radial-gradient(
      ellipse 70% 55% at 50% 42%,
      #b8bcc2 0%,
      #8f949b 42%,
      #5c6168 78%,
      #3f444a 100%
    ) !important;
  background-attachment: fixed;
  font-family: var(--chess-ui-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.page-schach-senioren .game-content--meister-schach {
  max-width: 640px !important;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  font-family: var(--chess-ui-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-schach-senioren .chess-stage {
  width: 100%;
  max-width: 540px;
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1.25rem;
  box-sizing: border-box;
}

/* —— Gesamtrahmen: gebürstetes Anthrazit/Titan + Messingkante —— */
.page-schach-senioren .chess-panel,
.page-schach-senioren .chess-panel--premium {
  --chess-metal-top: #2a2a2a;
  --chess-metal-mid: #1a1a1a;
  --chess-metal-deep: #121212;
  --chess-brass: #c9a227;
  --chess-brass-bright: #e8d48b;
  --chess-frame-radius: 16px;

  position: relative;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(160deg, #2c2c2c 0%, #1a1a1a 45%, #141414 100%);
  border: 3px solid #333333;
  border-radius: var(--chess-frame-radius);
  box-shadow:
    /* Messing-/Rahmenkontur */
    0 0 0 1px rgba(201, 162, 39, 0.45),
    0 0 0 2px rgba(51, 51, 51, 0.9),
    /* Gebürstetes Metall innen */
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.55),
    /* Weicher, tiefer Bühnen-Schlagschatten */
    0 10px 20px rgba(0, 0, 0, 0.28),
    0 22px 48px rgba(0, 0, 0, 0.38),
    0 40px 80px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  box-sizing: border-box;
  font-family: var(--chess-ui-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #ffffff;
  isolation: isolate;
}

/* —— Top Bar: 3 Spalten → Name exakt zentriert —— */
.page-schach-senioren .chess-topbar {
  display: grid !important;
  grid-template-columns: minmax(6.75rem, 1fr) minmax(0, auto) minmax(6.75rem, 1fr) !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: 0.45rem;
  padding: 0.75rem 0.75rem;
  background:
    linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 55%, #161616 100%) !important;
  border: none;
  border-bottom: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: calc(var(--chess-frame-radius) - 3px) calc(var(--chess-frame-radius) - 3px) 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #ffffff !important;
  box-sizing: border-box;
  font-family: var(--chess-ui-font) !important;
}

.page-schach-senioren .chess-topbar__timer {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  min-height: 3rem;
  border: 1.5px solid var(--chess-brass);
  border-radius: 10px;
  flex-shrink: 0;
  justify-self: start;
  background:
    linear-gradient(180deg, #222222 0%, #111111 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
}

.page-schach-senioren .chess-topbar__timer svg {
  color: var(--chess-brass-bright) !important;
}

/* Prominentestes Element: Spielername */
.page-schach-senioren .chess-topbar__name {
  margin: 0 !important;
  justify-self: center;
  text-align: center;
  max-width: min(100%, 14rem);
  font-family: var(--chess-ui-font) !important;
  font-size: clamp(1.2rem, 4.2vw, 1.55rem) !important;
  font-weight: 800 !important;
  letter-spacing: 0.01em;
  line-height: 1.15 !important;
  color: #ffffff !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
  -webkit-font-smoothing: antialiased;
}

.page-schach-senioren .chess-topbar__actions {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.45rem;
  flex-shrink: 0;
  justify-self: end;
}

.page-schach-senioren .chess-icon-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  padding: 0.55rem !important;
  margin: 0 !important;
  border: 1.5px solid var(--chess-brass) !important;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, #2a2a2a 0%, #141414 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #ffffff !important;
  cursor: pointer;
  text-decoration: none !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

.page-schach-senioren .chess-icon-btn:hover,
.page-schach-senioren .chess-icon-btn:focus-visible {
  background:
    linear-gradient(180deg, #3a3420 0%, #1a1a1a 100%) !important;
  color: var(--chess-brass-bright) !important;
  outline: 2px solid var(--chess-brass-bright);
  outline-offset: 2px;
}

.page-schach-senioren .chess-icon-btn[aria-pressed="true"] {
  opacity: 0.55;
}

/* Timer untergeordnet zum Namen, aber klar lesbar */
.page-schach-senioren .chess-timer {
  font-family: Consolas, "Courier New", ui-monospace, monospace !important;
  font-size: 0.98rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  color: #f3f3f3 !important;
  line-height: 1 !important;
  opacity: 0.95;
}

/* Icons 28–32px, fette Striche */
.page-schach-senioren .chess-topbar svg,
.page-schach-senioren .chess-bottombar svg,
.page-schach-senioren .chess-icon-btn svg,
.page-schach-senioren .chess-svg-icon {
  width: 30px !important;
  height: 30px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  display: block !important;
  flex-shrink: 0 !important;
  color: inherit !important;
  overflow: visible !important;
}

.page-schach-senioren .chess-svg-icon--king {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
}

.page-schach-senioren .chess-topbar svg [stroke],
.page-schach-senioren .chess-bottombar svg [stroke],
.page-schach-senioren .chess-icon-btn svg [stroke] {
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-schach-senioren .chess-icon-btn--close svg [stroke] {
  stroke-width: 3.25;
}

/* —— Brett + Koordinaten (integriert im Metallrahmen) —— */
.page-schach-senioren .chess-board-wrap {
  padding: 0.5rem 0.7rem 0.55rem;
  background:
    linear-gradient(180deg, #1f1f1f 0%, #141414 40%, #101010 100%) !important;
  border: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

.page-schach-senioren .chess-coords {
  display: grid !important;
  font-family: var(--chess-ui-font) !important;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  user-select: none;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
}

.page-schach-senioren .chess-coords span {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff !important;
}

.page-schach-senioren .chess-coords--files {
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  padding: 0.25rem 0;
  text-align: center;
}

.page-schach-senioren .chess-board-mid {
  display: grid !important;
  grid-template-columns: 1.15rem minmax(0, 1fr) 1.15rem !important;
  align-items: stretch;
  gap: 0.2rem;
}

.page-schach-senioren .chess-coords--ranks {
  grid-template-rows: repeat(8, minmax(0, 1fr)) !important;
  height: 100%;
  align-content: stretch;
}

#chess-board.chess-board,
.page-schach-senioren #chess-board,
.page-schach-senioren .chess-board {
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  grid-template-rows: repeat(8, 1fr) !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  border: 2px solid #2d2d2d !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  background-color: #121212 !important;
  background-image: none !important;
  min-height: 240px;
  border-radius: 4px;
  /* Innere Polierkante – ohne separaten „aufgeklebten“ Außenblock */
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 2px 3px rgba(255, 255, 255, 0.05),
    inset 0 -2px 5px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(201, 162, 39, 0.28) !important;
}

#chess-board > .square,
.page-schach-senioren #chess-board > .square,
.page-schach-senioren .chess-board > .square,
.page-schach-senioren .chess-board > .chess-square {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Heller Marmor: #f8f9fa → #e9ecef + feine Äderung */
.page-schach-senioren .square.chess-square--light,
.page-schach-senioren .chess-square--light {
  background-color: #f8f9fa !important;
  background-image:
    radial-gradient(ellipse 90% 60% at 22% 18%, rgba(255, 255, 255, 0.95) 0%, transparent 52%),
    radial-gradient(ellipse 70% 50% at 78% 72%, rgba(173, 181, 189, 0.28) 0%, transparent 55%),
    linear-gradient(
      118deg,
      transparent 0%,
      transparent 40%,
      rgba(173, 181, 189, 0.22) 41%,
      transparent 42.5%,
      transparent 63%,
      rgba(134, 142, 150, 0.18) 64%,
      transparent 65.5%
    ),
    linear-gradient(
      28deg,
      transparent 0%,
      transparent 52%,
      rgba(206, 212, 218, 0.35) 53%,
      transparent 54.5%
    ),
    linear-gradient(145deg, #f8f9fa 0%, #f1f3f5 38%, #e9ecef 72%, #dee2e6 100%) !important;
}

/* Dunkler Marmor: #121212 → #1a1a1a + feine silberne Äderung */
.page-schach-senioren .square.chess-square--dark,
.page-schach-senioren .chess-square--dark {
  background-color: #121212 !important;
  background-image:
    radial-gradient(ellipse 80% 55% at 28% 22%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 65% 45% at 75% 78%, rgba(0, 0, 0, 0.55) 0%, transparent 58%),
    linear-gradient(
      125deg,
      transparent 0%,
      transparent 36%,
      rgba(173, 181, 189, 0.14) 37%,
      transparent 38.5%,
      transparent 58%,
      rgba(108, 117, 125, 0.12) 59%,
      transparent 60.5%
    ),
    linear-gradient(
      42deg,
      transparent 0%,
      transparent 70%,
      rgba(222, 226, 230, 0.1) 71%,
      transparent 72.5%
    ),
    linear-gradient(155deg, #1a1a1a 0%, #141414 40%, #121212 70%, #0d0d0d 100%) !important;
}

/* —— Interaktion: Hover, Auswahl, Ziele, letzter Zug —— */

/* Letzter Zug: blasses Gold-Overlay (hell & dunkel lesbar) */
.page-schach-senioren .square.last-move-from::before,
.page-schach-senioren .square.last-move-to::before,
.page-schach-senioren .chess-square.last-move-from::before,
.page-schach-senioren .chess-square.last-move-to::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 215, 0, 0.28);
  box-shadow: inset 0 0 0 3px rgba(212, 175, 55, 0.85);
  pointer-events: none;
  z-index: 0;
}

.page-schach-senioren .square.last-move-to::before,
.page-schach-senioren .chess-square.last-move-to::before {
  background: rgba(255, 215, 0, 0.34);
  box-shadow: inset 0 0 0 3px #d4af37;
}

/* Ausgewähltes Feld */
.page-schach-senioren .square.is-selected,
.page-schach-senioren .square.selected,
.page-schach-senioren .chess-square.is-selected,
.page-schach-senioren .chess-square.selected {
  outline: 4px solid #ffd700 !important;
  outline-offset: -4px !important;
  box-shadow:
    inset 0 0 0 3px #000000,
    inset 0 0 14px rgba(255, 215, 0, 0.45),
    0 0 0 1px #f5e6a3 !important;
  z-index: 4 !important;
  cursor: pointer;
}

/* Mögliche Ziele: goldener Punkt */
.page-schach-senioren .square.possible-move:not(.is-capture)::after,
.page-schach-senioren .square.is-target:not(.is-capture)::after,
.page-schach-senioren .chess-square.possible-move:not(.is-capture)::after,
.page-schach-senioren .chess-square.is-target:not(.is-capture)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28%;
  height: 28%;
  max-width: 22px;
  max-height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1b0, #d4af37 55%, #8a6a12);
  border: 2px solid #5c4508;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 1;
}

/* Schlagziele: goldener Ring */
.page-schach-senioren .square.possible-move.is-capture,
.page-schach-senioren .square.is-target.is-capture,
.page-schach-senioren .chess-square.possible-move.is-capture,
.page-schach-senioren .chess-square.is-target.is-capture {
  box-shadow:
    inset 0 0 0 5px #d4af37,
    inset 0 0 0 8px #000000,
    inset 0 0 18px rgba(255, 215, 0, 0.25) !important;
  z-index: 3 !important;
  cursor: pointer;
}

.page-schach-senioren .square.possible-move.is-capture::after,
.page-schach-senioren .square.is-target.is-capture::after {
  content: none;
}

.page-schach-senioren .square:focus-visible,
.page-schach-senioren .chess-square:focus-visible {
  outline: 4px solid #ffd700 !important;
  outline-offset: -4px !important;
  box-shadow: inset 0 0 0 2px #000000 !important;
  z-index: 4 !important;
}

.page-schach-senioren .square.square--own-piece,
.page-schach-senioren .square.possible-move {
  cursor: pointer;
}

/* —— Figuren: groß, zentriert, Marmor-SVG —— */
.page-schach-senioren .chess-piece,
.page-schach-senioren .square .chess-piece,
.page-schach-senioren .square .piece {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 93% !important;
  height: 93% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  pointer-events: none;
  user-select: none;
  line-height: 1 !important;
  z-index: 2;
  position: relative;
  transform: scale(1);
  transform-origin: center center;
  transition: transform 0.15s ease, filter 0.15s ease;
  will-change: transform;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* Hover: auswählbare Figuren (Maus) – goldener Glow + leichter Zoom */
@media (hover: hover) and (pointer: fine) {
  .page-schach-senioren .square.square--own-piece:hover,
  .page-schach-senioren .square:has(.piece):hover.square--own-piece,
  .page-schach-senioren .square.possible-move.is-capture:hover {
    cursor: pointer;
    z-index: 5 !important;
  }

  .page-schach-senioren .square.square--own-piece:hover .chess-piece,
  .page-schach-senioren .square.square--own-piece:hover .piece,
  .page-schach-senioren .square.possible-move.is-capture:hover .chess-piece,
  .page-schach-senioren .square.possible-move.is-capture:hover .piece {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.85))
      drop-shadow(0 0 3px rgba(255, 215, 0, 0.65));
  }

  .page-schach-senioren .square.possible-move:not(.is-capture):hover::after {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-schach-senioren .chess-piece,
  .page-schach-senioren .square .piece {
    transition: none;
  }
}

.page-schach-senioren .chess-piece svg,
.page-schach-senioren .chess-piece-svg {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  display: block !important;
  overflow: visible !important;
}

/* —— Bottom Bar (Gunmetal, nahtlos unten im Rahmen) —— */
.page-schach-senioren .chess-bottombar {
  position: relative !important;
  right: auto !important;
  bottom: auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  background:
    linear-gradient(0deg, #2a2a2a 0%, #1a1a1a 55%, #161616 100%) !important;
  border: none;
  border-top: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 0 0 calc(var(--chess-frame-radius) - 3px) calc(var(--chess-frame-radius) - 3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
  z-index: 2;
  box-sizing: border-box;
  font-family: var(--chess-ui-font) !important;
}

.page-schach-senioren .chess-bottombar__timer {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  min-height: 3rem;
  border: 1.5px solid var(--chess-brass);
  border-radius: 10px;
  background:
    linear-gradient(180deg, #222222 0%, #111111 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
}

.page-schach-senioren .chess-bottombar__timer svg {
  color: var(--chess-brass-bright) !important;
}

.page-schach-senioren .chess-bottombar__side {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0.45rem;
  border: 1.5px solid var(--chess-brass);
  border-radius: 10px;
  background:
    linear-gradient(180deg, #2a2a2a 0%, #141414 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: var(--chess-brass-bright) !important;
  box-sizing: border-box;
}

.page-schach-senioren .chess-hint {
  margin: 1.5rem 0 0.75rem;
  text-align: center;
  font-family: var(--chess-ui-font) !important;
  font-size: 1.1rem;
  font-weight: 600;
  color: #000000;
  line-height: 1.5;
  max-width: 28rem;
  -webkit-font-smoothing: antialiased;
}

.page-schach-senioren .game-back-arcade {
  display: inline-flex;
  justify-content: center;
  min-height: 2.85rem;
  font-family: var(--chess-ui-font) !important;
}

@media (max-width: 560px) {
  .page-schach-senioren .chess-topbar {
    grid-template-columns: minmax(5.25rem, 1fr) minmax(0, auto) minmax(5.25rem, 1fr) !important;
    gap: 0.3rem;
    padding: 0.65rem 0.55rem;
  }

  .page-schach-senioren .chess-topbar__name {
    font-size: clamp(1.05rem, 4.5vw, 1.25rem) !important;
    max-width: min(100%, 9.5rem);
  }

  .page-schach-senioren .chess-topbar__timer {
    padding: 0.35rem 0.45rem;
    min-height: 2.75rem;
    gap: 0.3rem;
  }

  .page-schach-senioren .chess-timer {
    font-size: 0.9rem !important;
  }

  .page-schach-senioren .chess-icon-btn {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    padding: 0.45rem !important;
  }

  .page-schach-senioren .chess-bottombar__side {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  .page-schach-senioren .chess-topbar svg,
  .page-schach-senioren .chess-bottombar svg,
  .page-schach-senioren .chess-icon-btn svg,
  .page-schach-senioren .chess-svg-icon {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
  }

  .page-schach-senioren .chess-svg-icon--king {
    width: 30px !important;
    height: 30px !important;
    max-width: 30px !important;
    max-height: 30px !important;
  }

  .page-schach-senioren .chess-board-mid {
    grid-template-columns: 0.95rem minmax(0, 1fr) 0.95rem !important;
  }

  .page-schach-senioren .chess-stage {
    padding-bottom: 1rem;
  }
}

@media (max-width: 380px) {
  .page-schach-senioren .chess-topbar__timer .chess-timer {
    /* sehr schmale Displays: Uhrzeit bleibt, Icon behalten */
    letter-spacing: 0.02em;
  }

  .page-schach-senioren .chess-topbar__actions {
    gap: 0.3rem;
  }
}
