:root {
  --bg: #050505;
  --face: #c0c0c0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: #f4f4f4;
  font-family: "Tahoma", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
}

.ms-app {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px 20px 18px 24px;
  gap: 14px;
}

.ms-head {
  width: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ms-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.back-link,
.ms-top h1 {
  font-size: 28px;
  font-weight: 600;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.back-link {
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  white-space: nowrap;
}

.back-link:active {
  background: #fff;
  color: #000;
}

.win {
  background: var(--face);
  color: #000;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 2px 2px 0 #000;
  padding: 3px;
}

.win-bar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 8px;
}

.win-body {
  padding: 8px;
  background: var(--face);
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px;
  margin-bottom: 8px;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
}

.led {
  min-width: 78px;
  background: #000;
  color: #ff2020;
  font-family: "Courier New", monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  padding: 2px 6px;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
}

.face {
  width: 46px;
  height: 46px;
  font-size: 28px;
  line-height: 1;
  background: var(--face);
  border: 3px solid;
  border-color: #fff #808080 #808080 #fff;
}

.face:active {
  border-color: #808080 #fff #fff #808080;
}

.board {
  display: grid;
  border: 3px solid;
  border-color: #808080 #fff #fff #808080;
}

.cell {
  width: var(--cell, 48px);
  height: var(--cell, 48px);
  padding: 0;
  font-size: calc(var(--cell, 48px) * 0.55);
  font-weight: 700;
  line-height: 1;
  background: var(--face);
  border: 3px solid;
  border-color: #fff #808080 #808080 #fff;
  color: #000;
}

.cell.open {
  border: 1px solid #808080;
  background: #c0c0c0;
}

.cell.pressed {
  border-color: #808080 #fff #fff #808080;
}

.cell.boom {
  background: #ff0000;
}

.cell.c1 { color: #0000ff; }
.cell.c2 { color: #008000; }
.cell.c3 { color: #ff0000; }
.cell.c4 { color: #000080; }
.cell.c5 { color: #800000; }
.cell.c6 { color: #008080; }
.cell.c7 { color: #000; }
.cell.c8 { color: #808080; }

.ms-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.ms-btn {
  min-width: 140px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: #1c1c1c;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
}

.ms-btn.selected,
.ms-btn:active {
  background: #e82127;
}

.ms-hint {
  color: #8a8a8a;
  font-size: 18px;
  text-align: left;
}

@media (max-height: 720px) {
  .cell { --cell: 36px; }
  .led { font-size: 24px; min-width: 64px; }
}
