.hot-tool .ms {
  margin: 1.25rem auto 2.25rem;
  color: #1c2a44;
}

.hot-tool .ms-levels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.hot-tool .ms-level,
.hot-tool .ms-mode {
  border: 1px solid #c3cddd;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font: inherit;
  font-weight: 650;
  line-height: 1.1;
  background: #fff;
  color: inherit;
  cursor: pointer;
}

.hot-tool .ms-level[aria-pressed="true"] { background: #1f3b73; border-color: #1f3b73; color: #fff; }
.hot-tool .ms-level:focus-visible,
.hot-tool .ms-mode:focus-visible,
.hot-tool .ms-face:focus-visible,
.hot-tool .ms-grid:focus-visible { outline: 3px solid #efb34c; outline-offset: 2px; }

.hot-tool .ms-panel {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, #33476e, #1f2e4d);
  box-shadow: 0 10px 26px rgba(20, 36, 65, 0.28);
}

.hot-tool .ms-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 10px;
  color: #fff;
}

.hot-tool .ms-counter {
  min-width: 5.2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  background: #0e1830;
  font-size: 1.05rem;
  white-space: nowrap;
}

.hot-tool .ms-counter strong { font-variant-numeric: tabular-nums; color: #ffd166; }
.hot-tool .ms-counter:last-child { text-align: right; }

.hot-tool .ms-face {
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  font-size: 1.55rem;
  line-height: 1;
  background: #ffd166;
  box-shadow: 0 3px 0 #c99a2e;
  cursor: pointer;
  transition: transform 80ms;
}

.hot-tool .ms-face:active { transform: translateY(2px); box-shadow: 0 1px 0 #c99a2e; }

.hot-tool .ms-scroll {
  max-width: 100%;
  overflow: auto;
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

.hot-tool .ms-grid {
  --cell: 32px;
  --cols: 9;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-auto-rows: var(--cell);
  gap: 2px;
  width: max-content;
  padding: 2px;
  border-radius: 8px;
  background: #15213b;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hot-tool .ms-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: calc(var(--cell) * 0.56);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(160deg, #a9c3f2, #7f9fdb);
  box-shadow: inset 0 -2px 0 rgba(15, 30, 70, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 80ms;
}

.hot-tool .ms-cell:hover { background: linear-gradient(160deg, #bed2f7, #93b0e6); }

.hot-tool .ms-cell.ms-open {
  background: #eef2f8;
  box-shadow: none;
  cursor: default;
  animation: ms-open 140ms ease;
}

@keyframes ms-open { from { transform: scale(0.85); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }

.hot-tool .ms-cell.ms-flag { font-size: calc(var(--cell) * 0.5); }
.hot-tool .ms-cell.ms-mine { background: #f5d6da; font-size: calc(var(--cell) * 0.5); }
.hot-tool .ms-cell.ms-boom { background: #e5383b; }
.hot-tool .ms-cell.ms-wrongflag { background: #f5d6da; }
.hot-tool .ms-cell.ms-cur { outline: 2px solid #ffd166; outline-offset: -2px; }
.hot-tool .ms-grid:not(:focus) .ms-cell.ms-cur { outline: 0; }

.hot-tool .ms-n1 { color: #1f5fd6; }
.hot-tool .ms-n2 { color: #1d8a3a; }
.hot-tool .ms-n3 { color: #d0302f; }
.hot-tool .ms-n4 { color: #213a8f; }
.hot-tool .ms-n5 { color: #8c2a1c; }
.hot-tool .ms-n6 { color: #0e8a8a; }
.hot-tool .ms-n7 { color: #222; }
.hot-tool .ms-n8 { color: #6b7280; }

.hot-tool .ms-grid.ms-lost { animation: ms-shake 300ms ease; }
.hot-tool .ms-grid.ms-won .ms-flag { animation: ms-pop 500ms ease; }

@keyframes ms-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@keyframes ms-pop { 50% { transform: scale(1.25); } }

.hot-tool .ms-under {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 1.25rem;
  margin-top: 0.75rem;
}

.hot-tool .ms-mode.ms-flagmode { background: #ffe9a8; border-color: #e0b33a; }
.hot-tool .ms-best strong { font-variant-numeric: tabular-nums; }

.hot-tool .ms-result {
  max-width: 34rem;
  margin: 0.75rem auto 0;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-weight: 650;
  text-align: center;
}

.hot-tool .ms-result.ms-good { background: #ddf5e2; color: #17602b; }
.hot-tool .ms-result.ms-bad { background: #fde3e5; color: #8f1d24; }

.hot-tool .ms-hint { margin: 0.75rem auto 0; max-width: 36rem; font-size: 0.85rem; text-align: center; color: #5a6a82; }

.hot-tool .ms-hint kbd {
  padding: 0 0.3rem;
  border: 1px solid #c3cddd;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 0.85em;
}

.hot-tool .ms-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hot-tool .ms-table { width: 100%; border-collapse: collapse; margin: 0.75rem 0 1.25rem; font-size: 0.95rem; }
.hot-tool .ms-table th,
.hot-tool .ms-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #dfe5ef; text-align: left; }
.hot-tool .ms-table thead th { background: #f1f4fa; }

@media (max-width: 420px) {
  .hot-tool .ms-panel { padding: 7px; }
  .hot-tool .ms-grid { gap: 1px; }
  .hot-tool .ms-counter { min-width: 4.4rem; font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hot-tool .ms-cell.ms-open, .hot-tool .ms-grid.ms-lost, .hot-tool .ms-grid.ms-won .ms-flag { animation: none; }
}
