/* Chess board CSS variables */
:root {
    --size: 48px;
    --label-size: 14px;
    --label-color: #fff;
}

/* Game-specific styles */
.game-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 18px;
    margin-top: 0px;
    margin-left: -1cm;
    align-items: flex-start;
    width: auto !important;
    flex-wrap: nowrap !important;
}

.game-board-section {
    background: transparent;
    border-radius: 0;
    padding: 10px;
    margin-left: calc(50px - 3cm);
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.board-area {
    display: grid;
    grid-template-columns: auto auto;
    gap: 10px;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Center Clocks - positioned on left side of board */
.center-clocks {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 0.5cm;
    height: auto;
    background: rgba(4, 6, 12, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 18px 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.04);
    backdrop-filter: blur(6px);
    outline: 1px solid rgba(53, 176, 178, 0.35);
    outline-offset: -3mm;
}

/* Stage Image */
.stage-image-container {
    text-align: center;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* Black Player Avatar Container */
.black-avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 0;
    position: relative;
    z-index: 5;
}

/* White Player Avatar Container */
.white-avatar-container {
    display: flex;
    justify-content: center;
    margin-top: 0;
    position: relative;
    z-index: 5;
}

.avatar-change-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s ease;
    z-index: 10;
}

.avatar-change-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
    transform: scale(1.1);
}

.opponent-clock-container,
.your-clock-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    width: auto;
    max-width: none;
}

.avatars-column {
    display: flex;
    flex-direction: column;
    gap: 120px;
    justify-content: space-between;
}

.player-panel {
    display: flex;
    align-items: center;
    gap: 15px;
}

.players-side {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
    margin-top: 2cm;
    margin-right: 2cm;
    margin-left: -7mm;
    transform: translateX(-2cm);
}

.player-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.opponent-section {
    order: 1;
    flex-direction: column;
    align-items: center;
    margin-left: -12px;
    margin-top: -60px;
}

.your-section {
    order: 2;
    flex-direction: column;
    align-items: center;
    margin-top: -60px;
    margin-left: -11px;
}

/* Flip state - swap order of sections and reverse internal order */
.board-flipped .opponent-section {
    order: 2;
}
.board-flipped .your-section {
    order: 1;
}

/* Flip stacking of children so clock stays in center */
.opponent-section .player-details { order: 1; }
.opponent-section .clock-avatar { order: 2; }
.opponent-section .board-clock-container { order: 3; }

.your-section .board-clock-container { order: 1; }
.your-section .clock-avatar { order: 2; }
.your-section .player-details { order: 3; }

.board-flipped .opponent-section .player-details { order: 3; }
.board-flipped .opponent-section .clock-avatar { order: 2; }
.board-flipped .opponent-section .board-clock-container { order: 1; }

.board-flipped .your-section .board-clock-container { order: 3; }
.board-flipped .your-section .clock-avatar { order: 2; }
.board-flipped .your-section .player-details { order: 1; }

.board-flipped .player-name {
    transform: rotate(180deg);
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: center;
    text-align: center;
}

.player-name {
    font-weight: bold;
    color: var(--light);
    font-size: 0.9rem;
}

/* Player name and rating styling for left-side display */
.opponent-clock-container .player-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 120px;
}

.opponent-clock-container .player-rating {
    color: var(--gold);
    font-size: 0.8rem;
    font-weight: bold;
}

.opponent-clock-container .player-score {
    display: none;
}

.your-clock-container .player-score {
    display: none;
}

/* Position black player's score in top left */
.black-score {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: 'Arial Black', Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
    border: 3px solid #7d3c98;
    backdrop-filter: blur(30px);
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

.opponent-clock-container .player-clock {
    display: block;
}

/* White player name and rating styling */
.your-clock-container .player-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 120px;
}

.your-clock-container .player-rating {
    color: var(--gold);
    font-size: 0.8rem;
    font-weight: bold;
}

.clock-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none !important;
    box-shadow: none !important;
    border: none !important;
}

.opponent-avatar {
    background: none !important;
    box-shadow: none !important;
    position: relative;
}

.small-avatar {
    width: 80px;
    height: 80px;
    border-radius: 60%;
    border: 3px solid white;
    object-fit: cover;
}

.avatar-score {
    position: absolute;
    top: -8px;
    left: -8px;
    background: var(--secondary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid var(--gold);
}

.your-section .avatar-score {
    top: auto;
    bottom: 80px;
    left: 3px;
}

.board-area > .board-container {
    grid-column: 2;
    grid-row: 1;
}

.board-clock-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-info-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-height: 100vh;
    overflow-y: auto;
    margin-top: 0;
    padding-bottom: 5cm;
}

/* Chess Board Styles */
:root {
    --size: clamp(60px, min(calc((100vh - 180px) / 8), calc((100vw - 460px) / 8)), 125px);
    --light: #f0d9b5;
    --dark: #b58863;
    --accent: #3498db;
    --label-color: rgba(255, 255, 255, 0.7);
    --label-size: 12px;
}

.board-container {
    width: fit-content;
    min-width: calc(8 * var(--size) + 10mm);
    margin: 0 auto;
    margin-top: 7mm;
    margin-left: -4cm;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(4, 6, 12, 0.82);
    border: 2px solid rgba(53, 176, 178, 0.45);
    border-radius: 14px;
    padding: 4px 6mm 4px 5mm;
    box-shadow: 0 4px 24px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.04);
    backdrop-filter: blur(6px);
    outline: 1px solid rgba(53, 176, 178, 0.18);
    outline-offset: 3px;
}

