.tool-fullwidth {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Tool shell */
.game-tool {
    max-width: 100%;
    margin: 0 auto;
}

.game-tool.editor-section,
.editor-section.game-tool {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-tool .card {
    border: 1px solid var(--color-border, #e5e7eb);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    border-radius: var(--radius, 12px);
    background: var(--color-surface, #fff);
}

.game-tool .card-body {
    padding: 1.25rem 1.35rem;
}

.game-tool .card-title {
    color: var(--color-text, #1f2937);
    font-weight: 700;
    font-size: 1.05rem;
}

.game-tool .form-control,
.game-tool .form-select,
.game-tool .select-input,
.game-tool textarea {
    border-radius: 8px;
    border: 1px solid var(--color-border, #e5e7eb);
}

.game-tool .form-control:focus,
.game-tool .form-select:focus,
.game-tool textarea:focus {
    border-color: var(--color-primary, #0d9488);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.game-tool .btn-primary {
    background: var(--color-primary, #0d9488);
    border-color: var(--color-primary, #0d9488);
}

.game-tool .btn-primary:hover {
    background: var(--color-primary-hover, #0f766e);
    border-color: var(--color-primary-hover, #0f766e);
}

.game-tool .alert {
    border-radius: 10px;
}

[data-theme="dark"] .game-tool .card {
    background: var(--color-surface, #1f2937);
    border-color: var(--color-border, #374151);
}

[data-theme="dark"] .game-tool .card-title,
[data-theme="dark"] .game-tool .form-label,
[data-theme="dark"] .game-tool {
    color: var(--color-text, #f9fafb);
}

[data-theme="dark"] .game-tool .text-muted,
[data-theme="dark"] .game-tool .form-text {
    color: var(--color-text-secondary, #9ca3af) !important;
}

[data-theme="dark"] .game-tool .form-control,
[data-theme="dark"] .game-tool .form-select,
[data-theme="dark"] .game-tool textarea {
    background: #111827;
    color: var(--color-text, #f9fafb);
    border-color: var(--color-border, #374151);
}

/* --- tool: game-2048 --- */
.game-2048 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.control-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    border-radius: 15px;
    color: white;
}

.control-panel .form-floating label {
    color: #333;
}

.info-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.info-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.info-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.game-grid {
    display: inline-grid;
    gap: 8px;
    padding: 20px;
    background: #bbada0;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.grid-cell {
    width: 80px;
    height: 80px;
    background: #cdc1b4;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #776e65;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.grid-cell.tile-2 { background: #eee4da; }
.grid-cell.tile-4 { background: #ede0c8; }
.grid-cell.tile-8 { background: #f2b179; color: #f9f6f2; }
.grid-cell.tile-16 { background: #f59563; color: #f9f6f2; }
.grid-cell.tile-32 { background: #f67c5f; color: #f9f6f2; }
.grid-cell.tile-64 { background: #f65e3b; color: #f9f6f2; }
.grid-cell.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 1.3rem; }
.grid-cell.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 1.3rem; }
.grid-cell.tile-512 { background: #edc850; color: #f9f6f2; font-size: 1.3rem; }
.grid-cell.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1.1rem; }
.grid-cell.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1.1rem; }
.grid-cell.tile-4096 { background: #3c3a32; color: #f9f6f2; font-size: 1rem; }
.grid-cell.tile-8192 { background: #1b1a19; color: #f9f6f2; font-size: 0.9rem; }

.grid-cell.new-tile {
    animation: newTile 0.3s ease-in-out;
}

.grid-cell.merged-tile {
    animation: mergedTile 0.3s ease-in-out;
}

@keyframes newTile {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes mergedTile {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.game-result, .game-over {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    margin: 2rem 0;
}

.stat-item {
    margin: 1rem 0;
}

.stat-label {
    font-weight: bold;
    margin-right: 0.5rem;
}

.stat-value {
    font-size: 1.2rem;
    color: #ffd700;
}

.action-buttons .btn {
    min-width: 120px;
    padding: 0.75rem 1.5rem;
}

@media (max-width: 768px) {
    .grid-cell {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
    }
    
    .game-grid {
        gap: 6px;
        padding: 15px;
    }
    
    .info-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .grid-cell {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .game-grid {
        gap: 4px;
        padding: 10px;
    }
}
