/* Sudoku Web Sitesi - Ana Stil Dosyası */

/* ============================================
   Değişkenler
   ============================================ */
:root {
    /* Renkler */
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-primary-light: #5dade2;
    --color-secondary: #2ecc71;
    --color-secondary-dark: #27ae60;
    --color-error: #e74c3c;
    --color-warning: #f39c12;
    --color-text: #2c3e50;
    --color-text-muted: #7f8c8d;
    --color-bg: #ecf0f1;
    --color-bg-card: #ffffff;
    --color-border: #bdc3c7;
    --color-border-light: #e5e8e8;

    /* Grid renkleri */
    --grid-line: #34495e;
    --grid-line-thick: #2c3e50;
    --cell-selected: #FFB366;
    --cell-highlight: #FFE4B5;
    --cell-same-number: #FFDAB9;
    --cell-error: #fadbd8;
    --cell-fixed: #f8f9f9;
    --cell-hint: #d5f5e3;

    /* Gölgeler */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);

    /* Kenarlık yarıçapı */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Geçişler */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;

    /* Font */
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Consolas', 'Monaco', monospace;
}

/* Dark Mode */
[data-theme="dark"] {
    --color-text: #ecf0f1;
    --color-text-muted: #bdc3c7;
    --color-bg: #1a1a2e;
    --color-bg-card: #16213e;
    --color-border: #2c3e50;
    --color-border-light: #1f4068;

    --grid-line: #5d6d7e;
    --grid-line-thick: #ecf0f1;
    --cell-selected: #1f4068;
    --cell-highlight: #1a5276;
    --cell-same-number: #2874a6;
    --cell-error: #943126;
    --cell-fixed: #212f3c;
    --cell-hint: #1e8449;
}

/* ============================================
   Temel Stiller
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   Header
   ============================================ */
.main-header {
    background: var(--color-bg-card);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text);
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-primary);
}

.nav-link.btn-primary {
    background: var(--color-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
}

.nav-link.btn-primary:hover {
    background: var(--color-primary-dark);
    color: white;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition-fast);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-card);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    min-width: 150px;
    list-style: none;
    display: none;
    padding: 0.5rem 0;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--color-text);
    transition: background var(--transition-fast);
}

.dropdown-menu li a:hover {
    background: var(--color-bg);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ============================================
   Footer
   ============================================ */
.main-footer {
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    list-style: none;
    margin-top: 0.5rem;
}

.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--color-primary);
}

/* ============================================
   Butonlar
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-bg-card);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
}

.btn-full {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Form Elemanları
   ============================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--color-bg-card);
    color: var(--color-text);
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

/* ============================================
   Alert / Messages
   ============================================ */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================
   Hero Section (Ana Sayfa)
   ============================================ */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    padding: 3rem 0;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.hero-visual {
    display: flex;
    justify-content: center;
}

.sudoku-preview {
    background: var(--color-bg-card);
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    width: 200px;
    height: 200px;
    border: 2px solid var(--grid-line-thick);
    border-radius: 4px;
    overflow: hidden;
}

.preview-cell {
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--color-text-muted);
    aspect-ratio: 1;
    min-height: 0;
    border-right: 1px solid var(--grid-line);
    border-bottom: 1px solid var(--grid-line);
}

/* 3x3 block sınırları - kalın çizgiler */
.preview-grid .preview-cell:nth-child(3n) {
    border-right: 2px solid var(--grid-line-thick);
}

.preview-grid .preview-cell:nth-child(n+19):nth-child(-n+27),
.preview-grid .preview-cell:nth-child(n+46):nth-child(-n+54),
.preview-grid .preview-cell:nth-child(n+73):nth-child(-n+81) {
    border-bottom: 2px solid var(--grid-line-thick);
}

/* Son sütun ve son satır borderlarını kaldır */
.preview-grid .preview-cell:nth-child(9n) {
    border-right: none;
}

.preview-grid .preview-cell:nth-child(n+73) {
    border-bottom: none;
}

.preview-cell.filled {
    background: var(--color-primary);
    color: white;
}

/* ============================================
   Features
   ============================================ */
.features {
    padding: 3rem 0;
    text-align: center;
}

.features h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--color-text-muted);
}

