/* Game Page Styles */
body {
    overflow: hidden;
}

.game-container {
    max-width: 100%;
    margin: 0;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.game-header {
    text-align: center;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.game-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
}

.game-header p {
    font-size: 0.85rem;
    margin: 0;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

.game-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.75rem;
    opacity: 0.7;
}

.info-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
}

.game-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

.game-board {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.game-board > * {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Auto scale for canvas games */
.game-board canvas {
    max-width: 100%;
    max-height: 100%;
    height: auto !important;
    width: auto !important;
    object-fit: contain;
}

/* Board Grid */
.board-grid {
    display: grid;
    gap: 2px;
    background: var(--border-color);
    border: 2px solid var(--border-color);
}

.cell {
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    font-size: 1.2rem;
}

.cell:hover {
    background: var(--primary-color);
    color: white;
    opacity: 0.8;
}

.cell.filled {
    cursor: default;
}

.cell.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Game Modal */
.game-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.game-modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    margin: 1rem;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.modal-content p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.modal-content ul {
    text-align: left;
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.modal-content li {
    margin-bottom: 0.5rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Leaderboard */
.leaderboard-container {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.leaderboard-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.leaderboard-filters select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: left;
}

.leaderboard-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table tr:hover {
    background: var(--bg-color);
}

.rank-badge {
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
}

.rank-badge.gold {
    background: #FFD700;
    color: #333;
}

.rank-badge.silver {
    background: #C0C0C0;
    color: #333;
}

.rank-badge.bronze {
    background: #CD7F32;
    color: white;
}

/* Profile */
.profile-container {
    max-width: 900px;
    margin: 2rem auto;
}

.profile-header {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    opacity: 0.7;
    margin-top: 0.5rem;
}

.game-history {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.game-history h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.history-item:last-child {
    border-bottom: none;
}