.coins-display {
    position: relative;
    margin-bottom: 20px;
    margin-top: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    top: calc(1cm + 3mm);
    left: calc(5cm - 1mm);
    align-items: center;
    gap: 10px;
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.board-frame {
    position: relative;
    width: calc(8 * var(--size));
    box-sizing: content-box;
    border: 2px solid #3498db;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    user-select: none;
    margin: 0 auto;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 100%;
    background: transparent;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.square.drag-over {
    box-shadow: inset 0 0 0 3px rgba(255, 255, 100, 0.9);
}

.square {
    width: var(--size);
    height: var(--size);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Board colors are set by JavaScript */
/*
.square.light {
    background: #e3caa5;
}

.square.dark {
    background: #6b5344;
}
*/

.piece {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
    width: 100%;
    height: 100%;
    font-size: 45px;
    font-weight: bold;
    font-family: "Segoe UI", "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
    transform: scale(0.98);
}

.coord {
    display: none;
}

.rank-labels {
    position: absolute;
    left: -28px;
    top: 0;
    bottom: 0;
    width: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px 3px;
    box-sizing: border-box;
}

.rank-label {
    font-size: var(--label-size);
    color: var(--label-color);
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--size);
}

.file-labels {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -19px;
    height: 16px;
    display: flex;
    gap: 0;
    justify-content: space-between;
    padding: 1px;
    box-sizing: border-box;
}

.file-label {
    font-size: var(--label-size);
    color: var(--label-color);
    width: var(--size);
    text-align: center;
}

.square.selected {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.square.last-move-sq {
    box-shadow: inset 0 0 0 2px var(--club-color, #35b0b2),
                inset 0 0 10px color-mix(in srgb, var(--club-color, #35b0b2) 50%, transparent);
}

.square.king-in-check {
    background-color: #e74c3c !important;
    box-shadow: inset 0 0 0 2px #c0392b;
}

.square.premove-highlight {
    background-color: rgba(52, 152, 219, 0.5) !important;
}

.square.right-click-highlight {
    background-color: rgba(231, 76, 60, 0.75) !important;
}

.square.hint::after {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    position: absolute;
}

.drag-clone {
    position: fixed;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: var(--size);
    height: var(--size);
}

  .board-controls {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-top: 100px;
      margin-left: 100px;
      flex-wrap: wrap;
      width: 100%;
  }

.control-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: rgba(52, 152, 219, 0.3);
    transform: translateY(-2px);
}

.control-btn.active {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 25%, transparent) !important;
    color: var(--club-color, #35b0b2) !important;
    border-color: color-mix(in srgb, var(--club-color, #35b0b2) 45%, transparent) !important;
}

.flip-icon-btn {
    position: absolute;
    bottom: -50px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(52, 152, 219, 0.2);
    color: var(--secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.flip-icon-btn:hover {
    background: rgba(52, 152, 219, 0.4);
    color: var(--secondary);
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.flip-icon-btn:active {
    transform: scale(0.95);
}

.board-status {
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
    color: var(--light);
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    width: 100%;
    max-width: 476px;
}

.player-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    position: relative;
}

.player-info.opponent {
    border: 2px solid var(--accent);
}

.player-info.you {
    border: 2px solid var(--secondary);
}

.player-avatar {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    border: 4px solid #333333;
    object-fit: cover;
}

.player-name {
    font-weight: bold;
    color: var(--light);
    font-size: 0.95rem;
}

.player-rating {
    color: var(--gold);
    font-size: 0.8rem;
}

.player-clock {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--light);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    width: 90px;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.player-clock.low-time {
    color: #e74c3c;
    animation: pulse 1s infinite;
}

/* Active clock — ticking side gets a teal glow */
.player-clock.active-clock {
    border-color: #35b0b2;
    box-shadow: 0 0 10px rgba(53, 176, 178, 0.6), 0 2px 10px rgba(0,0,0,0.2);
    color: #fff;
}

.opponent-clock-container:has(.active-clock) .clock-icon,
.your-clock-container:has(.active-clock) .clock-icon {
    color: #35b0b2 !important;
}

.opponent-clock-container:has(.player-clock.low-time) .clock-icon,
.your-clock-container:has(.player-clock.low-time) .clock-icon {
    color: #e74c3c !important;
    animation: pulse 1s infinite;
}

.player-info-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.player-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.player-info-right {
    text-align: right;
    min-width: 80px;
}

.player-info-text {
    text-align: left;
    flex: 1;
}

.player-status {
    font-size: 0.85rem;
    color: #95a5a6;
    font-style: italic;
}

.score-indicator {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--gold);
    color: #1a252f;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    display: none;
}

.score-indicator.winner {
    background: #2ecc71;
    color: white;
}

.score-indicator.loser {
    background: #e74c3c;
    color: white;
}

.game-controls-panel {
    background: url('Concept Background Dark.png') no-repeat center center / cover;
    border-radius: 10px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 0;
    height: 0;
    overflow: hidden;
    border: 2px solid #0A1A30;
}

#darkModeBtn {
    position: absolute;
    right: -1.3cm;
    top: 165px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#piecesBtn {
    position: absolute;
    right: -1.3cm;
    top: 215px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#boardBtn {
    position: absolute;
    right: -1.3cm;
    top: 265px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#promoteToggle {
    position: absolute;
    right: -1.3cm;
    top: 315px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#newGameBtn {
    position: absolute;
    right: -1.3cm;
    top: 125px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#drawBtn {
    position: absolute;
    right: -1.3cm;
    top: 85px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#resignBtn {
    position: absolute;
    right: -1.3cm;
    top: 45px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#rematchBtn {
    position: absolute;
    right: -1.3cm;
    top: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#promoteToggle.active {
    background: var(--secondary) !important;
    color: white;
}

#fullscreen-btn {
    position: absolute !important;
    right: -1.3cm !important;
    top: 365px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(52, 152, 219, 0.2) !important;
    color: var(--secondary) !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 18px !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

#fullscreen-btn:hover {
    background: rgba(52, 152, 219, 0.4) !important;
    color: var(--secondary) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

#analyzeToggleBtn {
    position: absolute !important;
    right: -1.3cm !important;
    top: 460px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(52, 152, 219, 0.2) !important;
    color: var(--secondary) !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 18px !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

#analyzeToggleBtn:hover {
    background: rgba(0, 230, 118, 0.25) !important;
    color: #00e676 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

#analyzeToggleBtn.active {
    background: rgba(0, 230, 118, 0.2) !important;
    color: #00e676 !important;
}

/* #flipBtn positioned via JS — no CSS override needed */

#flipBtn:hover {
    background: rgba(52, 152, 219, 0.4) !important;
    color: var(--secondary) !important;
    transform: scale(1.1) rotate(180deg) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

#flipBtn:active {
    transform: scale(0.95) !important;
}

.right-side-content {
    display: flex;
    flex-direction: column;
    gap: 0px;
    height: 100%;
    width: 260px;
    flex-shrink: 0;
    margin-left: 0;
    background: url('Concept Background.png') no-repeat center center / cover;
}

.new-game-btn {
    background: url('Concept Background2.png') no-repeat center center / cover;
    color: #f0d9b5;
    border: 2px solid #0A1A30;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.new-game-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.new-game-btn:active {
    transform: translateY(0);
}

.resign-btn {
    background: url('Concept Background2.png') no-repeat center center / cover;
    color: #f0d9b5;
    border: 2px solid #0A1A30;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.resign-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.resign-btn:active {
    transform: translateY(0);
}

.draw-btn {
    background: url('Concept Background2.png') no-repeat center center / cover;
    color: #f0d9b5;
    border: 2px solid #0A1A30;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.draw-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.draw-btn:active {
    transform: translateY(0);
}

.right-side-wrapper {
    margin-top: 150px;
    margin-right: 0;
}
/* make it click-through, but restore auto on its interactive children */
.game-info-section {
    pointer-events: none;
}
.game-info-section button,
.game-info-section a,
.game-info-section input,
.game-info-section select,
.game-info-section .tab-header,
.game-info-section .control-btn,
.game-info-section .central-tokens,
#teamLivePanelHeader {
    pointer-events: auto;
}

.game-tabs {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: visible;
    flex: 1;
    width: 100%;
    min-height: 5cm;
    padding-bottom: 5cm;
}

.tab-headers {
    display: flex;
    background: rgba(26, 37, 47, 0.9);
}

.tab-header {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: var(--light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 0;
    box-sizing: border-box;
}

.tab-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-header.active {
    background: var(--secondary);
    color: white;
    border-bottom: 2px solid var(--gold);
}

.tab-content {
    padding: 12px;
    height: 300px;
    overflow-y: auto;
}

#movesTab,
#chatTab {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#movesList {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 4px 12px;
    pointer-events: auto;
}

#moveNavigation {
    flex-shrink: 0;
    padding: 6px 0 10px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(30, 30, 30, 0.9);
    margin-top: auto;
}

.moves-list {
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.3;
}

.move-item {
    padding: 3px 6px;
    border-radius: 5px;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.move-number {
    color: #95a5a6;
    min-width: 22px;
    font-size: 0.75rem;
}

.move-annot {
    min-width: 52px;
    display: flex;
    gap: 2px;
    justify-content: flex-end;
    align-items: center;
}

.move-annot-badge {
    font-size: 0.68rem;
    font-weight: bold;
    border-radius: 4px;
    padding: 1px 4px;
    white-space: nowrap;
    cursor: default;
}

.move-white, .move-black {
    flex: 1;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
    padding: 1px 2px;
    transition: background 0.15s ease;
}

.move-white:hover, .move-black:hover {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 14%, transparent);
}

.move-white.current-move, .move-black.current-move {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 32%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--club-color, #35b0b2) 60%, transparent);
}

.move-white.viewing-move, .move-black.viewing-move {
    background: rgba(46, 204, 113, 0.32);
    box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.6);
}

.move-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(30, 30, 30, 0.9);
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 5px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.6rem;
}

.move-navigation .nav-btn i {
    font-size: inherit;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(52, 152, 219, 0.3);
    transform: translateY(-2px);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.move-navigation .nav-btn {
    background: #2c3e50;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.move-navigation .nav-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.move-navigation .nav-btn:hover svg {
    filter: drop-shadow(0 0 3px #35b0b2);
}

.move-navigation .nav-btn:hover:not(:disabled) {
    background: #35B0B2;
    color: #ffffff;
    border-color: #35B0B2;
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(53, 176, 178, 0.7);
}

.move-navigation .nav-btn:active:not(:disabled) {
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-position {
    font-size: 0.72rem;
    color: #ffffff;
    min-width: 30px;
    flex-shrink: 0;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    background: rgba(30, 30, 30, 0.9);
    border-radius: 8px;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 20px;
    line-height: 25px;
}

.game-result {
    background: url('Concept Background.png') no-repeat center center / cover;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--gold);
    border: 2px solid #0A1A30;
    margin-top: 10px;
    display: none;
}

.game-result.win {
    background: rgba(46, 204, 113, 0.1);
    border-color: #2ecc71;
}

.game-result.loss {
    background: rgba(231, 76, 60, 0.1);
    border-color: #e74c3c;
}

.game-result.draw {
    background: rgba(241, 196, 15, 0.1);
    border-color: #f1c40f;
}

.game-export {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.export-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #0A1A30;
    border-radius: 10px;
    background: url('Concept Background.png') no-repeat center center / cover;
    color: var(--light);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
}

.export-btn:hover {
    background: rgba(52, 152, 219, 0.3);
    transform: translateY(-2px);
}

.export-btn.download {
    background: rgba(46, 204, 113, 0.2);
}

.export-btn.share {
    background: rgba(155, 89, 182, 0.2);
}

.rematch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    display: none;
}

.rematch-box {
    background: url('Concept Background.png') no-repeat center center / cover;
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 2px solid #122e45;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.rematch-title {
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.rematch-result {
    font-size: 1.2rem;
    color: var(--light);
    margin-bottom: 25px;
}

.rematch-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.rematch-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 180px;
}

.rematch-btn.rematch {
    background: linear-gradient(45deg, #35b0b2, #2980b9);
    color: white;
}

.rematch-btn.lobby {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
}

.rematch-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    padding: 10px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.chat-input-area {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    font-size: 0.85rem;
}

.send-btn {
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0 15px;
    cursor: pointer;
    font-size: 0.85rem;
}

.chat-message {
    margin-bottom: 8px;
    padding: 5px 8px;
    border-radius: 4px;
}

.chat-message.self {
    background: rgba(52, 152, 219, 0.1);
}

.spectators-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.spectator-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.spectator-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--secondary);
    object-fit: cover;
}

.spectator-info {
    flex: 1;
}

.spectator-name {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--light);
}

