
.iad-board-view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 10px;
}
.iad-board-view-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.iad-board-view-opt {
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.iad-board-view-opt input { margin: 0; cursor: pointer; }
.iad-board-view-open-audience {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 5px 10px;
  background: #fff;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.iad-board-view-open-audience:hover {
  border-color: #059669;
  color: #047857;
}
.iad-board-view-audience-banner {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  color: #e2e8f0;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.iad-board-view-audience-banner[hidden] { display: none !important; }
.iad-board-audience-match-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.iad-board-audience-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.iad-board-audience-card--p1 { border-top: 3px solid #059669; }
.iad-board-audience-card--p2 { border-top: 3px solid #7c3aed; }
.iad-board-audience-card-role {
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.iad-board-audience-card-name {
  font-weight: 800;
  font-size: 0.92rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Player 2 view: rotate board scene 180°; counter-rotate direct children for upright labels. */
.iad-board-view-scene--p2 {
  transform: rotate(180deg);
  transform-origin: center center;
}
.iad-board-view-scene--p2 > * {
  transform: rotate(180deg);
}
html.iad-board-view--audience .iad-board-view-bar { display: none !important; }
html.iad-board-view--audience .iad-board-audience-host {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(260px, 520px) minmax(120px, 1fr);
  gap: 12px;
  align-items: start;
}
html.iad-board-view--audience .iad-board-audience-board {
  grid-column: 2;
  grid-row: 1;
}
html.iad-board-view--audience .iad-board-audience-side--p2 {
  grid-column: 1;
  grid-row: 1;
}
html.iad-board-view--audience .iad-board-audience-side--p1 {
  grid-column: 3;
  grid-row: 1;
}
html.iad-board-view--audience .iad-board-audience-hide-in-audience {
  display: none !important;
}
@media (max-width: 900px) {
  html.iad-board-view--audience .iad-board-audience-host {
    grid-template-columns: 1fr;
  }
  html.iad-board-view--audience .iad-board-audience-board,
  html.iad-board-view--audience .iad-board-audience-side--p2,
  html.iad-board-view--audience .iad-board-audience-side--p1 {
    grid-column: 1;
    grid-row: auto;
  }
  .iad-board-audience-match-bar { order: -1; }
}


.aeris-chess-page { max-width: 1100px; margin: 20px auto 40px; padding: 0 16px; box-sizing: border-box; }
.aeris-chess-layout { display: grid; grid-template-columns: minmax(320px, 560px) 1fr; gap: 18px; align-items: start; }
.aeris-chess-board-wrap {
  perspective: 2200px;
  perspective-origin: 50% 8%;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  box-sizing: border-box;
}
@media (max-width: 980px) {
  .aeris-chess-page {
    margin: 8px auto 20px;
    padding: 0 6px;
    max-width: 100%;
    overflow-x: clip;
  }
  .aeris-chess-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .aeris-chess-panel {
    padding: 6px;
    min-width: 0;
    box-sizing: border-box;
  }
  .aeris-chess-layout > .aeris-chess-panel:first-child {
    padding: 4px 2px 6px;
    overflow: visible;
  }
  .aeris-chess-board-wrap {
    max-width: 100%;
    width: 100%;
    overflow: visible;
    perspective: none;
    padding-bottom: 4px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }
  .aeris-chess-board-wrap::before {
    left: -2%;
    right: -2%;
    bottom: -16px;
    height: 36px;
  }
  .aeris-chess-board-3d,
  .aeris-chess-board-3d.aeris-chess-flat {
    transform: none !important;
    transform-origin: center center;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    padding: 4px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    box-shadow:
      0 10px 28px rgba(20, 14, 10, 0.24),
      0 4px 10px rgba(20, 14, 10, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }
  .aeris-chess-board-3d.aeris-rotate-turn {
    animation: aeris-turn-rotate-flat 560ms cubic-bezier(.2,.75,.2,1);
  }
  @keyframes aeris-turn-rotate-flat {
    from { transform: rotateZ(-180deg); }
    to { transform: rotateZ(0deg); }
  }
  #chessGridWrap.aeris-chess-grid-wrap {
    --chess-size: min(calc(100vw - 20px), calc(100dvh - 240px), 92vw);
    width: var(--chess-size) !important;
    height: var(--chess-size) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 200px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    box-sizing: border-box;
    grid-template-columns: 8px repeat(8, minmax(0, 1fr)) 8px;
    grid-template-rows: 8px repeat(8, minmax(0, 1fr)) 8px;
  }
  .iad-games-hub-nav {
    margin-bottom: 10px;
    padding: 8px;
    gap: 6px;
  }
  .iad-games-hub-nav a {
    font-size: 0.8rem;
    padding: 5px 8px;
  }
  #board.aeris-chess-grid {
    transform: none;
  }
  #board.aeris-chess-grid button {
    overflow: visible;
    touch-action: manipulation;
    min-width: 0;
    min-height: 0;
  }
  .aeris-chess-page > p:first-of-type {
    font-size: 0.88rem;
    margin-bottom: 12px !important;
  }
  .aeris-chess-file,
  .aeris-chess-rank {
    font-size: 9px;
  }
  .aeris-chess-piece-3d .aeris-chess-piece-img,
  .aeris-chess-piece-img,
  .aeris-chess-piece-3d .aeris-chess-piece-svg,
  .aeris-chess-piece-3d .aeris-chess-fallback {
    transform: translateY(0) scale(0.8) !important;
    transform-origin: 50% 90%;
    width: 82%;
    height: 82%;
  }
  #board.aeris-chess-grid button:hover .aeris-chess-piece-img,
  #board.aeris-chess-grid button.aeris-hovered .aeris-chess-piece-img {
    transform: translateY(-1px) scale(0.82) !important;
  }
  .aeris-chess-board-3d.aeris-tilt-off .aeris-chess-piece-img,
  .aeris-chess-board-3d.aeris-tilt-off .aeris-chess-piece-svg,
  .aeris-chess-board-3d.aeris-tilt-off .aeris-chess-fallback {
    transform: translateY(0) scale(0.8) !important;
  }
  .aeris-to-move-overlay {
    font-size: 0.7rem;
    padding: 6px 10px;
    max-width: calc(100% - 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
@media (max-width: 900px) {
  .aeris-chess-layout { grid-template-columns: 1fr; }
}
.aeris-chess-panel {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px;
  box-sizing: border-box;
  min-width: 0;
}
.aeris-chess-board-wrap::before {
  content: '';
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -42px;
  height: 74px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.34) 0%, rgba(0,0,0,0.08) 52%, rgba(0,0,0,0) 100%);
  filter: blur(2px);
  pointer-events: none;
}

.aeris-to-move-overlay {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.09em;
  font-size: 0.78rem;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(226, 232, 240, 0.35);
  box-shadow: 0 10px 25px rgba(0,0,0,0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.aeris-to-move-overlay--white {
  color: #f1f5f9;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.18);
}

.aeris-to-move-overlay--black {
  color: #e2e8f0;
  border-color: rgba(15, 23, 42, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

@keyframes aerisToMovePulse {
  0% { box-shadow: 0 10px 25px rgba(0,0,0,0.22); }
  35% { box-shadow: 0 0 0 8px rgba(37,99,235,0.18), 0 16px 35px rgba(0,0,0,0.22); }
  70% { box-shadow: 0 0 0 3px rgba(37,99,235,0.10), 0 10px 25px rgba(0,0,0,0.22); }
  100% { box-shadow: 0 10px 25px rgba(0,0,0,0.22); }
}

.aeris-to-move-overlay.aeris-to-move-pulse {
  animation: aerisToMovePulse 700ms cubic-bezier(.2,.75,.2,1);
}

/* Checkmate celebration */
.aeris-chess-win-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  background: radial-gradient(ellipse at center, rgba(15,23,42,0.55) 0%, rgba(15,23,42,0.82) 100%);
  overflow: hidden;
}
.aeris-chess-win-overlay.is-on { display: flex; }
.aeris-chess-win-card {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 28px 32px;
  border-radius: 20px;
  background: rgba(255,255,255,0.96);
  border: 2px solid #fbbf24;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  max-width: min(92vw, 420px);
}
.aeris-chess-win-card .aeris-win-title {
  margin: 0 0 8px;
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #b45309;
  text-transform: uppercase;
}
.aeris-chess-win-card .aeris-win-name {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  word-break: break-word;
}
.aeris-chess-win-card .aeris-win-sub {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 0.95rem;
}
.aeris-chess-win-card .aeris-win-close {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: #0f172a;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.aeris-chess-balloon {
  position: absolute;
  bottom: -40px;
  width: 28px;
  height: 36px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  animation: aerisBalloonRise linear forwards;
  z-index: 1;
  opacity: 0.95;
}
.aeris-chess-balloon::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.65);
  transform: translateX(-50%);
}
@keyframes aerisBalloonRise {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-110vh) translateX(var(--drift, 20px)) rotate(18deg); opacity: 0.2; }
}
.aeris-chess-fw {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  z-index: 2;
  animation: aerisFireworkBurst 1.1s ease-out forwards;
  box-shadow: 0 0 8px currentColor;
}
@keyframes aerisFireworkBurst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}
.aeris-chess-board-3d {
  /* Slightly shallower tilt reduces screen-space overlap between ranks (fixes far/back-rank hit testing). */
  transform: rotateX(22deg) rotateZ(-0.5deg) translateZ(0);
  transform-style: preserve-3d;
  border-radius: 16px;
  box-shadow:
    0 56px 90px rgba(20, 14, 10, 0.42),
    0 18px 30px rgba(20, 14, 10, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -8px 18px rgba(52, 34, 20, 0.35);
  background:
    linear-gradient(178deg, rgba(255,255,255,0.34) 0%, transparent 42%),
    radial-gradient(circle at 12% 8%, rgba(255, 240, 204, 0.22), transparent 36%),
    linear-gradient(150deg, #7a5a3f 0%, #5f422b 34%, #4a3221 72%, #3d2819 100%);
  border: 1px solid rgba(58, 38, 24, 0.8);
  padding: 14px;
  position: relative;
  transform-origin: 50% 78%;
}
.aeris-chess-board-3d.aeris-tilt-off {
  /* During drag, disable the 3D tilt so pointer hit-testing matches button rects. */
  transform: none !important;
  animation: none !important;
}
.aeris-chess-board-3d.aeris-rotate-turn {
  animation: aeris-turn-rotate 560ms cubic-bezier(.2,.75,.2,1);
  backface-visibility: hidden;
}
@keyframes aeris-turn-rotate {
  /* Always spin clockwise to switch sides */
  from { transform: rotateX(22deg) rotateZ(-180.5deg) translateZ(0); }
  to   { transform: rotateX(22deg) rotateZ(-0.5deg) translateZ(0); }
}
.aeris-chess-board-3d::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 12px;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 226, 178, 0.26),
    inset 0 0 26px rgba(33, 19, 10, 0.34);
}
.aeris-chess-board-3d::after {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -20px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 74%);
  transform: translateZ(-1px);
  pointer-events: none;
}
/* Grid: corners (4), top+bottom file letters (a–h), left+right rank numbers (1–8), 64 squares */
.aeris-chess-grid-wrap {
  display: grid;
  grid-template-columns: 22px repeat(8, minmax(0, 1fr)) 22px;
  grid-template-rows: 20px repeat(8, minmax(0, 1fr)) 20px;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: min(72vh, 520px);
}
@media (max-width: 980px) {
  .aeris-chess-grid-wrap {
    max-height: none;
  }
}
.aeris-chess-corner {
  min-width: 0;
  min-height: 0;
  pointer-events: none;
}
.aeris-chess-file {
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #5c4330;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
  padding-bottom: 2px;
}
.aeris-chess-file.aeris-chess-file-bottom {
  align-items: flex-start;
  padding-bottom: 0;
  padding-top: 3px;
}
.aeris-chess-rank {
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #5c4330;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
#board.aeris-chess-grid {
  grid-column: 2 / 10;
  grid-row: 2 / 10;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #7a4f2c;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.3),
    inset 0 5px 18px rgba(255, 230, 170, 0.14),
    inset 0 -8px 22px rgba(26, 15, 8, 0.22);
  background: #2a190f;
  transform: translateZ(2px);
}
#board.aeris-chess-grid button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  line-height: 0;
  user-select: none;
  touch-action: none;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(45, 29, 18, 0.26);
  transition: filter 0.12s ease, box-shadow 0.12s ease;
}
#board.aeris-chess-grid button:hover {
  filter: brightness(1.06);
  box-shadow:
    inset 0 0 0 1px rgba(255, 237, 206, 0.24),
    inset 0 4px 8px rgba(255,255,255,0.08);
}
#board.aeris-chess-grid button.aeris-hovered {
  filter: brightness(1.06);
  box-shadow:
    inset 0 0 0 1px rgba(255, 237, 206, 0.24),
    inset 0 4px 8px rgba(255,255,255,0.08);
}
#board.aeris-chess-grid button.aeris-drag-source {
  opacity: 0.4;
  filter: brightness(0.95);
}
#board.aeris-chess-grid button.aeris-dragging { cursor: grabbing; }
.aeris-chess-piece-wrap {
  display: flex !important;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  perspective: 300px;
  position: relative;
  pointer-events: none;
}
.aeris-chess-piece-wrap::after {
  content: '';
  position: absolute;
  left: 17%;
  right: 17%;
  bottom: 8%;
  height: 14%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.42) 0%, rgba(0,0,0,0.06) 62%, rgba(0,0,0,0) 100%);
  transform: translateZ(0);
  pointer-events: none;
  filter: blur(1.2px);
}
.aeris-chess-piece-3d .aeris-chess-piece-img {
  /* Counter-rotate against the board tilt so pieces stay "standing" instead of lying down. */
  transform: translateY(-2px) rotateX(-22deg) rotateZ(0deg) scale(0.975);
  transform-origin: 50% 100%;
}
.aeris-chess-piece-img {
  width: 92%;
  height: 92%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  filter:
    drop-shadow(0 1px 0 rgba(255,252,243,0.64))
    drop-shadow(0 6px 5px rgba(0,0,0,0.3))
    drop-shadow(0 16px 18px rgba(0,0,0,0.4));
  transition: transform 0.15s ease, filter 0.15s ease;
}
.aeris-chess-piece-img.aeris-piece-w-real {
  filter:
    drop-shadow(0 1px 0 rgba(255,255,255,0.7))
    drop-shadow(0 5px 4px rgba(25,16,8,0.26))
    drop-shadow(0 14px 16px rgba(0,0,0,0.36))
    saturate(1.06)
    contrast(1.03)
    brightness(1.06);
}
.aeris-chess-piece-img.aeris-piece-b-real {
  filter:
    drop-shadow(0 1px 0 rgba(255,226,175,0.14))
    drop-shadow(0 5px 4px rgba(0,0,0,0.34))
    drop-shadow(0 16px 20px rgba(0,0,0,0.46))
    saturate(0.98)
    contrast(1.08)
    brightness(0.9);
}
#board.aeris-chess-grid button:hover .aeris-chess-piece-img {
  transform: translateY(-4px) rotateX(-22deg) rotateZ(0deg) scale(0.99);
  filter:
    drop-shadow(0 1px 0 rgba(255,252,243,0.72))
    drop-shadow(0 7px 6px rgba(0,0,0,0.32))
    drop-shadow(0 18px 22px rgba(0,0,0,0.44));
}
#board.aeris-chess-grid button.aeris-hovered .aeris-chess-piece-img {
  transform: translateY(-2px) rotateX(16deg) rotateZ(0deg) scale(0.985);
  filter:
    drop-shadow(0 1px 0 rgba(255,252,243,0.72))
    drop-shadow(0 7px 6px rgba(0,0,0,0.32))
    drop-shadow(0 18px 22px rgba(0,0,0,0.44));
}
#board.aeris-chess-grid button:hover .aeris-chess-piece-img.aeris-piece-w-real {
  filter:
    drop-shadow(0 1px 0 rgba(255,255,255,0.78))
    drop-shadow(0 6px 5px rgba(25,16,8,0.28))
    drop-shadow(0 18px 22px rgba(0,0,0,0.4))
    saturate(1.08)
    contrast(1.04)
    brightness(1.08);
}
#board.aeris-chess-grid button.aeris-hovered .aeris-chess-piece-img.aeris-piece-w-real {
  filter:
    drop-shadow(0 1px 0 rgba(255,255,255,0.78))
    drop-shadow(0 6px 5px rgba(25,16,8,0.28))
    drop-shadow(0 18px 22px rgba(0,0,0,0.4))
    saturate(1.08)
    contrast(1.04)
    brightness(1.08);
}
#board.aeris-chess-grid button:hover .aeris-chess-piece-img.aeris-piece-b-real {
  filter:
    drop-shadow(0 1px 0 rgba(255,226,175,0.18))
    drop-shadow(0 6px 5px rgba(0,0,0,0.38))
    drop-shadow(0 19px 24px rgba(0,0,0,0.5))
    saturate(1)
    contrast(1.1)
    brightness(0.92);
}
#board.aeris-chess-grid button.aeris-hovered .aeris-chess-piece-img.aeris-piece-b-real {
  filter:
    drop-shadow(0 1px 0 rgba(255,226,175,0.18))
    drop-shadow(0 6px 5px rgba(0,0,0,0.38))
    drop-shadow(0 19px 24px rgba(0,0,0,0.5))
    saturate(1)
    contrast(1.1)
    brightness(0.92);
}
.aeris-chess-piece-3d .aeris-chess-piece-svg {
  transform: translateY(-2px) rotateX(-22deg) rotateZ(0deg);
  transform-origin: 50% 100%;
}
.aeris-chess-piece-3d .aeris-chess-fallback {
  transform: translateY(-2px) rotateX(-22deg) rotateZ(0deg);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 5px 7px rgba(0,0,0,0.38));
}

