.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: tetris-game --- */
.tetris-game {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.game-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-sidebar {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-main {
    display: flex;
    justify-content: center;
}

.game-board-container {
    position: relative;
    background: #2c3e50;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    border: 2px solid #34495e;
    border-radius: 4px;
    background: #1a252f;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.overlay-content {
    text-align: center;
    color: white;
}

.next-piece-grid,
.current-piece-grid {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1px;
    padding: 2px;
}

.game-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
}

.game-stats .stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.controls-info .control-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.controls-info kbd {
    background: #34495e;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 8px;
    font-size: 12px;
}

.game-time .time-display {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    color: #e74c3c;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 2px solid #e74c3c;
}

.game-result {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.result-stats .stat-item {
    text-align: center;
    padding: 15px;
}

.result-stats .stat-label {
    display: block;
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.result-stats .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

.control-panel .form-floating {
    height: 100%;
}

.control-panel .btn {
    height: 100%;
    min-height: 58px;
}

@media (max-width: 768px) {
    .game-container .row {
        flex-direction: column;
    }
    
    .game-sidebar {
        margin-bottom: 15px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
}