.spectator-rating {
    font-size: 0.75rem;
    color: #95a5a6;
}

.time-control-info {
    background: url('Concept Background2.png') no-repeat center center / cover;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--light);
    border: 2px solid #0A1A30;
    margin-top: 0;
    margin-left: 1cm;
    margin-right: auto;
    width: 260px;
    align-self: flex-start;
}

.time-control-label {
    color: var(--accent-teal);
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.time-control-label img {
    width: 2.5em;
    height: 2.5em;
    object-fit: contain;
}

.time-option {
    padding: 6px 4px !important;
    font-size: 0.8rem !important;
    min-width: 60px;
    max-width: 90px;
}

.time-option h4 {
    font-size: 0.9rem !important;
}

.time-option p {
    font-size: 0.7rem !important;
}

@media (max-width: 1200px) {
    .game-board-section {
        margin-left: calc(0px - 3cm);
        background: transparent;
        border-radius: 0;
        padding: 5px;
    }
}

@media (max-width: 768px) {
    .game-controls-panel {
        flex-direction: column;
    }
    .control-btn {
        width: 100%;
    }
    .board {
        grid-template-columns: repeat(8, var(--size));
    }
    :root {
        --size: 36.12px;
    }
    .rematch-buttons {
        flex-direction: column;
    }
    .rematch-btn {
        width: 100%;
        min-width: unset;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================== */
/* COMPACT HEADER FOR GAME MODE */
/* =========================================== */

body.game-mode {
    padding-top: 0;
    overflow-x: hidden;
}

/* Make entire header smaller */
body.game-mode .header {
    height: 45px !important;
    min-height: 45px !important;
    padding: 0 15px !important;
    background: #0a1929 !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
}

/* Make logo smaller */
body.game-mode .logo {
    font-size: 1.1rem !important;
    padding: 6px 10px !important;
    background: transparent !important;
    border: none !important;
}

body.game-mode .logo i {
    font-size: 0.9rem !important;
}

/* Move nav links to the right */
body.game-mode .nav-links {
    margin-left: auto !important;
    margin-right: 20px !important;
    gap: 5px !important;
}

body.game-mode .nav-link {
    padding: 5px 8px !important;
    font-size: 0.8rem !important;
    gap: 4px !important;
    border-radius: 4px !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

body.game-mode .nav-link:hover {
    background: rgba(52, 152, 219, 0.2) !important;
    transform: translateY(-1px) !important;
}

body.game-mode .nav-link i {
    font-size: 0.8rem !important;
}

/* Hide nav text on smaller screens */
@media (max-width: 1200px) {
    body.game-mode .nav-link span:not(.fa) {
        display: none;
    }
    body.game-mode .nav-link {
        padding: 6px !important;
        width: 30px !important;
        height: 30px !important;
        justify-content: center !important;
    }
    body.game-mode .nav-link i {
        margin: 0 !important;
        font-size: 0.9rem !important;
    }
}

/* Make user area compact */
body.game-mode .user-area {
    gap: 10px !important;
}

body.game-mode .quick-play-header {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
    gap: 4px !important;
    margin-left: 0 !important;
}

/* Hide quick play text */
@media (max-width: 1200px) {
    body.game-mode .quick-play-header span {
        display: none;
    }
    body.game-mode .quick-play-header {
        padding: 6px !important;
        width: 30px !important;
        height: 30px !important;
        justify-content: center !important;
    }
}

/* Make user stats compact */
body.game-mode .user-stats {
    padding: 4px 8px !important;
    gap: 12px !important;
    font-size: 0.8rem !important;
}

body.game-mode .stat-item {
    gap: 4px !important;
}

body.game-mode .stat-value {
    font-size: 0.85rem !important;
}

/* Hide stat labels */
@media (max-width: 992px) {
    body.game-mode .user-stats span:not(.stat-value):not(.fa) {
        display: none;
    }
    body.game-mode .stat-item {
        gap: 3px !important;
    }
}

/* Make avatar smaller */
body.game-mode .avatar-small {
    width: 32px !important;
    height: 32px !important;
}

body.game-mode .crown {
    width: 16px !important;
    height: 16px !important;
    font-size: 0.6rem !important;
    top: -4px !important;
    right: -4px !important;
}

/* Adjust container for fixed header */
body.game-mode .container {
    margin-top: 45px !important;
    height: calc(100vh - 45px) !important;
    padding: 10px !important;
    width: 100% !important;
    max-width: none !important;
}

/* Adjust board section */
body.game-mode .game-board-section {
    margin-left: calc(10px - 3cm) !important;
    padding: 5px !important;
    background: transparent !important;
    border-radius: 0 !important;
}

/* Adjust game info */
body.game-mode .game-info-section {
    gap: 8px !important;
}

body.game-mode .player-info {
    padding: 10px !important;
}

body.game-mode .player-clock {
    font-size: 1.5rem !important;
    padding: 6px !important;
    margin: 6px 0 !important;
}

/* Tabs smaller */
body.game-mode .tab-header {
    padding: 8px !important;
    font-size: 0.8rem !important;
}

body.game-mode .tab-content {
    padding: 10px !important;
    height: 280px !important;
    font-size: 0.8rem !important;
}

/* Move list smaller */
body.game-mode .moves-list {
    font-size: 0.75rem !important;
}

body.game-mode .move-item {
    padding: 2px 4px !important;
    margin-bottom: 2px !important;
}

/* Game controls smaller */
body.game-mode .game-controls-panel {
    padding: 10px !important;
    gap: 6px !important;
}

body.game-mode .control-btn {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    gap: 5px !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    body.game-mode .header {
        height: 40px !important;
        padding: 0 10px !important;
    }
    body.game-mode .logo {
        font-size: 1rem !important;
    }
    body.game-mode .nav-links {
        margin-right: 10px !important;
        gap: 3px !important;
    }
    body.game-mode .nav-link {
        padding: 4px !important;
        width: 26px !important;
        height: 26px !important;
    }
    body.game-mode .user-stats {
        display: none !important;
    }
    body.game-mode .quick-play-header {
        display: none !important;
    }
    body.game-mode .avatar-small {
        width: 28px !important;
        height: 28px !important;
    }
    body.game-mode .container {
        margin-top: 40px !important;
        height: calc(100vh - 40px) !important;
        padding: 5px !important;
    }
    body.game-mode .game-board-section {
        padding: 10px !important;
    }
    body.game-mode :root {
        --size: 36.12px;
    }
}

@media (max-width: 480px) {
    body.game-mode .header {
        height: 36px !important;
    }
    body.game-mode .logo span {
        display: none;
    }
    body.game-mode .logo {
        padding: 4px !important;
        width: 32px !important;
        height: 32px !important;
        justify-content: center !important;
    }
    body.game-mode .nav-links {
        display: none !important;
    }
    body.game-mode .avatar-small {
        width: 24px !important;
        height: 24px !important;
    }
    body.game-mode .container {
        margin-top: 36px !important;
        height: calc(100vh - 36px) !important;
        padding: 3px !important;
    }
    body.game-mode :root {
        --size: 28.52px;
    }
}

/* Animation for smooth transitions */
body.game-mode .header,
body.game-mode .logo,
body.game-mode .nav-link,
body.game-mode .control-btn {
    transition: all 0.2s ease;
}
/* Premove styles */
.square.premove-from {
    box-shadow: inset 0 0 0 3px #3498db !important;
    background: rgba(52, 152, 219, 0.2) !important;
}

.square.premove-to {
    box-shadow: inset 0 0 0 3px #2ecc71 !important;
    background: rgba(46, 204, 113, 0.2) !important;
    position: relative;
}

.square.premove-hint {
    position: relative;
}

.square.premove-hint::after {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(155, 89, 182, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #9b59b6;
}

.premove-piece-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(155, 89, 182, 0.8);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    z-index: 10;
    pointer-events: none;
}
/* Make premove hints more visible */
.square.premove-hint {
    position: relative;
    z-index: 10;
}

.square.premove-hint::after {
    content: '';
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: rgba(155, 89, 182, 0.5);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #9b59b6;
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.8);
    animation: pulse 1s infinite;
}

.premove-piece-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    color: rgba(155, 89, 182, 0.9);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    z-index: 11;
    pointer-events: none;
}

.square.premove-from {
    box-shadow: inset 0 0 0 4px #3498db !important;
    background: rgba(52, 152, 219, 0.4) !important;
}

.square.premove-to {
    box-shadow: inset 0 0 0 4px #2ecc71 !important;
    background: rgba(46, 204, 113, 0.4) !important;
}
/* Enhanced premove styles */
.square.premove-from {
    box-shadow: inset 0 0 0 5px #3498db !important;
    background: rgba(52, 152, 219, 0.3) !important;
    z-index: 10;
}

.square.premove-to {
    box-shadow: inset 0 0 0 5px #2ecc71 !important;
    background: rgba(46, 204, 113, 0.3) !important;
    z-index: 10;
}

.square.premove-hint {
    position: relative !important;
    overflow: visible !important;
}

.premove-piece-hint {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 24px !important;
    color: rgba(155, 89, 182, 0.9) !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8) !important;
    z-index: 100 !important;
    pointer-events: none !important;
    opacity: 0.8 !important;
}

/* Pulse animation for premove hints */
@keyframes premove-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

.premove-piece-hint {
    animation: premove-pulse 1s infinite;
}
/* Enhanced premove styles */
.square.premove-hint {
    position: relative;
    overflow: visible !important;
}

.premove-piece-hint {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 28px !important;
    color: rgba(155, 89, 182, 0.9) !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8) !important;
    z-index: 1000 !important;
    pointer-events: none !important;
    opacity: 0.9 !important;
    animation: premove-pulse 1s infinite;
}