/* When we temporarily disable the board tilt for hit-testing, remove the counter-rotation. */
.aeris-chess-board-3d.aeris-tilt-off .aeris-chess-piece-img {
  transform: translateY(-2px) rotateX(0deg) rotateZ(0deg) scale(0.975) !important;
}
.aeris-chess-board-3d.aeris-tilt-off #board.aeris-chess-grid button:hover .aeris-chess-piece-img {
  transform: translateY(-4px) rotateX(0deg) rotateZ(0deg) scale(0.99) !important;
}
.aeris-chess-board-3d.aeris-tilt-off .aeris-chess-piece-svg,
.aeris-chess-board-3d.aeris-tilt-off .aeris-chess-fallback {
  transform: translateY(-2px) rotateX(0deg) rotateZ(0deg) !important;
}
.aeris-player-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.aeris-player-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.28);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.45);
}
.aeris-player-dot-w { background: linear-gradient(160deg, #fff 0%, #e7e7e7 100%); }
.aeris-player-dot-b { background: linear-gradient(160deg, #1d1d1d 0%, #000 100%); }
.aeris-player-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aeris-chess-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: min(56px, 12vw);
  height: min(56px, 12vw);
  z-index: 10000;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.4));
}
.aeris-chess-drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.aeris-chess-piece-svg {
  width: 88%;
  height: 88%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.22));
}
.aeris-chess-fallback {
  pointer-events: none;
  font-size: clamp(26px, 6.5vw, 42px);
  line-height: 1;
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols2", sans-serif;
}
.aeris-piece-w { color: #f8fafc; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.aeris-piece-b { color: #0f172a; text-shadow: 0 1px 0 rgba(255,255,255,0.15); }
.aeris-sq-light {
  background:
    radial-gradient(circle at 24% 18%, rgba(255,252,242,0.45) 0%, rgba(255,252,242,0) 42%),
    linear-gradient(164deg, rgba(255,255,255,0.26) 0%, rgba(255,255,255,0.03) 38%, transparent 62%),
    linear-gradient(158deg, #f1dfbe 0%, #dfc08f 44%, #c69f66 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -1px 0 rgba(96, 63, 33, 0.14);
}
.aeris-sq-dark {
  background:
    radial-gradient(circle at 24% 18%, rgba(255,236,199,0.14) 0%, rgba(255,236,199,0) 46%),
    linear-gradient(164deg, rgba(255,255,255,0.1) 0%, transparent 42%),
    linear-gradient(160deg, #8c5a33 0%, #663f24 50%, #4a2f1b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,224,170,0.1),
    inset 0 -1px 0 rgba(20, 11, 6, 0.3);
}
#board.aeris-chess-grid button.aeris-selected {
  outline: 3px solid #1d4ed8;
  outline-offset: -3px;
  z-index: 1;
}
.aeris-chess-timers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}
.aeris-chess-clock {
  position: relative;
  border-radius: 14px;
  padding: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(165deg, #c4c4c4 0%, #8a8a8a 45%, #6b6b6b 100%);
  box-shadow:
    0 10px 22px rgba(0,0,0,0.22),
    0 3px 6px rgba(0,0,0,0.12),
    inset 0 2px 1px rgba(255,255,255,0.45),
    inset 0 -2px 4px rgba(0,0,0,0.25);
  border: 1px solid rgba(0,0,0,0.2);
  transform: translateZ(0);
}
.aeris-chess-clock::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 11px;
  pointer-events: none;
  box-shadow:
    inset 0 3px 8px rgba(0,0,0,0.35),
    inset 0 -2px 6px rgba(255,255,255,0.08);
  border: 1px solid rgba(0,0,0,0.15);
}
.aeris-clock-face {
  position: relative;
  z-index: 1;
  margin: 8px;
  padding: 14px 12px 16px;
  border-radius: 10px;
  background:
    radial-gradient(ellipse 120% 80% at 50% 20%, rgba(255,255,255,0.15) 0%, transparent 50%),
    linear-gradient(180deg, #1a2f1f 0%, #0d1810 55%, #070d09 100%);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.6),
    inset 0 -1px 0 rgba(255,255,255,0.06);
  border: 1px solid rgba(0,0,0,0.5);
}
.aeris-clock-digits {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;
  color: #c8f5d8;
  text-shadow:
    0 0 8px rgba(80, 220, 140, 0.45),
    0 2px 0 rgba(0,0,0,0.85),
    0 -1px 0 rgba(255,255,255,0.12);
}
.aeris-chess-clock.aeris-active {
  background: linear-gradient(165deg, #9ec5ff 0%, #3b82f6 40%, #1d4ed8 100%);
  box-shadow:
    0 12px 28px rgba(37, 99, 235, 0.45),
    0 4px 8px rgba(0,0,0,0.15),
    inset 0 2px 1px rgba(255,255,255,0.5),
    inset 0 -2px 4px rgba(0,0,0,0.2);
  border-color: rgba(30, 64, 175, 0.6);
}
.aeris-chess-clock.aeris-active .aeris-clock-face {
  background:
    radial-gradient(ellipse 120% 80% at 50% 15%, rgba(255,255,255,0.2) 0%, transparent 45%),
    linear-gradient(180deg, #1e3a5f 0%, #0f2744 55%, #0a1c30 100%);
  border-color: rgba(59, 130, 246, 0.4);
}
.aeris-chess-clock.aeris-active .aeris-clock-digits {
  color: #e0f2ff;
  text-shadow:
    0 0 10px rgba(96, 200, 255, 0.55),
    0 2px 0 rgba(0,0,0,0.85),
    0 -1px 0 rgba(255,255,255,0.15);
}
.aeris-chess-voice-status {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 6px;
  min-height: 1.2em;
}
.aeris-chess-captures {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  min-height: 28px;
  margin-top: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.aeris-chess-captures:empty::before {
  content: 'No captures yet';
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
}
.aeris-chess-captures .aeris-cap-piece {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aeris-chess-captures .aeris-cap-piece .aeris-chess-piece-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aeris-chess-captures .aeris-cap-piece .aeris-chess-piece-img,
.aeris-chess-captures .aeris-cap-piece .aeris-chess-piece-svg,
.aeris-chess-captures .aeris-cap-piece .aeris-chess-fallback {
  transform: none !important;
  width: 20px !important;
  height: 20px !important;
  max-width: 20px;
  max-height: 20px;
  font-size: 16px;
  line-height: 1;
}
.aeris-chess-captures-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 6px 0 2px;
}
@media (prefers-reduced-motion: reduce) {
  /* Do not flatten the 3D look; only disable the turn animation. */
  .aeris-chess-board-3d { box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12); }
  .aeris-chess-board-3d.aeris-rotate-turn { animation: none; }
  .aeris-chess-board-wrap { perspective: 2200px; }
  /* Keep pieces "standing" even when reduced motion is enabled. */
  .aeris-chess-piece-img,
  .aeris-chess-piece-svg,
  .aeris-chess-fallback {
    transform: translateY(-2px) rotateX(-22deg) rotateZ(0deg) scale(0.975) !important;
  }
}
@media (prefers-reduced-motion: reduce) and (max-width: 980px) {
  .aeris-chess-board-wrap { perspective: none; }
  .aeris-chess-board-3d { transform: none !important; }
  .aeris-chess-piece-img,
  .aeris-chess-piece-svg,
  .aeris-chess-fallback {
    transform: translateY(-1px) scale(0.9) !important;
  }
}