/* ============================================
   Game Types
   ============================================ */
.game-types {
    padding: 3rem 0;
    text-align: center;
}

.game-types h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.type-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.type-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.type-grid {
    display: grid;
    gap: 1px;
    background: var(--grid-line);
    margin-bottom: 1rem;
    width: fit-content;
    margin: 0 auto 1rem;
}

.type-2x2 { grid-template-columns: repeat(4, 20px); }
.type-2x3 { grid-template-columns: repeat(6, 15px); }
.type-3x3 { grid-template-columns: repeat(9, 12px); }

.type-cell {
    background: var(--color-bg);
    width: 100%;
    aspect-ratio: 1;
}

.type-info h3 {
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.type-info p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ============================================
   Game Page
   ============================================ */
.game-page {
    display: flex;
    justify-content: center;
}

.game-container {
    max-width: 700px;
    width: 100%;
}

.game-settings {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.setting-group {
    flex: 1;
    min-width: 120px;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.setting-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    color: var(--color-text);
}

.game-stats {
    display: flex;
    justify-content: space-around;
    background: var(--color-bg-card);
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Sudoku Grid */
.sudoku-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.sudoku-grid {
    display: grid;
    background: var(--grid-line);
    gap: 1px;
    border: 2px solid var(--grid-line-thick);
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* Grid sizes */
.sudoku-grid[data-type="2x2"] { grid-template-columns: repeat(4, 1fr); }
.sudoku-grid[data-type="2x3"] { grid-template-columns: repeat(6, 1fr); }
.sudoku-grid[data-type="3x3"] { grid-template-columns: repeat(9, 1fr); }

.sudoku-cell {
    width: 40px;
    height: 40px;
    background: var(--color-bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

[data-theme="dark"] .sudoku-cell {
    width: 35px;
    height: 35px;
    font-size: 1rem;
}

.sudoku-cell.fixed {
    background: var(--cell-fixed);
    cursor: default;
}

.sudoku-cell.selected {
    background: var(--cell-selected);
}

.sudoku-cell.highlighted {
    background: var(--cell-highlight);
}

.sudoku-cell.same-number {
    background: var(--cell-same-number);
}

.sudoku-cell.error {
    background: var(--cell-error);
    color: var(--color-error);
}

.sudoku-cell.hint {
    background: var(--cell-hint);
}

/* Number Pad */
.number-pad {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.num-btn {
    width: 48px;
    height: 48px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    color: var(--color-text);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.num-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.num-btn.active {
    background: var(--color-primary);
    color: white;
}

/* Game Actions */
.game-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Continue Section */
.continue-section {
    background: var(--color-warning);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.game-container {
    position: relative;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--radius-lg);
}

[data-theme="dark"] .loading-overlay {
    background: rgba(22, 33, 62, 0.95);
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loading-text {
    color: var(--color-text);
    font-weight: 600;
    font-size: 1rem;
}

.continue-section.hidden {
    display: none;
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    color: var(--color-secondary);
    margin-bottom: 0.5rem;
}

.complete-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.complete-stat {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.complete-stat.highlight {
    grid-column: span 2;
    background: var(--color-primary);
    color: white;
}

.complete-stat .label {
    display: block;
    font-size: 0.875rem;
    opacity: 0.8;
}

.complete-stat .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.complete-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.auth-card {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--color-text-muted);
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-border);
}

.auth-divider span {
    background: var(--color-bg-card);
    padding: 0 1rem;
    color: var(--color-text-muted);
    position: relative;
}

.btn-google {
    background: white;
    color: #333;
    border: 1px solid var(--color-border);
}

.btn-google:hover {
    background: #f8f9fa;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-footer p {
    margin: 0.5rem 0;
    color: var(--color-text-muted);
}

.guest-link {
    font-size: 0.875rem;
}

/* ============================================
   Leaderboard
   ============================================ */
.leaderboard-page {
    padding: 1rem 0;
}

.leaderboard-header {
    text-align: center;
    margin-bottom: 2rem;
}

.leaderboard-filters {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    color: var(--color-text);
}

.period-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.leaderboard-table-wrapper {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 1rem;
    text-align: left;
}

.leaderboard-table th {
    background: var(--color-bg);
    font-weight: 600;
}

.leaderboard-table tr:nth-child(even) {
    background: var(--color-bg);
}

.leaderboard-table td.loading {
    text-align: center;
    color: var(--color-text-muted);
}

.your-rank {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-md);
}

.leaderboard-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.leaderboard-table tbody tr:hover {
    background: var(--color-bg-hover, #f0f0f0);
}

.player-info.clickable {
    cursor: pointer;
}

.player-info.clickable:hover {
    color: var(--color-primary);
}

.player-avatar {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    object-fit: cover;
}

.score-detail-col {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.score-detail-col.has-score {
    color: var(--color-text);
}

.score-value {
    font-weight: 600;
}

.games-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: 2px;
}

.total-score {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-primary);
}

.best-time {
    color: var(--color-success, #27ae60);
    font-weight: 600;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-bg-card);
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .modal-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.user-summary {
    margin-bottom: 1.5rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.summary-stat {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.summary-stat .stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.summary-stat .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.user-stats-by-type {
    margin-bottom: 1.5rem;
}

.user-stats-by-type h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.type-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.type-stat-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.type-stat-header {
    background: var(--color-primary);
    color: white;
    padding: 0.5rem 1rem;
    font-weight: 600;
    text-align: center;
}

.type-stat-body {
    padding: 0.75rem 1rem;
}

.type-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.type-stat-row span {
    color: var(--color-text-muted);
}

.type-stat-row strong {
    color: var(--color-text);
}

.user-games-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.games-table-wrapper {
    overflow-x: auto;
}

.games-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.games-table th,
.games-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.games-table th {
    background: var(--color-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.games-table tbody tr:hover {
    background: var(--color-bg-hover, #f5f5f5);
}

.games-pagination {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.pagination-info {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    color: var(--color-text);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.pagination-btn:hover:not(.active) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 600;
}

.pagination-dots {
    padding: 0.5rem 0.5rem;
    color: var(--color-text-muted);
}

/* ============================================
   Profile Page
   ============================================ */
.profile-page {
    padding: 1rem 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info h1 {
    margin-bottom: 0.25rem;
}

.verification-warning {
    color: var(--color-warning);
    font-size: 0.875rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card .stat-icon.win { background: var(--color-secondary); }
.stat-card .stat-icon.time { background: var(--color-warning); }
.stat-card .stat-icon.score { background: #9b59b6; }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.profile-section {
    background: var(--color-bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.profile-section h2 {
    margin-bottom: 1rem;
}

.achievements-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.achievement-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.achievement-icon {
    font-size: 1.25rem;
}

.games-table {
    width: 100%;
    border-collapse: collapse;
}

.games-table th,
.games-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.games-table th {
    font-weight: 600;
}

.no-data {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2rem;
}

/* ============================================
   Download Page
   ============================================ */
.download-page {
    max-width: 600px;
    margin: 0 auto;
}

.download-header {
    text-align: center;
    margin-bottom: 2rem;
}

.download-form {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.download-form .btn {
    margin-top: 1.5rem;
}

.download-info {
    background: var(--color-bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.download-info h3 {
    margin-bottom: 1rem;
}

.download-info ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.download-info li {
    margin-bottom: 0.5rem;
}

/* ============================================
   Theme Toggle
   ============================================ */
.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--color-bg-card);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 99;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.icon-sun, .icon-moon {
    display: none;
}

[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun {
    display: block;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        padding-top: 1rem;
    }

    .nav-menu.active {
        display: flex;
    }

    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-visual {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .sudoku-cell {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .leaderboard-table {
        font-size: 0.875rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem;
    }

    .pagination-controls {
        gap: 0.25rem;
    }

    .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .sudoku-cell {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }

    .num-btn {
        width: 40px;
        height: 40px;
    }

    .game-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }
}

/* Global Modal Styles */
.alert-modal,
.confirm-modal {
    text-align: center;
    padding: 2rem;
    min-width: 300px;
    max-width: 400px;
}

.alert-modal .modal-icon,
.confirm-modal .modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.alert-modal .modal-message,
.confirm-modal .modal-message {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.alert-modal .modal-close-btn,
.confirm-modal .modal-confirm-btn,
.confirm-modal .modal-cancel-btn {
    min-width: 100px;
}
}