@keyframes premove-pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 0.9; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.1); 
        opacity: 1; 
    }
}

.square.premove-from {
    box-shadow: inset 0 0 0 5px #3498db !important;
    background: rgba(52, 152, 219, 0.3) !important;
}

.square.premove-to {
    box-shadow: inset 0 0 0 5px #2ecc71 !important;
    background: rgba(46, 204, 113, 0.3) !important;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-box {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 2px solid #f1c40f;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ecf0f1;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-message {
    color: #bdc3c7;
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Coin Particle Effects */
.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    flex: 1;
}

.modal-btn.confirm {
    background: #e74c3c;
    color: white;
}

.modal-btn.confirm:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}

.modal-btn.cancel {
    background: #7f8c8d;
    color: white;
}

.modal-btn.cancel:hover {
    background: #95a5a6;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(127, 140, 141, 0.3);
}

/* Shortcut buttons in lobby header */
.nav-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    margin-left: 32px;
}
.quick-play-shortcut, .tournament-shortcut {
    background: rgba(255,255,255,0.07);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--light);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.quick-play-shortcut:hover, .tournament-shortcut:hover {
    background: rgba(52,152,219,0.18);
    color: var(--gold);
}

/* Fix opponent and player info layout */
.opponent-info, .player-info-container {
    position: relative;
    z-index: 20;
    margin-bottom: 15px;
}

