.game-arena-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.chess-frame-wrapper {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--card-radius);
  padding: 16px 20px;
  width: 100%;
  max-width: min(100%, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: var(--transition-smooth);
}


.chess-status-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chess-status-bar {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px solid var(--panel-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.status-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-turn-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s ease;
}

.status-turn-text {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
}

.status-timer-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 183, 3, 0.18);
  color: #ffb703;
  border: 1px solid rgba(255, 183, 3, 0.5);
  animation: timer-pulse 0.9s infinite alternate ease-in-out;
}

@keyframes timer-pulse {
  0% { transform: scale(0.97); opacity: 0.85; }
  100% { transform: scale(1.03); opacity: 1; box-shadow: 0 0 10px rgba(255, 183, 3, 0.4); }
}


.ai-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.ai-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffb703, #00f0ff);
  box-shadow: 0 0 10px #00f0ff;
  transition: width 0.05s linear;
}


.chess-board-center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: min(100%, 580px, 64vh);
}

.player-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(17, 20, 36, 0.7);
  border: 1.5px solid var(--panel-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0.65;
}

.player-card.active-turn {
  opacity: 1 !important;
  transform: translateY(-1px);
  border-color: var(--secondary-accent) !important;
  background: rgba(0, 240, 255, 0.06) !important;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.22), inset 0 0 12px rgba(0, 240, 255, 0.05);
}

.player-card-black.active-turn {
  border-color: #ffb703 !important;
  background: rgba(255, 183, 3, 0.07) !important;
  box-shadow: 0 0 18px rgba(255, 183, 3, 0.22), inset 0 0 12px rgba(255, 183, 3, 0.05);
}

.player-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-avatar {
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.player-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.player-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.player-badge-white {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.captured-inline-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.captured-mini-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.captured-tray {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 20px;
  flex-wrap: wrap;
  background: transparent;
  border: none;
  padding: 0;
}

.captured-piece {
  font-size: 16px;
  line-height: 1;
  opacity: 0.9;
  transition: transform 0.2s ease;
  animation: capture-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes capture-pop {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 0.9; }
}

.material-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.2;
}


.player-turn-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.player-card.active-turn .player-turn-indicator {
  background: rgba(0, 240, 255, 0.15);
  color: var(--secondary-accent);
  border-color: rgba(0, 240, 255, 0.4);
}

.player-card-black.active-turn .player-turn-indicator {
  background: rgba(255, 183, 3, 0.18);
  color: #ffb703;
  border-color: rgba(255, 183, 3, 0.5);
}

.turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  transition: transform 0.2s ease;
}

.player-card.active-turn .turn-dot {
  animation: turn-dot-pulse 1.1s infinite ease-in-out;
}

@keyframes turn-dot-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 0 currentColor;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.85;
    box-shadow: 0 0 8px 3px currentColor;
  }
}


.chess-grid-board-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chess-grid-board {
  display: grid !important;
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(8, minmax(0, 1fr)) !important;
  width: 100% !important;
  max-width: min(100%, 540px, 58vh) !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  user-select: none;
  position: relative;
  border: 4px solid var(--panel-border);
  box-sizing: border-box;
}

.chess-tile {
  position: relative;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  aspect-ratio: 1 / 1 !important;
  box-sizing: border-box !important;
  overflow: hidden;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}


.tile-coord {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
  opacity: 0.65;
  line-height: 1;
  z-index: 1;
}

.tile-coord-rank {
  top: 3px;
  left: 4px;
}

.tile-coord-file {
  bottom: 3px;
  right: 4px;
}


.last-move-tile {
  position: relative;
}


.chess-piece {
  font-size: clamp(22px, 5.2vw, 42px);
  line-height: 1 !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;
  cursor: grab;
  z-index: 2;
  user-select: none;
  pointer-events: none;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.18s ease;
}

.chess-piece.piece-selected {
  transform: translateY(-2px) scale(1.12);
  filter: drop-shadow(0 4px 10px rgba(0, 240, 255, 0.6));
}

