.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: memory-match --- */
.memory-match-game {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.control-panel {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
}

.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.info-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.info-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.memory-grid {
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
}

.memory-grid.easy {
    grid-template-columns: repeat(4, 1fr);
    max-width: 400px;
}

.memory-grid.medium {
    grid-template-columns: repeat(6, 1fr);
    max-width: 600px;
}

.memory-grid.hard {
    grid-template-columns: repeat(8, 1fr);
    max-width: 800px;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #fff;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.memory-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.memory-card.flipped {
    background: white;
    color: #333;
    transform: rotateY(180deg);
}

.memory-card.matched {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    cursor: default;
}

.memory-card .card-content {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.memory-card.flipped .card-content {
    opacity: 1;
}

.memory-card .card-back {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    opacity: 0.8;
}

.memory-card.flipped .card-back {
    display: none;
}

.game-result {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
}

.result-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.stat-label {
    font-weight: 500;
    color: #6c757d;
}

.stat-value {
    font-weight: bold;
    color: #495057;
}

.action-buttons .btn {
    min-width: 120px;
}

@media (max-width: 768px) {
    .memory-grid.medium {
        grid-template-columns: repeat(4, 1fr);
        max-width: 400px;
    }
    
    .memory-grid.hard {
        grid-template-columns: repeat(6, 1fr);
        max-width: 600px;
    }
    
    .memory-card {
        font-size: 1.25rem;
    }
}