.opponent-info .rating-badge,
.player-info-container .rating-badge {
    position: static;
    left: auto;
}

.opponent-info .username,
.player-info-container .username {
    position: static;
    left: auto;
}

/* ═══════════════════════════════════════════════════════════
   RIGHT PANEL REDESIGN
   ═══════════════════════════════════════════════════════════ */

/* Right column — transparent so only the bordered panels show black */
.right-side-content {
    background: transparent !important;
}

/* Match title bar (TEAM MATCH / 1 min Bullet) */
#matchTitleBar {
    background: transparent !important;
    border-bottom: none !important;
}

/* Controls grid — was id-only so .game-controls-panel didn't match */
#gameControlsPanel {
    background: #000 !important;
    border: 1px solid var(--club-color, #35b0b2) !important;
    box-shadow: 0 0 8px color-mix(in srgb, var(--club-color, #35b0b2) 30%, transparent) !important;
    border-radius: 10px !important;
    padding: 6px !important;
}

/* Team live panel header + body */
#teamLivePanelHeader,
#teamLivePanelBody {
    background: #000 !important;
}
#teamLivePanelHeader {
    border-bottom: 1px solid var(--club-color, #35b0b2) !important;
}

/* Time control card */
.time-control-info {
    background: #000 !important;
    border: 1px solid var(--club-color, #35b0b2) !important;
    box-shadow: 0 0 8px color-mix(in srgb, var(--club-color, #35b0b2) 30%, transparent) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    width: auto !important;
    align-self: stretch !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: left !important;
    margin-bottom: 6px !important;
    gap: 12px !important;
}

.time-control-label {
    font-size: 0.68rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    color: var(--club-color, #35b0b2) !important;
    margin-bottom: 0 !important;
}

.time-control-label img {
    width: 1.3em !important;
    height: 1.3em !important;
}

#timeControlDisplay {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    color: var(--club-color, #35b0b2) !important;
    letter-spacing: 0.3px !important;
}

/* Controls panel */
.game-controls-panel {
    background: #000 !important;
    border: 1px solid var(--club-color, #35b0b2) !important;
    box-shadow: 0 0 8px color-mix(in srgb, var(--club-color, #35b0b2) 30%, transparent) !important;
    border-radius: 10px !important;
    padding: 8px 10px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: center !important;
    height: auto !important;
    overflow: visible !important;
    margin-bottom: 6px !important;
}

/* Pull all buttons back out of absolute positioning */
.control-btn,
#darkModeBtn, #piecesBtn, #boardBtn, #promoteToggle,
#newGameBtn, #drawBtn, #resignBtn, #rematchBtn,
#fullscreen-btn, #analyzeToggleBtn {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: #8899aa !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    font-size: 0.82rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s !important;
    box-shadow: none !important;
    transform: none !important;
}

.control-btn:hover,
#darkModeBtn:hover, #piecesBtn:hover, #boardBtn:hover, #promoteToggle:hover,
#newGameBtn:hover, #drawBtn:hover, #rematchBtn:hover,
#fullscreen-btn:hover, #flipBtn:hover, #analyzeToggleBtn:hover {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 18%, transparent) !important;
    color: var(--club-color, #35b0b2) !important;
    border-color: color-mix(in srgb, var(--club-color, #35b0b2) 35%, transparent) !important;
    transform: translateY(-1px) !important;
}

/* Resign — red accent on hover */
#resignBtn:hover {
    background: rgba(231, 76, 60, 0.18) !important;
    color: #e74c3c !important;
    border-color: rgba(231, 76, 60, 0.35) !important;
}

/* Draw — yellow accent on hover */
#drawBtn:hover {
    background: rgba(241, 196, 15, 0.18) !important;
    color: #f1c40f !important;
    border-color: rgba(241, 196, 15, 0.35) !important;
}

/* Flip — spin on hover */
#flipBtn:hover {
    transform: translateY(-1px) rotate(180deg) !important;
}

/* Analyze active state */
#analyzeToggleBtn.active {
    background: rgba(0, 230, 118, 0.15) !important;
    color: #00e676 !important;
    border-color: rgba(0, 230, 118, 0.3) !important;
}

/* Autopromote active */
#promoteToggle.active {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 20%, transparent) !important;
    color: var(--club-color, #35b0b2) !important;
    border-color: color-mix(in srgb, var(--club-color, #35b0b2) 40%, transparent) !important;
}

/* Tabs container */
.game-tabs {
    background: #000 !important;
    border: 1px solid var(--club-color, #35b0b2) !important;
    box-shadow: 0 0 8px color-mix(in srgb, var(--club-color, #35b0b2) 30%, transparent) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
}

/* Tab header bar */
.tab-headers {
    display: flex !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-bottom: 1px solid var(--club-color, #35b0b2) !important;
    border-radius: 10px 10px 0 0 !important;
    padding: 5px 5px 0 5px !important;
    gap: 4px !important;
}

.tab-header {
    flex: 1 !important;
    padding: 7px 10px !important;
    border-radius: 7px 7px 0 0 !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    color: #6a7f93 !important;
    background: transparent !important;
    border: none !important;
    transition: color 0.15s, background 0.15s !important;
    cursor: pointer !important;
}

.tab-header:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #aabccc !important;
}

.tab-header.active {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 15%, transparent) !important;
    color: var(--club-color, #35b0b2) !important;
    border: 1px solid color-mix(in srgb, var(--club-color, #35b0b2) 30%, transparent) !important;
    border-bottom: none !important;
}

/* Move navigation bar */
#moveNavigation {
    background: rgba(0, 0, 0, 0.2) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 7px 0 8px !important;
}

.move-navigation .nav-btn {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 6px !important;
    color: #8899aa !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.move-navigation .nav-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 18%, transparent) !important;
    color: var(--club-color, #35b0b2) !important;
    transform: none !important;
}

/* Chat header */
.chat-header {
    border-bottom: 1px solid color-mix(in srgb, var(--club-color, #35b0b2) 30%, transparent) !important;
    padding-bottom: 8px !important;
    margin-bottom: 8px !important;
}

.chat-header h4 {
    color: var(--club-color, #35b0b2) !important;
    font-size: 0.85rem !important;
}

.chat-header i {
    color: var(--club-color, #35b0b2) !important;
}

.mute-toggle {
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.78rem !important;
    cursor: pointer !important;
}

.mute-toggle:hover {
    color: var(--club-color, #35b0b2) !important;
}

/* Chat messages area */
.chat-messages {
    background: transparent !important;
    padding: 4px 0 !important;
    height: auto !important;
}

/* Individual messages */
.chat-message {
    background: rgba(255,255,255,0.04) !important;
    border-left: 2px solid var(--sender-color, color-mix(in srgb, var(--club-color, #35b0b2) 50%, transparent)) !important;
    border-radius: 0 6px 6px 0 !important;
    padding: 5px 8px !important;
    margin-bottom: 6px !important;
    font-size: 0.8rem !important;
    max-width: 100% !important;
    color: rgba(255,255,255,0.85) !important;
}

.chat-message strong {
    color: var(--sender-color, var(--club-color, #35b0b2)) !important;
}

.chat-message.self {
    background: color-mix(in srgb, var(--sender-color, var(--club-color, #35b0b2)) 10%, transparent) !important;
}

/* Chat input */
.chat-input {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #e8f4fd !important;
    font-size: 0.82rem !important;
}

.chat-input:focus {
    outline: none !important;
    border-color: color-mix(in srgb, var(--club-color, #35b0b2) 40%, transparent) !important;
    background: rgba(255, 255, 255, 0.09) !important;
}

.send-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    background: color-mix(in srgb, var(--club-color, #35b0b2) 70%, transparent) !important;
    border: none !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.82rem !important;
    flex-shrink: 0 !important;
    transition: background 0.18s !important;
}

.send-btn:hover {
    background: var(--club-color, #35b0b2) !important;
}

/* Right side content spacing */
.right-side-content {
    gap: 6px !important;
    width: calc(185px + 1.5cm) !important;
}

.game-info-section {
    width: calc(185px + 1.5cm) !important;
    max-width: calc(185px + 1.5cm) !important;
}

.game-controls-panel {
    width: 100% !important;
}

/* ── Icon alignment fix ───────────────────────────────────── */
.game-controls-panel .control-btn,
.game-controls-panel #darkModeBtn,
.game-controls-panel #piecesBtn,
.game-controls-panel #boardBtn,
.game-controls-panel #promoteToggle,
.game-controls-panel #newGameBtn,
.game-controls-panel #drawBtn,
.game-controls-panel #resignBtn,
.game-controls-panel #rematchBtn,
.game-controls-panel #fullscreen-btn,
.game-controls-panel #flipBtn,
.game-controls-panel #analyzeToggleBtn {
    width: 20px !important;
    height: 22px !important;
    padding: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 26px !important;
    line-height: 1 !important;
    font-size: 0.68rem !important;
}

.game-controls-panel .control-btn i,
.game-controls-panel .control-btn svg {
    display: block !important;
    line-height: 1 !important;
    margin: 0 !important;
    pointer-events: none !important;
}

/* Fix flip button — reset bottom/left too, override .flip-icon-btn class */
.game-controls-panel #flipBtn,
.game-controls-panel .flip-icon-btn {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: auto !important;
    height: 32px !important;
    padding: 0 !important;
    gap: 0 !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
}

.game-controls-panel {
    margin-left: 0 !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    padding: 3px !important;
    justify-content: stretch !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.game-controls-panel .control-btn,
.game-controls-panel #flipBtn,
.game-controls-panel .flip-icon-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    height: 32px !important;
    position: relative !important;
    top: auto !important; right: auto !important;
    bottom: auto !important; left: auto !important;
}

/* Extend moves/chat tab area down by 3cm */
.game-tabs {
    min-height: calc(300px + 3cm) !important;
}

.tab-content {
    height: calc(300px + 3cm) !important;
}

/* Reduce tab height by 1cm (net +2cm from original) */
.game-tabs {
    min-height: calc(300px + 2cm) !important;
}

.tab-content {
    height: calc(300px + 2cm) !important;
}

/* Remove scrollbar from tab content */
.tab-content::-webkit-scrollbar,
#movesTab::-webkit-scrollbar,
#movesList::-webkit-scrollbar,
#chatTab::-webkit-scrollbar {
    width: 0 !important;
    display: none !important;
}

.tab-content,
#movesTab,
#movesList,
#chatTab {
    scrollbar-width: none !important;
}

/* Desktop: let the layout paint freely (players-side uses negative transforms) */
html, body {
    overflow: unset !important;
    height: unset !important;
}

/* game-info-section scrolls internally so moves/chat are reachable */
.game-info-section {
    overflow-y: auto !important;
    padding-bottom: 0 !important;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.game-info-section::-webkit-scrollbar {
    width: 0 !important;
    display: none !important;
}

html, body, .game-info-section {
    scrollbar-width: none !important;
}

/* Hide time-control display from all areas except the left sidebar */
.time-control-info { display: none !important; }
.right-side-wrapper #timeControlIcon, .right-side-wrapper #timeControlDisplay, .right-side-wrapper #timeControlLabel { display: none !important; }
.players-side .time-control-info, .center-clocks .time-control-info { display: none !important; }

.tab-headers { display:flex !important; width:100% !important; }
.tab-header { flex:1 !important; text-align:center !important; }
.tab-header { padding: 8px 4px !important; font-size: 0.78rem !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
#flipBtn { position: fixed !important; }
.game-controls-panel .control-btn { height: 32px !important; width: 100% !important; }
.game-controls-panel .control-btn { height: 40px !important; width: 100% !important; font-size: 1rem !important; }

.game-controls-panel {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 3px !important;
    padding: 3px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
.game-controls-panel .control-btn {
    width: 100% !important;
    height: 40px !important;
    font-size: 1rem !important;
    flex: unset !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
#piecesBtn, #boardBtn, #promoteToggle, #drawBtn, #resignBtn, #abortBtn, #rematchBtn, #lobbyBtn { width:42px !important; height:42px !important; min-width:42px !important; }
.game-tabs .tab-headers { display:flex !important; width:100% !important; } .game-tabs .tab-headers .tab-header { flex:1 !important; width:50% !important; max-width:50% !important; min-width:0 !important; overflow:hidden !important; text-overflow:ellipsis !important; white-space:nowrap !important; }

.right-side-content {
    width: 220px !important;
    max-width: 220px !important;
}
.game-info-section {
    width: 220px !important;
    max-width: 220px !important;
}

.right-side-content { width: 260px !important; max-width: 260px !important; }
.game-info-section { width: auto !important; max-width: none !important; }
.game-info-section { width: 100% !important; max-width: none !important; } .right-side-content { width: 100% !important; max-width: 100% !important; }
.right-side-wrapper { flex: 1 !important; } .game-info-section { width: 100% !important; max-width: none !important; } .right-side-content { width: 100% !important; max-width: 100% !important; }

/* ═══════════════════════════════════════════════════════
   MOBILE RESPONSIVE — Portrait & Landscape
   ═══════════════════════════════════════════════════════ */

/* Portrait mobile: stack board above right panel */
@media (max-width: 767px) and (orientation: portrait) {
    :root { --size: calc((100vw - 28px) / 8); }

    body { overflow-y: auto !important; overflow-x: hidden !important; touch-action: auto !important; margin: 0 !important; }

    .game-container {
        flex-direction: column !important;
        align-items: center !important;
        margin-left: 0 !important;
        gap: 8px !important;
        width: 100vw !important;
    }

    .game-board-section {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        align-items: center !important;
    }

    .board-area {
        grid-template-columns: auto !important;
        justify-content: center !important;
    }

    .players-side { display: none !important; }

    .board-container {
        margin-left: 0 !important;
        min-width: unset !important;
        width: calc(8 * var(--size) + 12px) !important;
        padding: 4px 6px !important;
        box-sizing: border-box !important;
    }

    .right-side-wrapper {
        margin-top: 0 !important;
        width: 100vw !important;
        transform: none !important;
    }

    .game-info-section {
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        overflow-y: auto !important;
        padding-bottom: 40px !important;
    }

    .right-side-content {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Landscape mobile: board fills screen, info overlaid as corner chips */
@media (pointer: coarse) and (orientation: landscape) {
    :root { --size: calc(100vh / 8); }
}

html.mobile-app {
    --size: calc(100vh / 8);
}

html.mobile-app body {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide ad strip and moves panel on mobile */
html.mobile-app #rightAdStrip {
    display: none !important;
}

html.mobile-app .container {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100vw !important;
}

html.mobile-app .game-container {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    gap: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

html.mobile-app .game-board-section {
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

html.mobile-app .board-area {
    display: block !important;
    gap: 0 !important;
}

/* Collapse players-side to zero but keep in DOM so clock JS still runs */
html.mobile-app .players-side {
    display: block !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}

html.mobile-app #opponentClubIconSlot {
    display: none !important;
}

html.mobile-app #playerClubIconSlot {
    display: none !important;
}

/* Collapse center-clocks wrapper — fixed children escape it fine */
html.mobile-app .center-clocks {
    display: block !important;
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
}

/* Flip button: hide on mobile */
html.mobile-app .center-clocks > div:last-child {
    display: none !important;
}

/* Lobby button: fixed chip at left, vertically centered */
html.mobile-app .center-clocks > button {
    display: flex !important;
    position: fixed !important;
    top: 50% !important;
    left: 6px !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    z-index: 300 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 4px 14px !important;
}

/* Opponent clock — top-right corner */
html.mobile-app .opponent-clock-container {
    position: fixed !important;
    top: 6px !important;
    right: 36px !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: auto !important;
    z-index: 300 !important;
    background: rgba(6, 13, 22, 0.88) !important;
    border: 1px solid rgba(231, 76, 60, 0.5) !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

/* Player clock — bottom-right corner */
html.mobile-app .your-clock-container {
    position: fixed !important;
    bottom: 6px !important;
    right: 36px !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: auto !important;
    z-index: 300 !important;
    background: rgba(6, 13, 22, 0.88) !important;
    border: 1px solid rgba(53, 176, 178, 0.5) !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

html.mobile-app .board-frame {
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    outline: none !important;
}

/* Board container: strip all decoration, raw board edge-to-edge */
html.mobile-app .board-container {
    margin: 0 !important;
    min-width: unset !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    height: 100vh !important;
}

/* Opponent name + ELO chip — top-left, clock at top-right */
html.mobile-app .opponent-info {
    position: fixed !important;
    top: 6px !important;
    left: 6px !important;
    right: auto !important;
    max-width: calc(50vw - 50vh - 16px) !important;
    overflow: hidden !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    width: auto !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    background: rgba(6, 13, 22, 0.88) !important;
    border: 1px solid rgba(240, 217, 181, 0.25) !important;
    border-radius: 8px !important;
    z-index: 300 !important;
    gap: 1px !important;
    box-sizing: border-box !important;
}

html.mobile-app .opponent-info .username {
    font-size: 0.68rem !important;
    padding: 0 !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

/* Opponent avatar — position set dynamically by JS relative to the clock's actual rect */
html.mobile-app #opponentAvatarImg {
    position: fixed !important;
    width: 102px !important;
    height: 102px !important;
    margin: 0 !important;
    z-index: 300 !important;
}

html.mobile-app .opponent-info .rating-badge {
    margin: 0 !important;
    transform: scale(0.72) !important;
    transform-origin: left center !important;
}

/* Player name + ELO chip — bottom-left corner */
html.mobile-app .player-row {
    position: fixed !important;
    bottom: 6px !important;
    left: 6px !important;
    right: auto !important;
    top: auto !important;
    max-width: calc(50vw - 50vh - 16px) !important;
    overflow: hidden !important;
    width: auto !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    background: rgba(6, 13, 22, 0.88) !important;
    border: 1px solid rgba(53, 176, 178, 0.25) !important;
    border-radius: 8px !important;
    z-index: 300 !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

html.mobile-app .player-row .player-info-container {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1px !important;
}

html.mobile-app .player-row .username {
    font-size: 0.68rem !important;
    white-space: nowrap !important;
}

/* Player avatar — position set dynamically by JS relative to the clock's actual rect */
html.mobile-app #playerAvatarImg {
    position: fixed !important;
    width: 102px !important;
    height: 102px !important;
    margin: 0 !important;
    z-index: 300 !important;
}

html.mobile-app .player-row .rating-badge {
    margin: 0 !important;
    transform: scale(0.72) !important;
    transform-origin: left center !important;
}

/* Hide moves panel on mobile — board only */
html.mobile-app .right-side-wrapper {
    display: none !important;
}

/* Profile popup avatar — 20% smaller in-game only (84px -> 67px) */
.user-profile-popup .profile-avatar-wrap {
    width: 67px !important;
    height: 67px !important;
}

/* ── Player profile popup: scrollable, avatar-left layout, hidden scrollbar (mirrors lobby.html) ── */
html.mobile-app .user-profile-popup {
    max-height: 88vh !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
html.mobile-app .user-profile-popup::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
html.mobile-app .close-profile-btn {
    position: sticky !important;
    top: 0 !important;
    float: right !important;
    z-index: 10 !important;
    background: rgba(13,15,20,0.9) !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1rem !important;
    margin-bottom: -36px !important;
}
/* Profile pic on left, username + bio/message on right */
html.mobile-app .profile-header-flex {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    gap: 14px !important;
}
html.mobile-app .profile-avatar-wrap {
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
}
html.mobile-app .profile-name-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    flex: 1 !important;
    min-width: 0 !important;
}
html.mobile-app .profile-name-col .profile-username-row {
    justify-content: flex-start !important;
}
html.mobile-app .profile-name-col h2,
html.mobile-app .profile-name-col h3 {
    text-align: left !important;
}
html.mobile-app .profile-name-col #usernameChangeArea,
html.mobile-app .profile-name-col .profile-bio-wrap,
html.mobile-app .profile-name-col p {
    text-align: left !important;
    margin-left: 0 !important;
    width: 100% !important;
}
html.mobile-app .profile-name-col #usernameChangeBtn {
    justify-content: flex-start !important;
}

/* Disable sticky hover on touch devices for control buttons */
html.mobile-app #gameControlsPanel button:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #8899aa !important;
    border-color: rgba(255, 255, 255, 0.09) !important;
    transform: none !important;
}
html.mobile-app #gameControlsPanel #promoteToggle.active:hover {
    background: color-mix(in srgb, var(--club-color, #35b0b2) 20%, transparent) !important;
    color: var(--club-color, #35b0b2) !important;
    border-color: color-mix(in srgb, var(--club-color, #35b0b2) 40%, transparent) !important;
}

/* Game controls — fixed on right side between clocks on mobile */
html.mobile-app #gameControlsPanel {
    position: fixed !important;
    right: calc(34px - 5mm) !important;
    top: 50% !important;
    transform: translateY(calc(-50% - 7mm)) !important;
    z-index: 400 !important;
    display: grid !important;
    grid-template-columns: repeat(3, 50px) !important;
    grid-template-rows: repeat(2, 50px) !important;
    grid-auto-rows: 50px !important;
    gap: 6px !important;
    background: rgba(6, 13, 22, 0.85) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 12px !important;
    padding: 8px !important;
}
html.mobile-app #fullscreen-btn { display: none !important; }
html.mobile-app #gameControlsPanel button,
html.mobile-app #piecesBtn,
html.mobile-app #boardBtn,
html.mobile-app #promoteToggle,
html.mobile-app #drawBtn,
html.mobile-app #resignBtn,
html.mobile-app #abortBtn,
html.mobile-app #rematchBtn,
html.mobile-app #lobbyBtn {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    font-size: 1.1rem !important;
}

.arrow-draw-source {
    outline: 2px solid rgba(255,170,0,0.8) !important;
    outline-offset: -2px;
    background-color: rgba(255,170,0,0.25) !important;
}

/* ── Board Focus Mode ── */
body.board-focus-mode .right-side-wrapper {
    display: none !important;
}
body.board-focus-mode .game-container {
    justify-content: center !important;
    align-items: center !important;
    height: 100vh !important;
    margin-left: 0 !important;
}
body.board-focus-mode.has-right-ad {
    --size: min(calc((100vw - 420px) / 8), calc((100vh - 160px) / 8));
}
body.board-focus-mode:not(.has-right-ad) {
    --size: min(calc((100vw - 160px) / 8), calc((100vh - 160px) / 8));
}
body.board-focus-mode .game-board-section {
    transform: translateX(-2cm) !important;
    margin-left: 0 !important;
}
body.board-focus-mode .board-container {
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
body.board-focus-mode .players-side {
    margin-top: 0 !important;
    overflow: visible !important;
}
body.board-focus-mode #opponentClubIconSlot,
body.board-focus-mode #playerClubIconSlot {
    display: flex !important;
    min-height: 52px !important;
    overflow: visible !important;
}
#boardFocusExitBtn {
    display: none;
    position: fixed;
    bottom: 12px;
    left: 12px;
    z-index: 500;
    width: 40px;
    height: 40px;
    background: rgba(6, 13, 22, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #8899aa;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
}
#boardFocusExitBtn:hover {
    background: rgba(52, 152, 219, 0.3);
    color: #35b0b2;
}
body.board-focus-mode #boardFocusExitBtn {
    display: flex;
}
