:root {
  --mem-on: rgba(15, 23, 42, 0.92);
  --mem-off: rgba(255, 255, 255, 0.6);
  --mem-border: rgba(15, 23, 42, 0.12);
}

.memHud {
  margin: 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.memHudLabel {
  font-size: 12px;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.7);
  letter-spacing: 0.2px;
}

.memLevelGrid {
  margin-top: 6px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 10px;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.memLevelDot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  background: rgba(255, 255, 255, 0.55);
}

.memLevelDot.isDone {
  background: var(--mem-on);
  border-color: var(--mem-on);
}

.memHudRight {
  text-align: right;
  display: grid;
  gap: 4px;
  min-width: 110px;
}

.memStatusLine {
  font-weight: 1000;
  font-size: 13px;
  color: rgba(15, 23, 42, 0.82);
}

.memStatusSub {
  font-size: 12px;
  color: rgba(100, 116, 139, 0.95);
}

.memStatus {
  margin: 10px 0 14px;
  font-size: 14px;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 10px 12px;
  border-radius: 999px;
}

.memBoard {
  width: min(420px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border: 3px solid rgba(15, 23, 42, 0.12);
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.memCell {
  appearance: none;
  border: 0;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-right: 3px solid rgba(15, 23, 42, 0.12);
  border-bottom: 3px solid rgba(15, 23, 42, 0.12);
  cursor: pointer;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  user-select: none;
  transition: transform 90ms ease, filter 180ms ease, background 180ms ease;
  position: relative;
}

.memCell:nth-child(3n) {
  border-right: 0;
}
.memCell:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.memCell:active {
  transform: scale(0.985);
}

.memCell.isLit {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.22), rgba(59, 130, 246, 0.14));
  filter: brightness(1.03);
}

.memCell.isError {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.22), rgba(244, 63, 94, 0.14));
}

.memCell:disabled {
  cursor: not-allowed;
  opacity: 0.98;
}

.memActions {
  margin-top: 14px;
  gap: 10px;
}

.memModalPanel {
  width: min(420px, 100%);
}

.memModalBody {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 1000;
  letter-spacing: 0.2px;
  line-height: 1.5;
}

.memModalBody.isOk {
  color: rgba(22, 163, 74, 0.98);
}

.memModalBody.isBad {
  color: rgba(220, 38, 38, 0.98);
}

@media (max-width: 420px) {
  .memHud {
    padding: 8px 10px;
    border-radius: 14px;
  }
  .memHudRight {
    min-width: 96px;
  }
  .memLevelGrid {
    grid-auto-columns: 9px;
    gap: 3px;
    padding: 3px 5px;
  }
  .memLevelDot {
    width: 9px;
    height: 9px;
  }
  .memBoard {
    border-radius: 18px;
    height: min(380px, 86vw);
  }
  .memModalBody {
    font-size: 16px;
  }
}
