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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 95%;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2em;
    color: #666;
    font-weight: 500;
}

.user-info {
    margin-top: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 20px;
    display: inline-block;
}

.user-info span {
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
}

.game-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.sidebar {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 15px;
    width: 200px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.sidebar h3 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.piece-list {
    font-size: 0.9em;
    line-height: 1.8;
}

.piece-item {
    padding: 5px;
    margin: 3px 0;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 5px;
    cursor: help;
    transition: all 0.2s;
}

.piece-item:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateX(5px);
}

.board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
    border: 3px solid #667eea;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.square {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.square.light {
    background: #f0d9b5;
}

.square.dark {
    background: #b58863;
}

.square.selected {
    background: #7fc97f !important;
    box-shadow: inset 0 0 0 3px #4caf50;
}

.square.possible-move {
    background: radial-gradient(circle, rgba(76, 175, 80, 0.3) 30%, transparent 30%);
}

.square.possible-capture {
    background: radial-gradient(circle, rgba(244, 67, 54, 0.3) 30%, transparent 30%);
}

.piece {
    font-size: 40px;
    cursor: grab;
    user-select: none;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s;
}

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

.piece.dragging {
    cursor: grabbing;
    opacity: 0.5;
}

.special-piece {
    position: relative;
}

.special-piece::after {
    content: '✨';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 12px;
}

.piece.in-check {
    animation: check-pulse 1s infinite alternate;
    filter: drop-shadow(0 0 10px #ff4444);
}

.king-in-check {
    background: radial-gradient(circle, rgba(255, 68, 68, 0.3) 50%, transparent 50%) !important;
    animation: check-glow 1s infinite alternate;
}

@keyframes check-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

@keyframes check-glow {
    from { box-shadow: inset 0 0 0 2px #ff4444; }
    to { box-shadow: inset 0 0 0 4px #ff4444; }
}

.game-status {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.turn-indicator {
    margin-top: 15px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px;
    font-weight: 600;
    text-align: center;
}

.piece-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    text-align: center;
}

.piece-info h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

#share-content {
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    font-family: monospace;
    word-break: break-all;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9em;
}

.social-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.social-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.social-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.share-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.army-code-section, .share-message-section {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
}

.code-display {
    font-family: 'Courier New', monospace;
    background: #333;
    color: #4caf50;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    font-size: 1.1em;
    letter-spacing: 2px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.viral-prompt {
    background: linear-gradient(135deg, #ff6b6b, #ffd93d);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    margin-top: 20px;
}

.victory-content {
    text-align: center;
    background: linear-gradient(135deg, #ffd700, #ffed4b);
}

.victory-title {
    font-size: 3em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

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

.victory-share {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

#victory-stats {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-mode-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.mode-btn {
    padding: 20px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1em;
}

.mode-btn p {
    margin: 10px 0 0 0;
    font-size: 0.9em;
    color: #666;
}

.mode-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.mode-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.ai-options {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
}

.ai-options select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    margin-top: 10px;
    min-width: 280px;
}

.difficulty-note {
    font-size: 0.85em;
    color: #666;
    margin-top: 8px;
    font-style: italic;
    line-height: 1.3;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.error-actions button {
    min-width: 120px;
}

.auth-options {
    background: #f0f8ff;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #333;
    transition: all 0.3s;
    margin: 0 auto;
    max-width: 300px;
}

.google-btn:hover {
    border-color: #4285F4;
    box-shadow: 0 2px 10px rgba(66, 133, 244, 0.2);
}

.auth-note {
    font-size: 0.85em;
    color: #666;
    margin-top: 10px;
}

.btn-secondary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary:disabled:hover {
    box-shadow: none;
    transform: none;
}

.captured {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.captured h4 {
    font-size: 0.9em;
    color: #999;
    margin-bottom: 10px;
}

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

@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }

    .sidebar {
        width: 100%;
        max-width: 400px;
    }

    .board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }

    .square {
        width: 40px;
        height: 40px;
    }

    .piece {
        font-size: 28px;
    }
}