.ms-tool-wrapper { --p-bg: #ffffff; --p-border: #e2e8f0; --p-primary: #ef4444; --p-text: #0f172a; width: 100%; max-width: 900px; margin: 0 auto; background: var(--p-bg); border-radius: 24px; padding: 32px; border: 1px solid var(--p-border); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); display: flex; flex-direction: column; align-items: center; }
.ms-header-main { font-size: 1.5rem; font-weight: 600; color: var(--p-text); margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.ms-badge { background: #fee2e2; color: #b91c1c; padding: 4px 12px; border-radius: 30px; font-size: 0.8rem; font-weight: 500; }
.ms-subtitle { color: #64748b; font-size: 0.95rem; padding-bottom: 16px; border-bottom: 1px solid var(--p-border); margin-bottom: 24px; text-align: center; width: 100%; }

@media (max-width: 768px) { .ms-tool-wrapper { padding: 20px; border-radius: 16px; } }

.ms-control-panel { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 24px; width: 100%; }
.ms-select { padding: 10px 16px; background: #f8fafc; border: 1px solid #cbd5e1; color: var(--p-text); border-radius: 12px; outline: none; font-size: 1rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
.ms-select:focus { border-color: var(--p-primary); }
.ms-btn { padding: 10px 24px; background: var(--p-primary); color: white; border: none; border-radius: 12px; font-weight: bold; font-size: 1rem; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2); }
.ms-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.ms-btn-flag { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; box-shadow: none; }
.ms-btn-flag.active { background: #fef08a; color: #854d0e; border-color: #fde047; }

.ms-dashboard { background: #1e293b; color: #ef4444; font-family: monospace; font-size: 2rem; font-weight: bold; padding: 12px 24px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 600px; margin-bottom: 24px; border: 4px solid #cbd5e1; box-shadow: inset 0 4px 8px rgba(0,0,0,0.5); }
.ms-dash-box { background: #0f172a; padding: 4px 12px; border-radius: 8px; min-width: 80px; text-align: center; letter-spacing: 2px; }
.ms-face { font-size: 2.5rem; cursor: pointer; user-select: none; transition: 0.1s; }
.ms-face:active { transform: scale(0.9); }

.ms-board-container { overflow-x: auto; max-width: 100%; padding-bottom: 12px; }
.ms-board { display: grid; background: #94a3b8; padding: 8px; gap: 2px; border: 4px solid #cbd5e1; border-left-color: #f1f5f9; border-top-color: #f1f5f9; border-right-color: #64748b; border-bottom-color: #64748b; }
.ms-cell { width: 32px; height: 32px; background: #cbd5e1; border: 3px solid; border-top-color: #f8fafc; border-left-color: #f8fafc; border-right-color: #94a3b8; border-bottom-color: #94a3b8; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.1rem; cursor: pointer; user-select: none; }
.ms-cell:active:not(.revealed):not(.flagged) { border: 1px solid #94a3b8; background: #e2e8f0; }
.ms-cell.revealed { border: 1px solid #94a3b8; background: #e2e8f0; cursor: default; }
.ms-cell.mine { background: #ef4444 !important; border: 1px solid #94a3b8; }
.ms-cell.flagged::after { content: '🚩'; font-size: 1.2rem; }
.ms-cell.wrong-flag { position: relative; }
.ms-cell.wrong-flag::before { content: '❌'; position: absolute; font-size: 1.5rem; z-index: 2; opacity: 0.8; }

.num-1 { color: #2563eb; } .num-2 { color: #16a34a; } .num-3 { color: #dc2626; } .num-4 { color: #4f46e5; }
.num-5 { color: #7c2d12; } .num-6 { color: #0d9488; } .num-7 { color: #000000; } .num-8 { color: #475569; }

[data-theme="dark"] .ms-tool-wrapper { background: #1e293b !important; border-color: #334155 !important; }
[data-theme="dark"] .ms-select { background: #0f172a; border-color: #475569; color: #f8fafc; }
[data-theme="dark"] .ms-btn-flag { background: #0f172a; border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .ms-btn-flag.active { background: #713f12; border-color: #a16207; color: #fef08a; }
[data-theme="dark"] .ms-dashboard { border-color: #475569; }
[data-theme="dark"] .ms-board { background: #475569; border-color: #334155; border-left-color: #64748b; border-top-color: #64748b; border-right-color: #1e293b; border-bottom-color: #1e293b; }
[data-theme="dark"] .ms-cell { background: #64748b; border-top-color: #94a3b8; border-left-color: #94a3b8; border-right-color: #334155; border-bottom-color: #334155; }
[data-theme="dark"] .ms-cell:active:not(.revealed):not(.flagged), [data-theme="dark"] .ms-cell.revealed { background: #334155; border-color: #1e293b; }
[data-theme="dark"] .num-1 { color: #60a5fa; } [data-theme="dark"] .num-2 { color: #4ade80; }
[data-theme="dark"] .num-3 { color: #f87171; } [data-theme="dark"] .num-4 { color: #818cf8; }

@media (max-width: 600px) { .ms-cell { width: 28px; height: 28px; font-size: 1rem; border-width: 2px; } }