.chess-piece.piece-just-landed {
  animation: piece-land 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes piece-land {
  0% { transform: scale(1.18); }
  100% { transform: scale(1); }
}


.move-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background-color: var(--secondary-accent);
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 0 10px var(--secondary-accent);
  animation: dot-appear 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dot-appear {
  0% { transform: scale(0.2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.move-capture-ring {
  position: absolute;
  width: 82%;
  height: 82%;
  border: 3px solid var(--danger-color);
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
  animation: dot-appear 0.2s ease-out, capture-ring-pulse 1.2s infinite alternate ease-in-out;
  box-shadow: inset 0 0 10px rgba(255, 65, 108, 0.4);
}

@keyframes capture-ring-pulse {
  0% { transform: scale(0.96); opacity: 0.8; }
  100% { transform: scale(1.02); opacity: 1; }
}


.move-log-box {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.move-log-list {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  overflow-y: auto;
  flex-grow: 1;
  max-height: 250px;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  border-bottom: 1px dashed var(--panel-border);
}
.log-row:nth-child(even) {
  background: rgba(255,255,255,0.01);
}
.log-num {
  font-weight: bold;
  color: var(--primary-accent);
  width: 30px;
}
.log-white, .log-black {
  flex-grow: 1;
}

.empty-log-text {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-style: italic;
}



.theme-wood {
  background: radial-gradient(circle at 50% 25%, #351f12 0%, #1c0f08 100%) !important;
  border: 8px solid #4a2c17 !important;
  border-radius: 16px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.75),
    inset 0 0 25px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(212, 175, 55, 0.25);
}

.theme-wood .chess-status-bar {
  background: rgba(28, 15, 8, 0.9);
  border: 1px solid #5a361c;
  color: #eed6b5;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.theme-wood .captured-tray {
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed #5a361c;
}

.theme-wood .chess-grid-board {
  border: 6px solid #281408;
  box-shadow: 
    inset 0 0 16px rgba(0, 0, 0, 0.8),
    0 10px 25px rgba(0, 0, 0, 0.7);
  border-radius: 6px;
}


.theme-wood .chess-tile.light-tile {
  background: linear-gradient(135deg, #edd6b6 0%, #dfc59f 100%);
  color: #3b2210;
}
.theme-wood .chess-tile.dark-tile {
  background: linear-gradient(135deg, #784725 0%, #583218 100%);
  color: #edd6b6;
}

.theme-wood .chess-tile:hover {
  filter: brightness(1.12);
}


.theme-wood .chess-tile.selected-tile {
  background: radial-gradient(circle, #e6b800 0%, #b38600 100%) !important;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}

.theme-wood .last-move-tile {
  background: radial-gradient(circle, rgba(218, 165, 32, 0.35) 0%, rgba(184, 134, 11, 0.25) 100%) !important;
}

.theme-wood .chess-tile.in-check {
  background: radial-gradient(circle, #e53935 0%, #8e0000 100%) !important;
  animation: check-pulse 0.8s infinite alternate;
}

.theme-wood .tile-coord {
  color: inherit;
  opacity: 0.65;
}

.theme-wood .chess-piece {
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.65));
}
.theme-wood .chess-piece.white-piece {
  color: #fffaf0;
  text-shadow: 
    0 1px 1px rgba(0, 0, 0, 0.9),
    0 0 4px rgba(255, 255, 255, 0.6);
}
.theme-wood .chess-piece.black-piece {
  color: #1a1614;
  text-shadow: 
    0 1px 1px rgba(255, 255, 255, 0.25),
    0 0 4px rgba(0, 0, 0, 0.9);
}

.theme-wood .player-card {
  background: rgba(28, 15, 8, 0.85);
  border: 1.5px solid #5a361c;
}
.theme-wood .player-card.active-turn {
  background: rgba(74, 44, 23, 0.5) !important;
  border-color: #eed6b5 !important;
  box-shadow: 0 0 16px rgba(238, 214, 181, 0.25) !important;
}
.theme-wood .player-card.active-turn .player-turn-indicator {
  background: rgba(238, 214, 181, 0.2);
  color: #eed6b5;
  border-color: rgba(238, 214, 181, 0.5);
}
.theme-wood .player-avatar {
  background: rgba(40, 20, 8, 0.8);
  border-color: #5a361c;
}
.theme-wood .player-name {
  color: #eed6b5;
}
.theme-wood .move-dot {
  background-color: rgba(46, 125, 50, 0.9);
  box-shadow: 0 0 8px rgba(46, 125, 50, 0.8);
}
.theme-wood .move-capture-ring {
  border-color: #d32f2f;
}



.theme-cyber {
  border-color: var(--secondary-accent);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.15), inset 0 0 20px rgba(0, 240, 255, 0.05);
}

.theme-cyber .chess-grid-board {
  border: 4px solid var(--panel-border);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}


.theme-cyber .chess-tile.light-tile {
  background-color: hsl(222, 22%, 16%);
  color: rgba(255, 255, 255, 0.4);
}
.theme-cyber .chess-tile.dark-tile {
  background-color: hsl(222, 25%, 9%);
  color: rgba(0, 240, 255, 0.3);
}

.theme-cyber .chess-tile:hover {
  background-color: hsl(222, 28%, 24%) !important;
}


.theme-cyber .chess-tile.selected-tile {
  background-color: rgba(0, 240, 255, 0.3) !important;
  box-shadow: inset 0 0 14px rgba(0, 240, 255, 0.6);
}

.theme-cyber .last-move-tile {
  background-color: rgba(0, 240, 255, 0.16) !important;
}


.theme-cyber .chess-tile.in-check {
  background-color: rgba(255, 50, 50, 0.35) !important;
  animation: check-pulse 0.8s infinite alternate;
}

@keyframes check-pulse {
  0% { box-shadow: inset 0 0 5px var(--danger-color); }
  100% { box-shadow: inset 0 0 20px var(--danger-color); }
}


.theme-cyber .chess-piece.white-piece {
  color: #fff;
  text-shadow: 
    0 0 4px #fff,
    0 0 10px var(--secondary-accent);
}
.theme-cyber .chess-piece.black-piece {
  color: #111;
  text-shadow: 
    0 0 2px #fff,
    0 0 12px var(--primary-accent);
}



.theme-nokia {
  background-color: hsl(76, 50%, 55%) !important;
  border: 8px double hsl(76, 55%, 15%);
  color: hsl(76, 55%, 12%);
  border-radius: 12px;
}

.theme-nokia .chess-status-bar {
  background: transparent;
  border-color: hsl(76, 55%, 15%);
  color: hsl(76, 55%, 12%);
  font-weight: 900;
}

.theme-nokia .captured-tray {
  border-color: hsl(76, 55%, 15%);
  background: transparent;
}

.theme-nokia .chess-grid-board {
  border: 4px solid hsl(76, 55%, 15%);
}


.theme-nokia .chess-tile.light-tile {
  background-color: hsl(76, 45%, 52%);
}
.theme-nokia .chess-tile.dark-tile {
  background-color: hsl(76, 50%, 38%);
}

.theme-nokia .chess-tile:hover {
  background-color: hsl(76, 45%, 45%) !important;
}


.theme-nokia .chess-tile.selected-tile {
  background-color: hsl(76, 55%, 15%) !important;
}
.theme-nokia .chess-tile.selected-tile .chess-piece {
  color: hsl(76, 50%, 55%) !important;
  text-shadow: none !important;
}


.theme-nokia .chess-tile.in-check {
  animation: nokia-check-blink 0.5s infinite steps(2);
}

@keyframes nokia-check-blink {
  0% { background-color: hsl(76, 50%, 38%); }
  100% { background-color: hsl(76, 55%, 15%); }
}
.theme-nokia .chess-tile.in-check.light-tile {
  animation: nokia-check-blink-light 0.5s infinite steps(2);
}
@keyframes nokia-check-blink-light {
  0% { background-color: hsl(76, 45%, 52%); }
  100% { background-color: hsl(76, 55%, 15%); }
}


.theme-nokia .chess-piece {
  color: hsl(76, 55%, 15%) !important;
  text-shadow: none !important;
}

.theme-nokia .player-card {
  background: hsl(76, 48%, 48%);
  border: 2px solid hsl(76, 55%, 15%);
  color: hsl(76, 55%, 12%);
}
.theme-nokia .player-avatar {
  background: hsl(76, 45%, 42%);
  border: 1px solid hsl(76, 55%, 15%);
}
.theme-nokia .player-card.active-turn {
  background: hsl(76, 55%, 15%) !important;
  color: hsl(76, 50%, 55%) !important;
}
.theme-nokia .player-card.active-turn .player-name,
.theme-nokia .player-card.active-turn .player-badge,
.theme-nokia .player-card.active-turn .captured-mini-label,
.theme-nokia .player-card.active-turn .turn-text {
  color: hsl(76, 50%, 55%) !important;
}
.theme-nokia .player-card.active-turn .player-turn-indicator {
  background: hsl(76, 50%, 55%);
  color: hsl(76, 55%, 15%);
}
.theme-nokia .ai-progress-track {
  background: hsl(76, 50%, 40%);
  border: 1px solid hsl(76, 55%, 15%);
}
.theme-nokia .ai-progress-fill {
  background: hsl(76, 55%, 15%);
  box-shadow: none;
}


.theme-nokia .move-dot {
  background-color: hsl(76, 55%, 12%);
  box-shadow: none;
}
.theme-nokia .move-capture-ring {
  border-color: hsl(76, 55%, 15%);
}



.promotion-panel {
  border-color: var(--secondary-accent);
  box-shadow: 0 0 20px rgba(var(--secondary-accent-rgb), 0.2);
}
.promotion-choices {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}
.promo-choice-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.promo-choice-btn:hover {
  background: var(--secondary-accent);
  color: black;
  transform: translateY(-2px);
}


.hidden {
  display: none !important;
}


.screen-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(10, 15, 25, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 6;
  backdrop-filter: blur(4px);
  border-radius: var(--card-radius);
  transition: var(--transition-smooth);
}


.arcade-overlay-panel {
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid var(--primary-accent);
  border-radius: 12px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 0 20px rgba(var(--primary-accent-rgb), 0.3);
}

.arcade-title {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-accent);
  letter-spacing: 2px;
  text-shadow: 0 0 8px var(--primary-accent);
}

.arcade-score-text {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-primary);
}

.arcade-start-btn {
  background: var(--primary-accent);
  color: #000;
  border: none;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 14px;
  padding: 12px 30px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: var(--transition-bounce);
  box-shadow: 0 4px 0 hsl(38, 80%, 25%);
}

.arcade-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 hsl(38, 80%, 25%);
}

.arcade-start-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 hsl(38, 80%, 25%);
}

.mobile-settings-toggle {
  display: inline-flex;
}

.game-viewport {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  height: auto;
}

.chess-game-content-layout {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  width: 100%;
}

.game-sidebar.gameplay-sidebar {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 24px;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  height: auto;
}


.settings-sidebar {
  display: none;
}

.settings-sidebar.mobile-open {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 56px !important;
  right: 0 !important;
  bottom: 0 !important;
  width: min(90vw, 360px) !important;
  background: rgba(15, 20, 32, 0.98) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  z-index: 9999999 !important;
  overflow-y: auto !important;
  padding: 24px !important;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.settings-sidebar .drawer-header-row {
  display: none;
}

.settings-sidebar .control-panel-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.settings-sidebar .panel-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0 0 2px 0;
  white-space: nowrap;
}

.settings-sidebar .skin-selector,
.settings-sidebar .mode-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-sidebar .skin-btn,
.settings-sidebar .mode-btn {
  padding: 10px 14px;
  font-size: 13px;
  white-space: normal;
  text-align: left;
  width: 100%;
}

.settings-sidebar .speed-selector {
  display: flex;
  flex-direction: row;
  gap: 6px;
  width: 100%;
}

.settings-sidebar .speed-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.settings-sidebar .mode-name {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
}

.settings-sidebar .mode-desc {
  display: block;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

.settings-sidebar .reset-group {
  margin-top: 4px;
}

.settings-sidebar .reset-btn {
  width: 100%;
  text-align: center;
}


@media (max-width: 1024px) {
  .mobile-settings-toggle {
    display: flex;
  }
  .game-body {
    overflow-x: hidden;
    height: 100vh;
    height: 100dvh;
  }
  .game-viewport {
    height: calc(100dvh - 56px);
    height: calc(100vh - 56px);
    overflow-y: auto;
    position: relative;
    padding: 6px 12px;
    gap: 8px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .settings-sidebar {
    display: none !important;
  }
  .settings-sidebar.mobile-open {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 32, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99;
    padding: 24px !important;
    overflow-y: auto;
    gap: 16px;
    animation: fadeIn 0.2s ease;
  }
  .settings-sidebar.mobile-open .control-panel-group {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px;
  }
  .settings-sidebar.mobile-open .skin-selector,
  .settings-sidebar.mobile-open .mode-selector,
  .settings-sidebar.mobile-open .speed-selector {
    width: 100%;
    display: flex;
  }
  .settings-sidebar.mobile-open .skin-btn,
  .settings-sidebar.mobile-open .mode-btn,
  .settings-sidebar.mobile-open .speed-btn {
    flex: 1;
    text-align: center;
  }

  .chess-game-content-layout {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 10px;
  }
  .game-sidebar.gameplay-sidebar {
    order: -1;
    width: 100%;
    max-width: 440px;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    gap: 8px;
  }
  .game-stats-hud {
    flex-direction: row;
    gap: 6px;
    width: 100%;
  }
  .hud-stat-box {
    padding: 6px 8px;
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    border-radius: 8px;
  }
  .hud-stat-label { font-size: 9px; }
  .hud-stat-num { font-size: 18px; }
  .move-log-box { display: none; }
  .keyboard-legend { display: none; }

  .game-arena-container {
    padding: 0;
    width: 100%;
  }
  .chess-frame-wrapper {
    padding: 8px 6px;
    width: 100%;
    max-width: 440px;
    gap: 6px;
    border-radius: 14px;
  }
  .chess-status-bar {
    font-size: 12px;
    padding: 6px 10px;
  }
  .status-turn-text {
    font-size: 11px;
    letter-spacing: 0.5px;
  }
  .status-timer-chip {
    font-size: 11px;
    padding: 2px 6px;
  }
  .chess-board-center-column {
    width: 100%;
    max-width: min(100%, 340px, 48vh);
    gap: 4px;
  }
  .player-card {
    padding: 4px 8px;
    border-radius: 8px;
  }
  .player-avatar {
    width: 26px;
    height: 26px;
    font-size: 16px;
    border-radius: 6px;
  }
  .player-name {
    font-size: 12px;
  }
  .player-badge {
    font-size: 8px;
    padding: 1px 4px;
  }
  .captured-mini-label {
    font-size: 8px;
  }
  .captured-piece {
    font-size: 13px;
  }
  .player-turn-indicator {
    padding: 2px 8px;
    font-size: 10px;
  }
  .turn-dot {
    width: 6px;
    height: 6px;
  }
  .chess-grid-board {
    width: 100% !important;
    max-width: min(100%, 340px, 48vh) !important;
    aspect-ratio: 1 / 1 !important;
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(8, minmax(0, 1fr)) !important;
  }
  .chess-piece {
    font-size: min(26px, 7.2vw) !important;
    line-height: 1 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    touch-action: manipulation;
  }
  .chess-tile {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1 !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .promotion-panel {
    max-width: 90vw;
    padding: 16px;
  }
  .promotion-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .promo-choice-btn {
    padding: 12px 8px;
    font-size: 15px;
    touch-action: manipulation;
  }
}


.chess-shell[data-theme="cyber"] { --shell-bg: #050714; }
.chess-shell[data-theme="wood"] { --shell-bg: #140a05; }
.chess-shell[data-theme="nokia"] { --shell-bg: #040c04; }

.chess-shell {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  max-width: none;
  width: 100%;
}

.chess-shell:fullscreen,
.chess-shell.pseudo-fullscreen,
.chess-shell.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--shell-bg, #060a17) !important;
  z-index: 999999 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}


.chess-shell:fullscreen .game-header,
.chess-shell.pseudo-fullscreen .game-header,
.chess-shell.is-fullscreen .game-header {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  flex-shrink: 0 !important;
  background: rgba(7, 12, 24, 0.95) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 0 !important;
  padding: 8px 24px !important;
  z-index: 50 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}


.chess-shell:fullscreen .settings-sidebar:not(.mobile-open),
.chess-shell.pseudo-fullscreen .settings-sidebar:not(.mobile-open),
.chess-shell.is-fullscreen .settings-sidebar:not(.mobile-open),
.chess-shell:fullscreen .gameplay-sidebar,
.chess-shell.pseudo-fullscreen .gameplay-sidebar,
.chess-shell.is-fullscreen .gameplay-sidebar {
  display: none !important;
}


.chess-shell:fullscreen .game-viewport,
.chess-shell.pseudo-fullscreen .game-viewport,
.chess-shell.is-fullscreen .game-viewport {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  flex: 1 1 0% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  padding: 8px 16px 12px !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.chess-shell:fullscreen .chess-game-content-layout,
.chess-shell.pseudo-fullscreen .chess-game-content-layout,
.chess-shell.is-fullscreen .chess-game-content-layout,
.chess-shell:fullscreen .game-arena-container,
.chess-shell.pseudo-fullscreen .game-arena-container,
.chess-shell.is-fullscreen .game-arena-container {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}


.chess-shell:fullscreen .chess-frame-wrapper,
.chess-shell.pseudo-fullscreen .chess-frame-wrapper,
.chess-shell.is-fullscreen .chess-frame-wrapper {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: auto !important;
  width: auto !important;
  max-width: none !important;
  gap: 6px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}


.chess-shell:fullscreen .chess-board-center-column,
.chess-shell.pseudo-fullscreen .chess-board-center-column,
.chess-shell.is-fullscreen .chess-board-center-column,
.chess-shell:fullscreen .chess-status-wrapper,
.chess-shell.pseudo-fullscreen .chess-status-wrapper,
.chess-shell.is-fullscreen .chess-status-wrapper {
  width: min(calc(100dvh - 250px), calc(100vw - 32px)) !important;
  max-width: min(calc(100dvh - 250px), calc(100vw - 32px)) !important;
  gap: 6px !important;
}


.chess-shell:fullscreen .player-card,
.chess-shell.pseudo-fullscreen .player-card,
.chess-shell.is-fullscreen .player-card {
  padding: 5px 12px !important;
}

.chess-shell:fullscreen .player-avatar,
.chess-shell.pseudo-fullscreen .player-avatar,
.chess-shell.is-fullscreen .player-avatar {
  width: 28px !important;
  height: 28px !important;
  font-size: 18px !important;
}

.chess-shell:fullscreen .chess-status-message,
.chess-shell.pseudo-fullscreen .chess-status-message,
.chess-shell.is-fullscreen .chess-status-message {
  padding: 4px 12px !important;
  font-size: 12px !important;
}

.chess-shell:fullscreen .chess-grid-board-wrapper,
.chess-shell.pseudo-fullscreen .chess-grid-board-wrapper,
.chess-shell.is-fullscreen .chess-grid-board-wrapper {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}


.chess-shell:fullscreen .chess-grid-board,
.chess-shell.pseudo-fullscreen .chess-grid-board,
.chess-shell.is-fullscreen .chess-grid-board {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  container-type: size;
}


.chess-shell:fullscreen .chess-piece,
.chess-shell.pseudo-fullscreen .chess-piece,
.chess-shell.is-fullscreen .chess-piece {
  font-size: clamp(26px, 8cqmin, 80px) !important;
}

@media (max-width: 600px) {
  .chess-shell:fullscreen .game-header,
  .chess-shell.pseudo-fullscreen .game-header,
  .chess-shell.is-fullscreen .game-header {
    padding: 6px 12px !important;
  }
  .chess-shell:fullscreen .game-viewport,
  .chess-shell.pseudo-fullscreen .game-viewport,
  .chess-shell.is-fullscreen .game-viewport {
    padding: 6px 8px 10px !important;
  }
  .chess-shell:fullscreen .chess-board-center-column,
  .chess-shell.pseudo-fullscreen .chess-board-center-column,
  .chess-shell.is-fullscreen .chess-board-center-column,
  .chess-shell:fullscreen .chess-status-wrapper,
  .chess-shell.pseudo-fullscreen .chess-status-wrapper,
  .chess-shell.is-fullscreen .chess-status-wrapper {
    width: min(calc(100dvh - 210px), calc(100vw - 16px)) !important;
    max-width: min(calc(100dvh - 210px), calc(100vw - 16px)) !important;
  }
}
.chess-game-content-layout,.game-arena-container,.chess-frame-wrapper {min-width:0;max-width:100%;box-sizing:border-box}
.chess-board-center-column,#chess-board {max-width:100%;box-sizing:border-box}
@media(max-width:680px){
 .chess-game-content-layout{display:flex;flex-direction:column;align-items:stretch}
 .game-arena-container{padding:8px 4px;overflow:visible}
 .chess-frame-wrapper{padding:10px 6px;max-width:100%;overflow:visible}
 .chess-status-bar{padding:8px;gap:6px;flex-wrap:wrap}
 .chess-status-turn-text,.status-turn-text{font-size:11px;letter-spacing:0}
 .chess-board-center-column {width:100%;max-width:min(100%,calc(100vw - 24px))}
 .theme-cyber .chess-piece.white,.chess-piece.white{color:#fff!important;text-shadow:0 2px 3px #000,1px 0 #000,-1px 0 #000,0 -1px #000}
}
