* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    overflow-anchor: none; /* Prevent scroll jumping during DOM updates */
}

.chess-container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.header {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.home-link {
    color: white;
    text-decoration: none;
    font-size: 1em;
    font-weight: 500;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.header h1 {
    color: white;
    font-size: 1.8em;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-status {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
}

.game-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Player Info */
.player-info {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.player-info.active {
    background: rgba(26, 35, 126, 0.95);
    border: 2px solid rgba(26, 35, 126, 0.8);
    box-shadow: 0 8px 32px rgba(26, 35, 126, 0.4);
}

.player-avatar {
    font-size: 3em;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.player-details {
    flex: 1;
}

.player-name {
    font-size: 1.8em;
    font-weight: 600;
    color: white;
    margin-bottom: 5px;
}

.player-email {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 4px;
}

.last-move {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 1.8em;
}

/* Board Wrapper */
.board-wrapper {
    position: relative;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.turn-indicator {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 15px;
    transition: background 0.3s ease, color 0.3s ease;
}

.turn-indicator.white-turn {
    background: #f5f5f5;
    border: 2px solid #ddd;
}

.turn-indicator.white-turn .turn-text {
    color: #333;
    text-shadow: none;
}

.turn-indicator.black-turn {
    background: #1a1a1a;
    border: 2px solid #333;
}

.turn-indicator.black-turn .turn-text {
    color: #f5f5f5;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.turn-text {
    font-size: 1.3em;
    font-weight: 600;
}

/* Board with captures layout */
.board-with-captures {
    display: flex;
    gap: 20px;
    align-items: stretch;
    justify-content: center;
}

/* Aspect ratio wrapper - uses padding-top trick for bulletproof 1:1 ratio */
.board-aspect-wrapper {
    position: relative;
    width: 100%;
    max-width: 640px;
    padding-top: 100%; /* Creates 1:1 aspect ratio based on width */
    flex: 1;
    align-self: flex-start;
}

/* Chessboard */
.chessboard {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 4px solid rgba(139, 69, 19, 0.8);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    background: #f0d9b5;
    box-sizing: border-box;
}

/* Captures Panel (right of board) */
.captures-panel {
    display: none;
    flex-direction: column;
    gap: 12px;
    min-width: 120px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    align-self: stretch;
    overflow: hidden;
}

.captures-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    border-radius: 8px;
    min-height: auto;
}

.captures-white {
    background: rgba(255, 255, 255, 0.1);
}

    background: rgba(0, 0, 0, 0.2);
}

.captures-white .captures-label {
    font-size: 0.7em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.captures-pieces {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    justify-items: center;
}

.captured-piece {
    font-size: 1.8em;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.captured-piece.black-piece {
    color: #333;
}

.captured-piece.white-piece {
    color: #fff;
}

.no-captures {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5em;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square:hover {
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3);
}

.square.selected {
    background-color: #baca44 !important;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.square.valid-move {
    position: relative;
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background-color: rgba(0, 128, 0, 0.4);
    border-radius: 50%;
}

.square.valid-move.has-piece::after {
    width: 90%;
    height: 90%;
    background-color: transparent;
    border: 4px solid rgba(255, 0, 0, 0.5);
    border-radius: 50%;
}

.square.check {
    background-color: #ff6b6b !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.piece {
    transition: transform 0.2s ease;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

.piece:hover {
    transform: scale(1.1);
}

.piece.dragging {
    opacity: 0.5;
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.control-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.game-controls #moveMessageInput {
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1em;
}

.game-controls #moveMessageInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.game-controls #moveMessageInput:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #1A237E 0%, #283593 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 35, 126, 0.6);
    background: linear-gradient(135deg, #283593 0%, #303F9F 100%);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #1A237E;
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-submit {
    background: #f44336;
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.btn-submit:hover:not(:disabled) {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.6);
}

.btn-submit:disabled {
    background: rgba(244, 67, 54, 0.3);
    cursor: not-allowed;
    box-shadow: none;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Chat Panel */
.chat-panel {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    height: 300px;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-header h3 {
    color: white;
    font-size: 1.1em;
}

.chat-messages {
    /* Most recent messages at top */
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.system {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    align-self: center;
    font-size: 0.85em;
    font-style: italic;
}

.chat-message.white {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    align-self: flex-start;
}

.chat-message.black {
    background: rgba(26, 35, 126, 0.9);
    color: white;
    align-self: flex-end;
}

.chat-input {
    display: flex;
    padding: 15px;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.95em;
}

.chat-input input:focus {
    outline: 2px solid rgba(26, 35, 126, 0.5);
}

/* Move History, Score Panels & Message History */
.move-history-panel,
.score-panel,
.message-history-panel {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.panel-header h3 {
    color: white;
    font-size: 1.1em;
}

.move-list {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.no-moves {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.move-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-family: 'Courier New', monospace;
}

.score-stats {
    padding: 20px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.score-row:last-child {
    border-bottom: none;
}

.score-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.score-value {
    color: white;
    font-weight: 700;
    font-size: 1.2em;
}

.match-history {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.match-item {
    padding: 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 0.9em;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-icon {
    font-size: 5em;
    margin-bottom: 20px;
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.modal-icon.winner {
    color: #52c41a;
    filter: drop-shadow(0 0 20px rgba(82, 196, 26, 0.5));
}

.modal-icon.loser {
    color: #faad14;
    filter: drop-shadow(0 0 20px rgba(250, 173, 20, 0.5));
}

.modal-icon.draw {
    color: #4a90e2;
    filter: drop-shadow(0 0 20px rgba(74, 144, 226, 0.5));
}

.modal-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
    font-weight: 700;
}

.modal-content p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.2em;
    line-height: 1.6;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        grid-row: 2;
    }
}

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .player-info {
        padding: 15px;
    }

    .player-avatar {
        font-size: 1.8em;
        width: 50px;
        height: 50px;
    }

    .player-name {
        font-size: 1.2em;
    }

    .board-wrapper {
    position: relative;
        padding: 15px;
    }

    .square {
        font-size: 1.8em;
    }

    .game-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Toast Notification */
.game-toast {
    position: fixed;
    top: 20px;
    right: 30px;
    background: rgba(20, 30, 40, 0.95); color: white;
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid rgba(50, 60, 70, 0.8); color: #f0f0f0;
}

.game-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.toast-message { color: white !important;
    flex: 1;
    font-size: 0.95em;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
}

.toast-dismiss {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 50%;
    line-height: 1;
}

.toast-dismiss:hover {
    color: #f5222d;
    background: rgba(245, 34, 45, 0.1);
    transform: rotate(90deg);
}

/* Message History Styles */
.message-history-panel {
    margin-top: 20px;
}

.message-history-container {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse; /* Most recent messages at top */
    gap: 12px;
    scroll-behavior: smooth;
}

.no-messages {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.history-message {
    padding: 12px 16px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: messageSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Color-coded backgrounds for different players */
.history-message.player-daniel {
    background: rgba(26, 35, 126, 0.15); /* Subtle navy blue */
    border-left: 4px solid rgba(26, 35, 126, 0.6);
}

.history-message.player-barry {
    background: rgba(255, 183, 77, 0.15); /* Subtle warm beige/orange */
    border-left: 4px solid rgba(255, 183, 77, 0.6);
}

.history-message.system {
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid rgba(255, 255, 255, 0.4);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.85em;
}

.message-sender {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.message-sender.daniel {
    color: rgba(26, 35, 126, 1);
}

.message-sender.barry {
    color: rgba(255, 183, 77, 1);
}

.message-timestamp {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

.message-content {
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
    word-wrap: break-word;
}

.message-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.message-location::before {
    content: '📍';
    font-size: 0.9em;
}

/* Historical Moves Viewer */
.historical-viewer {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
    padding-bottom: 20px;
}

.historical-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: rgba(26, 35, 126, 0.3);
    border-radius: 10px;
    margin: 15px 20px;
}

.btn-nav {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #1A237E;
    font-weight: bold;
}

.btn-nav:hover:not(:disabled) {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#moveCounter {
    color: white;
    font-weight: 600;
    font-size: 1em;
    min-width: 120px;
    text-align: center;
}

.historical-board-container {
    position: relative;
    width: 312px;
    height: 312px;
    margin: 15px auto;
    opacity: 0.85;
}

#arrowCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#historicalBoard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important;
    grid-template-rows: repeat(8, 1fr) !important;
    pointer-events: none;
    user-select: none;
    border: 2px solid rgba(139, 69, 19, 0.6);
    border-radius: 4px;
    background: #f0d9b5;
    box-sizing: border-box;
}

#historicalBoard .square {
    font-size: 1.8em !important;
    cursor: default;
}

.historical-board .square:hover {
    box-shadow: none;
}

.historical-move-info {
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    box-sizing: border-box;
}

.move-info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: white;
    font-size: 0.8em;
    flex-wrap: wrap;
}

.move-info-row strong {
    min-width: 70px;
    color: rgba(255, 255, 255, 0.8);
}

.move-info-row span {
    color: rgba(255, 255, 255, 1);
    font-weight: 500;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.move-info-row.message-row span {
    font-style: italic;
}

@media (max-width: 768px) {
    .game-toast {
        right: 10px;
        left: 10px;
        max-width: none;
        top: 10px;
    }

    .message-history-container {
        max-height: 300px;
    }

    .history-message {
        padding: 10px 12px;
    }

    .historical-controls {
        flex-wrap: wrap;
        gap: 10px;
    }

    .btn-nav {
        padding: 8px 12px;
        font-size: 1em;
    }

    #moveCounter {
        width: 100%;
        order: -1;
        margin-bottom: 5px;
    }
}

/* Move Message Input Container */
.move-message-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
}

.move-message-container input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

.move-message-container input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.move-message-container input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Move Message Bubble Styles */
.history-message.move-message {
    background: rgba(139, 195, 74, 0.15); /* Subtle green for moves with messages */
    border-left: 4px solid rgba(139, 195, 74, 0.6);
}

.history-message.move-message.player-daniel {
    background: rgba(26, 35, 126, 0.2);
    border-left: 4px solid rgba(26, 35, 126, 0.7);
}

.history-message.move-message.player-barry {
    background: rgba(255, 183, 77, 0.2);
    border-left: 4px solid rgba(255, 183, 77, 0.7);
}

.move-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.8);
}

.move-number {
    font-weight: 600;
    color: white;
}

.move-message-bubble {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
}

.move-message-bubble::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 16px;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    transform: rotate(45deg);
}

.message-author {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-right: 6px;
}

.message-text {
    color: white;
    font-style: italic;
    line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .move-message-container {
        flex-direction: column;
        align-items: stretch;
    }

    .move-message-container input {
        width: 100%;
    }

    .move-message-bubble {
        padding: 8px 12px;
    }
}

/* Real-time polling visual feedback */
.opponent-move-from {
    animation: pulse-from 2s ease-in-out;
}

.opponent-move-to {
    animation: pulse-to 2s ease-in-out;
}

@keyframes pulse-from {
    0%, 100% {
        background-color: inherit;
    }
    50% {
        background-color: rgba(255, 193, 7, 0.6);
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    }
}

@keyframes pulse-to {
    0%, 100% {
        background-color: inherit;
    }
    50% {
        background-color: rgba(76, 175, 80, 0.6);
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
    }
}

/* Opponent move notification */
.opponent-move-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(20, 30, 40, 0.95);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    font-size: 1em;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.opponent-move-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Toast notification for opponent's move (above board) */
/* Toast styled to match chess board */
.opponent-move-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 320px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.opponent-move-toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.opponent-move-toast .toast-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
}

.opponent-move-toast .toast-icon {
    font-size: 1.3em;
}

.opponent-move-toast .toast-title strong {
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 4px;
}

.opponent-move-toast .toast-message { color: white !important;
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-style: italic;
    font-size: 0.95em;
    line-height: 1.4;
}

.opponent-move-toast .toast-prompt {
    margin-top: 10px;
    font-size: 0.9em;
    font-weight: 600;
    color: #4CAF50;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Piece movement animation highlights */
.square.animate-from {
    background-color: rgba(255, 193, 7, 0.5) !important;
    box-shadow: inset 0 0 20px rgba(255, 193, 7, 0.8);
}

.square.animate-to {
    background-color: rgba(76, 175, 80, 0.5) !important;
    box-shadow: inset 0 0 20px rgba(76, 175, 80, 0.8);
    animation: pulse-target 1s ease-in-out infinite;
}

@keyframes pulse-target {
    0%, 100% { box-shadow: inset 0 0 20px rgba(76, 175, 80, 0.6); }
    50% { box-shadow: inset 0 0 30px rgba(76, 175, 80, 1); }
}

/* Persistent highlights after animation (10 seconds) */
.square.highlight-from {
    background-color: rgba(255, 193, 7, 0.4) !important;
    box-shadow: inset 0 0 15px rgba(255, 193, 7, 0.6);
}

.square.highlight-to {
    background-color: rgba(76, 175, 80, 0.4) !important;
    box-shadow: inset 0 0 15px rgba(76, 175, 80, 0.6);
}

.square.highlight-fade {
    transition: background-color 1s ease-out, box-shadow 1s ease-out;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Waiting for opponent message - positioned absolutely to not shift board */
/* Container for waiting message - reserves space to prevent layout shift */
.waiting-container {
    min-height: 50px;
    margin-bottom: 10px;
}

#waitingMessage {
    display: none;
    text-align: center;
    padding: 12px 20px;
    background: rgba(255, 152, 0, 0.95);
    border: 2px solid rgba(255, 152, 0, 0.8);
    border-radius: 12px;
    color: #000;
    font-weight: 600;
    font-size: 0.95em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: waiting-pulse 2s ease-in-out infinite;
}

@keyframes waiting-pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
        border-color: rgba(255, 152, 0, 0.5);
    }
}

/* Network error message */
#networkError {
    display: none;
    text-align: center;
    padding: 12px 20px;
    background: rgba(244, 67, 54, 0.15);
    border: 2px solid rgba(244, 67, 54, 0.3);
    border-radius: 12px;
    margin: 15px 0;
    color: #f44336;
    font-weight: 500;
    font-size: 0.95em;
}

/* Polling indicator (optional subtle indicator) */
.polling-active::after {
    content: '';
    position: fixed;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    z-index: 9999;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Enhance turn indicator when it's your turn */
.player-card.active {
    animation: your-turn-pulse 2s ease-in-out infinite;
}

@keyframes your-turn-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(52, 152, 219, 0.5);
    }
}

/* ==========================================================================
   CONFIRMATION DIALOGS - Resign & Draw
   ========================================================================== */

/* Overlay */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fade-in 0.2s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dialog box */
.confirm-dialog {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: slide-up 0.3s ease;
}

@keyframes slide-up {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.confirm-dialog h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.confirm-dialog p {
    color: #666;
    margin-bottom: 10px;
    line-height: 1.5;
}

.confirm-dialog .confirm-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.confirm-dialog .confirm-icon.warning {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Button container */
.confirm-buttons {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Base button style */
.confirm-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

/* Safe option - Green/Large (NO, cancel, continue playing) */
.confirm-btn.confirm-no,
.confirm-btn.confirm-cancel,
.confirm-btn.confirm-no-large {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.confirm-btn.confirm-no:hover,
.confirm-btn.confirm-cancel:hover,
.confirm-btn.confirm-no-large:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.confirm-btn.confirm-no-large {
    padding: 18px 40px;
    font-size: 1.2em;
    min-width: 200px;
}

/* Danger option - Red/Small (YES to resign/destructive action) */
.confirm-btn.confirm-yes-danger,
.confirm-btn.confirm-yes-small {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
    box-shadow: 0 4px 15px rgba(192, 57, 43, 0.3);
}

.confirm-btn.confirm-yes-danger:hover,
.confirm-btn.confirm-yes-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(192, 57, 43, 0.4);
}

.confirm-btn.confirm-yes-small {
    padding: 12px 25px;
    font-size: 0.9em;
    min-width: 120px;
}

/* Draw buttons */
.confirm-btn.confirm-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.confirm-btn.confirm-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.confirm-btn.confirm-decline {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.confirm-btn.confirm-decline:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.confirm-btn.confirm-accept {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.confirm-btn.confirm-accept:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.confirm-btn.confirm-yes-draw {
    background: linear-gradient(135deg, #f39c12, #f1c40f);
    color: #333;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.confirm-btn.confirm-yes-draw:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

/* Final confirmation dialog - more serious styling */
.confirm-dialog.final-confirm {
    border: 3px solid #e74c3c;
}

.confirm-dialog.final-confirm h2 {
    color: #c0392b;
}

/* Draw button in game controls */
.btn-draw {
    background: linear-gradient(135deg, #f39c12, #f1c40f) !important;
    color: #333 !important;
    border: none !important;
}

.btn-draw:hover {
    background: linear-gradient(135deg, #e67e22, #f39c12) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
}

/* Success toast */
.success-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 15px 30px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 5px 25px rgba(39, 174, 96, 0.4);
    z-index: 3000;
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.success-toast.fade-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    to {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
}

/* ==========================================================================
   COORDINATE LABELS (a-h, 1-8)
   ========================================================================== */

.board-container {
    display: flex;
    align-items: stretch;
    flex: 1;
    max-width: 680px;
}

.rank-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding-right: 8px;
    width: 20px;
}

.rank-labels > div {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.board-and-files {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    max-width: 640px;
    align-items: stretch;
}

.file-labels {
    display: flex;
    justify-content: space-around;
    padding-top: 8px;
    padding-left: 0;
    height: 24px;
}

.file-labels > div {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Mobile responsive coordinates */
@media (max-width: 768px) {
    .rank-labels {
        width: 16px;
        padding-right: 4px;
    }

    .rank-labels > div,
    .file-labels > div {
        font-size: 0.7em;
    }

    .file-labels {
        height: 20px;
        padding-top: 4px;
    }
}


/* Fix historical board size stability */
#historicalBoard .square {
    width: 39px !important;
    height: 39px !important;
    min-width: 39px !important;
    min-height: 39px !important;
    max-width: 39px !important;
    max-height: 39px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#historicalBoard .piece { position: relative; top: -4px;
    font-size: 1.8em !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* White pieces - solid white fill with black outline */
.piece[data-color="w"] {
    color: white !important;
    -webkit-text-stroke: 1px black;
    text-shadow: 
        0 0 1px black,
        0 0 2px black,
        1px 1px 1px rgba(0,0,0,0.5);
    paint-order: stroke fill;
}

/* Black pieces - solid black */
.piece[data-color="b"] {
    color: #1a1a1a !important;
    text-shadow: 
        0 0 1px rgba(0,0,0,0.3),
        1px 1px 2px rgba(0,0,0,0.2);
}

/* Barry (White player) container - lighter grey instead of navy */
.player-white.active {
    background: rgba(40, 45, 55, 0.95) !important;
    border: 2px solid rgba(50, 55, 65, 0.8) !important;
    box-shadow: 0 8px 32px rgba(40, 45, 55, 0.4) !important;
}

/* Keep Daniel (Black player) container with darker styling */
.player-black.active {
    background: rgba(40, 45, 55, 0.95) !important;
    border: 2px solid rgba(50, 55, 65, 0.8) !important;
    box-shadow: 0 8px 32px rgba(40, 45, 55, 0.4) !important;
}

/* See Last Move button */
.btn-replay {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
    border: none !important;
}

.btn-replay:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    transform: translateY(-1px);
}

.btn-replay:disabled {
    background: rgba(100, 100, 100, 0.5) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Captured piece flash animation during move replay */
.captured-piece.capture-flash {
    animation: captureFlash 0.5s ease-in-out infinite;
}

@keyframes captureFlash {
    0%, 100% { 
        background-color: rgba(255, 0, 0, 0.7);
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
    50% { 
        background-color: rgba(255, 100, 100, 0.9);
        box-shadow: 0 0 20px rgba(255, 0, 0, 1);
    }
}

/* Better contrast for captured pieces in player info containers */
.player-info .captured-pieces {
    background: rgba(200, 200, 200, 0.9);
    padding: 8px 12px;
    border-radius: 10px;
    min-height: 40px;
}

/* Hide captured pieces container when empty */
.player-info .captured-pieces:empty {
    display: none;
}

.player-info .captured-pieces span {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.2));
}

/* Captured piece flash animation - round shape */
.captured-piece.capture-flash {
    border-radius: 50% !important;
    animation: captureFlash 0.5s ease-in-out infinite;
}

/* Ensure captured pieces in sidebar have round background when flashing */
.captures-pieces .captured-piece {
    border-radius: 50%;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Proceed to New Game button - green */
.btn-newgame {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    color: white !important;
    border: none !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    animation: newgame-pulse 1.5s ease-in-out infinite;
}

.btn-newgame:hover {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

@keyframes newgame-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(34, 197, 94, 0.7);
    }
}

/* GOT TO GO button */
.btn-gtg {
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
    color: white !important;
    border: none !important;
}

.btn-gtg:hover {
    background: linear-gradient(135deg, #d35400, #e74c3c) !important;
    transform: translateY(-1px);
}

.btn-gtg.cancel-mode {
    background: linear-gradient(135deg, #c0392b, #e74c3c) !important;
}

/* GOT TO GO persistent toast - top left */
.gtg-toast {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(230, 126, 34, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 300px;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gtg-toast.show {
    display: block;
    animation: slideInLeft 0.4s ease;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.gtg-toast .gtg-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 4px;
}

.gtg-toast .gtg-message {
    font-size: 0.95em;
    line-height: 1.4;
}

.gtg-toast .gtg-countdown {
    margin-top: 4px;
    font-size: 0.85em;
    opacity: 0.8;
}

/* Captured pieces sidebar - light grey to match player info */
.captures-white {
    background: rgba(200, 200, 200, 0.9) !important;
    border-radius: 8px;
}

.captures-white .captures-label {
    color: #333 !important;
}

/* Daniel captures label - white text for contrast */
.captures-black .captures-label {
    color: white !important;
}

/* Captured pieces 3x3 grid layout */
.captures-pieces {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    justify-items: center;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
    justify-items: center !important;
}

/* Player Status Display */
.player-status {
    font-size: 0.75rem;
    margin-top: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.player-status.online {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.player-status.away {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.player-status.offline {
    color: #9ca3af;
    background: rgba(156, 163, 175, 0.1);
}

/* Chat message styling */
.chat-message {
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.chat-message .chat-text {
    display: block;
    word-wrap: break-word;
}

.chat-message .chat-meta {
    font-size: 0.7rem;
    color: #888;
    margin-top: 4px;
}

.chat-message.white {
    border-left: 3px solid #f0d9b5;
}

.chat-message.black {
    border-left: 3px solid #b58863;
}

.chat-message.system {
    border-left: 3px solid #666;
    font-style: italic;
    color: #aaa;
}

/* Make chat panels scrollable */
.chat-messages, .message-history-container {
    max-height: 400px;
    overflow-y: auto;
}

/* Pin visualization */
.pinned-piece {
    background: rgba(50, 50, 50, 0.8) !important;
    animation: pin-glitch 0.3s ease-in-out 3;
}

@keyframes pin-glitch {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.pin-attacker {
    background: rgba(239, 68, 68, 0.5) !important;
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.8) !important;
}

.pin-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(220, 38, 38, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.pin-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.pin-toast .pin-icon {
    font-size: 1.1em;
}

.pin-toast .pin-text strong {
    color: #fef08a;
}

/* Chat History Viewer - mirrors Move History Viewer */
.chat-history-viewer {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
    padding-bottom: 20px;
}

.chat-history-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    margin: 15px 20px;
}

#chatCounter {
    color: white;
    font-weight: 600;
    font-size: 1em;
    min-width: 120px;
    text-align: center;
}

.chat-history-display {
    padding: 15px 20px;
    margin: 0 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.chat-info-row {
    color: rgba(255, 255, 255, 0.9);
    padding: 6px 0;
    font-size: 0.9em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-info-row:last-of-type {
    border-bottom: none;
}

.chat-info-row strong {
    color: #81D4FA;
    margin-right: 8px;
}

.chat-message-row {
    border-bottom: none;
    padding-bottom: 5px;
}

.chat-message-content {
    color: white;
    font-size: 1.1em;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 5px;
    min-height: 50px;
    word-wrap: break-word;
}

.chat-sync-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 15px 20px 0;
    background: rgba(255, 193, 7, 0.2);
    border-radius: 8px;
    font-size: 0.85em;
}

.sync-label {
    color: rgba(255, 255, 255, 0.7);
}

#chatMoveContext {
    color: #FFC107;
    font-weight: 600;
}

/* Warnings Toggle */
.warnings-toggle {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #f59e0b;
}

.toggle-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    font-weight: 500;
}

/* Danger warning styling for squares */
.danger-warning {
    animation: danger-pulse 0.5s ease-in-out 3;
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.8) !important;
}

@keyframes danger-pulse {
    0%, 100% {
        background-color: rgba(239, 68, 68, 0.3);
    }
    50% {
        background-color: rgba(239, 68, 68, 0.6);
    }
}

/* Exposed piece warning (piece that would be left in danger) */
.exposed-warning {
    animation: exposed-glitch 0.3s ease-in-out 3;
    box-shadow: inset 0 0 15px rgba(251, 191, 36, 0.8) !important;
}


/* Queen danger warning - purple pulsing */
.queen-danger-warning {
    animation: queen-danger-pulse 0.4s ease-in-out 4;
    box-shadow: inset 0 0 25px rgba(168, 85, 247, 0.9) !important;
}

@keyframes queen-danger-pulse {
    0%, 100% {
        background-color: rgba(168, 85, 247, 0.4);
    }
    50% {
        background-color: rgba(168, 85, 247, 0.7);
    }
}

@keyframes exposed-glitch {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Warning toast for danger */
.danger-toast {
    position: fixed;
    top: 140px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.9em;
}

.danger-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Danger Warning Modal */
.danger-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.danger-modal.show {
    opacity: 1;
}

.danger-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #f59e0b;
    border-radius: 16px;
    padding: 24px 32px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(245, 158, 11, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.danger-modal.show .danger-modal-content {
    transform: scale(1);
}

.danger-icon {
    font-size: 3em;
    margin-bottom: 12px;
    animation: danger-shake 0.5s ease-in-out;
}

@keyframes danger-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.danger-message {
    color: #fbbf24;
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 20px;
}

.danger-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.btn-move-anyway {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-move-anyway:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(220, 38, 38, 0.4);
}

.btn-let-me-check {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-let-me-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(5, 150, 105, 0.4);
}

.danger-note {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7em;
    font-style: italic;
    line-height: 1.4;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Show Warning Again Button */
.btn-show-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    margin-left: 12px;
    transition: all 0.2s ease;
    animation: warning-pulse 1.5s ease-in-out infinite;
}

.btn-show-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

@keyframes warning-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Game Selector Panel */
.game-selector-panel {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-selector-panel .panel-header h3 {
    color: #e0e0e0;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-selector-panel .panel-header h3::before {
    content: '📚';
}

.game-selector-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.game-select {
    flex: 1;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.game-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.game-select:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

.game-select option {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 8px;
}

.game-nav-buttons {
    display: flex;
    gap: 5px;
}

.game-nav-buttons .btn-nav {
    padding: 10px 12px;
}

.selected-game-info {
    color: white;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    text-align: center;
}

.selected-game-info .game-status {
    color: #888;
    font-size: 0.85rem;
}

.selected-game-info .game-status.active {
    color: #4caf50;
}

.selected-game-info .game-status.completed {
    color: #90caf9;
}

/* Current game highlight in dropdown */
.game-select option[data-active="true"] {
    background: #2a5a2a;
    font-weight: bold;
}

/* File upload button */
.btn-icon {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}
.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

/* File links in chat */
.chat-message a {
    color: #4fc3f7;
    text-decoration: none;
    word-break: break-all;
}
.chat-message a:hover {
    text-decoration: underline;
}
.file-attachment {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.2);
    padding: 6px 10px;
    border-radius: 6px;
    margin-top: 4px;
}
.file-attachment .file-icon {
    font-size: 18px;
}

/* Chat input button sizing */
.chat-input .btn {
    padding: 10px 16px;
    font-size: 0.85em;
    flex-shrink: 0;
    white-space: nowrap;
}

.chat-input .btn-icon {
    padding: 8px 12px;
    font-size: 1.1em;
}

/* ============================================================================
   WIN ODDS DISPLAY - Stockfish Evaluation
   ============================================================================ */

.odds-display {
    width: 100%;
    padding: 12px 10px;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.odds-label {
    font-size: 0.7em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-align: center;
}

.odds-bar-container {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.odds-bar {
    height: 100%;
    transition: width 0.5s ease-out;
}

.odds-bar.odds-white {
    background: linear-gradient(90deg, #f5f5f5 0%, #e0e0e0 100%);
}

.odds-bar.odds-black {
    background: linear-gradient(90deg, #444 0%, #222 100%);
}

.odds-percentages {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.7em;
    font-weight: 600;
}

.odds-white-pct {
    color: rgba(255, 255, 255, 0.9);
}

.odds-black-pct {
    color: rgba(180, 180, 180, 0.9);
}

/* Toggle styling update for multiple checkboxes */
.warnings-toggle {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

/* Separate odds display in each captured container */
.odds-single {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    text-align: center;
}

.odds-pct {
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.white-pct {
    color: #f5f5f5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.black-pct {
    color: #aaa;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Container for label and pieces at top */
.captures-top {
    flex-shrink: 0;
}

/* Resign hint animation */
.resign-wrapper {
    position: relative;
    display: inline-block;
}

.resign-hint {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: -8px;
    font-size: 1.8em;
    animation: bounce-point 2.4s ease-in-out infinite;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

@keyframes bounce-point {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-8px);
    }
}

/* Game selector dropdown in Move History Viewer */
.game-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #2a2a2a;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.game-selector:hover {
    border-color: #666;
}

.game-selector:focus {
    outline: none;
    border-color: #007bff;
}

.game-selector option {
    background: #2a2a2a;
    color: #e0e0e0;
    padding: 8px;
}

/* Critical Resign State - Flames at 5% odds or below */
.resign-wrapper.critical {
    position: relative;
}

.resign-wrapper.critical #resignBtn {
    animation: critical-pulse 0.8s ease-in-out infinite;
    background: linear-gradient(135deg, #FFB347, #FF8C00) !important;
    border-color: #FF8C00 !important; color: #000 !important;
    box-shadow: 0 0 20px rgba(255, 179, 71, 0.6), 0 0 40px rgba(255, 140, 0, 0.4);
}

@keyframes critical-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 179, 71, 0.6), 0 0 40px rgba(255, 140, 0, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(255, 179, 71, 0.8), 0 0 60px rgba(255, 140, 0, 0.6);
    }
}

/* Flames effect around button */
.resign-wrapper.critical::before,
.resign-wrapper.critical::after {
    content: '🔥';
    position: absolute;
    font-size: 1.5em;
    animation: flame-flicker 0.3s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 5px rgba(255, 100, 0, 0.8));
    z-index: 10;
}

.resign-wrapper.critical::before {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.resign-wrapper.critical::after {
    right: -8px;
    top: 50%;
    transform: translateY(-50%) scaleX(-1);
}

@keyframes flame-flicker {
    0% {
        opacity: 0.8;
        transform: translateY(-50%) scale(1);
    }
    100% {
        opacity: 1;
        transform: translateY(-55%) scale(1.1);
    }
}

/* Critical resign hint with skull */
.resign-wrapper.critical .resign-hint {
    font-size: 2.2em;
    animation: urgent-bounce 0.5s ease-in-out infinite;
}

@keyframes urgent-bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-12px);
    }
}

/* Auto-resign suggestion modal */
.resign-suggestion-modal {
    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;
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.resign-suggestion-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 3px solid #ff4444;
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.5), inset 0 0 30px rgba(255, 0, 0, 0.1);
    animation: modal-shake 0.5s ease-out;
}

@keyframes modal-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.resign-suggestion-content h2 {
    color: #ff4444;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.resign-suggestion-content .flames-row {
    font-size: 2em;
    margin: 10px 0;
}

.resign-suggestion-content .odds-display {
    color: #ff6b6b;
    font-size: 3em;
    font-weight: bold;
    margin: 15px 0;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

.resign-suggestion-content p {
    color: #ccc;
    margin: 15px 0;
    font-size: 1.1em;
}

.resign-suggestion-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.resign-suggestion-buttons button {
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
}

.resign-suggestion-buttons .resign-now-btn {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    border: none;
    color: white;
    font-weight: bold;
    animation: resign-btn-pulse 1s ease-in-out infinite;
}

@keyframes resign-btn-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 0, 0, 0.5); }
    50% { box-shadow: 0 0 25px rgba(255, 0, 0, 0.8); }
}

.resign-suggestion-buttons .continue-btn {
    background: transparent;
    border: 2px solid #666;
    color: #999;
}

.resign-suggestion-buttons .continue-btn:hover {
    border-color: #888;
    color: #ccc;
}

/* ========== Plan Move Feature ========== */
#planArrowCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.btn-plan {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
}

.btn-plan:hover {
    background: linear-gradient(135deg, #a66bbe, #9b59b6);
}

.btn-plan.active {
    background: linear-gradient(135deg, #8e44ad, #6c3483);
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.6);
}

.plan-start-marker {
    position: absolute;
    width: 30%;
    height: 30%;
    background: rgba(155, 89, 182, 0.8);
    border-radius: 50%;
    top: 35%;
    left: 35%;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 0 8px rgba(155, 89, 182, 0.9);
}

#planMoveToast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2d2d44, #1a1a2e);
    border: 2px solid #9b59b6;
    border-radius: 12px;
    padding: 16px 20px;
    z-index: 10000;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(155, 89, 182, 0.3);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

#planMoveToast.show {
    opacity: 1;
    transform: translateX(0);
}

.plan-toast-header {
    font-size: 16px;
    font-weight: bold;
    color: #9b59b6;
    margin-bottom: 12px;
}

.plan-toast-body {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.6;
}

.plan-toast-body p {
    margin: 6px 0;
}

.plan-toast-private {
    margin-top: 10px;
    color: #8bc34a;
    font-size: 13px;
}

/* ========== Month Navigator ========== */
.month-navigator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid #333;
}

.month-label {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    min-width: 120px;
    text-align: center;
}

.month-navigator .btn-nav {
    padding: 4px 8px;
    font-size: 12px;
}

.month-navigator .btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ========== Message Toast (opponent chat notification) ========== */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 1px solid #4a5568;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 200px;
    max-width: 320px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.message-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.message-toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.message-toast-icon {
    font-size: 18px;
}

.message-toast-sender {
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
}

.message-toast-content {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

@media (max-width: 480px) {
    .message-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ========== Threefold Repetition Warning Modal ========== */
.repetition-modal {
    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;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.repetition-modal.show {
    opacity: 1;
}

.repetition-modal-content {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 2px solid #f6ad55;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.repetition-modal.show .repetition-modal-content {
    transform: scale(1);
}

.repetition-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.repetition-title {
    font-size: 20px;
    font-weight: bold;
    color: #f6ad55;
    margin-bottom: 12px;
}

.repetition-message {
    color: #e2e8f0;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.repetition-message strong {
    color: #fc8181;
}

.repetition-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-different-move {
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-different-move:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-accept-draw {
    background: #718096;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-accept-draw:hover {
    background: #4a5568;
}

@media (max-width: 480px) {
    .repetition-modal-content {
        padding: 20px;
    }
    
    .repetition-buttons {
        flex-direction: column;
    }
    
    .btn-different-move,
    .btn-accept-draw {
        width: 100%;
    }
}


/* Variant Selector */
.variant-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.variant-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border-color, #ddd);
    border-radius: 8px;
    background: var(--bg-color, #f5f5f5);
    color: var(--text-color, #333);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.variant-btn:hover {
    border-color: var(--primary-color, #4a90d9);
    background: var(--bg-hover, #e8f0fe);
}

.variant-btn.active {
    border-color: var(--primary-color, #4a90d9);
    background: var(--primary-color, #4a90d9);
    color: white;
}

/* Chess 960 indicator */
.variant-badge {
    display: inline-block;
    background: #ff9800;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
    text-transform: uppercase;
}
